/* ============================================================
   KISA Detective — Theme: Sage Grove
   Dark teal-charcoal + sage green + warm cream
   ============================================================ */

:root {
  --bg:       #1e2424;
  --card:     #2b4f4a;
  --card2:    #243e3a;
  --border:   #3d6b63;
  --gold:     #a7c58e;
  --gold2:    #c8e0b0;
  --text:     #e8ddcb;
  --muted:    #7aaa88;
  --accent:   #c0392b;
  --green:    #5b8a6a;
  --red:      #c0392b;
}

/* ── Reset ── */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', Georgia, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
}

/* ── Header ── */
header {
  background: var(--card2);
  padding: .75rem 1.1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--gold);
  flex-shrink: 0;
}
.header-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: .03em;
}

/* ── Lang toggle ── */
.lang-toggle { display: flex; gap: .35rem; }
.lang-btn {
  padding: .28rem .7rem;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: .82rem;
  font-weight: 700;
}
.lang-btn.active {
  background: var(--gold);
  color: #1e2424;
  border-color: var(--gold);
}

/* ── Tab bar ── */
.tab-bar {
  display: flex;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.tab-btn {
  flex: 1;
  padding: .75rem .3rem;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: .95rem;
  font-weight: 700;
  border-bottom: 3px solid transparent;
  transition: all .2s;
  line-height: 1.3;
  text-align: center;
}
.tab-btn.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}
.tab-btn.pulse { animation: pulse 1s infinite; }
@keyframes pulse {
  0%,100% { background: transparent; }
  50%      { background: rgba(201,162,39,.15); }
}

/* ── Panels ── */
.panel { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 1rem; padding-bottom: calc(1rem + 120px + env(safe-area-inset-bottom, 0px)); display: none; }
.panel.active { display: block; }

/* ── Section label ── */
.section-label {
  font-size: .78rem;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: .1em;
  font-weight: 700;
  padding-bottom: .35rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: .85rem;
}

/* ── Registration ── */
#view-reg {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 1.1rem;
  padding: 1.5rem;
}
.reg-logo {
  width: 120px;
  height: 120px;
  border-radius: 24px;
  object-fit: cover;
  box-shadow: 0 4px 24px rgba(0,0,0,.6);
  border: 2px solid var(--gold);
}
.reg-card {
  background: var(--card);
  border-radius: 12px;
  padding: 1.75rem;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  border: 1px solid var(--border);
}
.reg-card h2 {
  text-align: center;
  font-size: 1.3rem;
  color: var(--gold);
  letter-spacing: .04em;
}

/* ── Inputs ── */
input, textarea, select {
  width: 100%;
  padding: .7rem .9rem;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--card2);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--gold);
}
textarea { resize: vertical; min-height: 80px; }

