/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:            #000;
  --surface:       #1c1c1e;
  --surface-2:     #2c2c2e;
  --surface-3:     #3a3a3c;
  --border:        rgba(255,255,255,0.10);
  --border-light:  rgba(255,255,255,0.06);
  --blue:          #0a84ff;
  --blue-dim:      rgba(10,132,255,0.15);
  --bubble-sent:   #0a84ff;
  --bubble-recv:   #2c2c2e;
  --text:          #fff;
  --text-dim:      #8e8e93;
  --text-tertiary: #48484a;
  --red:           #ff453a;
  --green:         #30d158;
  --gold:          #ffd60a;
  --font:          -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', sans-serif;
  --radius-bubble: 18px;
  --radius-ui:     12px;
  --header-h:      56px;
  --input-h:       56px;
  --tab-bar-h:     52px;
  --safe-bottom:   env(safe-area-inset-bottom, 0px);
}

html, body {
  width: 100%; height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* ── Screens ─────────────────────────────────────────────────────────────── */
.screen {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease;
  overflow: hidden;
}
.screen.active { opacity: 1; pointer-events: all; }

/* ── Overlays ────────────────────────────────────────────────────────────── */
.overlay {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column;
  background: var(--bg);
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.32,0.72,0,1);
}
.overlay.active { transform: translateY(0); }

/* ── Typography ──────────────────────────────────────────────────────────── */
h1 { font-weight: 700; }
p  { line-height: 1.5; }

/* ── Avatar ──────────────────────────────────────────────────────────────── */
.avatar {
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; color: #fff; flex-shrink: 0;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.avatar-sm { width: 36px; height: 36px; font-size: 15px; }
.avatar-md { width: 44px; height: 44px; font-size: 18px; }
.avatar-lg { width: 52px; height: 52px; font-size: 21px; }

/* ── ═══════════════════════════════════════════════════════════════════════ */
/* ── TITLE SCREEN ────────────────────────────────────────────────────────── */
/* ── ═══════════════════════════════════════════════════════════════════════ */
#screen-title {
  background:
    radial-gradient(ellipse at 20% 30%, rgba(10,132,255,0.08), transparent 55%),
    radial-gradient(ellipse at 80% 70%, rgba(10,132,255,0.05), transparent 55%),
    #000;
  align-items: center; justify-content: center;
}

.title-inner {
  display: flex; flex-direction: column;
  align-items: center; gap: 0;
  width: 100%; max-width: 320px;
  padding: 40px 24px 60px;
}

.title-logo {
  display: flex; flex-direction: column;
  align-items: center; gap: 10px;
  margin-bottom: 56px;
}

.title-icon { font-size: 52px; line-height: 1; }

.title-name {
  font-size: 42px; font-weight: 800;
  letter-spacing: -1px; color: #fff;
}

.title-sub {
  font-size: 13px; color: var(--text-dim);
  letter-spacing: 0.04em; text-transform: uppercase;
}

.title-alpha-badge {
  display: inline-block;
  margin-top: 10px;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(192, 96, 0, 0.18);
  border: 1px solid rgba(192, 96, 0, 0.45);
  color: #e07820;
  font-size: 11px;
  letter-spacing: 0.04em;
}

.title-buttons {
  display: flex; flex-direction: column;
  gap: 12px; width: 100%;
}

.btn-primary {
  width: 100%; padding: 15px;
  background: var(--blue); color: #fff;
  border: none; border-radius: var(--radius-ui);
  font-family: var(--font); font-size: 17px; font-weight: 600;
  cursor: pointer; letter-spacing: -0.2px;
  transition: opacity 0.12s;
}
.btn-primary:active { opacity: 0.75; }

.btn-secondary {
  width: 100%; padding: 15px;
  background: var(--surface); color: var(--text);
  border: none; border-radius: var(--radius-ui);
  font-family: var(--font); font-size: 17px; font-weight: 400;
  cursor: pointer;
  transition: opacity 0.12s;
}
.btn-secondary:active { opacity: 0.6; }

.title-credit {
  margin-top: 48px;
  font-size: 12px; color: var(--text-tertiary);
  letter-spacing: 0.02em;
}

/* ── ═══════════════════════════════════════════════════════════════════════ */
/* ── HOW TO PLAY ─────────────────────────────────────────────────────────── */
/* ── ═══════════════════════════════════════════════════════════════════════ */
#screen-howto { background: var(--bg); }

.howto-scroll {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 16px 20px 40px;
}

.howto-title-h {
  font-size: 28px; font-weight: 700; margin-bottom: 24px;
}

