:root {
  --gold: #f0c43c;
  --ink: #e8e9f2;
  --dim: #8b93ad;
  --glass: rgba(10, 13, 28, 0.55);
  --line: rgba(150, 165, 210, 0.18);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; overflow: hidden; }

body {
  background: #05060e;
  color: var(--ink);
  font-family: 'M PLUS 1 Code', 'Hiragino Sans', sans-serif;
  user-select: none;
  -webkit-user-select: none;
}

#world { position: fixed; inset: 0; display: block; }

#stage { position: fixed; inset: 0; pointer-events: none; }

.hidden { display: none !important; }

/* ===== 画面シェイク ===== */
@keyframes shakeAnim {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-7px, 3px); }
  40% { transform: translate(6px, -4px); }
  60% { transform: translate(-4px, -2px); }
  80% { transform: translate(3px, 3px); }
}
#stage.shake { animation: shakeAnim 0.28s ease-out; }

/* ===== HUD ===== */
#hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  padding: 20px 28px;
}
/* パネル内フッター: 視線が集中する枠内に高度と連続を置く */
.wbFoot {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 13px;
}
#altWrap { display: flex; align-items: baseline; gap: 3px; }
#altNow {
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
  color: var(--gold);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.6);
  font-variant-numeric: tabular-nums;
}
#altWrap small { font-size: 13px; color: var(--dim); font-weight: 600; }
#streakChip {
  display: flex;
  align-items: baseline;
  gap: 7px;
}
#streakChip .mdot {
  width: 10px; height: 10px;
  border-radius: 50%;
  align-self: center;
  background: var(--matCol, #8a5a33);
  box-shadow: 0 0 10px var(--matCol, #8a5a33);
}
#streakChip b {
  font-size: 27px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.6);
}
#streakChip small { font-size: 11px; color: var(--dim); letter-spacing: 2px; }

/* 順位表 */
.hud-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
#standings {
  min-width: 188px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.srow {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  gap: 8px;
  font-size: 13px;
  color: var(--dim);
  align-items: baseline;
}
.srow span { font-weight: 700; }
.srow i { font-style: normal; font-variant-numeric: tabular-nums; }
.srow.you { color: var(--ink); font-weight: 700; }
.srow.you b { color: var(--gold); }
#standEmpty { font-size: 11.5px; color: var(--dim); max-width: 190px; text-align: right; }

/* ===== 出題エリア ===== */
#wordBox {
  position: absolute;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  width: min(92vw, 700px);
  padding: 18px 28px 22px;
  border-radius: 20px;
  background: rgba(6, 8, 20, 0.5);
  border: 1px solid var(--line);
  backdrop-filter: blur(7px);
}
#wordTag {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #9ad7ff;
  margin-bottom: 8px;
  animation: meteorPulse 0.9s ease-in-out infinite alternate;
}
@keyframes meteorPulse { from { opacity: 0.65; } to { opacity: 1; text-shadow: 0 0 14px #9ad7ff; } }
#wKanji {
  font-family: 'Shippori Mincho', serif;
  font-size: clamp(40px, 6.4vw, 62px);
  font-weight: 800;
  letter-spacing: 4px;
  text-shadow: 0 3px 26px rgba(0, 0, 0, 0.75);
}
#wKanji.meteor {
  background: linear-gradient(100deg, #9ad7ff, #d2b0ff, #ffd9a0, #9ad7ff);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: meteorSlide 2.2s linear infinite;
}
@keyframes meteorSlide { to { background-position: 220% 0; } }
#wKana { margin-top: 8px; font-size: 17px; color: var(--dim); letter-spacing: 3px; }
#wRoma {
  margin-top: 10px;
  font-size: 26px;
  letter-spacing: 2px;
  font-weight: 600;
}
#rTyped { color: var(--gold); }
#rRest { color: #535b75; }
#wRoma.typoFlash { animation: typoAnim 0.3s ease-out; }
@keyframes typoAnim {
  0% { color: #ff5a5a; transform: translateX(-4px); }
  50% { transform: translateX(4px); }
  100% { transform: translateX(0); }
}

/* ノーミスゲージ: 50で満タン→祝福の雨。右端に次の報酬 */
#feverRow {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 8px auto 0;
  width: min(380px, 76%);
}
#feverGauge {
  flex: 1;
  height: 5px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
