/* ===========================
   CREW QUEST – style.css
   =========================== */

:root {
  --bg-dark:      #0a0c14;
  --bg-panel:     #12162a;
  --bg-panel2:    #1a1f38;
  --accent:       #4af0b0;
  --accent2:      #f03a6e;
  --accent3:      #f0c23a;
  --text:         #e8eaff;
  --text-dim:     #7880a0;
  --red:          #e84040;
  --blue:         #3a8ef0;
  --green:        #42d46a;
  --yellow:       #f0d040;
  --purple:       #b060f0;
  --orange:       #f07830;
  --pink:         #f060b0;
  --white-col:    #d0d8f0;
  --radius:       10px;
  --radius-lg:    18px;
  --shadow:       0 4px 32px rgba(0,0,0,0.6);
  --glow-accent:  0 0 16px #4af0b060;
  --glow-red:     0 0 16px #e8404060;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-user-select: none;
  user-select: none;
}

body {
  background: var(--bg-dark);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
}

/* ========== SCREENS ========== */
.screen {
  position: absolute;
  inset: 0;
  display: none;
  overflow: hidden;
}
.screen.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

canvas {
  position: absolute;
  inset: 0;
  display: block;
}

/* ========== TYPOGRAPHY ========== */
.game-title {
  font-size: clamp(2.5rem, 6vw, 5rem);
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: linear-gradient(135deg, var(--accent), #fff 50%, var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 20px #4af0b080);
  line-height: 1;
}

.subtitle {
  font-size: 1.1rem;
  color: var(--text-dim);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-top: 0.4em;
}

.label {
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.4em;
}

.crew-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.1em;
  min-height: 1.4em;
  text-align: center;
}

/* ========== BUTTONS ========== */
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #22c080);
  color: #000;
  border: none;
  padding: 0.9em 2.5em;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: var(--glow-accent);
  transition: transform 0.15s, box-shadow 0.15s;
}
.btn-primary:hover {
  transform: scale(1.05);
  box-shadow: 0 0 24px #4af0b0a0;
}
.btn-primary:active { transform: scale(0.97); }

.btn-secondary {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid #ffffff22;
  padding: 0.7em 1.8em;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.icon-btn {
  background: #ffffff12;
  border: 1px solid #ffffff20;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.icon-btn:hover { background: #ffffff22; }

/* ========== LOADING SCREEN ========== */
#screen-loading {
  flex-direction: column;
}
#loading-text {
  position: relative;
  z-index: 10;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6em;
}
.loading-bar-wrap {
  width: 280px;
  height: 6px;
  background: #ffffff15;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 0.8em;
}
#loading-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 3px;
  transition: width 0.3s ease;
  box-shadow: 0 0 10px var(--accent);
}
#loading-status {
  font-size: 0.8rem;
  color: var(--text-dim);
  letter-spacing: 0.1em;
}

/* ========== MENU SCREEN ========== */
#menu-ui {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2em;
  padding: 2em;
  background: linear-gradient(180deg, #0a0c14e0 0%, #12162ae0 100%);
  border-radius: var(--radius-lg);
  border: 1px solid #ffffff15;
  box-shadow: var(--shadow);
  min-width: 340px;
  max-width: 480px;
  width: 90vw;
}

#color-swatches {
  display: flex;
  gap: 0.5em;
  flex-wrap: wrap;
  justify-content: center;
}

.color-swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: transform 0.15s, border-color 0.15s;
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.selected {
  border-color: #fff;
  box-shadow: 0 0 12px currentColor;
  transform: scale(1.2);
}

#difficulty-wrap { text-align: center; }
#diff-buttons {
  display: flex;
  gap: 0.5em;
}
.diff-btn {
  background: #ffffff12;
  border: 1px solid #ffffff25;
  color: var(--text-dim);
  padding: 0.5em 1.2em;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.08em;
  transition: all 0.2s;
}
.diff-btn:hover { border-color: var(--accent); color: var(--accent); }
.diff-btn.active {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}

#menu-controls {
  position: absolute;
  top: 1em;
  right: 1em;
}

/* ========== INTRO ========== */
#intro-skip {
  position: absolute;
  bottom: 2em;
  right: 2em;
  z-index: 20;
}