.howto-step {
  background: var(--surface); border-radius: var(--radius-ui);
  padding: 16px; margin-bottom: 12px;
}
.howto-step-title {
  font-size: 13px; font-weight: 700;
  color: var(--blue); letter-spacing: 0.04em;
  text-transform: uppercase; margin-bottom: 6px;
}
.howto-step p { font-size: 15px; color: var(--text-dim); line-height: 1.55; }
.howto-step strong { color: var(--text); }

/* ── ═══════════════════════════════════════════════════════════════════════ */
/* ── BOTTOM TAB BAR ──────────────────────────────────────────────────────── */
/* ── ═══════════════════════════════════════════════════════════════════════ */
.tab-bar {
  display: flex;
  background: rgba(28,28,30,0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 0.5px solid var(--border);
  padding: 4px 0 calc(4px + var(--safe-bottom));
  flex-shrink: 0;
}

.tab-btn {
  flex: 1;
  display: flex; flex-direction: column; align-items: center;
  gap: 2px;
  background: none; border: none; cursor: pointer;
  padding: 6px 0;
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 10px; font-weight: 500;
  transition: color 0.15s;
  position: relative;
}
.tab-btn svg { width: 24px; height: 24px; }
.tab-btn.active { color: var(--blue); }
.tab-btn:active { opacity: 0.7; }

.tab-badge {
  position: absolute; top: 2px; right: calc(50% - 20px);
  background: var(--red); color: #fff;
  font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
}

/* ── ═══════════════════════════════════════════════════════════════════════ */
/* ── CONTACTS SCREEN ─────────────────────────────────────────────────────── */
/* ── ═══════════════════════════════════════════════════════════════════════ */
#screen-contacts { background: var(--bg); }

.contacts-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  padding: 12px 16px 8px;
  border-bottom: 0.5px solid var(--border);
  flex-shrink: 0;
}
.contacts-title {
  font-size: 28px; font-weight: 700; line-height: 1.1;
}

.header-btn-left, .header-btn-right {
  background: none; border: none; cursor: pointer;
  font-family: var(--font); font-size: 17px;
  color: var(--blue); padding: 4px 0;
}
.header-btn-right { color: var(--text-dim); font-size: 15px; }

.header-btn-icon {
  background: none; border: none; cursor: pointer;
  color: var(--blue); padding: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; line-height: 1;
  border-radius: 8px;
  transition: background 0.12s;
}
.header-btn-icon:active { background: var(--surface); }

.search-bar {
  padding: 8px 16px 4px; flex-shrink: 0;
}
.search-inner {
  background: var(--surface);
  border-radius: 10px;
  padding: 7px 12px;
  display: flex; align-items: center; gap: 6px;
}
.search-icon { font-size: 14px; color: var(--text-dim); }
.search-inner input {
  background: none; border: none; outline: none;
  font-family: var(--font); font-size: 15px; color: var(--text-dim);
  width: 100%; pointer-events: none;
}

.contact-list {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
}

.contact-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  border-bottom: 0.5px solid var(--border-light);
  cursor: pointer; transition: background 0.1s;
}
.contact-item:active { background: var(--surface); }

.contact-info {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 3px;
}
.contact-row1 { display: flex; align-items: baseline; justify-content: space-between; }
.contact-name { font-size: 17px; font-weight: 600; }
.contact-time { font-size: 13px; color: var(--text-dim); flex-shrink: 0; margin-left: 6px; }
.contact-row2 { display: flex; align-items: center; justify-content: space-between; }
.contact-preview {
  font-size: 15px; color: var(--text-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex: 1; min-width: 0; margin-right: 8px;
}
.unread-badge {
  background: var(--blue); color: #fff;
  font-size: 12px; font-weight: 600;
  min-width: 20px; height: 20px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 6px; flex-shrink: 0;
}

/* ── ═══════════════════════════════════════════════════════════════════════ */
/* ── CHAT SCREEN ─────────────────────────────────────────────────────────── */
/* ── ═══════════════════════════════════════════════════════════════════════ */
/* bottom: auto removes the bottom:0 from inset:0 so that JS can set height
   without fighting a conflicting bottom constraint. top + height then fully
   control the element's size. visualViewport.resize updates height via JS. */
#screen-chat {
  background: var(--bg);
  bottom: auto;
}