#feverFill {
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, #a8780b, #f0c43c, #ffe9a0);
  box-shadow: 0 0 12px rgba(240, 196, 60, 0.55);
  transition: width 0.12s ease-out;
}
body.fever3 #feverFill, body.fever4 #feverFill {
  background: linear-gradient(90deg, #f0c43c, #7cc4ff, #c98fff, #ff8ab0);
}
#feverNext {
  font: 700 11px 'M PLUS 1 Code', monospace;
  color: var(--gold);
  white-space: nowrap;
}
#feverNext.pop { animation: newRecAnim 0.6s ease-out; }

/* 傾きゲージ */
#instRow {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 14px auto 0;
  width: min(460px, 88%);
}
.windIco { font-size: 15px; }
body.danger .windIco { animation: shakeAnim 0.3s linear infinite; }
#instBar {
  flex: 1;
  height: 12px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.09);
  overflow: hidden;
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.5);
}
#instFill {
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, #5fae7c, #d8c44a, #e06a3c);
  transition: width 0.18s ease-out;
}
#instFill.danger { animation: dangerBlink 0.5s steps(2) infinite; }
@keyframes dangerBlink { 50% { filter: brightness(1.8); } }


/* 次のターゲット(レース感の核) */
#nextTarget {
  display: flex;
  align-items: center;
  gap: 6px;
  font: 600 13px 'M PLUS 1 Code', monospace;
  color: var(--dim);
}
#nextTarget b { font-weight: 700; }
#nextTarget i { font-style: normal; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
#nextTarget .sav { width: 18px; height: 18px; }
#nextTarget.near, #nextTarget.near i, #nextTarget.near b { color: var(--gold); }
#nextTarget.hot, #nextTarget.hot i, #nextTarget.hot b {
  color: #ffd9a0;
  animation: pressPulse 0.6s ease-in-out infinite;
  text-shadow: 0 0 14px rgba(240, 196, 60, 0.7);
}
#nextTarget.crown { color: var(--gold); text-shadow: 0 0 14px rgba(240, 196, 60, 0.6); }
.srow.near b { color: #ffd9a0; }

/* フィーバー段階 */
body.fever2 #wordBox {
  box-shadow: 0 0 60px rgba(240, 196, 60, 0.22), inset 0 0 30px rgba(240, 196, 60, 0.06);
}
body.fever3 #wordBox, body.fever4 #wordBox { animation: feverBorder 2s linear infinite; }
@keyframes feverBorder {
  0% { border-color: #f0c43c; } 25% { border-color: #7cc4ff; }
  50% { border-color: #c98fff; } 75% { border-color: #ff8ab0; } 100% { border-color: #f0c43c; }
}
body.fever4 #streakChip b { animation: pressPulse 0.5s ease-in-out infinite; }

/* ===== センターフラッシュ ===== */
#flash {
  position: absolute;
  top: calc(100% + 18px); /* 出題パネルの直下 — 入力中の文字とは絶対に重ならない */
  left: 50%;
  transform: translate(-50%, 0) scale(0.92);
  font-family: 'Shippori Mincho', serif;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 3px;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.95), 0 0 30px rgba(0, 0, 0, 0.8);
  white-space: nowrap;
  pointer-events: none;
}
#flash.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
#flash.gold { color: var(--gold); text-shadow: 0 0 30px rgba(240, 196, 60, 0.6); }
#flash.warn { color: #ff8a5a; }
#flash.mile { color: #bcd0ff; }
#flash.meteorFlash { color: #9ad7ff; text-shadow: 0 0 26px rgba(120, 190, 255, 0.7); }
#flash.tut { color: #d7e3ff; font-size: 22px; text-shadow: 0 2px 12px rgba(0,0,0,0.95), 0 0 24px rgba(120,150,220,0.5); }

