body { overscroll-behavior-y: none; --moon-size: 46vmin; --moon-top: 64vh; --moon-right: -14vw; }
#app { position: relative; z-index: 1; }
.small { font-size: 14px; }
.center { text-align: center; }
.err { color: #ffb3b3; background: rgba(229, 56, 59, 0.15); border: 1px solid rgba(229, 56, 59, 0.5); padding: 10px 12px; border-radius: 10px; margin: 0; }
ul.plain, ol.plain { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
ul.plain { list-style: none; padding-left: 0; }

/* Join */
.join { max-width: 520px; margin: 0 auto; padding: max(28px, env(safe-area-inset-top)) 16px 40px; display: flex; flex-direction: column; gap: 18px; }
.join-head h1 { font-size: clamp(52px, 15vw, 76px); line-height: 0.95; margin: 6px 0 10px; }
.join-head p { margin: 0; line-height: 1.45; }
.join-form { display: flex; flex-direction: column; gap: 18px; }
.join-form fieldset { border: 0; margin: 0; padding: 0; }
.join-form legend { font-weight: 700; font-size: 15px; margin-bottom: 8px; padding: 0; }
.hint { display: block; margin: -2px 0 10px; font-size: 14px; line-height: 1.4; color: var(--ink-2); font-weight: 400; }
.field > span.hint { margin: -4px 0 0; font-weight: 400; font-size: 14px; }
.qs-intro { border-top: 1px solid var(--line); padding-top: 14px; }
.qs-intro p { margin: 4px 0 0; }

/* Shell */
.shell { max-width: 620px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: max(12px, env(safe-area-inset-top)) 16px 12px; background: rgba(20, 16, 26, 0.96); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-size: 22px; white-space: nowrap; min-width: 0; }
.sim-badge { white-space: nowrap; }
@media (max-width: 420px) { .brand { font-size: 18px; } .clock { font-size: 16px !important; } .top { gap: 8px; } .top .sim-badge { font-size: 10px; padding: 2px 5px; } }
.top-right { display: flex; align-items: center; gap: 10px; }
.clock { font-size: 18px; display: flex; align-items: center; gap: 6px; }
.iconbtn { width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--line-2); background: transparent; font-weight: 700; font-size: 17px; cursor: pointer; }
.content { flex: 1; padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; outline: none; }
.content h2.display { font-size: 34px; margin: 4px 0; line-height: 1.05; }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: 620px; margin: 0 auto; background: rgba(20, 16, 26, 0.97); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs button { position: relative; background: none; border: 0; padding: 10px 4px 9px; min-height: 60px; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 12px; font-weight: 700; color: var(--ink-2); cursor: pointer; }
.tabs button[aria-current="page"] { color: var(--accent); }
.tabs .badge { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; background: var(--blood); color: #fff; font-size: 11px; line-height: 19px; font-style: normal; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.15); } }

/* Night */
.status .stat-row { display: flex; gap: 26px; margin-bottom: 10px; }
.status .stat-row div { display: flex; align-items: baseline; gap: 6px; }
.status .big { font-size: 40px; line-height: 1; }
.status h2 { font-size: 28px !important; }
.status p { margin: 6px 0 0; line-height: 1.45; }
.status ul.plain li { line-height: 1.4; padding-left: 16px; position: relative; }
.status ul.plain li::before { content: ''; position: absolute; left: 0; top: 8px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.ghostcard { display: flex; gap: 14px; align-items: flex-start; border-color: rgba(169, 199, 255, 0.4); color: var(--ghost); }
.ghostcard svg { width: 34px; height: 34px; flex: none; animation: float 3s ease-in-out infinite; }
.ghostcard h2 { font-size: 28px !important; color: var(--ink); }
.ghostcard p { margin: 4px 0 0; color: var(--ink); line-height: 1.45; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.tip { display: flex; align-items: center; gap: 12px; justify-content: space-between; }
.tip p { margin: 0; line-height: 1.4; }

.feed { display: flex; flex-direction: column; gap: 10px; }
.ev { background: rgba(30, 24, 39, 0.85); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; }
.ev.new { animation: evin 0.5s cubic-bezier(.2, .9, .3, 1.2) both; }
@keyframes evin { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
.ev h3 { margin: 4px 0 4px; font-size: 18px; line-height: 1.25; }
.ev p { margin: 4px 0 0; line-height: 1.45; color: var(--ink-2); }
.ev-k { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
.ev.death { border-color: rgba(229, 56, 59, 0.55); background: linear-gradient(180deg, rgba(229, 56, 59, 0.14), rgba(30, 24, 39, 0.88) 60%); }
.ev.death .ev-k { color: #ff8b8d; }
.ev.death h3 { font-family: var(--display); font-weight: 400; font-size: 24px; }
.ev .dressed { font-style: italic; margin-top: 0; }
.ev .clue { color: var(--ink); background: rgba(20, 16, 26, 0.6); border-left: 0; border-radius: 10px; padding: 10px 12px; margin-top: 10px; }
.ev .clue span { display: block; font-size: 12.5px; font-weight: 700; color: var(--accent); margin-bottom: 2px; }
.ev .weapon { color: var(--ink); }
.ev.accusation.right { border-color: rgba(143, 209, 106, 0.6); }
.ev.accusation.wrong { border-color: rgba(229, 56, 59, 0.45); }
.ev.opening { border-color: rgba(255, 122, 31, 0.6); }
.ev.envelope { border-color: rgba(255, 122, 31, 0.45); }
.ev.whisper .ev-k { color: var(--ghost); }

.reveal { border-color: var(--accent); }
.reveal h3 { margin: 14px 0 6px; }
.reveal li { line-height: 1.4; }
.reveal .timeline li { font-size: 15px; line-height: 1.4; padding-left: 0; }
.reveal .timeline .mono { margin-right: 6px; }
.reveal .kills { margin: 4px 0 6px 14px; color: var(--ink-2); font-size: 15px; }
.tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--bg-3); border: 1px solid var(--line-2); }

/* Notebook */
.nb-head p { margin: 0 0 6px; }
.nb-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.nb-row { display: flex; align-items: stretch; background: rgba(30, 24, 39, 0.85); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.nb-row.dead, .nb-row.caught { opacity: 0.6; }
.nb-main { flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; cursor: pointer; min-height: 56px; }
.nb-name { font-weight: 700; font-size: 17px; }
.nb-sub { color: var(--ink-2); font-size: 14px; }
.nb-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.nb-tags:empty { display: none; }
.nb-note { font-size: 13.5px; color: var(--ink-2); font-style: italic; margin-top: 2px; }
.nb-more { width: 56px; flex: none; background: none; border: 0; border-left: 1px solid var(--line); font-size: 18px; letter-spacing: 1px; color: var(--ink-2); cursor: pointer; }
.pill, .mark { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.pill.dead { background: rgba(229, 56, 59, 0.2); color: #ffb3b3; }
.pill.caught { background: rgba(255, 122, 31, 0.2); color: #ffc49b; }
.pill.cleared { background: rgba(143, 209, 106, 0.18); color: #c7ecb2; }
.mark.suspect { background: var(--accent); color: var(--accent-ink); }
.mark.innocent { background: var(--bg-3); color: var(--ink); border: 1px solid var(--line-2); }

/* Secrets */
.secrets { display: flex; flex-direction: column; gap: 10px; }
.secrets h3.label { margin: 14px 0 0; }
.hold { display: grid; position: relative; border-radius: 16px; border: 1px solid var(--line-2); background: rgba(30, 24, 39, 0.9); user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none; cursor: pointer; min-height: 72px; overflow: hidden; }
.hold:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hold-front { grid-area: 1 / 1; display: flex; align-items: center; gap: 14px; padding: 16px; transition: opacity 0.15s; }
.hold-front > div { display: flex; flex-direction: column; gap: 2px; }
.hold-front .seal { width: 44px; height: 44px; flex: none; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; }
.hold-front .dot { margin-left: auto; width: 10px; height: 10px; border-radius: 50%; background: var(--blood); box-shadow: 0 0 10px var(--blood); }
.hold-back { grid-area: 1 / 1; padding: 16px; background: var(--bg-2); opacity: 0; transition: opacity 0.12s; }
.hold-back p { margin: 6px 0 0; line-height: 1.45; }
.hold-back h3 { margin: 0 0 4px; font-size: 26px; }
.hold.revealed .hold-back { opacity: 1; }
.hold.revealed .hold-front { opacity: 0; }
.hold.role { min-height: 150px; }
.hold.role .hold-front { min-height: 150px; }
.hold.env.unread { border-color: var(--accent); box-shadow: 0 0 22px rgba(255, 122, 31, 0.25); }
.hold.env .hold-front { min-height: 90px; }
.hold.env { min-height: 90px; }
.whisper { background: rgba(30, 24, 39, 0.85); border: 1px solid rgba(169, 199, 255, 0.3); border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.whisper.new { border-color: var(--ghost); box-shadow: 0 0 20px rgba(169, 199, 255, 0.25); }
.whisper .ev-k { color: var(--ghost); }
.whisper p { margin: 0; line-height: 1.45; font-size: 16.5px; }
.proof { text-align: center; padding: 18px 4px; }
.proof p.display { font-size: 28px; line-height: 1.2; margin: 14px 0; }

/* Act */
.act { display: flex; flex-direction: column; gap: 12px; }
.act-card h3 { margin: 6px 0 6px; font-size: 20px; }
.act-card p { margin: 0 0 12px; line-height: 1.45; }
.act-card .label { display: flex; align-items: center; gap: 6px; }

/* Modals */
.modal-back { position: fixed; inset: 0; z-index: 50; background: rgba(5, 3, 8, 0.7); display: flex; align-items: flex-end; justify-content: center; animation: fade 0.18s ease both; }
.modal { width: 100%; max-width: 560px; max-height: 88vh; overflow: auto; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 22px 22px 0 0; padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; animation: up 0.25s cubic-bezier(.2, .9, .3, 1.1) both; }
.modal h2.display { font-size: 30px; margin: 0; line-height: 1.05; }
.modal p { margin: 0; line-height: 1.45; }
@media (min-width: 700px) { .modal-back { align-items: center; } .modal { border-radius: 22px; } }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
.sheet-btns { display: flex; flex-direction: column; gap: 8px; }
.sheet-sep { height: 1px; background: var(--line); margin: 4px 0; }
.pick { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.pick button { width: 100%; text-align: left; background: rgba(20, 16, 26, 0.7); border: 1px solid var(--line-2); border-radius: 12px; padding: 12px 14px; min-height: 52px; display: flex; flex-direction: column; gap: 2px; cursor: pointer; }
.pick button:active { background: var(--bg-3); }

body.ghost .card, body.ghost .ev, body.ghost .nb-row { border-color: rgba(169, 199, 255, 0.25); }

@media (min-width: 900px) {
  .top { padding-left: 24px; padding-right: 24px; }
  .clock { font-size: 22px; }
}