.chat-header {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  border-bottom: 0.5px solid var(--border);
  flex-shrink: 0; min-height: var(--header-h);
}
.chat-back-btn {
  background: none; border: none; cursor: pointer;
  font-size: 28px; color: var(--blue);
  padding: 0 8px 0 0; line-height: 1;
  font-family: var(--font);
}
.chat-header-center {
  flex: 1; display: flex; align-items: center; gap: 10px;
  min-width: 0;
}
#chat-avatar-wrap { flex-shrink: 0; }
.chat-header-info {
  display: flex; flex-direction: column; gap: 1px; min-width: 0;
}
.chat-name { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-status { font-size: 12px; color: var(--text-dim); }
.chat-casefile-btn {
  background: none; border: none; cursor: pointer;
  padding: 4px 0 4px 8px; color: var(--blue);
  display: flex; align-items: center; justify-content: center;
}
.chat-casefile-btn svg { width: 22px; height: 22px; }

.message-area {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 8px 12px 8px;
  display: flex; flex-direction: column; gap: 2px;
}

/* Timestamp separators */
.ts-separator {
  text-align: center;
  font-size: 12px; color: var(--text-dim);
  margin: 12px 0 4px;
  font-weight: 500;
}

/* Bubble groups */
.bubble-group {
  display: flex; flex-direction: column;
  max-width: 75%; margin: 2px 0;
}
.bubble-group.sent { align-self: flex-end; align-items: flex-end; }
.bubble-group.recv { align-self: flex-start; align-items: flex-start; }

/* Individual bubbles */
.bubble {
  display: inline-block;
  padding: 9px 14px;
  font-size: 16px; line-height: 1.4;
  word-break: break-word;
  margin: 1px 0;
}
.bubble-group.sent .bubble {
  background: var(--bubble-sent); color: #fff;
  border-radius: var(--radius-bubble) var(--radius-bubble) 4px var(--radius-bubble);
}
.bubble-group.sent .bubble:first-child {
  border-radius: var(--radius-bubble) var(--radius-bubble) var(--radius-bubble) 4px;
}
.bubble-group.sent .bubble:only-child {
  border-radius: var(--radius-bubble) var(--radius-bubble) 4px var(--radius-bubble);
}
.bubble-group.recv .bubble {
  background: var(--bubble-recv); color: var(--text);
  border-radius: var(--radius-bubble) var(--radius-bubble) var(--radius-bubble) 4px;
}
.bubble-group.recv .bubble:first-child {
  border-radius: 4px var(--radius-bubble) var(--radius-bubble) var(--radius-bubble);
}
.bubble-group.recv .bubble:only-child {
  border-radius: 4px var(--radius-bubble) var(--radius-bubble) var(--radius-bubble);
}

/* Bubble entry animation */
.bubble-pop {
  animation: bubblePop 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes bubblePop {
  from { transform: scale(0.85); opacity: 0.6; }
  to   { transform: scale(1);    opacity: 1; }
}

/* Read receipt */
.read-receipt {
  font-size: 11px; color: var(--text-dim);
  margin-top: 2px; padding-right: 2px;
  text-align: right;
}

/* Typing indicator bubble */
.typing-bubble {
  background: var(--bubble-recv);
  border-radius: 4px var(--radius-bubble) var(--radius-bubble) var(--radius-bubble);
  padding: 13px 16px;
  display: flex; align-items: center; gap: 5px;
  width: fit-content;
  animation: bubblePop 0.2s cubic-bezier(0.34,1.56,0.64,1);
}
.typing-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-dim);
  animation: typingBounce 1.3s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.18s; }
.typing-dot:nth-child(3) { animation-delay: 0.36s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0);   opacity: 0.45; }
  30%           { transform: translateY(-7px); opacity: 1; }
}

/* Input area */
.input-area {
  flex-shrink: 0;
  border-top: 0.5px solid var(--border);
  padding: 8px 12px calc(8px + var(--safe-bottom));
  background: var(--bg);
}
.input-row { display: flex; align-items: flex-end; gap: 8px; }
.input-wrap {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--surface-3);
  border-radius: 20px;
  padding: 8px 14px;
  min-height: 38px;
  display: flex; align-items: center;
}
.msg-input {
  background: none; border: none; outline: none; resize: none;
  font-family: var(--font); font-size: 16px; color: var(--text);
  width: 100%; max-height: 120px; line-height: 1.4;
}
.msg-input::placeholder { color: var(--text-dim); }
.btn-send {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--blue); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: #fff; flex-shrink: 0;
  transition: opacity 0.12s, background 0.15s;
}
.btn-send:disabled { background: var(--surface-3); cursor: default; }
.btn-send:not(:disabled):active { opacity: 0.7; }