/* ===== 心理演出: 危険・フロー・ステージ ===== */
#vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  opacity: 0;
  transition: opacity 0.6s;
  background: radial-gradient(ellipse at 50% 55%, transparent 52%, rgba(190, 28, 28, 0.5) 100%);
}
body.danger #vignette { opacity: 1; animation: vigPulse 0.62s ease-in-out infinite; }
@keyframes vigPulse { 50% { opacity: 0.45; } }
body.danger #wordBox {
  animation: tremble 0.12s linear infinite;
  border-color: rgba(255, 90, 70, 0.55);
}
@keyframes tremble {
  25% { transform: translate(calc(-50% - 2px), 1.5px); }
  75% { transform: translate(calc(-50% + 2px), -1.5px); }
}

body.flow #wordBox {
  border-color: rgba(240, 196, 60, 0.45);
  box-shadow: 0 0 42px rgba(240, 196, 60, 0.16), inset 0 0 26px rgba(240, 196, 60, 0.05);
}
body.flow #streakChip b {
  color: var(--gold);
  text-shadow: 0 0 16px rgba(240, 196, 60, 0.7);
}

#stageBanner {
  position: fixed;
  left: 0; right: 0;
  top: 55%;
  padding: 16px 0 18px;
  text-align: center;
  font-family: 'Shippori Mincho', serif;
  font-size: 38px;
  font-weight: 800;
  letter-spacing: 12px;
  color: #fff;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.9);
  background: linear-gradient(90deg, transparent, rgba(8, 10, 24, 0.85) 22%, rgba(8, 10, 24, 0.85) 78%, transparent);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  opacity: 0;
  transform: scale(1.08);
  transition: opacity 0.5s, transform 0.5s;
  pointer-events: none;
  z-index: 6;
}
#stageBanner.show { opacity: 1; transform: scale(1); }
#stageBanner small {
  display: block;
  font: 700 11px 'M PLUS 1 Code', monospace;
  letter-spacing: 7px;
  color: var(--gold);
  margin-bottom: 6px;
}

/* ===== オーバーレイ共通 ===== */
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* safe center: 内容が画面より高い時は上揃えにフォールバックしてスクロール可能に */
  justify-content: safe center;
  gap: 14px;
  background: rgba(4, 5, 14, 0.72);
  backdrop-filter: blur(10px);
  text-align: center;
  padding: 32px 24px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.press {
  margin-top: 10px;
  font-size: 14px;
  letter-spacing: 4px;
  color: var(--dim);
  animation: pressPulse 1.6s ease-in-out infinite;
}
@keyframes pressPulse { 50% { opacity: 0.35; } }
.press b { color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: 2px 9px; margin: 0 3px; }

/* タイトル */
#title h1 {
  font-family: 'Cinzel', 'Shippori Mincho', serif;
  font-size: clamp(64px, 11vw, 124px);
  font-weight: 800;
  letter-spacing: 0.22em;
  margin-right: -0.22em;
  line-height: 1.05;
  background: linear-gradient(175deg, #fdf6dc 18%, var(--gold) 48%, #8a5a33 95%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 30px rgba(240, 196, 60, 0.25));
}
.t-sub { font-size: 13px; letter-spacing: 8px; color: var(--dim); margin-top: -6px; }

/* 巨大なSPACEキー（クリックでも開始できる） */
#spaceKey {
  pointer-events: auto;
  position: relative;
  margin-top: 14px;
  width: min(420px, 80vw);
  height: 74px;
  border-radius: 16px;
  border: 2px solid rgba(240, 196, 60, 0.75);
  background:
    linear-gradient(180deg, rgba(240, 196, 60, 0.16), rgba(240, 196, 60, 0.05)),
    var(--glass);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  box-shadow:
    0 0 0 0 rgba(240, 196, 60, 0.45),
    0 6px 30px rgba(240, 196, 60, 0.18),
    inset 0 -4px 0 rgba(0, 0, 0, 0.45);
  animation: keyPulse 1.5s ease-in-out infinite;
  transition: transform 0.1s;
}
#spaceKey:hover { transform: translateY(-2px) scale(1.02); }
#spaceKey:active { transform: translateY(1px); }
@keyframes keyPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(240, 196, 60, 0.45), 0 6px 30px rgba(240, 196, 60, 0.18), inset 0 -4px 0 rgba(0, 0, 0, 0.45); }
  50% { box-shadow: 0 0 0 9px rgba(240, 196, 60, 0), 0 6px 44px rgba(240, 196, 60, 0.38), inset 0 -4px 0 rgba(0, 0, 0, 0.45); }
}
.sk-label {
  font: 800 24px 'M PLUS 1 Code', monospace;
  letter-spacing: 10px;
  margin-right: -10px;
  color: #fdf6dc;
  text-shadow: 0 0 18px rgba(240, 196, 60, 0.8);
}
.sk-start {
  font: 700 11px 'M PLUS 1 Code', monospace;
  letter-spacing: 5px;
  color: var(--gold);
}
.xlogo { width: 19px; height: 19px; color: var(--ink); flex: none; }
#cityCanvas {
  pointer-events: auto;
  margin-top: 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  max-width: 92vw;
}
.cityCaption { font-size: 12px; color: var(--dim); letter-spacing: 1px; }

