:root {
  --ink: #1b1530;
  --ink-2: #3a3058;
  --paper: #fff8ee;
  --paper-2: #f3e7d3;
  --gold: #ffcf4a;
  --gold-2: #e8a91c;
  --red: #e8344a;
  --blue: #3f7cf0;
  --green: #3fbf6a;
  --purple: #8a5cf0;
  --sakura: #ffb7d5;
  --night: #120c2a;
  --muted: #7d7295;
  --shadow: 0 6px 0 rgba(27, 21, 48, 0.35), 0 14px 30px rgba(0, 0, 0, 0.35);
  --font: 'M PLUS Rounded 1c', 'Hiragino Maru Gothic ProN', 'Yu Gothic', 'Microsoft YaHei', system-ui, sans-serif;
  --display: 'Yusei Magic', 'M PLUS Rounded 1c', system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: var(--night);
  font-family: var(--font); color: var(--ink); user-select: none; -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent; touch-action: none;
}
button { font-family: inherit; }

#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#mg {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: none; image-rendering: auto; background: #000; border-radius: 6px;
  box-shadow: 0 0 0 3px var(--ink), 0 0 60px rgba(0, 0, 0, 0.6);
}
body.mg-on #mg { display: block; }
body.mg-on #gl, body.mg-on #labels, body.mg-on #hud { visibility: hidden; }
#labels, #hud, #ui, #overlay { position: fixed; inset: 0; pointer-events: none; }
#ui > *, #overlay > *, #hud > * { pointer-events: auto; }
#labels { z-index: 2; overflow: hidden; }
#hud { z-index: 3; }
#ui { z-index: 4; }
#overlay { z-index: 6; }
#fade { position: fixed; inset: 0; background: #000; opacity: 0; pointer-events: none; z-index: 20; transition: opacity 0.35s; }
#fade.on { opacity: 1; }