.char-count {
  display: block;
  text-align: right;
  font-size: 11px;
  color: var(--text-dim);
  padding: 0 4px 4px;
  min-height: 16px;
  opacity: 0;
  transition: opacity 0.15s;
}
.char-count.visible { opacity: 1; }
.char-count.at-limit { color: #ff453a; font-weight: 600; }

/* ── ═══════════════════════════════════════════════════════════════════════ */
/* ── CASE FILE SCREEN ───────────────────────────────────────────────────── */
/* ── ═══════════════════════════════════════════════════════════════════════ */
#screen-casefile { background: var(--bg); }

.casefile-app-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  padding: 12px 16px 8px;
  border-bottom: 0.5px solid var(--border);
  flex-shrink: 0;
}
.casefile-app-title {
  font-size: 28px; font-weight: 700; line-height: 1.1;
}
.casefile-app-case {
  font-size: 13px; color: var(--text-dim);
  padding-bottom: 4px;
}

/* ── MMO progress strip ───────────────────────────────────────────────────── */
.casefile-progress {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; padding: 10px 16px;
  flex-shrink: 0; border-bottom: 0.5px solid var(--border-light);
}
.mmo-pip {
  font-size: 12px; font-weight: 600; padding: 4px 10px;
  border-radius: 20px; letter-spacing: 0.02em;
  transition: background 0.2s, color 0.2s;
}
.mmo-pip.pip-on  { background: rgba(10,132,255,0.18); color: var(--blue); }
.mmo-pip.pip-off { background: rgba(255,255,255,0.06); color: var(--text-dim); }
.mmo-sep { font-size: 12px; color: var(--border); }

.casefile-scroll {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 16px 16px 40px;
}

/* ── Suspect matrix ───────────────────────────────────────────────────────── */
.suspect-matrix {
  border: 0.5px solid var(--border);
  border-radius: 12px; overflow: hidden;
  margin-bottom: 24px;
}
.matrix-header-row {
  display: grid; grid-template-columns: 1fr repeat(3, 64px);
  background: rgba(255,255,255,0.04);
  border-bottom: 0.5px solid var(--border);
}
.matrix-col-head {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 8px 4px; gap: 2px;
}
.matrix-cat-icon  { font-size: 14px; }
.matrix-cat-label { font-size: 10px; font-weight: 600; color: var(--text-dim); letter-spacing: 0.05em; }

.matrix-row {
  display: grid; grid-template-columns: 1fr repeat(3, 64px);
  border-bottom: 0.5px solid var(--border);
  transition: background 0.2s;
}
.matrix-row:last-child { border-bottom: none; }
.matrix-row-complete { background: rgba(10,132,255,0.08); }