/* 称号バー */
.rank-box {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  font-size: 13px;
}
.rank-name {
  font-family: 'Shippori Mincho', serif;
  font-weight: 800;
  font-size: 17px;
  color: var(--gold);
}
.rank-name.rankUp { animation: rankUpAnim 0.9s ease-out; text-shadow: 0 0 24px rgba(240, 196, 60, 0.9); }
@keyframes rankUpAnim { 0% { transform: scale(1.7); } 100% { transform: scale(1); } }
.rank-bar {
  width: 220px;
  height: 7px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}
.rank-fill {
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, #8a5a33, var(--gold));
}
.rank-next { font-size: 11.5px; color: var(--dim); }

/* リザルト */
#ovTitle {
  font-family: 'Shippori Mincho', serif;
  font-size: 40px;
  font-weight: 800;
  letter-spacing: 10px;
  color: #c9cfe2;
}
#ovNew {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 5px;
  color: var(--gold);
  animation: newRecAnim 0.7s ease-out, pressPulse 1.4s 0.7s ease-in-out infinite;
}
@keyframes newRecAnim { 0% { transform: scale(2.2); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.bigHeight { display: flex; align-items: baseline; gap: 6px; }
#ovHeight {
  font-size: 84px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 4px 38px rgba(240, 196, 60, 0.25);
}
.bigHeight small { font-size: 26px; color: var(--dim); }
.stats {
  display: flex;
  gap: 26px;
  margin-top: 6px;
}
.stats div { display: flex; flex-direction: column; gap: 3px; }
.stats b { font-size: 21px; font-variant-numeric: tabular-nums; }
.stats span { font-size: 11px; color: var(--dim); letter-spacing: 1px; }
#ovMsg {
  margin-top: 12px;
  font-family: 'Shippori Mincho', serif;
  font-size: 15.5px;
  color: #c9cfe2;
}
#toCity {
  pointer-events: auto;
  margin-top: 4px;
  font-size: 12px;
  color: var(--dim);
  background: none;
  border: none;
  border-bottom: 1px dashed var(--dim);
  cursor: pointer;
  font-family: inherit;
}
#toCity:hover { color: var(--ink); }

/* ===== ソーシャル ===== */
.handleRow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}
.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1.5px solid var(--gold);
  object-fit: cover;
}
.handleRow .at { color: var(--dim); font-size: 16px; font-weight: 700; }
#handleInput {
  width: 230px;
  padding: 9px 12px;
  font: 600 14px 'M PLUS 1 Code', monospace;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
}
#handleInput:focus { border-color: var(--gold); }
#handleSave {
  padding: 9px 16px;
  font: 700 13px 'M PLUS 1 Code', monospace;
  color: #1a1206;
  background: linear-gradient(175deg, #fdf6dc, var(--gold));
  border: none;
  border-radius: 10px;
  cursor: pointer;
}
#handleSave:hover { filter: brightness(1.1); }
.handleMsg { font-size: 12px; color: var(--gold); min-height: 16px; }

#challengeBanner {
  font-family: 'Shippori Mincho', serif;
  font-size: 16px;
  font-weight: 800;
  color: var(--gold);
  padding: 10px 22px;
  border: 1px solid rgba(240, 196, 60, 0.5);
  border-radius: 12px;
  background: rgba(240, 196, 60, 0.08);
  animation: pressPulse 1.8s ease-in-out infinite;
}

