/* ============================================================
   LUMINA Engine 体験版（ブラウザ版）のページ
   入口はサイトと同じ明るい紙色＋金、遊ぶ画面は暗い舞台。
   ============================================================ */
:root {
  --bg: #f6f3ee;
  --bg2: #ffffff;
  --bg3: #efeae2;
  --line: #e6e0d6;
  --text: #3f4656;
  --text-br: #1b2230;
  --dim: #6d7586;
  --gold: #c3922a;
  --gold-dk: #8f6714;
  --gold-soft: rgba(195, 146, 42, .12);
  --ok: #2f7d4f;
  --ng: #b3402e;
  --warn: #a86a12;
  --stage: #07080c;
  --stage-text: #e9e6df;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(40, 30, 10, .10);
  --sans: 'Noto Sans JP', system-ui, -apple-system, 'Segoe UI', 'Hiragino Sans', 'Yu Gothic UI', Meiryo, sans-serif;
  --brand: 'Space Grotesk', 'Segoe UI', system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121419;
    --bg2: #1a1d24;
    --bg3: #20242c;
    --line: #2c313b;
    --text: #c7ccd6;
    --text-br: #f1f2f5;
    --dim: #9198a6;
    --gold: #e0b354;
    --gold-dk: #f0cf86;
    --gold-soft: rgba(224, 179, 84, .14);
    --ok: #5cc48a;
    --ng: #f08a78;
    --warn: #f0b860;
    --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }
/* display を指定した部品でも hidden 属性で確実に隠す */
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.8;
  -webkit-text-size-adjust: 100%;
  /* 日本語を文節の切れ目で折り返す（対応していないブラウザでは通常の折り返し） */
  word-break: auto-phrase;
}
a { color: var(--gold-dk); }
button { font: inherit; }
img { max-width: 100%; display: block; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--bg2); padding: 6px 12px; border-radius: 8px; z-index: 10; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ---------- ブランド ---------- */
.mark { width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0; }
.mark-lg { width: 64px; height: 64px; border-radius: 15px; }

.bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 1120px; margin: 0 auto; padding: 18px 24px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text-br); }
.brand-word { font-family: var(--brand); font-weight: 700; font-size: 1.15rem; letter-spacing: .04em; line-height: 1.1; display: flex; flex-direction: column; }
.brand-sub { font-size: .62rem; letter-spacing: .32em; color: var(--dim); font-weight: 500; }
.bar-link { font-size: .9rem; color: var(--dim); text-decoration: none; border: 1px solid var(--line); padding: 6px 14px; border-radius: 999px; background: var(--bg2); }
.bar-link:hover { color: var(--text-br); border-color: var(--gold); }

/* ---------- 入口 ---------- */
main { max-width: 1120px; margin: 0 auto; padding: 0 24px 40px; }
.hero { display: grid; grid-template-columns: 1fr 1.15fr; gap: 40px; align-items: center; padding: 28px 0 44px; }
.eyebrow { font-family: var(--brand); font-weight: 700; letter-spacing: .28em; font-size: .78rem; color: var(--gold); margin: 0 0 10px; }
h1 { font-family: var(--brand); color: var(--text-br); font-size: clamp(2.1rem, 4.6vw, 3.2rem); line-height: 1.12; margin: 0 0 18px; letter-spacing: -.01em; }
.h1-sub { display: block; font-family: var(--sans); font-size: .5em; font-weight: 700; letter-spacing: .08em; color: var(--text); margin-top: 8px; }
.lead { font-size: 1.05rem; color: var(--text); margin: 0 0 14px; }
.note { font-size: .88rem; color: var(--dim); margin: 0; padding-left: 12px; border-left: 3px solid var(--line); }

