:root {
  --bg: #0d0e12;
  --panel: #16181e;
  --panel-2: #1d2028;
  --line: #2a2e39;
  --text: #ecebe6;
  --muted: #8e93a1;
  --signal: #c8f051;
  --fun: #ffb547;      /* 星・高評価 */
  --star-off: #3a3f4d; /* 星の未評価部分 */
  --bad: #ff6b7a;
  --radius: 14px;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  --sans: 'Zen Kaku Gothic New', 'Hiragino Sans', 'Yu Gothic UI', system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.7 var(--sans); -webkit-tap-highlight-color: transparent; }
body.locked { overflow: hidden; }
a { color: inherit; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
html[data-lang="ja"] [data-only="en"], html[data-lang="en"] [data-only="ja"] { display: none !important; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.wrap.narrow { max-width: 560px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.empty { padding: 60px 0; text-align: center; color: var(--muted); }

/* ---------- ヘッダー ---------- */
.site-head { position: sticky; top: 0; z-index: 20; background: rgba(13, 14, 18, .9); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); }
.site-head .wrap { display: flex; align-items: center; gap: 10px; height: 54px; }
.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; font-family: var(--mono); font-weight: 700; font-size: 14px; letter-spacing: .06em; white-space: nowrap; }
.logo-mark { width: 24px; height: 24px; border-radius: 6px; background: var(--signal); color: #111; display: grid; place-items: center; font-size: 12px; }
.nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.nav a { text-decoration: none; color: var(--muted); padding: 6px 10px; border-radius: 8px; font-size: 13px; white-space: nowrap; }
.nav a[aria-current] { color: var(--text); background: var(--panel-2); }
.nav-q { width: 32px; height: 32px; padding: 0 !important; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50% !important; font-weight: 700; }
.lang-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-left: 2px; }
.lang-switch button { background: var(--panel); border: 0; color: var(--muted); font-size: 11.5px; padding: 5px 8px; cursor: pointer; min-height: 32px; white-space: nowrap; }
.lang-switch button + button { border-left: 1px solid var(--line); }
.lang-switch button[aria-pressed="true"] { color: var(--text); background: var(--panel-2); box-shadow: inset 0 -2px 0 var(--signal); }
.banner { background: #2a2410; color: #f2dc9a; font-size: 12px; padding: 6px 16px; text-align: center; }

/* ---------- トップ: HERO ---------- */
.hero-banner { position: relative; background: #0b1222; }
.hero-media { position: relative; overflow: hidden; }
.hero-img { display: block; width: 100%; height: clamp(300px, 33vw, 520px); object-fit: cover; object-position: left center; }
/* 左の余白側を暗くして文字を読みやすく、下端は背景色へなじませる（画像の上だけにかける） */
.hero-media::after { content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, rgba(10, 14, 26, .7) 0%, rgba(10, 14, 26, .35) 30%, rgba(10, 14, 26, 0) 45%),
              linear-gradient(0deg, var(--bg) 0%, rgba(13, 14, 18, 0) 22%); }
/* PC: 画像左側の暗い余白に文字を重ねる（画面の左端を基準に、どの幅でも余白に収める） */
.hero-copy { position: absolute; top: 0; bottom: 0; left: clamp(16px, 5vw, 96px); z-index: 1; width: min(520px, 34vw); display: flex; flex-direction: column; justify-content: center; }
.hero-copy .headline { font-size: clamp(22px, 2.6vw, 38px); text-shadow: 0 2px 18px rgba(0, 0, 0, .55); }
.hero-copy .tagline { color: #c3c8d6; font-size: clamp(12.5px, 1.15vw, 16px); text-shadow: 0 1px 10px rgba(0, 0, 0, .6); }
@media (max-width: 760px) {
  /* スマホ: 画像は横長の帯にして、文字はその下に置く */
  .hero-img { height: 200px; object-position: 72% center; }
  .hero-media::after { background: linear-gradient(0deg, var(--bg) 0%, rgba(13, 14, 18, 0) 35%); }
  .hero-copy { position: relative; left: auto; width: auto; padding: 8px 16px 0; background: var(--bg); }
}

/* ---------- トップ ---------- */
.intro { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 18px 0 4px; }
.intro .seg { margin-left: auto; }
.total { margin: 0; font-size: 13px; color: var(--muted); white-space: nowrap; }
.total b { font-family: var(--mono); font-size: 22px; color: var(--text); margin: 0 3px; }
.rank-head { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; margin: 16px 0 12px; }
.rank-note { margin: 0; font-size: 12px; color: var(--muted); }
.seg.small button { min-height: 32px; padding: 4px 12px; font-size: 12.5px; }
.rank { position: absolute; top: 6px; left: 6px; min-width: 30px; height: 30px; padding: 0 6px; border-radius: 999px; display: grid; place-items: center; font-family: var(--mono); font-weight: 700; font-size: 14px; background: rgba(13, 14, 18, .82); color: var(--text); border: 1px solid var(--line); }
.rank.r1 { background: #ffd34d; color: #111; border-color: #ffd34d; }
.rank.r2 { background: #d6dbe4; color: #111; border-color: #d6dbe4; }
.rank.r3 { background: #e0a26b; color: #111; border-color: #e0a26b; }
.headline { margin: 0; font-size: clamp(21px, 5.2vw, 30px); line-height: 1.35; font-weight: 900; letter-spacing: .01em; }
.tagline { margin: 6px 0 0; font-size: 14px; color: var(--muted); }
/* 見出しは辞書の改行で区切る。説明文は画面幅いっぱいまで使って折り返す（右側に余白を作らない） */
.headline, .tagline { white-space: pre-line; }
.headline { word-break: auto-phrase; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { background: var(--panel); border: 0; padding: 6px 14px; cursor: pointer; font-size: 13px; color: var(--muted); min-height: 36px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--panel-2); color: var(--text); box-shadow: inset 0 -2px 0 var(--signal); }
.day { margin: 18px 0 26px; }
.day-head { display: flex; align-items: baseline; gap: 10px; font-size: 14px; font-family: var(--mono); font-weight: 700; margin: 0 0 10px; }
.day-head small { font-family: var(--sans); font-weight: 400; color: var(--muted); font-size: 12px; }
.ggrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.gcard { display: flex; flex-direction: column; border-radius: var(--radius); overflow: hidden; background: var(--panel); border: 1px solid var(--line); }
.gthumb { display: block; position: relative; aspect-ratio: 9 / 16; background: #0a0b0e; }
.gthumb:focus-visible, .gcard h3 a:focus-visible { outline: 2px solid var(--signal); outline-offset: -2px; }
.gcard h3 a { text-decoration: none; }
.gactions { display: grid; grid-template-columns: 1fr auto; gap: 6px; margin-top: 10px; }
.gbtn { display: flex; align-items: center; justify-content: center; gap: 5px; min-height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); text-decoration: none; font-size: 13.5px; font-weight: 700; white-space: nowrap; }
.gbtn.play { background: var(--signal); border-color: var(--signal); color: #111; }
.gbtn:active { transform: scale(.97); }
.gbtn:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
.gthumb img { width: 100%; height: 100%; object-fit: cover; }
.gbody { padding: 9px 10px 10px; display: flex; flex-direction: column; flex: 1; }
.gbody .gactions { margin-top: auto; padding-top: 10px; }
.gbody h3 { margin: 0; font-size: 14.5px; line-height: 1.35; }
.gmeta { margin: 2px 0 0; font-size: 11.5px; color: var(--muted); }
.gscore { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.gtime { margin: 4px 0 0; font-size: 12.5px; font-weight: 700; color: var(--signal); }

/* カレンダー */
.month-nav { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 14px 0; }
.month-nav h2 { font-size: 17px; margin: 0; min-width: 8em; text-align: center; font-family: var(--mono); }
.icon-btn { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; font-size: 20px; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cal-head { background: var(--panel); text-align: center; font-size: 11px; color: var(--muted); padding: 4px 0; }
.cal-day { background: var(--panel); min-height: 74px; position: relative; padding: 20px 3px 3px; display: block; width: 100%; border: 0; text-align: left; color: inherit; font: inherit; }
.cal-day.out { background: #111318; }
.cal-day.has { cursor: pointer; }
.cal-day.has:hover { background: var(--panel-2); }
.cal-day.sel { box-shadow: inset 0 0 0 2px var(--signal); background: var(--panel-2); }
.cal-day:focus-visible { outline: 2px solid var(--signal); outline-offset: -2px; }
.cal-num { position: absolute; left: 4px; top: 2px; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.cal-day.today .cal-num { color: #111; background: var(--signal); border-radius: 8px; padding: 0 5px; }
.cal-count { position: absolute; right: 4px; top: 2px; font-family: var(--mono); font-size: 10.5px; color: #111; background: var(--fun); border-radius: 8px; padding: 0 5px; line-height: 16px; }
.cal-thumbs { display: flex; gap: 2px; height: 48px; pointer-events: none; }
.cal-thumbs img, .cal-thumbs i { flex: 1 1 0; min-width: 0; height: 100%; object-fit: cover; border-radius: 3px; background: #0a0b0e; }
.cal-list { margin: 18px 0 8px; scroll-margin-top: 64px; }
@media (min-width: 700px) { .cal-day { min-height: 120px; } .cal-thumbs { height: 92px; } }

/* ---------- ゲームページ ---------- */
.back { display: inline-block; margin: 14px 0 4px; font-size: 13px; color: var(--muted); text-decoration: none; }
.gtitle { font-size: 26px; line-height: 1.3; margin: 0; font-weight: 900; }
.page-title { font-size: 24px; margin: 20px 0 12px; font-weight: 900; }
.hero { display: block; position: relative; width: 100%; max-width: min(300px, 72vw); margin: 16px auto 10px; padding: 0; border: 0; border-radius: 18px; overflow: hidden; cursor: pointer; background: #000; aspect-ratio: 9 / 16; }
.hero img { width: 100%; height: 100%; object-fit: cover; opacity: .85; }
.hero-play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: var(--signal); color: #111; font-weight: 900; font-size: 20px; padding: 14px 30px; border-radius: 999px; white-space: nowrap; box-shadow: 0 8px 30px rgba(0, 0, 0, .5); }
.hero:active .hero-play { transform: translate(-50%, -50%) scale(.96); }
.howto { text-align: center; margin: 4px 0 0; font-size: 14px; }
.pc-note { text-align: center; margin: 2px 0 0; font-size: 12px; color: var(--muted); }
@media (pointer: coarse) { .pc-note { display: none; } }

.rate-box, .result { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 16px; margin: 22px 0; }
.sheet-q { text-align: center; font-weight: 700; margin: 0 0 12px; font-size: 16px; }
/* 星の入力: DOM は ★5→★1 の順。row-reverse で ★1 を左に置き、押した星（とそれより左）を光らせる */
.stars-input { display: flex; flex-direction: row-reverse; justify-content: center; gap: 2px; }
.sbtn { background: none; border: 0; padding: 2px 6px; font-size: 40px; line-height: 1; color: var(--star-off); cursor: pointer; min-width: 52px; min-height: 52px; transition: color .1s, transform .1s; }
.sbtn:hover, .sbtn:hover ~ .sbtn, .sbtn:focus-visible, .sbtn:focus-visible ~ .sbtn { color: var(--fun); }
.sbtn:active { transform: scale(.9); }
.sbtn:focus-visible { outline: 2px solid var(--signal); outline-offset: -2px; border-radius: 8px; }
.stars-ends { display: flex; justify-content: space-between; max-width: 290px; margin: 2px auto 0; font-size: 11.5px; color: var(--muted); }
.sheet-foot { display: flex; justify-content: center; gap: 22px; margin-top: 12px; }
.linkish { background: none; border: 0; color: var(--muted); font-size: 12.5px; text-decoration: underline; cursor: pointer; padding: 6px; }
.result h2 { font-size: 14px; margin: 14px 0 8px; color: var(--muted); font-weight: 700; }
.result h2:first-of-type { margin-top: 0; }
.result-thanks { text-align: center; font-weight: 700; color: var(--signal); margin: 0 0 6px; }
.result-thanks:empty { display: none; }
/* 星の表示（--v の割合まで塗る） */
.stars { display: inline-block; letter-spacing: 1px; font-size: 13px; line-height: 1; background: linear-gradient(90deg, var(--fun) var(--v), var(--star-off) var(--v)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stars.big { font-size: 20px; }
.starline { display: inline-flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.starline b { color: var(--fun); font-family: var(--mono); font-size: 13px; }
.starline .muted { font-size: 11.5px; }
.starsum { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; }
.starsum-avg { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 92px; }
.starsum-avg > b { font-family: var(--mono); font-size: 34px; line-height: 1; color: var(--fun); }
.starsum-avg .muted { font-size: 12px; }
.starsum-dist { display: grid; gap: 4px; font-size: 12px; }
.srow { display: grid; grid-template-columns: 26px 1fr 26px; align-items: center; gap: 6px; }
.srow > span:last-child { text-align: right; color: var(--muted); font-family: var(--mono); }
.srow i { height: 8px; border-radius: 4px; background: var(--panel-2); overflow: hidden; }
.srow i b { display: block; height: 100%; background: var(--fun); border-radius: 4px; }
.yours { font-size: 13px; margin: 10px 0 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.yours b { color: var(--fun); }
.ai-verdict { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.ai-verdict > b { color: var(--fun); font-family: var(--mono); font-size: 16px; }
.ai-comment { font-size: 14px; margin: 8px 0 4px; }

.more { margin: 10px 0 40px; border-top: 1px solid var(--line); }
.more summary { cursor: pointer; padding: 14px 0; font-weight: 700; color: var(--muted); list-style: none; }
.more summary::-webkit-details-marker { display: none; }
.more summary::after { content: ' ▾'; }
.more[open] summary::after { content: ' ▴'; }
.more h3 { font-size: 13px; color: var(--muted); margin: 18px 0 6px; }
.more p { margin: 0 0 8px; font-size: 14px; }
.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border-radius: 10px; overflow: hidden; margin: 0 0 6px; }
.metrics div { background: var(--panel); padding: 8px 10px; }
.metrics dt { font-size: 11px; color: var(--muted); }
.metrics dd { margin: 0; font-family: var(--mono); font-size: 14px; }
.metrics dd small { display: block; font-size: 10.5px; color: var(--muted); }
.similar { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; font-size: 13.5px; }
.similar li { background: var(--panel); border-radius: 10px; padding: 8px 12px; }
.libs { list-style: none; padding: 0; margin: 0 0 8px; display: flex; flex-wrap: wrap; gap: 6px; font-size: 13.5px; }
.libs li { background: var(--panel); border-radius: 999px; padding: 4px 12px; }
.plan { margin: 4px 0 8px; padding-left: 1.4em; font-size: 13.5px; display: grid; gap: 6px; color: var(--muted); }
.plan li.chosen { color: var(--text); }
.plan .tag { font-size: 11px; border: 1px solid var(--line); border-radius: 999px; padding: 0 7px; color: var(--muted); }
.plan .tag.on { border-color: var(--signal); color: var(--signal); }
.sim { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px; }
.playlog { display: grid; grid-auto-flow: column; grid-auto-columns: 130px; gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.playlog figure { margin: 0; }
.playlog img { border-radius: 8px; aspect-ratio: 9 / 16; object-fit: cover; background: #000; width: 100%; height: auto; }
.playlog figcaption { font-size: 11.5px; color: var(--muted); margin-top: 4px; line-height: 1.45; }

/* ---------- 全画面プレイヤー ---------- */
/* スマホ: 上に細いバー（もどる）を置き、ゲームはその下の領域いっぱい。ゲームの表示と重ならない */
.player { position: fixed; inset: 0; z-index: 100; background: #000; display: flex; flex-direction: column; }
/* プレイ中は、ページの拡大（2本指のピンチ・ダブルタップ）や長押しの文字選択・メニューが、ゲームの操作を横取りしないようにする */
.player, .player * { touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
body.locked { overscroll-behavior: none; }
.player-top { flex: 0 0 auto; height: calc(40px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 8px 0; display: flex; align-items: center; background: #05060a; border-bottom: 1px solid #1c1f28; }
.phone { flex: 1 1 auto; min-height: 0; }
.phone iframe { width: 100%; height: 100%; border: 0; display: block; background: #000; }
.player-close { background: transparent; border: 0; color: #cfd3df; border-radius: 999px; padding: 4px 10px; font-size: 13px; cursor: pointer; min-height: 32px; }
.player-close:active { background: #1d2028; }
.save-reset-wrap { text-align: center; margin: 0; }
.save-reset-wrap:has(> [hidden]) { display: none; }
/* PC: スマホ型の枠で表示し、もどるは枠の外の左上 */
@media (pointer: fine) and (min-width: 700px) {
  .player { display: grid; place-items: center; background: radial-gradient(circle at 50% 30%, #1d2028, #050506); }
  .player-top { position: fixed; left: 16px; top: 16px; height: auto; padding: 0; background: none; border: 0; }
  .player-close { border: 1px solid rgba(255, 255, 255, .25); background: rgba(0, 0, 0, .4); padding: 6px 14px; }
  .phone { flex: none; width: min(420px, calc((100vh - 40px) * 9 / 16)); height: min(calc(100vh - 40px), 747px); border-radius: 28px; overflow: hidden; box-shadow: 0 0 0 10px #1a1c22, 0 20px 80px rgba(0, 0, 0, .7); }
}

/* ---------- 評価シート ---------- */
.sheet { position: fixed; inset: 0; z-index: 120; background: rgba(0, 0, 0, .55); display: flex; align-items: flex-end; justify-content: center; }
.sheet-panel { width: 100%; max-width: 520px; background: var(--panel); border-radius: 18px 18px 0 0; padding: 22px 16px calc(16px + env(safe-area-inset-bottom)); animation: up .2s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }

/* ---------- 観測データ ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0 0 16px; }
.panel h2 { font-size: 14px; margin: 0 0 10px; }
.chart { width: 100%; height: auto; max-height: 300px; display: block; }
.chart text { fill: var(--muted); font: 11px var(--mono); }
.chart .grid { stroke: #23262f; }
.chart .dot { fill: var(--fun); fill-opacity: .85; }
.table-wrap { overflow-x: auto; }
.data { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 760px; }
.data th, .data td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.data th:first-child, .data td:first-child { text-align: left; }
.data th { font-size: 11.5px; color: var(--muted); font-weight: 400; }
.data td { font-family: var(--mono); }
.data td:first-child { font-family: var(--sans); }
.c-fun { color: var(--fun); }

/* ---------- 説明ページ ---------- */
.prose .lead { font-size: 17px; font-weight: 700; }
.prose h2 { font-size: 16px; margin: 26px 0 6px; }
.prose ul { padding-left: 20px; }

footer { border-top: 1px solid var(--line); padding: 18px 0 calc(28px + env(safe-area-inset-bottom)); color: var(--muted); font-size: 12px; margin-top: 30px; }
footer a { color: var(--muted); }
@media (max-width: 420px) { .logo span:last-child { font-size: 12.5px; } .nav a:not(.nav-q) { padding: 6px 6px; font-size: 12px; } }