.sav {
  width: 17px; height: 17px;
  border-radius: 50%;
  object-fit: cover;
  align-self: center;
}
.sav.ph { display: inline-block; background: rgba(150, 165, 210, 0.25); }
.srow { grid-template-columns: 14px 17px 1fr auto; }
.srow.chal b { color: var(--gold); }

#ovWorld { font-size: 15px; font-weight: 700; color: #bcd0ff; }
#ovWarn { font-size: 12px; color: #d8a85a; }
#ovChallenge {
  font-family: 'Shippori Mincho', serif;
  font-size: 17px;
  font-weight: 800;
  color: var(--gold);
  text-shadow: 0 0 22px rgba(240, 196, 60, 0.5);
  animation: newRecAnim 0.7s ease-out;
}
#shareX {
  pointer-events: auto;
  margin-top: 6px;
  padding: 12px 28px;
  font: 700 15px 'M PLUS 1 Code', monospace;
  color: #fff;
  background: #15202b;
  border: 1px solid #5a6a7a;
  border-radius: 99px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  transition: transform 0.12s, box-shadow 0.12s;
}
#shareX .xlogo { width: 17px; height: 17px; }
#shareX:hover { transform: translateY(-1px); box-shadow: 0 4px 18px rgba(0, 0, 0, 0.5); }

/* ===== シェアモーダル ===== */
.modal { z-index: 200; background: rgba(2, 3, 10, 0.78); }
.modalCard {
  position: relative;
  width: min(620px, 92vw);
  padding: 26px 28px 24px;
  border-radius: 22px;
  background: rgba(13, 16, 32, 0.92);
  border: 1px solid var(--line);
  backdrop-filter: blur(14px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  animation: modalIn 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
@keyframes modalIn { from { transform: scale(0.88) translateY(16px); opacity: 0; } }
#worldClose, #rankClose {
  position: absolute;
  top: 12px; right: 14px;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: none;
  color: var(--dim);
  font-size: 14px;
  cursor: pointer;
}
#worldClose:hover, #rankClose:hover { color: var(--ink); }
#copiedBadge {
  font: 700 14px 'M PLUS 1 Code', monospace;
  padding: 7px 16px;
  border-radius: 99px;
  color: var(--dim);
  border: 1px solid var(--line);
}
#copiedBadge.ok {
  color: #0e1407;
  background: linear-gradient(175deg, #d8f7a8, #76d672);
  border: none;
  animation: badgePop 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.4);
}
@keyframes badgePop { 0% { transform: scale(0.5); opacity: 0; } }
#shareCardImg {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}
.steps {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 2px;
}
.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 96px;
}
.step b { font-size: 11.5px; color: var(--dim); font-weight: 600; white-space: nowrap; }
.sno {
  font: 700 11px 'M PLUS 1 Code', monospace;
  color: var(--gold);
}
.step .xlogo { width: 24px; height: 24px; }
.keycap {
  font: 700 15px 'M PLUS 1 Code', monospace;
  padding: 3px 12px;
  border-radius: 8px;
  border: 1.5px solid #aab3cc;
  color: var(--ink);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.5);
  background: rgba(255, 255, 255, 0.06);
}
.postIco { font-size: 19px; }
.sarrow { color: var(--dim); font-size: 18px; margin-top: 12px; }
#shareGo {
  pointer-events: auto;
  width: 100%;
  padding: 14px 0;
  font: 800 16px 'M PLUS 1 Code', monospace;
  color: #fff;
  background: #15202b;
  border: 1px solid #5a6a7a;
  border-radius: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.12s, filter 0.12s;
}
#shareGo:hover { transform: translateY(-1px); filter: brightness(1.25); }
#shareGo .xlogo { width: 17px; height: 17px; }

.legal { margin-top: 4px; display: flex; gap: 14px; align-items: center; justify-content: center; }
.legalBtn { pointer-events: auto; background: none; border: none; cursor: pointer; font: 600 12px 'M PLUS 1 Code', monospace; color: var(--gold); }
.legalBtn:hover { text-decoration: underline; }
.legal a { font-size: 11.5px; color: rgba(139,147,173,.6); text-decoration: none; pointer-events: auto; }
.legal a:hover { color: var(--dim); text-decoration: underline; }