/* ========== HUD ========== */
#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  padding: 0.5em 1em;
  background: linear-gradient(180deg, #0a0c14e8 0%, transparent 100%);
  gap: 1em;
}
#hud-left, #hud-right {
  display: flex;
  align-items: center;
  gap: 0.5em;
}
#hud-center {
  flex: 1;
  display: flex;
  justify-content: center;
}
#task-progress-wrap {
  display: flex;
  align-items: center;
  gap: 0.4em;
}
.hud-label {
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
}
#task-bar-bg {
  width: 120px;
  height: 8px;
  background: #ffffff15;
  border-radius: 4px;
  overflow: hidden;
}
#task-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #22c080);
  border-radius: 4px;
  transition: width 0.5s ease;
  box-shadow: 0 0 8px var(--accent);
}
#task-count {
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 700;
}
.hud-btn {
  background: #ffffff12;
  border: 1px solid #ffffff20;
  color: var(--text);
  padding: 0.35em 0.8em;
  border-radius: var(--radius);
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  white-space: nowrap;
}
.hud-btn:hover { background: #ffffff22; border-color: var(--accent); }
.hud-btn.alert {
  border-color: var(--red);
  color: var(--red);
  animation: pulse-red 1s infinite;
}
#btn-report {
  border-color: var(--accent3);
  color: var(--accent3);
}
#btn-meeting {
  border-color: var(--red);
  color: var(--red);
}
#btn-meeting:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  animation: none;
}

#crew-status-icons {
  display: flex;
  gap: 0.3em;
  align-items: center;
}
.crew-icon {
  width: 24px;
  height: 28px;
}

/* ========== PANELS ========== */
.panel {
  position: absolute;
  z-index: 60;
  background: var(--bg-panel);
  border: 1px solid #ffffff18;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.2em;
}
.panel.hidden { display: none; }
.panel-close {
  position: absolute;
  top: 0.7em;
  right: 0.8em;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;
}
.panel-close:hover { color: var(--text); }
.panel h3 {
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.8em;
}

#task-list-panel {
  top: 3.5em;
  left: 1em;
  width: 220px;
}
.task-item {
  display: flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.4em 0;
  font-size: 0.82rem;
  color: var(--text-dim);
  border-bottom: 1px solid #ffffff08;
}
.task-item.done { color: var(--accent); text-decoration: line-through; opacity: 0.6; }
.task-item .task-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
  flex-shrink: 0;
}
.task-item.done .task-dot { background: var(--accent); }
.task-room {
  font-size: 0.7rem;
  color: var(--text-dim);
  opacity: 0.6;
  margin-left: auto;
}

/* ========== MAP OVERLAY ========== */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 80;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.overlay.hidden { display: none; }
.overlay-close {
  position: absolute;
  top: 0.7em;
  right: 0.8em;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.2rem;
  cursor: pointer;
  z-index: 5;
}
.overlay-close:hover { color: var(--text); }

#map-container {
  position: relative;
  background: var(--bg-panel);
  border: 1px solid #ffffff18;
  border-radius: var(--radius-lg);
  padding: 1em;
  box-shadow: var(--shadow);
}
#map-canvas { position: relative; border-radius: var(--radius); }

/* ========== TASK PANEL ========== */
#task-panel {
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(500px, 95vw);
  padding-bottom: 1.5em;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
#task-header {
  display: flex;
  align-items: center;
  margin-bottom: 0.6em;
}
#task-title {
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  flex: 1;
}
#task-canvas {
  position: relative;
  border-radius: var(--radius);
  background: #0a0e20;
  border: 1px solid #ffffff12;
  display: block;
  margin: 0 auto;
}
#task-instruction {
  font-size: 0.8rem;
  color: var(--text-dim);
  text-align: center;
  margin-top: 0.5em;
  letter-spacing: 0.05em;
}

/* ========== EVENT OVERLAY ========== */
#event-overlay {
  z-index: 90;
}
#event-content {
  background: var(--bg-panel);
  border: 1px solid #ffffff18;
  border-radius: var(--radius-lg);
  padding: 2em 3em;
  text-align: center;
  max-width: 400px;
  box-shadow: var(--shadow);
}
#event-icon { font-size: 3rem; margin-bottom: 0.4em; }
#event-title { font-size: 1.4rem; font-weight: 800; margin-bottom: 0.3em; }
#event-desc { color: var(--text-dim); font-size: 0.9rem; margin-bottom: 1.2em; }

/* ========== PAUSE OVERLAY ========== */
#pause-overlay { z-index: 95; }
#pause-content {
  background: var(--bg-panel);
  border: 1px solid #ffffff18;
  border-radius: var(--radius-lg);
  padding: 2.5em;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 1em;
  min-width: 240px;
  box-shadow: var(--shadow);
}
#pause-content h2 {
  font-size: 1.8rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 0.5em;
}

/* ========== MEETING SCREEN ========== */
#screen-meeting {
  flex-direction: column;
  align-items: stretch;
}
#meeting-ui {
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-rows: auto 1fr auto;
  grid-template-columns: 1fr 1fr;
  gap: 1em;
  padding: 1em;
  height: 100%;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

#meeting-header {
  grid-column: 1 / -1;
  text-align: center;
  padding: 0.5em;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3em;
}
#siren-lights {
  display: flex;
  gap: 2em;
}
.siren-light {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--red);
  animation: siren-blink 0.6s infinite alternate;
}
.siren-light:nth-child(2) { animation-delay: 0.3s; }
@keyframes siren-blink {
  from { opacity: 1; box-shadow: 0 0 20px var(--red); }
  to   { opacity: 0.2; box-shadow: none; }
}

