/* ---------------------------------------------------------
   Timer Imposter — dark, covert-ops party game styling
--------------------------------------------------------- */

:root{
  --bg:            #12151b;
  --bg-alt:        #171b22;
  --card:          #1c212b;
  --card-2:        #232936;
  --line:          #2a3140;
  --text:          #edf0f4;
  --text-dim:      #8b93a3;
  --text-faint:    #5b6272;
  --accent:        #f2b705;
  --accent-dim:    #b5890a;
  --safe:          #38b98a;
  --safe-bg:       #10261e;
  --danger:        #e2504f;
  --danger-bg:     #2a1414;
  --special:       #4f9bf2;
  --special-bg:    #10202f;
  --radius-lg:     22px;
  --radius-md:     14px;
  --radius-sm:     9px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

*{ box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body{
  margin:0; padding:0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  min-height: 100vh;
  overscroll-behavior-y: contain;
}

body{
  background-image:
    radial-gradient(circle at 15% 0%, #1c2635 0%, transparent 45%),
    radial-gradient(circle at 90% 100%, #201a1a 0%, transparent 40%);
  background-attachment: fixed;
}

#app{
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 20px 16px calc(28px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
}

.sound-toggle{
  position: absolute;
  top: 16px;
  right: 16px;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: var(--card-2);
  border: 1px solid var(--line);
  color: var(--text-dim);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

h1, h2, h3{ margin: 0 0 4px; font-weight: 800; letter-spacing: -0.01em; }
p{ margin: 0; }

.eyebrow{
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}

.subtitle{ color: var(--text-dim); font-size: 14.5px; line-height: 1.5; margin-bottom: 18px; }

.header-block{ margin-bottom: 18px; }

/* ---------- layout helpers ---------- */
.screen{ display:flex; flex-direction:column; flex:1; animation: fadeSlide 0.28s ease; }
@keyframes fadeSlide{
  from{ opacity:0; transform: translateY(8px); }
  to{ opacity:1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce){
  .screen{ animation: none; }
}

.spacer{ flex: 1; }
.stack{ display:flex; flex-direction:column; gap:12px; }
.row{ display:flex; gap:10px; align-items:center; }
.row-between{ display:flex; justify-content:space-between; align-items:center; gap:10px; }

/* ---------- cards ---------- */
.card{
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px;
}
.card + .card{ margin-top: 12px; }

/* ---------- buttons ---------- */
button{
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
button:focus-visible{
  box-shadow: 0 0 0 3px rgba(242,183,5,0.55);
}

.btn{
  width: 100%;
  padding: 17px 18px;
  font-size: 16.5px;
  font-weight: 700;
  border-radius: var(--radius-md);
  background: var(--card-2);
  color: var(--text);
  border: 1px solid var(--line);
  transition: transform 0.08s ease, background 0.15s ease, border-color .15s ease;
  min-height: 54px;
}
.btn:active{ transform: scale(0.97); }

.btn-primary{
  background: var(--accent);
  color: #1a1400;
  border-color: var(--accent);
}
.btn-primary:disabled{
  background: var(--card-2);
  color: var(--text-faint);
  border-color: var(--line);
  cursor: not-allowed;
}

.btn-danger{ background: var(--danger); color: #2a0d0d; border-color: var(--danger); }
.btn-safe{ background: var(--safe); color: #062017; border-color: var(--safe); }
.btn-special{ background: var(--special); color: #06131f; border-color: var(--special); }
.btn-ghost{ background: transparent; border-color: var(--line); color: var(--text-dim); }
.btn-outline{ background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn-sm{ width: auto; padding: 10px 14px; font-size: 14px; min-height: 40px; border-radius: var(--radius-sm); }
.btn-icon{
  width: 44px; height: 44px; min-height: 44px; padding: 0;
  border-radius: var(--radius-sm);
  background: var(--card-2); color: var(--danger);
  border: 1px solid var(--line);
  font-size: 18px; flex-shrink: 0;
  display:flex; align-items:center; justify-content:center;
}

.btn-group{ display:flex; flex-wrap:wrap; gap:8px; }
.choice{
  flex: 1 1 calc(50% - 8px);
  padding: 14px 10px;
  border-radius: var(--radius-md);
  background: var(--card-2);
  border: 1.5px solid var(--line);
  color: var(--text-dim);
  font-weight: 700;
  font-size: 14.5px;
  text-align: center;
  transition: all .15s ease;
  min-height: 52px;
}
.choice.selected{
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(242,183,5,0.08);
}
.choice:disabled{
  opacity: 0.35;
  cursor: not-allowed;
}
.choice-full{ flex-basis: 100%; }
.choice-sub{ display:block; font-size: 11.5px; font-weight: 500; color: var(--text-faint); margin-top: 2px; }
.choice.selected .choice-sub{ color: var(--accent-dim); }

/* mode list (full width tiles) */
.mode-tile{
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--card-2);
  border: 1.5px solid var(--line);
  color: var(--text);
  margin-bottom: 8px;
}
.mode-tile.selected{ border-color: var(--accent); background: rgba(242,183,5,0.08); }
.mode-tile .mode-name{ font-weight: 800; font-size: 15px; display:flex; align-items:center; gap:8px; }
.mode-tile .mode-desc{ font-size: 12.5px; color: var(--text-dim); margin-top: 3px; line-height: 1.4; }
.mode-tile:disabled{ opacity: 0.35; }
.mode-tile .mode-warn{ color: var(--danger); font-size: 11.5px; font-weight: 700; margin-top: 4px; }

/* ---------- inputs ---------- */
input[type="text"]{
  width: 100%;
  padding: 15px 14px;
  font-size: 16px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--line);
  background: var(--bg-alt);
  color: var(--text);
  font-family: inherit;
}
input[type="text"]:focus{ outline: none; border-color: var(--accent); }
input[type="text"]::placeholder{ color: var(--text-faint); }

/* ---------- player list ---------- */
.player-row{
  display:flex; align-items:center; gap:10px;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}
.player-name{
  flex:1; min-width:0;
  font-weight: 700; font-size: 15px;
  overflow-wrap: anywhere;
}
.player-index{
  font-family: var(--mono);
  color: var(--text-faint);
  font-size: 12.5px;
  width: 20px;
  flex-shrink: 0;
}
.player-count-badge{
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
}

/* ---------- pass-the-phone / reveal ---------- */
.pass-banner{
  text-align:center;
  margin: auto 0;
}
.pass-banner .to-icon{ font-size: 46px; margin-bottom: 10px; }
.pass-banner .to-label{ font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-dim); }
.pass-banner .to-name{ font-size: 30px; font-weight: 800; margin: 6px 0 4px; word-break: break-word; }
.pass-warning{ color: var(--text-faint); font-size: 13.5px; margin-top: 10px; }

.reveal-scan{
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md);
  height: 3px;
  background: var(--line);
  margin: 18px 0;
}
.reveal-scan::after{
  content:"";
  position:absolute; top:0; left:-40%;
  width: 40%; height:100%;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: scan 1.6s linear infinite;
}
@keyframes scan{ from{ left:-40%; } to{ left: 100%; } }
@media (prefers-reduced-motion: reduce){ .reveal-scan::after{ animation: none; } }

.role-screen{
  flex:1;
  display:flex;
  flex-direction:column;
  border-radius: var(--radius-lg);
  padding: 28px 22px;
  text-align:center;
  justify-content: center;
}
.role-screen.is-safe{ background: var(--safe-bg); border: 1px solid #1f4c3a; }
.role-screen.is-danger{ background: var(--danger-bg); border: 1px solid #5a2323; }
.role-screen.is-special{ background: var(--special-bg); border: 1px solid #234163; }
.role-screen.is-neutral{ background: var(--card); border: 1px solid var(--line); }

.role-badge{ font-size: 44px; margin-bottom: 8px; }
.role-title{ font-size: 20px; font-weight: 800; letter-spacing: 0.02em; margin-bottom: 22px; }
.role-title.safe{ color: var(--safe); }
.role-title.danger{ color: var(--danger); }
.role-title.special{ color: var(--special); }
.role-title.neutral{ color: var(--text); }

.role-value-label{ font-family: var(--mono); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 8px; }
.role-value{ font-family: var(--mono); font-size: 42px; font-weight: 700; color: var(--text); }
.role-value.small{ font-size: 30px; }
.role-hint{ margin-top: 14px; color: var(--text-dim); font-size: 13px; }

/* ---------- timer ---------- */
.timer-wrap{
  flex:1;
  display:flex; flex-direction:column;
  align-items:center; justify-content:center;
  text-align:center;
}
.timer-target-icon{ font-size: 42px; margin-bottom: 10px; }
.timer-player{ font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.timer-instruction{ color: var(--text-dim); font-size: 14.5px; margin-bottom: 6px; }
.timer-lock{ font-family: var(--mono); font-size: 12px; color: var(--text-faint); letter-spacing: 0.08em; margin-bottom: 30px; }

.timer-btn{
  width: 190px; height: 190px;
  border-radius: 50%;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.03em;
  border: none;
  display:flex; align-items:center; justify-content:center;
  background: radial-gradient(circle at 30% 25%, #ffd451, var(--accent));
  color: #1a1400;
  box-shadow: 0 0 0 8px rgba(242,183,5,0.12);
  transition: transform .1s ease, box-shadow .2s ease;
}
.timer-btn:active{ transform: scale(0.95); }
.timer-btn.running{
  background: radial-gradient(circle at 30% 25%, #ff8a7a, var(--danger));
  color: #2a0d0d;
  box-shadow: 0 0 0 8px rgba(226,80,79,0.14);
  animation: pulse 1.1s ease-in-out infinite;
}
@keyframes pulse{
  0%,100%{ box-shadow: 0 0 0 8px rgba(226,80,79,0.14); }
  50%{ box-shadow: 0 0 0 16px rgba(226,80,79,0.05); }
}
@media (prefers-reduced-motion: reduce){ .timer-btn.running{ animation: none; } }

.no-talk-banner{
  background: var(--danger-bg);
  border: 1px solid #5a2323;
  color: var(--danger);
  font-weight: 800;
  text-align:center;
  padding: 10px;
  border-radius: var(--radius-md);
  margin-bottom: 14px;
  font-size: 14px;
  letter-spacing: 0.02em;
}

.memory-countdown{
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
  margin-top: 10px;
}

/* ---------- waiting ---------- */
.waiting-wrap{ flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; }
.waiting-icon{ font-size: 52px; margin-bottom: 14px; }

/* ---------- results ---------- */
.result-row{
  display:flex; align-items:center; gap:12px;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}
.result-row.rank-1{ border-color: var(--accent); background: rgba(242,183,5,0.08); }
.result-rank{
  font-family: var(--mono);
  font-weight: 800;
  font-size: 15px;
  width: 26px;
  flex-shrink: 0;
  color: var(--text-dim);
  text-align:center;
}
.rank-1 .result-rank{ color: var(--accent); }
.result-main{ flex: 1; min-width: 0; }
.result-name{ font-weight: 800; font-size: 15.5px; display:flex; align-items:center; gap:6px; flex-wrap:wrap; }
.result-sub{ font-size: 12.5px; color: var(--text-dim); margin-top: 2px; }
.result-time{ font-family: var(--mono); font-weight:700; font-size: 16px; text-align:right; flex-shrink:0; }
.tag{
  display:inline-block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 700;
}
.tag-imposter{ background: var(--danger-bg); color: var(--danger); border: 1px solid #5a2323; }
.tag-special{ background: var(--special-bg); color: var(--special); border: 1px solid #234163; }

.awards-grid{ display:flex; flex-direction:column; gap:8px; }
.award-row{ display:flex; align-items:center; gap:10px; }
.award-icon{ font-size: 20px; width: 28px; text-align:center; flex-shrink:0; }
.award-text{ font-size: 13.5px; }
.award-text b{ color: var(--text); }

/* ---------- stats ---------- */
.stat-card .stat-name{ font-weight: 800; font-size: 15.5px; margin-bottom: 8px; }
.stat-grid{ display:grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; }
.stat-item{ font-size: 12.5px; color: var(--text-dim); display:flex; justify-content:space-between; }
.stat-item b{ color: var(--text); font-family: var(--mono); }

/* ---------- misc ---------- */
.section-label{
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 18px 0 8px;
}
.section-label:first-child{ margin-top: 0; }
.empty-note{ color: var(--text-faint); font-size: 13.5px; text-align:center; padding: 14px 0; }
.divider{ height:1px; background: var(--line); margin: 16px 0; border: none; }
.footer-note{ text-align:center; color: var(--text-faint); font-size: 11.5px; margin-top: 16px; }