.matrix-name-col {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
}
.matrix-avatar { flex-shrink: 0; }
.matrix-suspect-name {
  font-size: 14px; font-weight: 500; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.matrix-cell {
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700;
  border-left: 0.5px solid var(--border);
}
.matrix-cell-empty   { color: rgba(255,255,255,0.15); }
.matrix-cell-filled  { color: var(--blue); }
.matrix-cell-cleared { color: #ff453a; font-size: 13px; }

/* ── Evidence sections ────────────────────────────────────────────────────── */
.casefile-section { margin-bottom: 20px; }
.casefile-section-title {
  font-size: 11px; font-weight: 700; color: var(--text-dim);
  letter-spacing: 0.08em; text-transform: uppercase;
  margin-bottom: 8px;
}
.cat-means       .casefile-section-title { color: #ff6b6b; }
.cat-motive      .casefile-section-title { color: #ffd60a; }
.cat-opportunity .casefile-section-title { color: #30d158; }

.casefile-empty {
  font-size: 15px; color: var(--text-dim);
  text-align: center; padding: 24px 0;
}

.clue-item {
  background: var(--surface);
  border-radius: 10px; padding: 11px 13px;
  font-size: 14px; line-height: 1.5;
  margin-bottom: 6px; color: var(--text);
}
.clue-item.clue-exonerates {
  opacity: 0.65;
  border-left: 3px solid #ff453a;
}

.casefile-tab-bar {
  display: flex; border-bottom: 0.5px solid var(--border);
  flex-shrink: 0;
}
.casefile-tab {
  flex: 1; padding: 10px; text-align: center;
  font-size: 14px; font-weight: 500; color: var(--text-dim);
  background: none; border: none; cursor: pointer;
  border-bottom: 2px solid transparent;
  font-family: var(--font);
}
.casefile-tab.active { color: var(--blue); border-bottom-color: var(--blue); }

.contradiction-item {
  background: rgba(255,69,58,0.10);
  border: 1px solid rgba(255,69,58,0.3);
  border-radius: 10px; padding: 12px 14px;
  font-size: 14px; line-height: 1.5;
  margin-bottom: 8px; color: var(--text);
  display: flex; gap: 8px; align-items: flex-start;
}
.contr-icon { color: #ff453a; font-size: 15px; flex-shrink: 0; margin-top: 1px; }

/* ── ═══════════════════════════════════════════════════════════════════════ */
/* ── CONTEXT MENU (dropdown) ─────────────────────────────────────────────── */
/* ── ═══════════════════════════════════════════════════════════════════════ */
.context-menu {
  position: fixed;
  top: 52px; left: 16px;
  z-index: 300;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px 0;
  min-width: 180px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  opacity: 0; pointer-events: none;
  transform: scale(0.95) translateY(-4px);
  transform-origin: top left;
  transition: opacity 0.15s, transform 0.15s;
}
.context-menu.open {
  opacity: 1; pointer-events: all;
  transform: scale(1) translateY(0);
}
.context-menu-item {
  display: block; width: 100%;
  padding: 11px 16px;
  background: none; border: none; cursor: pointer;
  font-family: var(--font); font-size: 16px; color: var(--text);
  text-align: left;
  transition: background 0.1s;
}
.context-menu-item:active { background: var(--surface-3); }
.context-menu-item + .context-menu-item {
  border-top: 0.5px solid var(--border-light);
}

.context-menu-backdrop {
  position: fixed; inset: 0; z-index: 299;
  display: none;
}
.context-menu-backdrop.open { display: block; }

/* ── ═══════════════════════════════════════════════════════════════════════ */
/* ── ACCUSATION OVERLAY ──────────────────────────────────────────────────── */
/* ── ═══════════════════════════════════════════════════════════════════════ */
#overlay-accusation {
  background: var(--bg);
}

.accusation-header {
  padding: 24px 20px 8px;
  border-bottom: 0.5px solid var(--border);
  flex-shrink: 0;
}
.accusation-title {
  font-size: 13px; font-weight: 700; color: var(--text-dim);
  letter-spacing: 0.1em; text-transform: uppercase;
  margin-bottom: 6px;
}
.accusation-subtitle {
  font-size: 22px; font-weight: 700; color: var(--text);
  line-height: 1.25;
}
.accusation-warning {
  font-size: 13px; color: var(--red);
  margin-top: 6px;
}

.accusation-list {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 16px 20px;
}

.suspect-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px;
  background: var(--surface); border-radius: var(--radius-ui);
  margin-bottom: 10px; cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.15s, background 0.15s;
}
.suspect-item.selected {
  border-color: var(--red);
  background: rgba(255,69,58,0.08);
}
.suspect-avatar-wrap { flex-shrink: 0; }
.suspect-info { flex: 1; min-width: 0; }
.suspect-name { display: block; font-size: 17px; font-weight: 600; }
.suspect-role { display: block; font-size: 13px; color: var(--text-dim); margin-top: 2px; }
.suspect-radio {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--surface-3);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: border-color 0.15s;
}
.suspect-item.selected .suspect-radio { border-color: var(--red); }
.radio-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--red); opacity: 0;
  transition: opacity 0.15s;
}
.suspect-item.selected .radio-dot { opacity: 1; }

.accusation-footer {
  padding: 16px 20px calc(16px + var(--safe-bottom));
  border-top: 0.5px solid var(--border); flex-shrink: 0;
  display: flex; flex-direction: column; gap: 10px;
}
.btn-accuse {
  width: 100%; padding: 16px;
  background: var(--red); color: #fff;
  border: none; border-radius: var(--radius-ui);
  font-family: var(--font); font-size: 17px; font-weight: 600;
  cursor: pointer; transition: opacity 0.12s;
}
.btn-accuse:disabled { opacity: 0.35; cursor: default; }
.btn-accuse:not(:disabled):active { opacity: 0.75; }
.btn-accuse-cancel {
  width: 100%; padding: 14px;
  background: none; color: var(--text-dim);
  border: none; border-radius: var(--radius-ui);
  font-family: var(--font); font-size: 16px; cursor: pointer;
}

/* ── ═══════════════════════════════════════════════════════════════════════ */
/* ── VERDICT OVERLAY ─────────────────────────────────────────────────────── */
/* ── ═══════════════════════════════════════════════════════════════════════ */
#overlay-verdict {
  background: var(--bg);
  align-items: center; justify-content: center;
  text-align: center; padding: 40px 32px 60px;
}
.verdict-icon { font-size: 64px; margin-bottom: 24px; }
#verdict-title {
  font-size: 32px; font-weight: 800;
  letter-spacing: -0.5px; margin-bottom: 8px;
}
#verdict-subtitle {
  font-size: 17px; color: var(--text-dim); margin-bottom: 28px;
}
#verdict-body {
  font-size: 15px; line-height: 1.65; color: var(--text);
  max-width: 340px; white-space: pre-line;
  margin-bottom: 12px;
}
#verdict-footer {
  font-size: 14px; color: var(--text-dim);
  margin-bottom: 40px; font-style: italic;
}
.verdict-buttons {
  display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 280px;
}

