/* ============ アソビアトラス design system ============ */
:root {
  --bg: #F7F3EA;          /* 生成り */
  --surface: #FFFFFF;
  --ink: #26221B;
  --ink-soft: #6F6656;
  --line: #E6DFD0;
  --felt: #2E6B4F;        /* 盤面フェルト */
  --felt-deep: #235441;
  --wood: #8A6240;
  --wood-soft: #C8A87E;
  --p1: #2B59C3;          /* 先手=青 */
  --p1-soft: #E8EEFB;
  --p2: #D8442E;          /* 後手=赤 */
  --p2-soft: #FBEAE7;
  --gold: #E8A825;
  --map-sea: #D7E6EF;
  --map-land: #E9DFC4;
  --map-coast: #C3B18B;
  --map-grid: rgba(120, 150, 170, 0.18);
  --map-pin-dim: #D9D2C2;
  --radius: 16px;
  --shadow: 0 2px 10px rgba(60, 45, 20, 0.08);
  --shadow-lift: 0 6px 24px rgba(60, 45, 20, 0.16);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Hiragino Maru Gothic ProN", "Hiragino Sans", "Noto Sans JP", sans-serif;
  line-height: 1.6;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}
button { font-family: inherit; border: none; background: none; cursor: pointer; color: inherit; }

/* ============ screens ============ */
.screen { display: none; min-height: 100dvh; padding: calc(20px + var(--safe-t)) 18px calc(86px + var(--safe-b)); max-width: 560px; margin: 0 auto; }
.screen.active { display: block; }
.screen.game-screen { display: none; padding: 0; max-width: none; }
.screen.game-screen.active { display: flex; flex-direction: column; height: 100dvh; }

/* ============ home ============ */
.home-head { margin-bottom: 18px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { display: flex; gap: 4px; }
.bm { width: 11px; height: 11px; display: inline-block; }
.bm1 { background: var(--p1); border-radius: 50%; }
.bm2 { background: var(--p2); border-radius: 3px; }
.bm3 { background: var(--gold); clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.bm4 { background: var(--felt); border-radius: 50%; }
h1 { font-size: 24px; font-weight: 800; letter-spacing: 0.02em; }
.brand-sub { color: var(--ink-soft); font-size: 13px; margin: 2px 0 14px 2px; }
.atlas-progress { background: var(--surface); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow); }
.ap-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-soft); font-weight: 700; margin-bottom: 6px; }
.ap-label span:last-child { font-variant-numeric: tabular-nums; color: var(--felt); }
.ap-bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
#ap-fill { height: 100%; width: 0%; border-radius: 99px; background: linear-gradient(90deg, var(--felt), #4C9B77); transition: width 0.6s cubic-bezier(.22,1,.36,1); }

