/* 配色はバックヤード（thetoyou-by）と同じ。PC は左の紺色サイドバー、スマホは下のタブ */
:root {
  --bg: #f1f4f8;
  --surface: #ffffff;
  --surface-2: #f5f7fa;
  --ink: #141b22;
  --muted: #4c5866;
  --line: #dbe2ea;
  --navy: #101b2e;
  --brand: #1a63d6;
  --brand-soft: #e6effd;
  --green: #137333;
  --green-soft: #e3f3e8;
  --amber: #8f5a00;
  --amber-soft: #fcf0d4;
  --gray-soft: #eaeef3;
  --red: #b3261e;
  --red-soft: #fbe5e3;
  --side: #101b2e; --side-ink: #e8eef8; --side-sub: #9fb0c8; --side-line: rgba(255,255,255,.10);
  --side-hover: rgba(255,255,255,.07); --side-active: rgba(138,180,248,.20); --side-active-ink: #d6e5ff;
  --dot: rgba(16,24,40,.06); --glow1: rgba(26,115,232,.11); --glow2: rgba(235,104,52,.08);
  --hero: linear-gradient(118deg,#0f1b2e 0%,#163566 55%,#1558d6 100%);
  --g1: linear-gradient(135deg,#5b9bff,#1558d6);
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 10px 28px -18px rgba(16,24,40,.30);
  --shadow-lift: 0 2px 4px rgba(16,24,40,.06), 0 18px 38px -20px rgba(16,24,40,.34);
  --radius: 16px;
  --tabbar: 64px;
  --sidew: 236px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1216; --surface: #181d23; --surface-2: #1f252c; --ink: #eef2f5; --muted: #a9b4bf;
    --line: #2c353e; --navy: #0a111c; --brand: #8ab4f8; --brand-soft: #1e2c44;
    --green: #74c997; --green-soft: #15301f; --amber: #e0b961; --amber-soft: #2e2611;
    --gray-soft: #252c34; --red: #f28b82; --red-soft: #3a2422;
    --side: #0a111c; --side-line: rgba(255,255,255,.08); --side-hover: rgba(255,255,255,.05); --side-active: rgba(138,180,248,.16);
    --dot: rgba(255,255,255,.045); --glow1: rgba(57,135,229,.15); --glow2: rgba(217,89,38,.10);
    --hero: linear-gradient(118deg,#0a111c 0%,#122a52 55%,#1a4fb8 100%);
    --g1: linear-gradient(135deg,#3d7fe0,#123f96);
    --shadow: 0 1px 2px rgba(0,0,0,.40), 0 12px 30px -18px rgba(0,0,0,.75);
    --shadow-lift: 0 2px 6px rgba(0,0,0,.45), 0 20px 44px -22px rgba(0,0,0,.85);
  }
}
:root[data-theme="dark"] {
  --bg: #0f1216; --surface: #181d23; --surface-2: #1f252c; --ink: #eef2f5; --muted: #a9b4bf;
  --line: #2c353e; --navy: #0a111c; --brand: #8ab4f8; --brand-soft: #1e2c44;
  --green: #74c997; --green-soft: #15301f; --amber: #e0b961; --amber-soft: #2e2611;
  --gray-soft: #252c34; --red: #f28b82; --red-soft: #3a2422;
  --side: #0a111c; --side-line: rgba(255,255,255,.08); --side-hover: rgba(255,255,255,.05); --side-active: rgba(138,180,248,.16);
  --dot: rgba(255,255,255,.045); --glow1: rgba(57,135,229,.15); --glow2: rgba(217,89,38,.10);
  --hero: linear-gradient(118deg,#0a111c 0%,#122a52 55%,#1a4fb8 100%);
  --g1: linear-gradient(135deg,#3d7fe0,#123f96);
  --shadow: 0 1px 2px rgba(0,0,0,.40), 0 12px 30px -18px rgba(0,0,0,.75);
  --shadow-lift: 0 2px 6px rgba(0,0,0,.45), 0 20px 44px -22px rgba(0,0,0,.85);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--ink); background-color: var(--bg);
  background-image: radial-gradient(1000px 520px at 10% -8%, var(--glow1), transparent 62%),
    radial-gradient(820px 480px at 100% -6%, var(--glow2), transparent 60%),
    radial-gradient(var(--dot) 1px, transparent 1.3px);
  background-size: auto, auto, 22px 22px; background-attachment: fixed, fixed, fixed;
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", -apple-system, sans-serif;
  font-size: 16px; line-height: 1.75; letter-spacing: .01em; font-feature-settings: "palt";
  touch-action: manipulation;
}
a { color: inherit; }
.num { font-family: Manrope, "Hiragino Sans", sans-serif; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- 上のバー（スマホ） ---------- */
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--side); color: #fff;
}
.brand, .side-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand-mark {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; flex: none;
  background: var(--g1); color: #fff; font-family: Manrope, sans-serif; font-weight: 800; font-size: 17px;
  box-shadow: 0 6px 16px -8px rgba(21,88,214,.9);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text b { font-family: Manrope, "Hiragino Sans", sans-serif; font-size: 15px; font-weight: 800; letter-spacing: .14em; }
.brand-text small { font-size: 10.5px; letter-spacing: .08em; color: var(--side-sub); }

/* ---------- メニュー（スマホは下のタブ） ---------- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  height: calc(var(--tabbar) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -6px 20px -16px rgba(16,24,40,.4);
}
.tabs .side-brand, .tabs .g { display: none; }
.tabs a {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: -.02em; white-space: nowrap; min-width: 0;
}
.tabs svg { width: 23px; height: 23px; flex: none; }
.tabs a.on { color: var(--brand); }
.tabs a.on::before { content: ""; position: absolute; top: 0; left: 22%; right: 22%; height: 3px; border-radius: 0 0 3px 3px; background: var(--brand); }

.main { max-width: 860px; margin: 0 auto; padding: 18px 16px calc(var(--tabbar) + 32px + env(safe-area-inset-bottom)); }
.loading { color: var(--muted); }

/* ゲーム中のスマホは下のタブを隠して画面を広く使う */
@media (max-width: 899px) {
  body.playing .tabs { display: none; }
  body.playing .main { padding: 10px 12px calc(16px + env(safe-area-inset-bottom)); }
}

/* ---------- PC：左の紺色サイドバー ---------- */
@media (min-width: 900px) {
  .top { display: none; }
  .tabs {
    top: 0; bottom: 0; right: auto; width: var(--sidew); height: auto; display: flex; flex-direction: column; gap: 2px;
    padding: 20px 14px 18px; border-top: 0; background: var(--side); color: var(--side-ink); box-shadow: none; overflow-y: auto;
  }
  .tabs .side-brand { display: flex; padding: 0 6px 14px; margin-bottom: 6px; border-bottom: 1px solid var(--side-line); }
  .tabs .side-brand .brand-text b { font-size: 16px; }
  .tabs .side-brand .brand-text small { letter-spacing: .04em; font-size: 11px; }
  .tabs .g { display: block; font-size: 11px; letter-spacing: .18em; color: var(--side-sub); font-weight: 700; margin: 14px 0 4px 10px; }
  .tabs a {
    flex-direction: row; justify-content: flex-start; gap: 11px; padding: 10px 12px; border-radius: 10px;
    font-size: 15px; font-weight: 600; letter-spacing: .02em; color: var(--side-ink);
  }
  .tabs svg { width: 20px; height: 20px; }
  .tabs a:hover { background: var(--side-hover); }
  .tabs a.on { background: var(--side-active); color: var(--side-active-ink); }
  .tabs a.on::before { display: none; }
  .tabs .lb { flex: 1; }
  .main { margin-left: var(--sidew); max-width: none; padding: 30px 44px 60px; }
  .main > * { max-width: 1100px; }
}

/* ---------- 共通 ---------- */
h1.page { font-size: 22px; margin: 4px 0 2px; letter-spacing: .02em; line-height: 1.4; }
h2.sec { font-size: 15px; margin: 26px 0 10px; letter-spacing: .04em; color: var(--muted); }
.sub { color: var(--muted); font-size: 13px; margin: 0 0 16px; }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); }
.pill { display: inline-block; padding: 1px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--brand-soft); color: var(--brand); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 13.5px; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--brand); }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
:root:not([data-theme="light"]) .btn.primary { color: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.primary { color: #0a111c; } }
.btn svg { width: 16px; height: 16px; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; font-size: 14px; }
.back:hover { color: var(--brand); }
.empty { color: var(--muted); font-size: 14px; padding: 20px; text-align: center; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 6px 14px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface);
  font: inherit; font-size: 13px; cursor: pointer; color: var(--ink);
}
.chip.on { background: var(--navy); color: #fff; border-color: var(--navy); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chip.on { background: var(--brand); color: #0a111c; border-color: var(--brand); } }

/* ---------- ホーム ---------- */
.hero {
  position: relative; overflow: hidden; padding: 26px 24px; border-radius: 20px; background: var(--hero); color: #fff;
  box-shadow: var(--shadow-lift);
}
.hero h1 { margin: 6px 0 4px; font-size: 25px; letter-spacing: .04em; line-height: 1.35; }
.hero p { margin: 0; color: #c9d8f0; font-size: 14px; }
.hero .eyebrow { font-family: Manrope, sans-serif; font-weight: 800; font-size: 11px; letter-spacing: .3em; color: #9fc0ff; }
.hero-deco { position: absolute; right: -10px; bottom: -14px; width: 190px; opacity: .9; pointer-events: none; }
@media (max-width: 560px) { .hero-deco { width: 120px; opacity: .45; } .hero h1 { font-size: 21px; } }

.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0 0; }
.summary .card { padding: 12px 14px; }
.summary b { display: block; font-family: Manrope, "Hiragino Sans", sans-serif; font-size: 22px; line-height: 1.25; }
.summary span { font-size: 11.5px; color: var(--muted); }

.games { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.game-card { display: flex; flex-direction: column; text-decoration: none; overflow: hidden; transition: transform .15s, box-shadow .15s; }
.game-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.game-thumb { aspect-ratio: 16 / 9; background: #0d1626; display: grid; place-items: center; }
.game-thumb svg { width: 100%; height: 100%; display: block; }
.game-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.game-name { font-weight: 800; font-size: 17px; line-height: 1.35; }
.game-desc { color: var(--muted); font-size: 13px; line-height: 1.6; }
.game-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--muted); margin-top: auto; padding-top: 6px; }
.game-meta b { color: var(--ink); font-family: Manrope, "Hiragino Sans", sans-serif; }
.game-card.soon { border-style: dashed; box-shadow: none; background: transparent; justify-content: center; align-items: center; text-align: center; padding: 26px 16px; color: var(--muted); min-height: 200px; }
.game-card.soon:hover { transform: none; }
.game-card.soon .plus { width: 44px; height: 44px; border-radius: 12px; border: 2px dashed var(--line); display: grid; place-items: center; font-size: 22px; margin-bottom: 8px; }

/* ---------- 記録 ---------- */
.rec-game { padding: 16px; margin-bottom: 14px; }
.rec-game h3 { margin: 0 0 10px; font-size: 16px; }
.rec-modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.rec-mode { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; }
.rec-mode h4 { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
.rec-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.rec-table td { padding: 4px 2px; border-top: 1px solid var(--line); }
.rec-table tr:first-child td { border-top: 0; }
.rec-table .rk { width: 26px; color: var(--muted); font-family: Manrope, sans-serif; font-weight: 800; }
.rec-table tr:first-child .rk { color: #d49a00; }
.rec-table .v { font-family: Manrope, "Hiragino Sans", sans-serif; font-weight: 800; }
.rec-table .d { text-align: right; color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.rec-actions { margin-top: 18px; }