/* ---------- boot ---------- */
#boot {
  position: fixed; inset: 0; z-index: 30; display: grid; place-items: center;
  background: radial-gradient(ellipse at 50% 40%, #2c1d5c 0%, #120c2a 70%);
  color: #fff; transition: opacity 0.6s;
}
#boot.done { opacity: 0; pointer-events: none; }
.boot-inner { text-align: center; }
.boot-yinyang {
  width: 72px; height: 72px; margin: 0 auto 18px; border-radius: 50%;
  background: url(../assets/icon.svg) center/contain no-repeat; animation: spin 1.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.boot-title { font-family: var(--display); font-size: 34px; letter-spacing: 1px; }
.boot-sub { opacity: 0.7; margin-top: 4px; }
.boot-bar { width: min(360px, 80vw); height: 10px; border-radius: 5px; background: rgba(255,255,255,0.12); margin: 22px auto 10px; overflow: hidden; }
#boot-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--red), var(--gold)); transition: width 0.25s; }
#boot-msg { font-size: 13px; opacity: 0.7; min-height: 1.2em; }

/* ---------- generic ---------- */
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; }
.panel {
  background: var(--paper); border: 3px solid var(--ink); border-radius: 16px; box-shadow: var(--shadow);
  padding: 16px 18px;
}
.panel.dark { background: rgba(27, 21, 48, 0.92); color: #fff; border-color: #000; }
.ribbon {
  display: inline-block; background: var(--red); color: #fff; font-weight: 800; padding: 4px 16px; border-radius: 999px;
  border: 3px solid var(--ink); box-shadow: 0 3px 0 var(--ink); letter-spacing: 0.5px;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 8px 20px; border-radius: 14px; border: 3px solid var(--ink);
  background: var(--paper); color: var(--ink); font-weight: 800; font-size: 17px; cursor: pointer;
  box-shadow: 0 4px 0 var(--ink); transition: transform 0.08s, background 0.12s;
}
.btn:hover, .btn.sel { background: var(--gold); transform: translateY(-2px); }
.btn.sel { box-shadow: 0 4px 0 var(--ink), 0 0 0 4px rgba(255, 207, 74, 0.45); }
.btn:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--ink); }
.btn.disabled { opacity: 0.45; filter: grayscale(0.6); }
.btn.small { min-height: 34px; font-size: 14px; padding: 4px 12px; border-radius: 10px; }
.kbd {
  display: inline-block; min-width: 22px; padding: 1px 6px; border: 2px solid currentColor; border-radius: 6px;
  font-size: 0.85em; font-weight: 800; text-align: center; line-height: 1.3;
}
.muted { color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; }
.grow { flex: 1; }
.center { text-align: center; }
.pts { color: #2a6be8; font-weight: 800; }
.cards { color: #d4920c; font-weight: 800; }

/* ---------- title ---------- */
.title-screen { justify-content: flex-end; align-items: flex-start; padding: 0 0 6vh 6vw; }
.logo {
  position: absolute; top: 7vh; left: 0; right: 0; text-align: center; color: #fff; pointer-events: none;
}
.logo h1 {
  margin: 0; font-family: var(--display); font-weight: 400; font-size: clamp(36px, 7vw, 92px); line-height: 1;
  color: #fff; text-shadow: 0 0 2px var(--ink), 0 4px 0 var(--red), 0 8px 0 var(--ink), 0 0 40px rgba(255, 120, 170, 0.6);
  letter-spacing: 1px;
}
.logo .jp {
  font-family: var(--display); font-size: clamp(16px, 2.6vw, 30px); margin-top: 14px; letter-spacing: 6px;
  color: var(--gold); text-shadow: 0 2px 0 var(--ink);
}
.logo .tag { margin-top: 10px; font-size: 14px; opacity: 0.85; text-shadow: 0 1px 2px #000; }
.menu-col { display: flex; flex-direction: column; gap: 12px; width: min(320px, 86vw); }
.menu-col .btn { justify-content: flex-start; font-size: 19px; }
.menu-col .btn .ico { width: 28px; text-align: center; }
.title-foot { position: absolute; right: 18px; bottom: 12px; color: rgba(255,255,255,0.6); font-size: 12px; text-align: right; }
.press-start { color: #fff; font-weight: 800; font-size: 20px; text-shadow: 0 2px 0 var(--ink); animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: 0.3; } }

/* ---------- setup ---------- */
.setup { padding: 14px 20px; gap: 12px; overflow-y: auto; background: linear-gradient(180deg, rgba(18,12,42,0.75), rgba(18,12,42,0.35)); }
.setup h2 { margin: 0; color: #fff; font-family: var(--display); font-weight: 400; font-size: 30px; text-shadow: 0 3px 0 var(--ink); }
.setup .sub { color: rgba(255,255,255,0.8); margin-top: -8px; }
.slots { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.slot { position: relative; padding: 12px; text-align: center; }
.slot .ptag { position: absolute; top: -12px; left: 12px; }
.slot .por { width: 76px; height: 76px; border-radius: 50%; margin: 6px auto; border: 4px solid var(--ink); background: #ddd center/cover; }
.slot .nm { font-weight: 800; }
.slot .ctl { font-size: 11px; color: var(--muted); margin-top: 4px; min-height: 2.4em; }
.opt-grid { display: grid; grid-template-columns: 200px 1fr; gap: 10px 14px; align-items: center; }
.opt-grid label { font-weight: 800; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg .btn { min-height: 36px; font-size: 14px; padding: 4px 12px; }
.seg .btn.on { background: var(--red); color: #fff; }
.boards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.board-card { padding: 0; overflow: hidden; cursor: pointer; transition: transform 0.12s; }
.board-card .art { height: 64px; display: grid; place-items: center; font-size: 54px; border-bottom: 3px solid var(--ink); }
.board-card .body { padding: 10px 12px; }
.board-card h3 { margin: 0 0 4px; }
.board-card .jp { font-size: 12px; color: var(--muted); }
.board-card p { font-size: 12.5px; margin: 4px 0 0; line-height: 1.35; }
.board-card.sel { transform: translateY(-4px); box-shadow: var(--shadow), 0 0 0 5px var(--gold); }
.foot-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: auto; }

/* ---------- character select ---------- */
.cs { flex-direction: row; padding: 16px; gap: 16px; }
.cs-left { width: 36%; display: flex; flex-direction: column; justify-content: flex-end; gap: 10px; }
.cs-info h2 { margin: 0; font-size: 26px; }
.cs-info .jp { color: var(--muted); font-size: 14px; }
.cs-info .ttl { font-weight: 700; color: var(--red); margin: 2px 0 6px; }
.cs-info p { margin: 6px 0; font-size: 14px; }
.dice-faces { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.die {
  min-width: 38px; height: 38px; padding: 0 6px; display: grid; place-items: center; border-radius: 9px;
  background: #fff; border: 3px solid var(--ink); font-weight: 800; font-size: 14px; box-shadow: 0 3px 0 var(--ink);
}
.die.neg { background: #ffd9de; }
.die.pos { background: #d9e8ff; }
.cs-right { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.cs-turn { color: #fff; font-size: 22px; font-weight: 800; text-shadow: 0 2px 0 var(--ink); }
.cs-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.cs-cell {
  position: relative; aspect-ratio: 1; border-radius: 12px; border: 3px solid var(--ink); background: #e9e2f5 center/cover;
  cursor: pointer; box-shadow: 0 3px 0 var(--ink); transition: transform 0.08s;
}
.cs-cell .nm {
  position: absolute; left: 0; right: 0; bottom: 0; font-size: 10px; font-weight: 800; color: #fff; text-align: center;
  background: linear-gradient(transparent, rgba(0,0,0,0.75)); border-radius: 0 0 9px 9px; padding: 8px 2px 2px; white-space: nowrap; overflow: hidden;
}
.cs-cell.cur { transform: scale(1.08); z-index: 2; }
.cs-cell.taken { filter: grayscale(0.85) brightness(0.65); }
.cs-cell .tag { position: absolute; top: -9px; right: -6px; font-size: 11px; font-weight: 800; color: #fff; padding: 1px 6px; border-radius: 8px; border: 2px solid var(--ink); }
.cs-picks { display: flex; gap: 8px; }
.cs-pick { flex: 1; display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 12px; }
.cs-pick .por { width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--ink); background: #ccc center/cover; flex: none; }
.cs-pick b { font-size: 13px; }

/* ---------- HUD ---------- */
.pcard {
  position: absolute; width: 230px; display: flex; gap: 8px; align-items: center; padding: 6px 10px 6px 6px;
  background: var(--paper); border: 3px solid var(--ink); border-radius: 40px 14px 14px 40px; box-shadow: 0 4px 0 rgba(27,21,48,0.4);
  transition: transform 0.25s, box-shadow 0.25s;
}
.pcard.p0 { left: 10px; top: 10px; } .pcard.p1 { right: 10px; top: 10px; }
.pcard.p2 { left: 10px; bottom: 10px; } .pcard.p3 { right: 10px; bottom: 10px; }
.pcard.active { transform: scale(1.06); box-shadow: 0 4px 0 rgba(27,21,48,0.4), 0 0 0 4px var(--gold), 0 0 30px rgba(255,207,74,0.6); }
.pcard .por { width: 58px; height: 58px; border-radius: 50%; border: 4px solid; background: #ccc center/cover; flex: none; position: relative; }
.pcard .rank { position: absolute; bottom: -6px; left: -6px; width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: #fff; font-weight: 800; display: grid; place-items: center; font-size: 13px; border: 2px solid #fff; }
.pcard .rank.r1 { background: var(--gold-2); }
.pcard .info { flex: 1; min-width: 0; }
.pcard .nm { font-weight: 800; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard .nm .who { font-size: 10px; padding: 0 5px; border-radius: 6px; color: #fff; margin-right: 4px; }
.pcard .stats { display: flex; gap: 10px; font-size: 18px; font-weight: 800; }
.pcard .items { display: flex; gap: 3px; min-height: 22px; }
.pcard .items span { font-size: 15px; width: 22px; height: 22px; display: grid; place-items: center; background: var(--paper-2); border-radius: 6px; border: 2px solid var(--ink-2); }
.turn-banner {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%); color: #fff; font-weight: 800; text-align: center;
  background: rgba(27,21,48,0.85); border: 3px solid #000; padding: 4px 18px; border-radius: 999px; font-size: 16px; white-space: nowrap;
}
.turn-banner .moon { margin-left: 8px; }
.hint-bar { position: absolute; bottom: 86px; left: 50%; transform: translateX(-50%); color: #fff; font-size: 13px; text-shadow: 0 1px 2px #000; white-space: nowrap; }

/* ---------- labels above 3D ---------- */
.lbl { position: absolute; transform: translate(-50%, -100%); font-weight: 800; white-space: nowrap; pointer-events: none; }
.lbl.steps {
  font-size: 34px; color: #fff; -webkit-text-stroke: 2px var(--ink); paint-order: stroke; text-shadow: 0 3px 0 var(--ink);
  width: 54px; height: 54px; display: grid; place-items: center; background: var(--blue); border-radius: 50%; border: 3px solid var(--ink);
}
.lbl.float { font-size: 30px; -webkit-text-stroke: 1.5px var(--ink); paint-order: stroke; text-shadow: 0 3px 0 var(--ink); animation: floatUp 1.3s ease-out forwards; }
.lbl.float.good { color: #6cf; } .lbl.float.bad { color: #ff6b7d; } .lbl.float.gold { color: var(--gold); }
@keyframes floatUp { 0% { opacity: 0; margin-top: 10px; } 15% { opacity: 1; } 75% { opacity: 1; } 100% { opacity: 0; margin-top: -60px; } }
.lbl.tagname { font-size: 12px; color: #fff; background: rgba(27,21,48,0.75); padding: 1px 8px; border-radius: 8px; }
.lbl.dir { font-size: 13px; background: var(--gold); border: 3px solid var(--ink); border-radius: 12px; padding: 4px 10px; color: var(--ink); }
.lbl.dir.sel { background: var(--red); color: #fff; transform: translate(-50%, -100%) scale(1.15); }

/* ---------- dialog ---------- */
.dialog {
  position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%); width: min(760px, 92vw);
  display: flex; gap: 14px; align-items: flex-start; animation: popIn 0.22s ease-out;
}
@keyframes popIn { from { transform: translateX(-50%) translateY(20px) scale(0.96); opacity: 0; } }
.npc {
  flex: none; width: 74px; height: 74px; border-radius: 50%; display: grid; place-items: center; font-size: 34px; font-weight: 800;
  border: 4px solid var(--ink); color: #fff; background: #555 center/cover; font-family: var(--display); box-shadow: 0 4px 0 var(--ink);
}
.dialog .bubble { flex: 1; position: relative; }
.dialog .who { font-weight: 800; color: var(--red); margin-bottom: 2px; }
.dialog .txt { font-size: 18px; line-height: 1.45; min-height: 2.9em; }
.dialog .more { position: absolute; right: 14px; bottom: 6px; animation: bob 0.6s infinite alternate; }
@keyframes bob { to { transform: translateY(4px); } }
.choice {
  position: absolute; right: 6vw; bottom: 210px; min-width: 260px; max-width: 420px; display: flex; flex-direction: column; gap: 8px;
  animation: popIn2 0.18s ease-out;
}
@keyframes popIn2 { from { transform: scale(0.95); opacity: 0; } }
.choice .q { font-weight: 800; margin-bottom: 2px; }
.choice .btn { justify-content: space-between; font-size: 16px; min-height: 42px; }
.choice .btn .r { font-size: 13px; color: var(--muted); font-weight: 700; }
.choice .btn.sel .r { color: var(--ink); }
.choice.wide { left: 50%; right: auto; transform: translateX(-50%); bottom: 50%; translate: 0 50%; max-width: 560px; width: min(560px, 92vw); }

.big-banner {
  position: absolute; left: 0; right: 0; top: 40%; text-align: center; pointer-events: none;
  font-family: var(--display); font-size: clamp(40px, 8vw, 96px); color: #fff;
  text-shadow: 0 4px 0 var(--ink), 0 0 30px rgba(255,255,255,0.4); animation: bannerIn 1.6s ease-out forwards;
}
.big-banner small { display: block; font-family: var(--font); font-weight: 800; font-size: 0.28em; color: var(--gold); letter-spacing: 3px; }
@keyframes bannerIn { 0% { transform: scale(2.2); opacity: 0; } 18% { transform: scale(1); opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; transform: scale(1.05); } }

.toast {
  position: absolute; top: 80px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 8px 18px;
  border-radius: 999px; font-weight: 800; border: 3px solid #000; animation: popIn 0.2s ease-out; white-space: nowrap;
}

/* ---------- shop ---------- */
.shop { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(640px, 94vw); }
.shop h3 { margin: 0 0 4px; }
.shop .items-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.shop .it { display: flex; gap: 12px; align-items: center; justify-content: flex-start; text-align: left; min-height: 56px; }
.shop .it .ic { font-size: 26px; width: 36px; text-align: center; }
.shop .it .d { font-size: 12px; font-weight: 400; color: var(--ink-2); }
.shop .it .price { margin-left: auto; font-size: 18px; }

/* ---------- minigame intro / results ---------- */
.mg-card { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(900px, 96vw); max-height: 96vh; overflow: auto; }
.mg-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.mg-head h2 { margin: 0; font-size: 30px; }
.mg-head .jp { color: var(--muted); }
.mode-badge { font-weight: 800; color: #fff; padding: 3px 12px; border-radius: 999px; border: 3px solid var(--ink); }
.mode-ffa { background: var(--purple); } .mode-2v2 { background: var(--blue); } .mode-1v3 { background: var(--red); } .mode-duel { background: #e87a1c; } .mode-battle { background: #222; }
.mg-body { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; margin-top: 10px; }
.mg-desc { font-size: 15px; line-height: 1.5; }
.mg-controls { background: var(--paper-2); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.mg-controls div { margin: 3px 0; }
.mg-teams { display: flex; gap: 10px; align-items: stretch; margin-top: 12px; }
.mg-team { flex: 1; display: flex; gap: 8px; justify-content: center; padding: 8px; border-radius: 12px; background: var(--paper-2); }
.mg-vs { align-self: center; font-family: var(--display); font-size: 28px; color: var(--red); }
.mg-p { text-align: center; width: 92px; }
.mg-p .por { width: 64px; height: 64px; border-radius: 50%; border: 4px solid; margin: 0 auto 3px; background: #ccc center/cover; }
.mg-p .nm { font-size: 12px; font-weight: 800; }
.mg-p .rdy { font-size: 11px; font-weight: 800; color: var(--muted); }
.mg-p .rdy.ok { color: var(--green); }
.mg-foot { margin-top: 12px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.mg-res { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.mg-res .r { display: flex; align-items: center; gap: 12px; padding: 6px 12px; border-radius: 14px; background: var(--paper-2); border: 3px solid transparent; }
.mg-res .r.win { border-color: var(--gold-2); background: #fff3c4; animation: winPulse 0.8s ease-in-out infinite alternate; }
@keyframes winPulse { to { box-shadow: 0 0 18px rgba(255, 190, 40, 0.6); } }
.mg-res .place { width: 44px; font-family: var(--display); font-size: 26px; text-align: center; }
.mg-res .por { width: 46px; height: 46px; border-radius: 50%; border: 3px solid; background: #ccc center/cover; }
.mg-res .score { margin-left: auto; font-weight: 800; }
.mg-res .reward { width: 70px; text-align: right; font-weight: 800; font-size: 20px; }

/* roulette */
.roulette { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(820px, 96vw); text-align: center; }
.roulette .strip { display: flex; gap: 10px; justify-content: center; margin: 14px 0; }
.roulette .slot-item {
  width: 150px; height: 120px; border-radius: 14px; border: 3px solid var(--ink); display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--paper-2); font-weight: 800; font-size: 13px; padding: 6px; transition: transform 0.1s, background 0.1s;
}
.roulette .slot-item .e { font-size: 40px; }
.roulette .slot-item.hi { background: var(--gold); transform: scale(1.1); }

/* final results */
.final { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding-bottom: 3vh; gap: 10px; }
.final .board { width: min(720px, 94vw); }
.bonus-card { text-align: center; position: absolute; top: 12%; left: 50%; transform: translateX(-50%); width: min(560px, 92vw); animation: popIn2 0.3s; }
.bonus-card .e { font-size: 54px; }
.bonus-card h2 { margin: 4px 0; }

/* settings / help */
.modal { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(760px, 94vw); max-height: 90vh; overflow: auto; }
.modal h2 { margin-top: 0; }
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; font-size: 14px; }
.help-grid h4 { margin: 8px 0 2px; }
.space-dot { display: inline-block; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ink); vertical-align: -3px; margin-right: 6px; }
.slider { width: 100%; accent-color: var(--red); }

/* pause */
.pause { position: absolute; inset: 0; background: rgba(10, 6, 24, 0.6); display: grid; place-items: center; }

/* ---------- touch ---------- */
#touchpad { display: none; position: fixed; inset: auto 0 0 0; height: 0; z-index: 15; pointer-events: none; }
body.has-touch.mg-on #touchpad, body.has-touch #touchpad.force { display: block; }
.tp-stick {
  position: fixed; left: 24px; bottom: 24px; width: 120px; height: 120px; border-radius: 50%;
  background: rgba(255,255,255,0.15); border: 3px solid rgba(255,255,255,0.4); pointer-events: auto; touch-action: none;
}
.tp-knob { position: absolute; left: 35px; top: 35px; width: 44px; height: 44px; border-radius: 50%; background: rgba(255,255,255,0.7); }
.tp-btns { position: fixed; right: 20px; bottom: 30px; display: flex; gap: 14px; pointer-events: auto; }
.tp-btns button {
  width: 66px; height: 66px; border-radius: 50%; border: 3px solid rgba(255,255,255,0.6); color: #fff; font-weight: 800; font-size: 20px;
  background: rgba(232, 52, 74, 0.55); touch-action: none;
}
.tp-btns .tp-b { background: rgba(63, 124, 240, 0.55); margin-top: 30px; }

@media (max-width: 760px) {
  .pcard { width: 160px; transform: scale(0.9); transform-origin: top left; }
  .pcard.p1, .pcard.p3 { transform-origin: top right; }
  .pcard .por { width: 42px; height: 42px; }
  .pcard .stats { font-size: 14px; }
  .slots { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .boards { grid-template-columns: 1fr; }
  .cs { flex-direction: column; }
  .cs-left { width: 100%; }
  .cs-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .mg-body { grid-template-columns: 1fr; }
  .opt-grid { grid-template-columns: 1fr; }
  .help-grid { grid-template-columns: 1fr; }
}

/* Multilingual titles and the language menu. */
.title-screen .menu-col{gap:8px}
.title-screen .menu-col .btn{font-size:clamp(14px,2.2vw,20px)}
html[lang="ja"] .logo h1,html[lang="zh-Hant"] .logo h1{font-size:clamp(26px,5vw,58px)}
html[lang="ja"] .cs-info,html[lang="zh-Hant"] .cs-info{overflow-wrap:anywhere}
html[lang="zh-Hant"]{--font:"Microsoft JhengHei","PingFang TC","M PLUS Rounded 1c",system-ui,sans-serif}
@media(max-height:650px){.title-screen{overflow-y:auto;justify-content:flex-start;align-items:center;padding:18px 5vw}.title-screen .logo{position:relative;top:auto;margin-bottom:18px}.title-screen .title-foot{position:static;margin-top:14px}.title-screen .menu-col{flex-shrink:0}}
