:root {
  --bg: #0e1424; --panel: #18213a; --panel2: #202b4a; --line: #2e3b60;
  --text: #eef2ff; --muted: #9aa6c8; --gold: #f5c542; --gold2: #ffdf7a;
  --green: #3ddc97; --red: #ff6b6b; --blue: #5aa9ff;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font-family: "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", "Meiryo", sans-serif; }
body { word-break: auto-phrase; line-break: strict; }
#app { max-width: 480px; margin: 0 auto; min-height: 100vh; padding: 12px 14px 40px; }
.hidden { display: none !important; }
button { font: inherit; color: inherit; border: none; cursor: pointer; }
.nb { display: inline-block; }

.btn { border-radius: 12px; padding: 13px 16px; font-weight: 700; background: var(--panel2); font-size: 16px; }
.btn.big { font-size: 20px; padding: 16px 40px; }
.btn.gold { background: linear-gradient(180deg, var(--gold2), var(--gold)); color: #3a2a00; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.line { background: #06c755; color: #fff; }
.btn.wide { display: block; width: 100%; margin-top: 12px; }
.notice { color: var(--muted); font-size: 11px; text-align: center; margin: 16px 0 0; }
.center { text-align: center; }

/* タイトル */
.title-box { min-height: 88vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 12px; }
.title-art { width: 100%; border-radius: 16px; aspect-ratio: 3 / 2; object-fit: cover; }
.title-main { font-size: 52px; line-height: 1.05; margin: 6px 0 0; }
.title-main span { display: block; color: var(--gold); font-size: 48px; }
.title-sub { font-size: 16px; margin: 0 0 12px; color: #dfe6ff; line-height: 1.6; }
.title-box .btn { width: 80%; }

/* 絵 */
.pic { position: relative; width: 100%; aspect-ratio: 3 / 2; border-radius: 14px; overflow: hidden; background: #000; }
.pic.tall { aspect-ratio: 4 / 5; }
.pic img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* 会話（ノベル） */
.vn { min-height: calc(100vh - 52px); display: flex; flex-direction: column; gap: 12px; cursor: pointer; user-select: none; }
.say { background: rgba(24,33,58,.96); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px 16px; min-height: 120px; }
.say.narr { background: transparent; border-color: transparent; text-align: center; }
.say.narr p { color: #dfe6ff; font-size: 18px; }
.say p { margin: 0; font-size: 18px; line-height: 1.75; }
.who { display: inline-block; font-weight: 800; font-size: 14px; color: var(--gold2); margin-bottom: 6px; }
.who.ai { color: #7fe3ff; }
.tap { margin-top: auto; text-align: center; color: var(--muted); font-size: 13px; animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: .35; } }
.card-over { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(5,8,18,.55); padding: 12px; }
.slip { width: 88%; background: #fbfaf5; color: #222; border-radius: 6px; padding: 12px 14px; font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,.5); }
.slip b { display: block; text-align: center; margin-bottom: 6px; font-size: 14px; }
.slip .row { display: flex; justify-content: space-between; padding: 2px 0; font-variant-numeric: tabular-nums; }
.slip .row.minus span:last-child { color: #c0392b; }
.slip-sep { border-top: 1px dashed #aaa; margin: 6px 0; }
.slip-left { text-align: right; font-weight: 800; font-size: 18px; margin-top: 4px; }
.ad { width: 86%; background: linear-gradient(135deg, #ff3d6e, #ffb347); color: #fff; border-radius: 10px; padding: 14px; text-align: center; box-shadow: 0 8px 24px rgba(0,0,0,.5); }
.ad small { display: block; font-size: 10px; opacity: .8; text-align: left; }
.ad b { display: block; font-size: 20px; line-height: 1.4; margin: 6px 0 10px; }
.ad span { display: inline-block; background: #fff; color: #e2335a; border-radius: 99px; padding: 5px 14px; font-size: 13px; font-weight: 700; }

/* 質問と選択肢 */
.q { margin: 14px 0 10px; }
.step { display: inline-block; font-size: 12px; color: var(--gold); border: 1px solid var(--gold); border-radius: 99px; padding: 1px 10px; margin-bottom: 6px; }
.q h2 { font-size: 22px; margin: 0 0 6px; line-height: 1.4; }
.lead { color: #cdd6f6; font-size: 15px; margin: 0 0 6px; line-height: 1.7; white-space: pre-line; }
.opts { display: grid; gap: 10px; }
.opt { text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 14px; line-height: 1.55; }
.opt:active { background: var(--panel2); transform: scale(.99); }
.opt b { display: block; font-size: 16px; }
.opt small { display: block; color: var(--muted); font-size: 13px; margin-top: 4px; }
.opt small.exp { color: #7fe3ff; }
.meter { display: block; color: var(--gold2); font-size: 13px; margin-top: 6px; letter-spacing: .02em; }

.script { background: #fbfaf5; color: #222; border-radius: 10px; padding: 10px 14px; margin: 0 0 12px; font-family: "Yu Mincho", "Hiragino Mincho ProN", serif; }
.script p { margin: 4px 0; font-size: 15px; line-height: 1.6; border-bottom: 1px dotted #bbb; padding-bottom: 4px; }
.script p:last-child { border-bottom: none; }

/* 架空の動画サイト */
.site { background: #0f0f0f; border-radius: 14px; padding: 10px; display: grid; gap: 12px; }
.site-bar { display: flex; justify-content: space-between; align-items: center; color: #fff; font-weight: 800; font-size: 16px; padding: 2px 4px; }
.site-bar span { font-size: 12px; font-weight: 400; color: #aaa; }
.vcard { display: block; text-align: left; }
.th { position: relative; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: #222; }
.th img { width: 100%; height: 100%; object-fit: cover; }
.th-txt { position: absolute; font-weight: 900; font-size: 26px; line-height: 1.15; letter-spacing: .01em; word-break: keep-all; }
.th-txt.pos-top { left: 8px; right: 8px; top: 8px; text-align: center; }
.th-txt.pos-right { right: 8px; top: 50%; transform: translateY(-50%); width: 48%; text-align: center; font-size: 28px; }
.vmeta { padding: 8px 2px 2px; }
.vmeta b { display: block; font-size: 14px; line-height: 1.45; color: #f1f1f1; }
.vmeta small { display: block; font-size: 12px; color: #aaa; margin-top: 2px; }
.thumb-opt { background: #1b1b1b; border: 2px solid #333; padding: 8px; border-radius: 14px; }
.thumb-opt:active { border-color: var(--gold); }
.yours { display: inline-block; font-size: 12px; font-weight: 700; color: #3a2a00; background: var(--gold); border-radius: 6px; padding: 1px 8px; margin-bottom: 6px; }

/* 待ち・結果 */
.wait { text-align: center; padding: 30px 0; color: #cdd6f6; }
.spin { width: 42px; height: 42px; margin: 0 auto 14px; border: 4px solid var(--line); border-top-color: var(--gold); border-radius: 50%; animation: sp 1s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
.metrics { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 6px 14px; margin: 12px 0; }
.m { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.m:last-child { border-bottom: none; }
.mk { font-size: 14px; color: #cdd6f6; }
.mk small { display: block; font-size: 11px; color: var(--muted); }
.mv { text-align: right; font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mv.minus { color: var(--red); font-size: 20px; }
.m.total .mv { color: var(--gold); font-size: 28px; }
.was { display: block; font-size: 12px; font-weight: 400; color: var(--muted); }
.cmt { background: #1d1d1d; border-radius: 12px; padding: 10px 12px; margin-top: 8px; animation: pop .35s ease-out; }
.cmt b { display: block; font-size: 12px; color: #aaa; }
.cmt p { margin: 2px 0 0; font-size: 15px; line-height: 1.6; }
.cmt.star { border: 1px solid var(--gold); background: #2a2410; }
.cmt.star b { color: var(--gold2); }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }
.ren { background: #2a1420; border: 1px solid #a33a5e; border-radius: 12px; padding: 10px 12px; margin-top: 12px; }
.ren b { font-size: 12px; color: #ff8fb3; }
.ren p { margin: 2px 0 0; font-size: 15px; }
.rv { background: var(--panel); border-left: 4px solid var(--green); border-radius: 10px; padding: 10px 12px; margin-top: 10px; }
.rv.ng { border-left-color: var(--red); }
.rv-h { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.rv-h em { font-style: normal; font-weight: 700; color: var(--green); }
.rv.ng .rv-h em { color: var(--red); }
.rv b { display: block; font-size: 14px; margin-top: 4px; }
.rv p { margin: 4px 0 0; font-size: 14px; line-height: 1.6; color: #dfe6ff; }

/* ハブ */
.hud { background: radial-gradient(120% 120% at 50% 0%, #26345e 0%, var(--panel) 70%); border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px; text-align: center; }
.day { font-size: 15px; color: var(--gold2); }
.day b { font-size: 26px; margin: 0 2px; }
.label { color: var(--muted); font-size: 12px; margin-top: 8px; }
.money { font-size: 32px; font-weight: 800; color: var(--gold); font-variant-numeric: tabular-nums; }
.jobs { display: grid; gap: 10px; margin-top: 10px; }
.job { display: flex; align-items: center; gap: 12px; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.job .ic { font-size: 30px; }
.job .jt { flex: 1; }
.job b { display: block; font-size: 16px; }
.job small { display: block; color: var(--muted); font-size: 12px; }
.job .tag { font-size: 12px; font-weight: 700; background: var(--gold); color: #3a2a00; border-radius: 99px; padding: 4px 10px; white-space: nowrap; }
.job.done .tag { background: var(--green); color: #05301e; }
.job.off { opacity: .45; }
.job.off .tag { background: var(--line); color: var(--muted); }

/* 重ねて出す画面 */
.modal { position: fixed; inset: 0; z-index: 20; background: rgba(5,8,18,.82); display: flex; align-items: center; justify-content: center; padding: 16px; }
.sheet { width: 100%; max-width: 440px; max-height: 90vh; overflow: auto; background: var(--panel); border-radius: 18px; padding: 18px 16px; }
.sheet p { line-height: 1.7; }
.get { text-align: center; color: var(--gold); font-weight: 800; font-size: 18px; margin-bottom: 10px; }
.big-num { text-align: center; font-size: 30px; font-weight: 800; color: var(--green); margin: 6px 0; }
.jobcard { background: #fbfaf5; color: #222; border-radius: 12px; padding: 12px 14px; }
.jobcard h3 { margin: 0 0 6px; font-size: 18px; text-align: center; }
.jobcard dl { margin: 8px 0 0; }
.jobcard dt { font-size: 12px; color: #7a6a3a; font-weight: 700; }
.jobcard dd { margin: 2px 0 0; font-size: 14px; line-height: 1.55; }

/* 結果 */
.result { background: radial-gradient(120% 80% at 50% 0%, #2a3a70 0%, var(--panel) 70%); border: 1px solid var(--line); border-radius: 18px; padding: 18px 16px; margin-top: 10px; }
.res-head { text-align: center; color: var(--muted); font-size: 14px; }
.res-type { text-align: center; color: var(--gold); font-size: 30px; font-weight: 900; margin: 8px 0 4px; line-height: 1.3; }
.res-line { text-align: center; margin: 0 0 12px; font-size: 15px; line-height: 1.6; }
.res-row { margin: 10px 0 0; border-top: 1px solid var(--line); padding-top: 8px; }
.res-row dt { font-size: 12px; color: var(--muted); }
.res-row dd { margin: 2px 0 0; font-size: 16px; font-weight: 700; line-height: 1.5; }
.res-common { font-size: 13px; color: #cdd6f6; line-height: 1.65; margin: 14px 0 6px; }
.res-cards { text-align: center; font-size: 26px; letter-spacing: 6px; }
.res-cards span { opacity: .25; filter: grayscale(1); }
.res-cards span.have { opacity: 1; filter: none; }

/* G0テスト用（testlog.js）。公開前に外す */
.tl-btn { position: fixed; right: 10px; bottom: 10px; z-index: 30; background: #fff; color: #111; border-radius: 99px; padding: 8px 14px; font-size: 13px; font-weight: 700; box-shadow: 0 4px 14px rgba(0,0,0,.4); }
.tl-modal { position: fixed; inset: 0; z-index: 40; background: rgba(5,8,18,.85); display: flex; align-items: center; justify-content: center; padding: 16px; }
.tl-sheet { width: 100%; max-width: 420px; background: var(--panel); border-radius: 18px; padding: 18px 16px; display: grid; gap: 10px; }
.tl-sheet h2 { margin: 0; font-size: 20px; text-align: center; }
.tl-lead { margin: 0; color: var(--gold2); font-size: 14px; text-align: center; }
.tl-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.tl-table th { text-align: left; color: var(--muted); font-weight: 400; padding: 7px 6px; width: 46%; font-size: 14px; border-bottom: 1px solid var(--line); }
.tl-table td { padding: 7px 6px; font-weight: 700; border-bottom: 1px solid var(--line); }
.tl-small { font-size: 13px; }
/* スマホの幅でも言葉の途中で折り返さないように、項目名の下に値を置く */
.tl-table th, .tl-table td { display: block; width: auto; }
.tl-table th { border-bottom: none; padding: 6px 4px 0; font-size: 12px; }
.tl-table td { padding: 1px 4px 6px; }
.tl-small { font-size: inherit; }