/* ── ═══════════════════════════════════════════════════════════════════════ */
/* ── OPENING CARD OVERLAY ────────────────────────────────────────────────── */
/* ── ═══════════════════════════════════════════════════════════════════════ */
#overlay-opening {
  background: #000;
  align-items: center; justify-content: center;
  padding: 48px 32px 48px;
  z-index: 200;
  opacity: 0; pointer-events: none;
  transition: opacity 0.4s ease;
  transform: none;
}
#overlay-opening.active { opacity: 1; pointer-events: all; }

.opening-lines {
  max-width: 340px; margin-bottom: 52px;
}
.opening-line {
  font-size: 17px; line-height: 1.7; color: var(--text);
  min-height: 1.7em;
  opacity: 0;
  animation: openingFadeIn 0.6s ease forwards;
}
.opening-line:empty { color: transparent; }
@keyframes openingFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
#btn-opening-continue {
  background: none; border: 1px solid rgba(255,255,255,0.25);
  color: var(--text-dim); border-radius: var(--radius-ui);
  padding: 13px 32px; font-family: var(--font);
  font-size: 15px; cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
  opacity: 0;
  animation: openingFadeIn 0.6s ease 3.5s forwards;
}
#btn-opening-continue:hover { border-color: rgba(255,255,255,0.5); color: var(--text); }

/* ── ═══════════════════════════════════════════════════════════════════════ */
/* ── CLUE TOAST ──────────────────────────────────────────────────────────── */
/* ── ═══════════════════════════════════════════════════════════════════════ */
#clue-toast {
  position: fixed; top: -80px; left: 50%; transform: translateX(-50%);
  z-index: 500;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 13px; font-weight: 500; color: var(--text);
  max-width: calc(100vw - 40px);
  text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  transition: top 0.35s cubic-bezier(0.32,0.72,0,1), opacity 0.35s;
  opacity: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#clue-toast.toast-show {
  top: calc(16px + env(safe-area-inset-top, 0px));
  opacity: 1;
}

/* ── ═══════════════════════════════════════════════════════════════════════ */
/* ── GENERIC HEADER (shared) ─────────────────────────────────────────────── */
/* ── ═══════════════════════════════════════════════════════════════════════ */
.generic-header {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  border-bottom: 0.5px solid var(--border);
  flex-shrink: 0;
}
.generic-header-title { font-size: 18px; font-weight: 700; flex: 1; }

/* ── Scrollbar (desktop) ─────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 0; }

/* ── Desktop sizing ──────────────────────────────────────────────────────── */
@media (min-width: 520px) {
  .screen {
    left: 50%; right: auto;
    width: 480px;
    margin-left: -240px;
  }
  .overlay {
    left: 50%; right: auto;
    width: 480px;
    margin-left: -240px;
  }
  /* Override transform for overlays only (slide-up) */
  .overlay { transform: translateY(100%); }
  .overlay.active { transform: translateY(0); }
  /* Opening card uses opacity not transform */
  #overlay-opening { transform: none; }
  #overlay-opening.active { transform: none; }
  #clue-toast { max-width: 440px; }
  .context-menu { left: calc(50% - 240px + 16px); }
}

/* ── ═══════════════════════════════════════════════════════════════════════ */
/* ── CASE DEBRIEF ──────────────────────────────────────────────────────── */
/* ── ═══════════════════════════════════════════════════════════════════════ */
#overlay-debrief {
  background: var(--bg);
}
.debrief-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px; border-bottom: 0.5px solid var(--border);
  flex-shrink: 0;
}
.debrief-header-title { font-size: 18px; font-weight: 700; }
.debrief-case-name { font-size: 13px; color: var(--text-dim); margin-left: auto; }
.debrief-scroll {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 0 0 calc(40px + var(--safe-bottom));
}
.debrief-section {
  padding: 24px 20px;
  border-bottom: 0.5px solid var(--border);
}
.debrief-section-title {
  font-size: 11px; font-weight: 700; letter-spacing: 1.5px;
  color: var(--text-dim); margin-bottom: 16px;
}