/* ===== あそびかた ===== */
.howtoCard { width: min(480px, 92vw); align-items: stretch; text-align: left; }
.howtoTitle { font-family: 'Shippori Mincho', serif; font-size: 24px; font-weight: 800; letter-spacing: 3px; text-align: center; }
.howtoLead { font-size: 14px; color: #c9cfe2; text-align: center; margin-top: -4px; }
.howtoList { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 12px; margin: 6px 0; }
.howtoList li { display: flex; flex-direction: column; gap: 2px; }
.howtoList b { font-size: 15px; color: var(--gold); }
.howtoList span { font-size: 13px; color: #aeb6cc; line-height: 1.7; }
#howtoGo {
  pointer-events: auto; margin-top: 4px; padding: 13px 0; width: 100%;
  font: 800 15px 'M PLUS 1 Code', monospace; color: #1a1206;
  background: linear-gradient(175deg, #fdf6dc, var(--gold)); border: none; border-radius: 12px; cursor: pointer;
}
#howtoGo:hover { filter: brightness(1.08); }
#howtoClose { position: absolute; top: 12px; right: 14px; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: none; color: var(--dim); font-size: 14px; cursor: pointer; }

/* ===== 不正検出の警告 ===== */
#cheatWarn { z-index: 400; background: rgba(20, 2, 2, 0.86); }
.cwIcon { font-size: 64px; filter: drop-shadow(0 0 24px rgba(220,40,40,.7)); }
.cwTitle {
  font-family: 'Shippori Mincho', serif;
  font-size: 30px; font-weight: 800; letter-spacing: 4px;
  color: #ff6b5a;
}
.cwLead { font-size: 16px; line-height: 1.9; color: #f0d8d8; }
.cwReasons {
  list-style: none; padding: 14px 22px; margin: 4px 0;
  background: rgba(80,10,10,.4); border: 1px solid rgba(220,80,80,.4); border-radius: 12px;
  font-size: 13.5px; color: #ffd0c8; max-width: 460px;
}
.cwReasons li { padding: 3px 0; }
.cwReasons li::before { content: '× '; color: #ff6b5a; font-weight: 700; }
.cwNote { font-size: 12.5px; color: #b88; line-height: 1.8; }
#cwClose {
  pointer-events: auto; margin-top: 8px;
  padding: 12px 28px; font: 700 14px 'M PLUS 1 Code', monospace;
  color: #fff; background: rgba(180,40,40,.25);
  border: 1px solid rgba(220,80,80,.6); border-radius: 10px; cursor: pointer;
}
#cwClose:hover { background: rgba(180,40,40,.45); }

.worldBtn { pointer-events: auto; background: none; border: none; cursor: pointer; font: 600 13px 'M PLUS 1 Code', monospace; color: #bcd0ff; }
.worldBtn:hover { color: #fff; text-decoration: underline; }
/* 世界ランキングの行 */
.wrow { display: grid; grid-template-columns: 30px 22px 1fr auto auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 9px; font-size: 13.5px; }
.wrow .rno { font: 700 12px 'M PLUS 1 Code', monospace; color: var(--dim); text-align: right; }
.wrow .sav { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; }
.wrow b { font-weight: 700; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wrow i { font-style: normal; font-weight: 700; color: var(--gold); font-variant-numeric: tabular-nums; }
.wrow em { font-style: normal; font-size: 11px; color: var(--dim); font-family: 'Shippori Mincho', serif; }
.wrow.you { background: rgba(240,196,60,.12); border: 1px solid rgba(240,196,60,.45); }
.wrow.you b { color: var(--gold); }
.wrow.top1 .rno { color: #ffe08a; }
.wempty { color: var(--dim); text-align: center; padding: 24px; font-size: 14px; }

.joinCard { width: min(480px, 92vw); align-items: stretch; text-align: left; }
.joinLead { font-size: 14px; color: #c9cfe2; line-height: 1.8; }
.joinLead b { color: var(--gold); }
.joinTerms { font-size: 13px; color: #aeb6cc; line-height: 1.85; padding-left: 20px; margin: 6px 0; display: flex; flex-direction: column; gap: 6px; }
.joinTerms b { color: #dfe3f0; }
.joinTermsLink { font-size: 12.5px; color: var(--gold); text-align: center; display: block; }
#joinAgree {
  pointer-events: auto; margin-top: 8px; padding: 13px 0; width: 100%;
  font: 800 15px 'M PLUS 1 Code', monospace; color: #1a1206;
  background: linear-gradient(175deg, #fdf6dc, var(--gold)); border: none; border-radius: 12px; cursor: pointer;
}
#joinAgree:hover { filter: brightness(1.08); }
#joinClose { position: absolute; top: 12px; right: 14px; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: none; color: var(--dim); font-size: 14px; cursor: pointer; }

/* ===== 称号の梯子 ===== */
.rankAllBtn {
  pointer-events: auto;
  font: 700 12px 'M PLUS 1 Code', monospace;
  color: var(--gold);
  background: none;
  border: 1px solid rgba(240, 196, 60, 0.4);
  border-radius: 99px;
  padding: 5px 13px;
  cursor: pointer;
  transition: background 0.15s;
}
.rankAllBtn:hover { background: rgba(240, 196, 60, 0.12); }
.rankCard { width: min(440px, 92vw); }
.rankTitle {
  font-family: 'Shippori Mincho', serif;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 4px;
}
.rankTitle span { font: 700 13px 'M PLUS 1 Code', monospace; color: var(--gold); margin-left: 8px; }
#worldList { width: 100%; max-height: 60vh; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; padding-right: 4px; }
#rankList {
  width: 100%;
  max-height: 56vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-right: 4px;
}
.rrow {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  gap: 10px;
  align-items: baseline;
  padding: 7px 12px;
  border-radius: 9px;
  font-size: 14px;
}
.rrow .rno { font: 700 11px 'M PLUS 1 Code', monospace; color: var(--dim); }
.rrow b { font-family: 'Shippori Mincho', serif; font-weight: 800; letter-spacing: 1px; }
.rrow i { font: 600 11.5px 'M PLUS 1 Code', monospace; font-style: normal; color: var(--dim); }
.rrow.locked { opacity: 0.42; }
.rrow.done b { color: var(--gold); }
.rrow.done .rno::after { content: ' ✓'; color: var(--gold); }
.rrow.current {
  background: rgba(240, 196, 60, 0.12);
  border: 1px solid rgba(240, 196, 60, 0.5);
  box-shadow: 0 0 18px rgba(240, 196, 60, 0.15);
}
.rrow.current b { color: #fdf6dc; text-shadow: 0 0 12px rgba(240, 196, 60, 0.7); }

/* ===== スマホゲート ===== */
#mobileGate { z-index: 300; pointer-events: auto; }
.mgIcon { font-size: 46px; margin-top: 6px; }
.mgMsg { font-size: 15px; line-height: 1.9; color: #c9cfe2; }
.mgMsg b { color: var(--gold); }
#mgCopy {
  padding: 13px 30px;
  font: 700 15px 'M PLUS 1 Code', monospace;
  color: #1a1206;
  background: linear-gradient(175deg, #fdf6dc, var(--gold));
  border: none;
  border-radius: 99px;
  cursor: pointer;
}
#mgCopy:active { transform: scale(0.97); }
.mgListTitle { margin-top: 14px; font-size: 13px; color: var(--dim); letter-spacing: 2px; }
#mgList {
  min-width: 260px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--glass);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 7px;
}
#mgChallenge {
  font-family: 'Shippori Mincho', serif;
  font-size: 15px;
  font-weight: 800;
  color: var(--gold);
  padding: 9px 18px;
  border: 1px solid rgba(240, 196, 60, 0.5);
  border-radius: 12px;
  background: rgba(240, 196, 60, 0.08);
}

/* ミュート */
#muteBtn {
  position: fixed;
  right: 16px;
  bottom: 14px;
  z-index: 50;
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--glass);
  font-size: 15px;
  cursor: pointer;
  backdrop-filter: blur(8px);
}
#escHint {
  position: fixed;
  left: 18px;
  bottom: 16px;
  font-size: 11px;
  color: rgba(140, 150, 180, 0.55);
  letter-spacing: 1px;
}