.start-card { background: var(--bg2); border: 1px solid var(--line); border-radius: calc(var(--radius) + 4px); box-shadow: var(--shadow); padding: 14px; }
.poster { position: relative; border-radius: var(--radius); overflow: hidden; background: var(--stage); aspect-ratio: 16 / 9; }
.poster img { width: 100%; height: 100%; object-fit: cover; opacity: .72; transition: opacity .3s, transform .6s; }
.poster::after { content: ''; position: absolute; inset: 0; background: radial-gradient(70% 70% at 50% 55%, rgba(7, 8, 12, .05), rgba(7, 8, 12, .55)); pointer-events: none; }
.start-btn {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 1;
  display: inline-flex; align-items: center; gap: 12px;
  padding: 14px 28px 14px 16px; border-radius: 999px; border: 1px solid #e9c46d; cursor: pointer;
  background: linear-gradient(135deg, #fbe7b4 0%, #e9c46d 55%, #d9a93f 100%);
  color: #2a1d05; font-weight: 700; font-size: 1.08rem; letter-spacing: .04em; white-space: nowrap;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .55) inset, 0 12px 30px rgba(0, 0, 0, .35);
  transition: transform .15s, box-shadow .15s, filter .15s;
}
.start-btn:hover { transform: translate(-50%, -52%); filter: saturate(1.08); box-shadow: 0 1px 0 rgba(255, 255, 255, .55) inset, 0 18px 38px rgba(0, 0, 0, .42); }
.poster:hover img { opacity: .82; transform: scale(1.02); }
.start-icon { width: 38px; height: 38px; border-radius: 50%; background: #2a1d05; display: grid; place-items: center; }
.start-icon svg { width: 18px; height: 18px; fill: #f3d58f; margin-left: 2px; }
.start-btn[disabled] { filter: grayscale(.7); opacity: .75; cursor: not-allowed; }
/* 音が出ます（ボタンのすぐ下・絵の上） */
.sound-icon { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sound-badge {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 1; margin: 0;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; pointer-events: none;
  padding: 3px 13px 3px 10px; border-radius: 999px;
  background: rgba(10, 11, 16, .74); border: 1px solid rgba(243, 213, 143, .38); color: #f6e7c2;
  font-size: .82rem; font-weight: 500; letter-spacing: .06em; line-height: 1.7;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}

.facts { margin: 14px 4px 2px; display: grid; gap: 6px; }
.facts div { display: grid; grid-template-columns: 4.5em 1fr; gap: 10px; font-size: .9rem; }
.facts dt { color: var(--dim); }
.facts dd { margin: 0; color: var(--text); }
.mobile-hint { margin: 10px 4px 2px; font-size: .86rem; color: var(--warn); background: var(--gold-soft); padding: 8px 12px; border-radius: 10px; }

.block { border-top: 1px solid var(--line); padding: 30px 0; }
.block h2 { font-size: 1.15rem; color: var(--text-br); margin: 0 0 14px; }
.block p { margin: 0; }

.checks { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.checks li { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 10px; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.ck-icon { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: .82rem; font-weight: 700; color: #fff; background: var(--line); }
.checks li[data-result="ok"] .ck-icon { background: var(--ok); }
.checks li[data-result="ok"] .ck-icon::before { content: '✓'; }
.checks li[data-result="ng"] .ck-icon { background: var(--ng); }
.checks li[data-result="ng"] .ck-icon::before { content: '✕'; }
.checks li[data-result="warn"] .ck-icon { background: var(--warn); }
.checks li[data-result="warn"] .ck-icon::before { content: '!'; }
.ck-name { color: var(--text-br); font-weight: 500; }
.ck-state { color: var(--dim); font-size: .9rem; text-align: right; }
.checks li[data-result="ng"] .ck-state { color: var(--ng); }
.checks-note { font-size: .88rem; color: var(--dim); }

.how { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.how-item { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.how-item h3 { margin: 0 0 4px; font-size: .95rem; color: var(--text-br); }
.how-item p { font-size: .88rem; color: var(--dim); }
.how-note { margin-top: 12px !important; font-size: .88rem; color: var(--dim); }

.foot { max-width: 1120px; margin: 0 auto; padding: 22px 24px 40px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; }
.foot-link { background: none; border: 0; padding: 0; color: var(--dim); font-size: .88rem; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.foot-link:hover { color: var(--text-br); }
.copy { margin: 0 0 0 auto; font-size: .82rem; color: var(--dim); }

/* ---------- 遊ぶ画面 ---------- */
.stage { position: fixed; inset: 0; z-index: 50; background: var(--stage); color: var(--stage-text); display: none; }
body[data-state="loading"] .stage,
body[data-state="playing"] .stage,
body[data-state="notice"] .stage { display: block; }
body[data-state="loading"],
body[data-state="playing"],
body[data-state="notice"] { overflow: hidden; }
.stage-game { position: absolute; inset: 0; }
.stage-game iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.stage-game .preview-shot { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: #000; }
.stage-game .preview-shot img { max-width: 100%; max-height: 100%; aspect-ratio: 16 / 9; object-fit: contain; }

.loader {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(60% 50% at 50% 45%, rgba(195, 146, 42, .16), transparent 70%), var(--stage);
  transition: opacity .5s;
}
body[data-state="playing"] .loader,
body[data-state="notice"] .loader { opacity: 0; pointer-events: none; }
.loader-box { width: min(440px, 100%); text-align: center; display: flex; flex-direction: column; align-items: center; }
.loader-box .mark-lg { animation: breathe 2.4s ease-in-out infinite; box-shadow: 0 0 40px rgba(228, 183, 90, .25); }
@keyframes breathe { 0%, 100% { transform: scale(1); filter: brightness(1); } 50% { transform: scale(1.04); filter: brightness(1.12); } }
.loader-title { font-size: 1.15rem; font-weight: 700; margin: 22px 0 14px; letter-spacing: .06em; }
.meter { width: 100%; height: 8px; border-radius: 999px; background: rgba(255, 255, 255, .10); overflow: hidden; position: relative; }
.meter-fill { height: 100%; width: 0%; border-radius: inherit; background: linear-gradient(90deg, #c3922a, #f3d58f); transition: width .35s ease-out; }
.meter.is-indeterminate .meter-fill { width: 35%; position: absolute; animation: slide 1.4s ease-in-out infinite; }
@keyframes slide { 0% { left: -35%; } 100% { left: 100%; } }
.loader-detail { margin: 10px 0 0; font-size: .88rem; color: rgba(233, 230, 223, .78); display: flex; gap: 12px; justify-content: space-between; width: 100%; }
.loader-mb { font-variant-numeric: tabular-nums; color: rgba(233, 230, 223, .6); white-space: nowrap; }
.loader-sound {
  margin: 20px 0 0; display: inline-flex; align-items: center; gap: 8px; text-align: left;
  padding: 6px 15px 6px 12px; border-radius: 999px; font-size: .86rem; line-height: 1.6;
  background: rgba(228, 183, 90, .10); border: 1px solid rgba(228, 183, 90, .30); color: #f3d58f;
}
/* 狭い画面では「。」の後ろで折り返す（文の途中で切れないように） */
.loader-sound-text { text-align: center; }
.loader-sound-text > span { display: inline-block; }
.loader-tip { margin: 18px 0 18px; font-size: .86rem; color: rgba(233, 230, 223, .62); min-height: 3.2em; }

.ghost-btn, .primary-btn { border-radius: 999px; padding: 9px 22px; cursor: pointer; font-weight: 500; }
.ghost-btn { background: transparent; color: inherit; border: 1px solid rgba(255, 255, 255, .28); }
.ghost-btn:hover { border-color: #e4b75a; color: #f3d58f; }
.primary-btn { background: linear-gradient(135deg, #fbe7b4, #e0b354); color: #2a1d05; border: 1px solid #e0b354; font-weight: 700; }
.primary-btn:hover { filter: brightness(1.06); }

.tools { position: absolute; top: 12px; right: 12px; display: none; gap: 8px; z-index: 3; transition: opacity .35s; }
body[data-state="playing"] .tools { display: flex; }
.tools.is-idle { opacity: 0; pointer-events: none; }
.tool {
  width: 42px; height: 42px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .22); cursor: pointer;
  background: rgba(10, 11, 16, .62); color: #f1ede4; display: grid; place-items: center;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.tool:hover { border-color: #e4b75a; color: #f3d58f; }
.tool svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.help-pop { position: absolute; top: 64px; right: 12px; z-index: 3; width: min(320px, calc(100% - 24px)); background: rgba(10, 11, 16, .88); border: 1px solid rgba(255, 255, 255, .16); border-radius: 12px; padding: 12px 16px; font-size: .86rem; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.help-pop p { margin: 6px 0; color: rgba(233, 230, 223, .8); }
.help-pop b { display: block; color: #f3d58f; font-weight: 700; }
.rotate-hint { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 3; background: rgba(10, 11, 16, .88); border: 1px solid rgba(255, 255, 255, .16); border-radius: 14px; padding: 12px 16px; display: flex; align-items: center; gap: 12px; width: max-content; max-width: calc(100% - 24px); font-size: .9rem; }
.rotate-hint p { margin: 0; }

.notice { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; padding: 20px; background: rgba(7, 8, 12, .92); }
.notice[hidden] { display: none; }
.notice-box { width: min(520px, 100%); background: #14161d; border: 1px solid rgba(255, 255, 255, .12); border-radius: 18px; padding: 28px 26px 22px; text-align: center; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); }
.notice-icon { width: 48px; height: 48px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 1.4rem; color: #2a1d05; background: linear-gradient(135deg, #fbe7b4, #e0b354); }
.notice-box h2 { margin: 0 0 10px; font-size: 1.2rem; color: #fff6e2; }
.notice-box p { margin: 0 0 10px; color: rgba(233, 230, 223, .82); white-space: pre-line; font-size: .95rem; }
.notice-list { text-align: left; margin: 6px auto 14px; padding: 12px 16px 12px 34px; background: rgba(255, 255, 255, .05); border-radius: 10px; font-size: .9rem; color: rgba(233, 230, 223, .85); max-width: 360px; }
.notice-list[hidden] { display: none; }
.notice-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 8px; }

/* ---------- ダイアログ ---------- */
.dlg { border: 1px solid var(--line); border-radius: 16px; padding: 22px 24px 18px; background: var(--bg2); color: var(--text); width: min(440px, calc(100% - 32px)); box-shadow: var(--shadow); }
.dlg-wide { width: min(620px, calc(100% - 32px)); }
.dlg::backdrop { background: rgba(7, 8, 12, .6); }
.dlg h2 { margin: 0 0 10px; font-size: 1.1rem; color: var(--text-br); }
.dlg h3 { margin: 16px 0 6px; font-size: .95rem; color: var(--text-br); }
.dlg p { margin: 0 0 8px; font-size: .92rem; }
.dlg .ghost-btn { color: var(--text); border-color: var(--line); }
.dlg .ghost-btn:hover { color: var(--gold-dk); border-color: var(--gold); }
.dlg-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; }
.dlg-small { font-size: .82rem !important; color: var(--dim); }
.credits { margin: 0 0 8px; padding-left: 18px; font-size: .9rem; }
.credits b { display: inline-block; min-width: 6.5em; color: var(--text-br); font-weight: 500; }

/* ---------- 狭い画面 ---------- */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 24px; padding-top: 12px; }
  .how { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .bar { padding: 14px 16px; }
  .bar-link { display: none; }
  main { padding: 0 16px 32px; }
  .foot { padding: 20px 16px 32px; }
  .start-btn { padding: 11px 20px 11px 12px; font-size: 1rem; gap: 10px; }
  .start-icon { width: 32px; height: 32px; }
  .sound-badge { bottom: 9px; font-size: .78rem; padding: 2px 11px 2px 9px; }
  .checks li { grid-template-columns: 26px 1fr; }
  .ck-state { grid-column: 2; text-align: left; }
  .how { grid-template-columns: 1fr; }
  .facts div { grid-template-columns: 4em 1fr; }
  .copy { margin-left: 0; width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