/* ── Buttons ── */
.btn {
  padding: .7rem 1.25rem;
  border-radius: 7px;
  border: none;
  font-weight: 700;
  cursor: pointer;
  font-size: 1rem;
  width: 100%;
  transition: opacity .2s;
  font-family: inherit;
  letter-spacing: .03em;
}
.btn:disabled { opacity: .35; cursor: not-allowed; }
.btn-primary { background: var(--gold); color: #1e2424; box-shadow: 0 4px 0 #5a7a50; }
.btn-primary:active { box-shadow: 0 1px 0 #5a7a50; }
.btn-gold  { background: var(--gold); color: #1e2424; box-shadow: 0 4px 0 #5a7a50; }
.btn-gold:active { box-shadow: 0 1px 0 #5a7a50; }
.btn-gold:hover { background: var(--gold2); }
.btn-success { background: var(--green); color: #1e2424; box-shadow: 0 4px 0 #0d1f14; }
.btn-success:active { box-shadow: 0 1px 0 #0d1f14; }
.btn-gold  { background: var(--gold); color: #1e2424; box-shadow: 0 4px 0 #3a5030; }
.btn-gold:active { box-shadow: 0 1px 0 #3a5030; }

/* ── Status messages ── */
.status-msg { text-align: center; font-size: .9rem; color: var(--muted); font-style: italic; }
.error-msg  { color: var(--red); text-align: center; font-size: .88rem; }

/* ── Sticky notes (clues) ── */
.board-empty {
  text-align: center;
  color: var(--muted);
  padding: 3rem 1rem;
}
.sticky-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
  gap: 1rem;
  padding-top: .75rem;
}
.sticky {
  background: #f5f0d8;
  color: #1a1208;
  border-radius: 2px;
  padding: .9rem .85rem .85rem;
  font-size: .9rem;
  line-height: 1.6;
  box-shadow: 2px 3px 10px rgba(0,0,0,.5);
  border-top: 3px solid var(--gold);
  position: relative;
  margin-top: 10px;
  animation: stickyIn .4s ease;
}
@keyframes stickyIn {
  from { transform: translateY(-16px) rotate(-1deg); opacity: 0; }
  to   { transform: translateY(0) rotate(0); opacity: 1; }
}
.sticky-pin {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 18px;
  line-height: 1;
}
.sticky-num {
  font-size: .72rem;
  font-weight: 800;
  color: #8a7020;
  margin-bottom: .4rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}

/* ── Suspects ── */
.suspects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: .9rem;
}
.suspect-card {
  background: var(--card);
  border-radius: 9px;
  overflow: hidden;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color .2s, transform .2s;
}
.suspect-card:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
}
.suspect-photo { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--card2); }
.suspect-placeholder {
  width: 100%;
  aspect-ratio: 1;
  background: var(--card2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
}
.suspect-name {
  padding: .5rem .7rem .2rem;
  font-weight: 700;
  font-size: .95rem;
  color: var(--text);
}

/* ── Suspect modal ── */
.modal-bg {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.9);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-bg.open { display: flex; }
.modal-card {
  background: var(--card);
  border-radius: 12px;
  max-width: 820px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: row;
  border: 1px solid var(--gold);
}
.modal-photo-wrap {
  width: 45%;
  flex-shrink: 0;
  background: #111;
  border-radius: 12px 0 0 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-photo { width: 100%; height: 100%; object-fit: cover; display: block; }
.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .85rem;
}
.modal-name { font-size: 1.3rem; font-weight: 700; color: var(--gold); }
.modal-bio  { color: var(--text); line-height: 1.8; font-size: 1rem; flex: 1; }
.close-btn {
  align-self: flex-end;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: .35rem .85rem;
  cursor: pointer;
  font-size: .85rem;
  font-weight: 700;
}

/* ── Suspect modal: mobile responsive ── */
@media (max-width: 599px) {
  .modal-card {
    flex-direction: column;
    max-height: 92vh;
  }
  .modal-photo-wrap {
    width: 100%;
    height: 240px;
    flex-shrink: 0;
    border-radius: 12px 12px 0 0;
  }
  .modal-photo { object-fit: cover; }
  .modal-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ── Submit / betting ── */
.submit-locked { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.lock-icon { font-size: 3rem; margin-bottom: .75rem; }
.field-label {
  font-size: .82rem;
  color: var(--gold);
  font-weight: 700;
  margin-bottom: .4rem;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.sus-select-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: .5rem;
  margin-bottom: 1rem;
}
.sus-option {
  padding: .5rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 7px;
  cursor: pointer;
  text-align: center;
  font-size: .9rem;
  transition: all .2s;
  color: var(--muted);
}
.sus-option.selected {
  border-color: var(--gold);
  background: rgba(201,162,39,.12);
  color: var(--gold);
  font-weight: 700;
}
.submit-success { text-align: center; padding: 2.5rem 1rem; }
.submit-success .check { font-size: 3.5rem; }
.submit-summary { color: var(--muted); margin-top: .5rem; font-size: .95rem; }

/* ── Results ── */
.results-list { display: flex; flex-direction: column; gap: .75rem; }
.result-row {
  background: var(--card);
  border-radius: 9px;
  padding: .9rem 1.1rem;
  display: flex;
  align-items: center;
  gap: .9rem;
  border: 1px solid var(--border);
}
.result-rank { font-size: 1.5rem; font-weight: 900; color: var(--gold); min-width: 2rem; text-align: center; }
.result-name { font-weight: 700; flex: 1; font-size: 1.05rem; }
.result-pts  { font-size: 1.15rem; font-weight: 700; color: var(--gold); }

/* ── Notes ── */
#team-notes {
  width: 100%;
  height: calc(100vh - 200px);
  padding: .9rem;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: .95rem;
  line-height: 1.7;
  resize: none;
  font-family: inherit;
}
#team-notes:focus { outline: none; border-color: var(--gold); }

/* ── Timer footer ── */
.timer-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--gold);
  transition: width 1s linear;
  z-index: 400;
  display: none;
}
.timer-footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--card2);
  border-top: 1px solid var(--gold);
  padding: .5rem 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .85rem;
  z-index: 50;
  transform: translateY(100%);
  transition: transform .3s;
}
.timer-footer.visible { transform: translateY(0); }
.timer-label { color: var(--muted); font-size: .9rem; font-style: italic; }
.timer-clock { font-size: 1.5rem; font-weight: 900; color: var(--gold); letter-spacing: 2px; }

/* ── Intro overlay ── */
#view-intro {
  display: none;
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 100;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
#view-intro.show { display: flex; }
.intro-img { max-width: 100%; max-height: 65vh; object-fit: contain; }
.intro-txt {
  color: var(--text);
  font-size: 1.3rem;
  text-align: center;
  padding: 1rem 2rem;
  text-shadow: 0 2px 10px rgba(0,0,0,.9);
  max-width: min(90vw, 820px);
  line-height: 1.6;
}

/* ── Connection dot ── */
.connected-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  display: inline-block;
  margin-right: .35rem;
}

/* ── Ornament ── */
.ornament {
  text-align: center;
  color: var(--gold);
  font-size: .85rem;
  opacity: .4;
  padding: .5rem;
  letter-spacing: .25em;
}

/* ── Hidden ── */
.hidden { display: none !important; }

/* ── Fuse glow ── */
@keyframes fuseGlow {
  from { box-shadow: 0 0 4px 2px #f5c842, 0 0 8px 4px #e8922a; }
  to   { box-shadow: 0 0 8px 4px #fff7a0, 0 0 16px 6px #f5c842; }
}

/* ── Chip buttons ── */
.chip-btn {
  padding: .35rem .75rem;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--card2);
  color: var(--muted);
  cursor: pointer;
  font-size: .8rem;
  font-weight: 700;
  transition: all .15s;
  font-family: inherit;
}
.chip-btn:hover  { border-color: var(--gold); color: var(--gold); }
.chip-btn.active { background: var(--gold); color: #1e2424; border-color: var(--gold); }