#meeting-title {
  font-size: clamp(1.4rem, 4vw, 2.2rem);
  font-weight: 900;
  letter-spacing: 0.15em;
  color: var(--red);
  text-shadow: 0 0 20px #e8404080;
}
#meeting-caller { font-size: 0.85rem; color: var(--text-dim); }

#statements-area, #clues-area, #vote-area {
  background: var(--bg-panel);
  border: 1px solid #ffffff12;
  border-radius: var(--radius-lg);
  padding: 1em;
  overflow-y: auto;
}
#statements-area { grid-column: 1; }
#clues-area { grid-column: 2; }
#vote-area {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 0.8em;
}

#statements-area h3,
#clues-area h3,
#vote-area h3 {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.6em;
  padding-bottom: 0.4em;
  border-bottom: 1px solid #ffffff10;
}

.statement-card {
  display: flex;
  align-items: flex-start;
  gap: 0.6em;
  padding: 0.5em;
  border-radius: var(--radius);
  background: #ffffff08;
  margin-bottom: 0.4em;
  font-size: 0.82rem;
}
.statement-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 0.15em;
}
.statement-name {
  font-weight: 700;
  color: var(--text);
  margin-right: 0.3em;
}
.statement-text { color: var(--text-dim); }

.clue-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5em;
  font-size: 0.8rem;
  color: var(--text-dim);
  padding: 0.3em 0;
  border-bottom: 1px solid #ffffff08;
}
.clue-icon { flex-shrink: 0; }

#vote-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
  justify-content: center;
}
.vote-card {
  background: var(--bg-panel2);
  border: 2px solid #ffffff15;
  border-radius: var(--radius);
  padding: 0.6em 0.9em;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3em;
  min-width: 80px;
  transition: border-color 0.2s, transform 0.15s;
  position: relative;
}
.vote-card:hover { border-color: var(--accent); transform: scale(1.05); }
.vote-card.selected { border-color: var(--red); box-shadow: 0 0 12px #e8404060; }
.vote-card.dead { opacity: 0.4; cursor: not-allowed; pointer-events: none; }
.vote-card canvas { border-radius: var(--radius); }
.vote-name {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.vote-suspicion {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--red);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 5px;
}
.vote-btn-wrap {
  text-align: center;
}
#btn-skip-vote { align-self: center; }

#suspicion-wrap {
  display: flex;
  align-items: center;
  gap: 0.5em;
  padding-top: 0.3em;
}
#suspicion-bar-bg {
  flex: 1;
  height: 8px;
  background: #ffffff15;
  border-radius: 4px;
  overflow: hidden;
}
#suspicion-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--green), var(--accent3), var(--red));
  border-radius: 4px;
  transition: width 0.5s;
}

/* ========== EJECTION SCREEN ========== */
#screen-ejection {
  flex-direction: column;
}
#ejection-ui {
  position: relative;
  z-index: 10;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6em;
}
#ejection-name {
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: 0.1em;
}
#ejection-verdict {
  font-size: 1.1rem;
  color: var(--text-dim);
}
#ejection-flavor {
  font-size: 0.85rem;
  color: var(--text-dim);
  max-width: 340px;
  font-style: italic;
}

/* ========== WIN/LOSE SCREEN ========== */
#screen-win {
  flex-direction: column;
}
#win-ui {
  position: relative;
  z-index: 10;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1em;
}
.result-title {
  font-size: clamp(2rem, 6vw, 4rem);
  font-weight: 900;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
#result-title.crew-win {
  background: linear-gradient(135deg, var(--accent), var(--blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
#result-title.impostor-win {
  background: linear-gradient(135deg, var(--red), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
#result-subtitle {
  font-size: 1rem;
  color: var(--text-dim);
  letter-spacing: 0.1em;
}
#result-recap {
  background: var(--bg-panel);
  border: 1px solid #ffffff12;
  border-radius: var(--radius-lg);
  padding: 1.2em 2em;
  font-size: 0.85rem;
  color: var(--text-dim);
  max-width: 500px;
  width: 90vw;
  line-height: 1.8;
  text-align: left;
}

/* ========== ANIMATIONS ========== */
@keyframes pulse-red {
  0%, 100% { box-shadow: 0 0 6px #e8404060; }
  50% { box-shadow: 0 0 18px #e84040c0; }
}
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes slideUp {
  from { transform: translateY(30px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-6px); }
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
.animate-in { animation: fadeIn 0.3s ease forwards; }
.animate-slide-up { animation: slideUp 0.4s ease forwards; }

/* ========== RESPONSIVE ========== */
@media (max-width: 640px) {
  #meeting-ui {
    grid-template-columns: 1fr;
  }
  #statements-area { grid-column: 1; }
  #clues-area { grid-column: 1; }
  #vote-area { grid-column: 1; }
  #task-bar-bg { width: 80px; }
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #ffffff25; border-radius: 2px; }

.hidden { display: none !important; }