.game-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.game-card {
  background: var(--surface); border-radius: var(--radius); padding: 14px 14px 12px;
  box-shadow: var(--shadow); text-align: left; position: relative; overflow: hidden;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  display: flex; flex-direction: column; gap: 2px;
}
.game-card:active { transform: scale(0.96); box-shadow: var(--shadow-lift); }
.gc-art { display: block; width: 56px; height: 56px; }
.gc-art svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 2px 4px rgba(60,45,20,0.18)); }
.gc-name { font-weight: 800; font-size: 15px; margin-top: 4px; }
.gc-origin { font-size: 11px; color: var(--ink-soft); }
.gc-badges { display: flex; gap: 4px; margin-top: 8px; flex-wrap: wrap; }
.badge { font-size: 10px; font-weight: 700; border-radius: 99px; padding: 1px 8px; }
.badge.b2p { background: var(--p1-soft); color: var(--p1); }
.badge.bcpu { background: var(--p2-soft); color: var(--p2); }
.badge.bdone { background: #EAF5EF; color: var(--felt); }
.gc-cards { position: absolute; top: 12px; right: 12px; font-size: 10.5px; font-weight: 700; color: var(--ink-soft); background: var(--bg); border-radius: 99px; padding: 2px 8px; font-variant-numeric: tabular-nums; }
.home-foot { text-align: center; color: var(--ink-soft); font-size: 12px; margin-top: 22px; }

/* ============ sub screens ============ */
.sub-head { margin-bottom: 16px; }
.sub-head h2 { font-size: 20px; font-weight: 800; }
.sub-head p { font-size: 12.5px; color: var(--ink-soft); }

/* zukan */
.zukan-list { display: flex; flex-direction: column; gap: 14px; }
.zk-map { background: var(--surface); border-radius: var(--radius); padding: 10px 10px 4px; box-shadow: var(--shadow); }
.zk-mapsvg { width: 100%; display: block; border-radius: 12px; }
.zk-pin { cursor: pointer; }
.zk-pin.lit { filter: drop-shadow(0 2px 5px rgba(200, 150, 30, 0.45)); }
.zk-pin:active { opacity: 0.75; }
.zk-map-cap { text-align: center; font-size: 11.5px; font-weight: 700; color: var(--ink-soft); padding: 8px 0 6px; }
.zk-game.flash { animation: zk-flash 1.2s; }
@keyframes zk-flash { 0%, 60% { box-shadow: 0 0 0 3px var(--gold), var(--shadow); } }
.zk-game { background: var(--surface); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.zk-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.zk-head .f { width: 26px; height: 26px; }
.zk-head .f svg { width: 100%; height: 100%; display: block; border-radius: 7px; }
.zk-head .n { font-weight: 800; font-size: 15px; }
.zk-head .o { font-size: 11px; color: var(--ink-soft); margin-left: auto; }
.zk-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.zk-card {
  aspect-ratio: 3 / 4; border-radius: 10px; padding: 8px; text-align: center;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-size: 11px; font-weight: 700; transition: transform 0.1s;
}
.zk-card:active { transform: scale(0.95); }
.zk-card.locked { background: var(--bg); color: #B9AF9C; border: 1.5px dashed var(--line); }
.zk-card.unlocked { background: linear-gradient(160deg, #FFFDF6, #F4EDDC); border: 1.5px solid var(--wood-soft); color: var(--ink); box-shadow: var(--shadow); }
.zk-card.rare.unlocked { background: linear-gradient(160deg, #FFF9E8, #FDEBC1); border-color: var(--gold); }
.zk-card .zc-ico { width: 26px; height: 26px; color: #8A6240; }
.zk-card .zc-ico svg { width: 100%; height: 100%; display: block; }
.zk-card.locked .zc-ico { filter: grayscale(1); opacity: 0.45; }

/* settings */
.settings-list { display: flex; flex-direction: column; gap: 10px; }
.set-row { background: var(--surface); border-radius: 12px; padding: 14px 16px; display: flex; justify-content: space-between; align-items: center; box-shadow: var(--shadow); font-weight: 700; font-size: 14px; }
.toggle { width: 46px; height: 27px; border-radius: 99px; background: var(--line); position: relative; transition: background 0.2s; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 21px; height: 21px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.2); transition: left 0.2s; }
.toggle.on { background: var(--felt); }
.toggle.on::after { left: 22px; }
.mini-btn { background: var(--p2-soft); color: var(--p2); font-weight: 700; font-size: 12.5px; border-radius: 99px; padding: 6px 14px; }
.set-note { text-align: center; font-size: 11px; color: var(--ink-soft); font-weight: 400; margin-top: 12px; line-height: 1.8; }

/* ============ tabbar ============ */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; justify-content: center; gap: clamp(16px, 14vw, 140px);
  background: rgba(255, 255, 253, 0.92); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); padding: 8px 0 calc(8px + var(--safe-b));
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: 10.5px; font-weight: 700; color: #B3A88F; width: 84px; padding: 4px 0; border-radius: 12px; }
.tab .t-ico { width: 22px; height: 22px; display: block; }
.tab .t-ico svg { width: 100%; height: 100%; display: block; }
.tab.active { color: var(--felt); }

.game-screen.active ~ .tabbar { display: none; }

/* ============ game screen ============ */
.game-head {
  display: flex; align-items: center; gap: 8px; padding: calc(12px + var(--safe-t)) 14px 12px;
  background: var(--bg); z-index: 5;
}
.icon-btn {
  width: 38px; height: 38px; border-radius: 12px; background: var(--surface);
  box-shadow: var(--shadow); font-size: 17px; font-weight: 700; color: var(--ink-soft);
  display: flex; align-items: center; justify-content: center;
}
.icon-btn:active { transform: scale(0.92); }
.g-title { flex: 1; text-align: center; font-weight: 800; font-size: 16px; display: flex; justify-content: center; gap: 7px; align-items: center; }
.g-title #g-flag { width: 24px; height: 24px; display: block; }
.g-title #g-flag svg { width: 100%; height: 100%; display: block; border-radius: 6px; }
.g-root { flex: 1; display: flex; flex-direction: column; overflow: hidden; position: relative;
  width: 100%; max-width: 720px; margin: 0 auto; }
.game-head { width: 100%; max-width: 720px; margin: 0 auto; }

/* 共通: 対局ステータスバー */
.turn-bar { display: flex; justify-content: center; gap: 10px; padding: 4px 16px 10px; }
.turn-pill {
  display: flex; align-items: center; gap: 7px; padding: 6px 14px; border-radius: 99px;
  background: var(--surface); box-shadow: var(--shadow); font-size: 12.5px; font-weight: 800;
  color: var(--ink-soft); opacity: 0.55; transition: all 0.2s; border: 2px solid transparent;
}
.turn-pill .dot { width: 12px; height: 12px; border-radius: 50%; }
.turn-pill.p1 .dot { background: var(--p1); }
.turn-pill.p2 .dot { background: var(--p2); }
.turn-pill.now { opacity: 1; transform: scale(1.05); }
.turn-pill.p1.now { border-color: var(--p1); color: var(--p1); }
.turn-pill.p2.now { border-color: var(--p2); color: var(--p2); }
.turn-pill .score { font-variant-numeric: tabular-nums; }

/* 盤面共通 */
.board-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 6px 14px 20px; min-height: 0; }
.felt-board {
  background: linear-gradient(160deg, #337557, var(--felt-deep));
  border: 6px solid var(--wood);
  border-radius: 14px;
  box-shadow: inset 0 2px 12px rgba(0,0,0,0.28), 0 8px 22px rgba(60,45,20,0.22);
  touch-action: manipulation;
}
.g-hint { text-align: center; font-size: 12px; color: var(--ink-soft); font-weight: 700; padding-bottom: 10px; min-height: 18px; }

/* ============ modals ============ */
.modal-veil {
  position: fixed; inset: 0; z-index: 60; background: rgba(38, 34, 27, 0.5);
  display: flex; align-items: flex-end; justify-content: center;
  backdrop-filter: blur(3px); animation: veil-in 0.2s;
}
@keyframes veil-in { from { opacity: 0; } }
.modal-veil.hidden { display: none; }
.modal {
  background: var(--bg); border-radius: 22px 22px 0 0; width: 100%; max-width: 560px;
  padding: 24px 22px calc(24px + var(--safe-b)); animation: modal-up 0.28s cubic-bezier(.22,1,.36,1);
}
@keyframes modal-up { from { transform: translateY(40px); opacity: 0; } }
@media (min-width: 600px) {
  .modal-veil { align-items: center; }
  .modal { border-radius: 22px; max-width: 420px; }
}

/* mode modal */
.mm-head { display: flex; align-items: center; gap: 8px; }
.mm-head h3 { font-size: 19px; font-weight: 800; }
.mm-head span { width: 34px; height: 34px; display: block; }
.mm-head span svg { width: 100%; height: 100%; display: block; border-radius: 9px; }
.mm-tagline { font-size: 12.5px; color: var(--ink-soft); margin: 4px 0 16px; }
.mm-modes { display: flex; flex-direction: column; gap: 10px; }
.mm-sec { font-size: 11px; font-weight: 800; color: var(--ink-soft); letter-spacing: 0.06em; margin-top: 4px; }
.mode-row { display: flex; gap: 8px; }
.mode-btn {
  flex: 1; background: var(--surface); border-radius: 14px; padding: 13px 6px;
  box-shadow: var(--shadow); font-weight: 800; font-size: 13.5px;
  display: flex; flex-direction: column; gap: 2px; align-items: center;
  border: 2px solid transparent; transition: transform 0.1s;
}
.mode-btn:active { transform: scale(0.95); }
.mode-btn .sub { font-size: 10px; color: var(--ink-soft); font-weight: 700; }
.mode-btn.cpu1 { border-color: #CBE3D6; }
.mode-btn.cpu2 { border-color: #8CC3A8; }
.mode-btn.cpu3 { border-color: var(--felt); }
.mode-btn.two { border-color: var(--p1); background: var(--p1-soft); color: var(--p1); }
.modal-close { display: block; margin: 18px auto 0; color: var(--ink-soft); font-weight: 700; font-size: 13px; padding: 6px 20px; }

/* result modal */
.result-modal { text-align: center; }
.r-emoji { width: 74px; height: 74px; margin: 0 auto; animation: pop 0.45s cubic-bezier(.22,1.6,.36,1); }
.r-emoji svg { width: 100%; height: 100%; display: block; }
@keyframes pop { from { transform: scale(0); } }
.result-modal h3 { font-size: 22px; font-weight: 800; margin: 4px 0 2px; }
.result-modal p { font-size: 13px; color: var(--ink-soft); }
.r-cards { display: flex; justify-content: center; gap: 10px; margin: 16px 0 4px; flex-wrap: wrap; }
.r-card {
  width: 92px; aspect-ratio: 3/4; border-radius: 10px; padding: 8px 6px;
  background: linear-gradient(160deg, #FFFDF6, #F4EDDC); border: 1.5px solid var(--wood-soft);
  font-size: 10.5px; font-weight: 800; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  box-shadow: var(--shadow-lift); animation: card-in 0.5s cubic-bezier(.22,1.4,.36,1) backwards;
}
.r-card.rare { background: linear-gradient(160deg, #FFF9E8, #FDEBC1); border-color: var(--gold); }
.r-card:nth-child(2) { animation-delay: 0.15s; }
.r-card .ico { width: 26px; height: 26px; color: #8A6240; }
.r-card .ico svg { width: 100%; height: 100%; display: block; }
.r-card .new { color: var(--p2); font-size: 9px; letter-spacing: 0.1em; }
@keyframes card-in { from { transform: translateY(24px) rotate(-6deg); opacity: 0; } }
.r-actions { display: flex; gap: 10px; margin-top: 18px; }
.btn { flex: 1; border-radius: 14px; padding: 14px; font-weight: 800; font-size: 14.5px; transition: transform 0.1s; }
.btn:active { transform: scale(0.96); }
.btn.primary { background: var(--felt); color: #fff; box-shadow: 0 4px 14px rgba(46,107,79,0.35); }
.btn.ghost { background: var(--surface); color: var(--ink-soft); box-shadow: var(--shadow); }

/* card modal */
.card-modal { text-align: center; }
.card-modal .cm-ico { width: 52px; height: 52px; margin: 0 auto; color: #8A6240; }
.card-modal .cm-ico svg { width: 100%; height: 100%; display: block; }
.card-modal h3 { font-size: 18px; font-weight: 800; margin: 6px 0 2px; }
.card-modal .cm-game { font-size: 11.5px; color: var(--ink-soft); font-weight: 700; }
.card-modal .cm-text {
  text-align: left; font-size: 13.5px; line-height: 2; margin: 14px 0 4px; color: var(--ink);
  background: var(--surface); border-radius: 12px; padding: 14px 16px; font-weight: 400;
  font-family: "Hiragino Mincho ProN", serif;
}
.card-modal .cm-lock { font-size: 12.5px; color: var(--ink-soft); margin: 14px 0; font-weight: 700; }

/* ============ toast ============ */
#toast {
  /* モーダル(z-index:60)や広告(90)より前面に出す。下寄せだとペイウォールに隠れるため上寄せ */
  position: fixed; left: 50%; top: calc(18px + var(--safe-t)); transform: translateX(-50%) translateY(-14px);
  background: var(--ink); color: #FFF9EC; font-size: 12.5px; font-weight: 700;
  padding: 9px 18px; border-radius: 99px; opacity: 0; pointer-events: none;
  transition: all 0.25s; z-index: 120; max-width: 88vw; text-align: center; white-space: normal;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }


/* ============ レスポンシブ (タブレット/デスクトップ/横持ち) ============ */
@media (min-width: 600px) {
  .screen { max-width: 680px; padding-left: 28px; padding-right: 28px; }
  .game-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
  h1 { font-size: 27px; }
}
@media (min-width: 900px) {
  .screen { max-width: 980px; }
  .game-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
  .zukan-list { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
  .zk-map { grid-column: 1 / -1; }
  .zukan-list > .zk-game { margin: 0; }
  .settings-list { max-width: 560px; }
}
/* 横持ちスマホ: ヘッダーを詰めて盤面の高さを確保 */
@media (max-height: 480px) {
  .game-head { padding: 6px 14px; }
  .turn-bar { padding: 0 16px 4px; }
  .turn-bar .turn-pill { padding: 3px 10px; font-size: 11px; }
  .g-hint { padding-bottom: 4px; font-size: 11px; }
  .board-wrap { padding: 2px 14px 8px; }
}
/* ポインタ環境: ホバーフィードバック */
@media (hover: hover) {
  .game-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
  .mode-btn:hover, .btn:hover, .icon-btn:hover { filter: brightness(1.04); box-shadow: var(--shadow-lift); }
  .zk-card.unlocked:hover { transform: translateY(-2px); }
  .zk-pin:hover { opacity: 0.85; }
}


/* ============ ペイウォール ============ */
.pw-modal { text-align: center; }
.pw-head .pieces { justify-content: center; margin-bottom: 10px; }
.pw-head h3 { font-size: 20px; font-weight: 800; }
.pw-head p { font-size: 12.5px; color: var(--ink-soft); margin-bottom: 14px; }
.pw-table { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); padding: 6px 12px; margin-bottom: 14px; }
.pw-row { display: grid; grid-template-columns: 1.2fr 0.9fr 1.1fr; gap: 6px; padding: 9px 2px;
  border-bottom: 1px solid var(--line); font-size: 11.5px; align-items: center; text-align: center; }
.pw-row:last-child { border-bottom: none; }
.pw-row span:first-child { text-align: left; font-weight: 800; }
.pw-row span { color: var(--ink-soft); }
.pw-thead span { font-size: 10.5px; font-weight: 800; letter-spacing: 0.06em; }
.pw-pre { color: var(--felt) !important; font-weight: 800; }
.pw-buy { width: 100%; font-size: 15px; padding: 15px; }
.pw-links { display: flex; justify-content: center; gap: 24px; margin-top: 12px; }
.pw-links button { font-size: 12.5px; font-weight: 700; color: var(--ink-soft); text-decoration: underline; }
.pw-note { font-size: 10.5px; color: var(--ink-soft); margin-top: 12px; line-height: 1.7; }

/* ホームカードのロック表示 */
.game-card.locked .gc-art { opacity: 0.55; }
.gc-lock { position: absolute; top: 44px; left: 44px; width: 26px; height: 26px; background: var(--surface);
  border-radius: 50%; box-shadow: var(--shadow); display: flex; align-items: center; justify-content: center; color: var(--ink-soft); }
.gc-lock svg { width: 15px; height: 15px; }
.badge.bweek { background: #FFF3D0; color: #A8770D; }
.badge.bpre { background: #FFF3D0; color: #A8770D; }

/* モード選択のロックバナー */
.mm-lockbar { display: flex; align-items: center; gap: 8px; background: #FFF7E2; border: 1.5px solid var(--gold);
  border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; font-size: 12px; font-weight: 800; color: #7A5A12; }
.mm-lockbar svg { width: 18px; height: 18px; flex: 0 0 auto; }
.mm-trial { font-size: 11px; color: var(--ink-soft); font-weight: 700; margin-left: auto; white-space: nowrap; }
.mm-pw-cta { width: 100%; margin-top: 10px; background: var(--gold); color: #fff; box-shadow: 0 4px 14px rgba(232,168,37,0.4); }

/* ============ 広告モック ============ */
.ad-overlay { position: fixed; inset: 0; z-index: 90; background: rgba(15, 14, 12, 0.92);
  display: flex; align-items: center; justify-content: center; }
.ad-overlay.hidden { display: none; }
.ad-box { width: min(86vw, 340px); background: #1E1C19; border-radius: 18px; padding: 16px; text-align: center;
  border: 1px solid #3A362F; }
.ad-tag { display: inline-block; font-size: 10px; font-weight: 800; color: #8A857B; border: 1px solid #4A463E;
  border-radius: 4px; padding: 1px 8px; letter-spacing: 0.1em; margin-bottom: 10px; }
.ad-fake { aspect-ratio: 16 / 10; border-radius: 12px;
  background: repeating-linear-gradient(45deg, #2A2722 0, #2A2722 14px, #24211D 14px, #24211D 28px);
  display: flex; align-items: center; justify-content: center; color: #B8B2A6; font-size: 13px; font-weight: 700; line-height: 1.9; }
.ad-fake span { font-size: 10.5px; color: #7A756B; font-weight: 400; }
.ad-close { margin-top: 12px; width: 100%; padding: 12px; border-radius: 12px; background: #35322C; color: #EAE6DD;
  font-weight: 800; font-size: 13.5px; }
.ad-close:disabled { opacity: 0.5; }
.ad-gopre { margin-top: 8px; font-size: 11.5px; color: var(--gold); font-weight: 700; text-decoration: underline; }


/* ============ ランキング ============ */
.rk-user { display: flex; align-items: center; gap: 10px; background: var(--surface); border-radius: 12px;
  padding: 12px 14px; box-shadow: var(--shadow); margin-bottom: 12px; font-weight: 800; font-size: 14px; }
.rk-user .rk-me-total { margin-left: auto; font-size: 12px; color: var(--felt); font-variant-numeric: tabular-nums; }
.rk-user .rk-edit { font-size: 11.5px; color: var(--ink-soft); text-decoration: underline; font-weight: 700; }
.rk-games { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; }
.rk-gchip { flex: 0 0 auto; width: 46px; height: 46px; border-radius: 12px; padding: 4px; background: var(--surface);
  box-shadow: var(--shadow); border: 2.5px solid transparent; position: relative; }
.rk-gchip svg { width: 100%; height: 100%; display: block; border-radius: 8px; }
.rk-gchip.sel { border-color: var(--felt); transform: translateY(-2px); }
.rk-gchip .pts { position: absolute; top: -6px; right: -6px; background: var(--gold); color: #fff; font-size: 9px;
  font-weight: 800; border-radius: 99px; padding: 1px 5px; font-variant-numeric: tabular-nums; }
.rk-list { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.rk-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line);
  font-size: 13.5px; font-weight: 700; }
.rk-row:last-child { border-bottom: none; }
.rk-row .pos { width: 30px; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink-soft); }
.rk-row.top1 .pos { color: #C9930C; font-size: 16px; }
.rk-row.top2 .pos { color: #8C97A6; font-size: 15px; }
.rk-row.top3 .pos { color: #A5622D; font-size: 15px; }
.rk-row .nm { flex: 1; }
.rk-row .pt { font-variant-numeric: tabular-nums; color: var(--ink-soft); }
.rk-row.me { background: #EAF5EF; }
.rk-row.me .nm { color: var(--felt); }
.rk-row.me .pt { color: var(--felt); font-weight: 800; }
.rk-sep { text-align: center; color: var(--ink-soft); font-size: 12px; padding: 2px 0; }
.rk-note { text-align: center; font-size: 11px; color: var(--ink-soft); margin-top: 14px; line-height: 1.9; }
.rk-empty { padding: 22px; text-align: center; font-size: 12.5px; color: var(--ink-soft); font-weight: 700; line-height: 2; }

/* 人気タグ */
.badge.bhot { background: #FDE8C8; color: #B05E0B; }
.badge.brise { background: var(--p2-soft); color: var(--p2); }

/* 名前モーダル */
.name-modal { text-align: center; }
.name-modal h3 { font-size: 18px; font-weight: 800; }
.name-modal p { font-size: 12px; color: var(--ink-soft); margin: 4px 0 14px; }
.name-modal input { width: 100%; padding: 14px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface);
  font-size: 16px; font-weight: 800; text-align: center; font-family: inherit; outline: none; }
.name-modal input:focus { border-color: var(--felt); }
.nm-actions { display: flex; gap: 10px; margin-top: 14px; }
.nm-actions .ghost { flex: 0 0 auto; }

/* リザルトのポイント表示 */
.r-pts { display: inline-flex; align-items: center; gap: 5px; background: #FFF3D0; color: #A8770D;
  font-size: 12.5px; font-weight: 800; border-radius: 99px; padding: 4px 12px; margin-top: 8px; }


/* ============ デイリーチャレンジ / 再開バナー ============ */
.dl-banner { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 2px solid var(--gold);
  border-radius: 14px; padding: 12px 14px; margin-bottom: 12px; box-shadow: var(--shadow); cursor: pointer;
  transition: transform 0.12s; }
.dl-banner:active { transform: scale(0.98); }
.dl-banner .dl-ico { width: 44px; height: 44px; flex: 0 0 auto; }
.dl-banner .dl-ico svg { width: 100%; height: 100%; border-radius: 11px; }
.dl-banner .dl-txt { flex: 1; min-width: 0; }
.dl-banner .dl-eyebrow { font-size: 10.5px; font-weight: 800; color: #A8770D; letter-spacing: 0.08em; }
.dl-banner .dl-main { font-size: 13.5px; font-weight: 800; }
.dl-banner .dl-sub { font-size: 11px; color: var(--ink-soft); font-weight: 700; }
.dl-banner.done { border-color: var(--felt); }
.dl-banner.done .dl-eyebrow { color: var(--felt); }
.dl-streak { font-size: 12px; font-weight: 800; color: var(--felt); white-space: nowrap; font-variant-numeric: tabular-nums; }
.rs-banner { display: flex; align-items: center; gap: 10px; background: var(--p1-soft); border-radius: 12px;
  padding: 10px 14px; margin-bottom: 12px; font-size: 12.5px; font-weight: 800; color: var(--p1); }
.rs-banner button.go { margin-left: auto; background: var(--p1); color: #fff; border-radius: 99px; padding: 6px 14px; font-weight: 800; font-size: 12px; }
.rs-banner button.x { color: var(--ink-soft); font-size: 15px; padding: 2px 6px; }

/* ============ ルールガイド (モード選択内) ============ */
.mm-rules { background: var(--bg); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px;
  font-size: 12.5px; line-height: 1.9; color: var(--ink); }
.mm-rules .t { font-size: 11px; font-weight: 800; color: var(--felt); letter-spacing: 0.06em; margin-bottom: 4px; }
.mm-rules-btn { display: block; margin: 0 0 12px; font-size: 12px; font-weight: 700; color: var(--ink-soft); text-decoration: underline; }

/* ============ 大陸コンプ実績 ============ */
.zk-regions { display: flex; gap: 8px; flex-wrap: wrap; padding: 10px 2px 2px; }
.zk-region { display: flex; align-items: center; gap: 6px; background: var(--surface); border-radius: 99px;
  padding: 6px 12px; font-size: 11.5px; font-weight: 800; box-shadow: var(--shadow); color: var(--ink-soft);
  border: 1.5px solid transparent; }
.zk-region b { font-variant-numeric: tabular-nums; }
.zk-region.done { border-color: var(--gold); color: #A8770D; background: #FFF7E2; }

/* ============ シェア画像ボタン ============ */
.cm-share { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; background: var(--felt);
  color: #fff; border-radius: 99px; padding: 9px 18px; font-weight: 800; font-size: 12.5px;
  box-shadow: 0 4px 12px rgba(46,107,79,0.35); }

/* ============ 紙吹雪 ============ */
#confetti-canvas { position: fixed; inset: 0; z-index: 100; pointer-events: none; }

/* ============ 色覚サポート ============ */
body.cb [fill="#5B82DF"] { fill: #4A9BD8; }
body.cb [fill="#D8442E"], body.cb [fill="#E0503A"] { fill: #E69F00; }
body.cb .st.p2, body.cb .pc.p2 { background: radial-gradient(circle at 35% 30%, #F0B429, #B87E00) !important; }
body.cb .st.p1, body.cb .pc.p1 { background: radial-gradient(circle at 35% 30%, #4A9BD8, #005A8F) !important; }
body.cb { --p2: #C98500; --p2-soft: #FBEFD6; }

/* ============ ひだりきき ============ */
body.lefty .yt-dicezone, body.lefty .sv-handzone, body.lefty .dm-handzone, body.lefty .ld-ctrl { flex-direction: row-reverse; }

/* ============ ナイトモード ============ */
body.night {
  --bg: #14181F; --surface: #1E242E; --ink: #E9EBF0; --ink-soft: #9AA3B5; --line: #2C3442;
  --p1-soft: #212C44; --p2-soft: #38221E;
  --map-sea: #1B2836; --map-land: #3A4150; --map-coast: #55607A; --map-grid: rgba(160,180,210,0.08);
  --map-pin-dim: #454E5E;
  --shadow: 0 2px 10px rgba(0,0,0,0.35); --shadow-lift: 0 6px 24px rgba(0,0,0,0.5);
}
body.night .tabbar { background: rgba(24, 29, 38, 0.92); }
body.night .zk-card.unlocked { background: linear-gradient(160deg, #2A3040, #232936); border-color: #55607A; color: var(--ink); }
body.night .zk-card.rare.unlocked { background: linear-gradient(160deg, #3A3324, #2C2718); border-color: var(--gold); }
body.night .zk-card.locked { background: #1A1F28; color: #5A6374; }
body.night .yt-row.usable { background: #33301F; }
body.night .mm-lockbar { background: #33301F; color: #D9B44A; }
body.night .badge.bweek, body.night .badge.bhot { background: #33301F; color: #D9B44A; }
body.night .gc-cards { background: #14181F; }
body.night .dl-banner .dl-eyebrow { color: #D9B44A; }
body.night .r-card { background: linear-gradient(160deg, #2A3040, #232936); border-color: #55607A; color: var(--ink); }


/* ============ 大陸コンプ / シェア ============ */
.zk-regions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; padding: 2px 4px 10px; }
.zk-region { font-size: 11px; font-weight: 800; border-radius: 99px; padding: 3px 11px;
  background: var(--bg); color: var(--ink-soft); border: 1.5px solid var(--line); font-variant-numeric: tabular-nums; }
.zk-region.comp { background: #FFF3D0; color: #A8770D; border-color: var(--gold); }
body.night .zk-region { background: rgba(255,255,255,0.06); border-color: #3A4254; }
body.night .zk-region.comp { background: #3A3324; }
.cm-share { width: 100%; margin-top: 12px; font-size: 13.5px; padding: 12px; }

/* ============ 価格まわり (全解放 / 個別購入) ============ */
.pw-save { font-size: 12px; font-weight: 700; color: #A8770D; background: #FFF3D0;
  border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; line-height: 1.7; }
.pw-save:empty { display: none; }
.pw-save b { font-variant-numeric: tabular-nums; }
.mm-buy { display: flex; gap: 8px; margin-top: 10px; }
.mm-buy .btn { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 12.5px; padding: 12px 6px; line-height: 1.4; }
.mm-buy .btn .p { font-size: 15px; font-variant-numeric: tabular-nums; }
.mm-buy-one { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); border: 2px solid var(--line); }
.mm-buy .mm-pw-cta { background: var(--gold); color: #fff; box-shadow: 0 4px 14px rgba(232,168,37,0.4); margin-top: 0; }

/* ---- 今週の記録(自己ベスト表示) ---- */
.rk-rec { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow);
  padding: 14px 16px; margin-bottom: 10px; }
.rk-rec-row { display: flex; justify-content: space-between; align-items: baseline;
  padding: 5px 0; font-weight: 800; font-size: 14px; }
.rk-rec-row span { color: var(--ink-soft); font-size: 13px; }
.rk-rec-row b { font-size: 20px; font-variant-numeric: tabular-nums; }
.rk-rec-row.best b { color: var(--gold-deep, #A8762C); }
.rk-rec-msg { font-size: 12.5px; font-weight: 800; color: var(--felt); margin-top: 4px; }
.rk-bar { height: 7px; border-radius: 4px; background: var(--bg); margin-top: 10px; overflow: hidden; }
.rk-bar i { display: block; height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, var(--felt), var(--felt-deep)); transition: width 0.4s; }
.rk-soon { color: var(--ink-soft); font-size: 11.5px; }