/* Killer card */
.debrief-killer-card {
  display: flex; align-items: center; gap: 12px;
  background: rgba(255,69,58,0.08);
  border: 1px solid rgba(255,69,58,0.2);
  border-radius: var(--radius-ui); padding: 14px 16px;
  margin-bottom: 16px;
}
.debrief-killer-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; color: #fff; font-size: 18px; flex-shrink: 0;
}
.debrief-killer-info { flex: 1; min-width: 0; }
.debrief-killer-name { font-size: 16px; font-weight: 600; }
.debrief-killer-role { font-size: 12px; color: var(--text-dim); }
.debrief-killer-badge {
  font-size: 10px; font-weight: 800; letter-spacing: 1px;
  color: var(--red); background: rgba(255,69,58,0.15);
  padding: 4px 8px; border-radius: 4px;
}
.debrief-summary-text {
  font-size: 14px; line-height: 1.65; color: var(--text-dim);
  margin-bottom: 20px; white-space: pre-line;
}
.debrief-detail-label {
  font-size: 10px; font-weight: 700; letter-spacing: 1.5px;
  color: var(--text-dim); margin-bottom: 4px;
}
.debrief-motive, .debrief-method {
  background: var(--surface); border-radius: 8px;
  padding: 12px 14px; margin-bottom: 10px;
}
.debrief-motive p, .debrief-method p {
  font-size: 13px; line-height: 1.5; color: var(--text);
}

/* Key moments */
.debrief-moment {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 10px 0; border-bottom: 0.5px solid var(--border-light);
}
.debrief-moment:last-child { border-bottom: none; }
.debrief-moment-marker {
  width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.debrief-moment.discovered .debrief-moment-marker {
  background: rgba(48,209,88,0.15); color: var(--green);
}
.debrief-moment.missed .debrief-moment-marker {
  background: rgba(255,69,58,0.1); color: var(--red);
}
.debrief-moment-text {
  font-size: 13px; line-height: 1.5; color: var(--text);
  padding-top: 2px;
}
.debrief-moment.missed .debrief-moment-text { color: var(--text-dim); }

/* Character profiles */
.debrief-profile-card {
  background: var(--surface); border-radius: var(--radius-ui);
  padding: 16px; margin-bottom: 12px;
}
.debrief-profile-header {
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
}
.debrief-profile-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; color: #fff; font-size: 15px; flex-shrink: 0;
}
.debrief-profile-info { flex: 1; min-width: 0; }
.debrief-profile-name { font-size: 15px; font-weight: 600; }
.debrief-profile-role { font-size: 11px; color: var(--text-dim); }
.debrief-guilty-tag {
  font-size: 9px; font-weight: 800; letter-spacing: 1px;
  color: var(--red); background: rgba(255,69,58,0.12);
  padding: 3px 6px; border-radius: 4px;
}
.debrief-innocent-tag {
  font-size: 9px; font-weight: 800; letter-spacing: 1px;
  color: var(--green); background: rgba(48,209,88,0.12);
  padding: 3px 6px; border-radius: 4px;
}
.debrief-profile-truth {
  font-size: 13px; line-height: 1.6; color: var(--text-dim);
}

/* Stats */
.debrief-stats {
  display: flex; gap: 12px; justify-content: center;
}
.debrief-stat {
  flex: 1; text-align: center;
  background: var(--surface); border-radius: 8px; padding: 16px 8px;
}
.debrief-stat-value {
  font-size: 22px; font-weight: 700; color: var(--text);
  margin-bottom: 4px;
}
.debrief-stat-label {
  font-size: 10px; font-weight: 600; letter-spacing: 0.5px;
  color: var(--text-dim); text-transform: uppercase;
}

/* CTA */
.debrief-cta {
  padding: 32px 20px; text-align: center;
}
.debrief-cta-text {
  font-size: 15px; color: var(--text-dim); margin-bottom: 16px;
}

/* ── ═══════════════════════════════════════════════════════════════════════ */
/* ── PAYWALL ────────────────────────────────────────────────────────────── */
/* ── ═══════════════════════════════════════════════════════════════════════ */
#overlay-paywall {
  background: var(--bg);
  align-items: center; justify-content: center;
  text-align: center; padding: 40px 32px 60px;
}
.paywall-inner {
  max-width: 340px;
}
.paywall-icon {
  font-size: 64px; margin-bottom: 20px;
}
.paywall-title {
  font-size: 28px; font-weight: 800;
  letter-spacing: -0.5px; margin-bottom: 8px; color: var(--text);
}
.paywall-subtitle {
  font-size: 16px; color: var(--text-dim); margin-bottom: 20px;
}
.paywall-body {
  font-size: 14px; line-height: 1.6; color: var(--text-dim);
  margin-bottom: 32px;
}
.paywall-btn {
  width: 100%; margin-bottom: 12px;
}

/* ── ═══════════════════════════════════════════════════════════════════════ */
/* ── AUTH BADGE (shared) ────────────────────────────────────────────────── */
/* ── ═══════════════════════════════════════════════════════════════════════ */
.auth-badge {
  position: fixed; top: 10px; right: 10px; z-index: 200;
}
.auth-icon-btn {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-dim); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600;
}
.auth-icon-avatar { background: var(--blue); color: #fff; border: none; }
.auth-dropdown {
  position: absolute; right: 0; top: 38px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-ui);
  min-width: 180px; overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.auth-dropdown-email {
  padding: 12px 16px; font-size: 12px; color: var(--text-dim);
  border-bottom: 0.5px solid var(--border);
}
.auth-dropdown-item {
  display: block; width: 100%; padding: 12px 16px;
  font-size: 14px; color: var(--text); text-decoration: none;
  background: none; border: none; text-align: left; cursor: pointer;
  font-family: var(--font);
}
.auth-dropdown-item:hover { background: var(--surface-3); }

/* ── ═══════════════════════════════════════════════════════════════════════ */
/* ── BUBBLE ACTION MENU ─────────────────────────────────────────────────── */
/* ── ═══════════════════════════════════════════════════════════════════════ */
.bubble-action-menu {
  position: fixed;
  z-index: 310;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px 0;
  min-width: 180px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  opacity: 0; pointer-events: none;
  transform: scale(0.92);
  transition: opacity 0.12s, transform 0.12s;
}
.bubble-action-menu.open {
  opacity: 1; pointer-events: all;
  transform: scale(1);
}
.bubble-action-item {
  display: block; width: 100%;
  padding: 11px 16px;
  background: none; border: none; cursor: pointer;
  font-family: var(--font); font-size: 15px; color: var(--text);
  text-align: left;
  transition: background 0.1s;
}
.bubble-action-item:active { background: var(--surface-3); }

.bubble-action-backdrop {
  position: fixed; inset: 0; z-index: 309;
  display: none;
}
.bubble-action-backdrop.open { display: block; }

/* Bubble highlight on long-press */
.bubble-highlight {
  transform: scale(1.02);
  box-shadow: 0 0 12px rgba(10,132,255,0.25);
  transition: transform 0.15s, box-shadow 0.15s;
}

/* Bubble checking pulse */
.bubble-checking {
  animation: bubbleCheckPulse 1s ease-in-out infinite;
}
@keyframes bubbleCheckPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ── ═══════════════════════════════════════════════════════════════════════ */
/* ── CASE BRIEFING TAB ──────────────────────────────────────────────────── */
/* ── ═══════════════════════════════════════════════════════════════════════ */
.briefing-player-card {
  background: var(--surface);
  border-left: 3px solid var(--blue);
  border-radius: var(--radius-ui);
  padding: 14px 16px;
  margin-bottom: 20px;
}
.briefing-player-name {
  font-size: 17px; font-weight: 600; color: var(--text);
}
.briefing-player-role {
  font-size: 12px; color: var(--blue);
  font-weight: 600; letter-spacing: 0.05em;
  text-transform: uppercase; margin-top: 2px;
}

.briefing-case-title {
  font-size: 20px; font-weight: 700; color: var(--text);
  margin-bottom: 4px;
}
.briefing-case-tagline {
  font-size: 14px; color: var(--text-dim);
  font-style: italic; margin-bottom: 20px;
}

.briefing-section-label {
  font-size: 11px; font-weight: 700; color: var(--text-dim);
  letter-spacing: 0.08em; text-transform: uppercase;
  margin-bottom: 8px;
}

.briefing-narrative {
  margin-bottom: 24px;
}
.briefing-narrative p {
  font-size: 15px; line-height: 1.7;
  color: rgba(255,255,255,0.7);
  font-style: italic;
  margin-bottom: 4px;
}

.briefing-suspect-roster {
  display: flex; flex-direction: column; gap: 8px;
}
.briefing-suspect-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface);
  border-radius: 10px;
  padding: 10px 12px;
}
.briefing-suspect-info { flex: 1; min-width: 0; }
.briefing-suspect-name {
  font-size: 14px; font-weight: 600; color: var(--text);
  display: block;
}
.briefing-suspect-role {
  font-size: 12px; color: var(--text-dim);
  display: block;
}

/* ── ACCUSATION: disabled suspect row ────────────────────────────────────── */
.suspect-item.suspect-disabled {
  opacity: 0.4;
  pointer-events: none;
}
.suspect-needs-evidence {
  display: block;
  font-size: 11px; color: var(--text-dim);
  font-style: italic; margin-top: 2px;
}
