/* ===========================
   Steam Review Guessr – Clean Styles
   =========================== */

/* Theme */
:root{
  --bg: #171a21;
  --panel: #1b2838;
  --accent: #66c0f4;
  --muted: #a3b9cc;
  --text: #c7d5e0;
  --ok: #66c0f4;
  --bad: #bd3c3c;
}

* { box-sizing: border-box; }

body{
  margin:0;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 800px at 15% -10%, #243449 0%, transparent 60%),
    radial-gradient(1200px 800px at 110% 10%, #162332 0%, transparent 60%),
    var(--bg);
}

/* Page shell */
.container{
  max-width: 1024px;
  margin: 32px auto;
  padding: 0 16px 80px; /* keep content off the footer chip */
}

h1{
  font-size: 32px;
  font-weight: 800;
  color: #fff;
  letter-spacing: .8px;
  margin: 0 0 8px;
  text-shadow: 0 2px 12px rgba(0,0,0,.4);
}
h1::after{
  content:"";
  display:block;
  height:2px;
  margin-top:10px;
  background: linear-gradient(90deg, transparent, rgba(102,192,244,.6), transparent);
}

.subtitle{ color: var(--muted); margin-bottom: 24px; }

/* Centered column sections */
.center,
#reviews,
#guessesPanel,
.input-row,
.game-controls{
  max-width: 820px;
  margin-left: auto;
  margin-right: auto;
}

/* ---------------------------
   Input + Autocomplete
   --------------------------- */
.input-row{
  display:flex;
  justify-content:center;
  align-items:center;
  gap:10px;
  margin: 8px auto 6px;
  width: 100%;
}

.input-stack{
  position: relative;      /* anchors dropdown */
  display: block;
  flex: 1 1 520px;
  max-width: 520px;
  min-width: 260px;
}

#guessInput{
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #263645;
  background: #0e141b;
  color: #e6eef5;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}
#guessInput:focus{
  border-color: #3aa0ff;
  box-shadow: 0 0 0 2px rgba(58,160,255,0.25);
}

/* Autocomplete dropdown matches input width */
.datalist{
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 100%;
  max-height: 240px;
  overflow-y: auto;
  background:#0e141b;
  border:1px solid #263645;
  border-radius:8px;
  padding:4px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.35);
  z-index:100;
}
.datalist > div{
  padding: 8px 10px;
  cursor: pointer;
  border-radius: 6px;
}
.datalist > div:hover,
.datalist > div.active{
  background: rgba(255,255,255,0.06);
}

/* ---------------------------
   Buttons & Badges
   --------------------------- */
button, .button{
  background: linear-gradient(180deg, #66c0f4, #1b9dd9);
  color:#0b1722;
  font-weight:700;
  border:none;
  padding:10px 14px;
  border-radius:8px;
  cursor:pointer;
  box-shadow: 0 2px 0 rgba(0,0,0,.25);
  transition: transform .06s ease, filter .15s ease, box-shadow .15s ease;
}
button.secondary, .button{
  background:#263645;
  color: var(--text);
}
button:active, .button:active{ transform: translateY(1px); }
button:disabled{ opacity:.6; cursor:not-allowed; }

/* Controls row (single Guess button) */
.game-controls{
  display:flex;
  justify-content:center;
  align-items:center;
  gap: 10px 12px;
  flex-wrap: wrap;
  margin: 6px auto 14px;
}

.badge{
  display:inline-block;
  font-size: 12px;
  font-weight:700;
  color:#fff;
  background:#417a9b;
  border-radius: 6px;
  padding: 4px 8px;
  white-space:nowrap;
}

/* Status line */
.status{
  max-width: 820px;
  margin: 0 auto 12px;
  padding: 10px 12px;
  background: #0e141b;
  border: 1px solid #263645;
  border-radius: 8px;
}
.correct{ color:#93e08f; }
.incorrect{ color: var(--bad); }

/* ---------------------------
   Reviews
   --------------------------- */
.review{
  background: linear-gradient(180deg, rgba(38,54,69,.35), rgba(27,40,56,.65));
  border: 1px solid rgba(102,192,244,.15);
  border-radius: 10px;
  padding: 16px;
  margin: 12px auto 18px;
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
  transition: transform .12s ease, border-color .15s ease, box-shadow .15s ease;
}
.review:hover{ transform: translateY(-2px); border-color: rgba(102,192,244,.35); }
.review .header{ display:flex; align-items:center; gap:10px; margin-bottom:10px; }
.thumb{ width:36px; height:36px; display:grid; place-items:center; background:#263645; border-radius:6px; }
.thumb svg{ width:22px; height:22px; fill: var(--accent); }
.review .body{ font-size:15px; line-height:1.5; white-space: pre-wrap; color: var(--text); }
.meta{ margin-top:10px; font-size:12px; color: var(--muted); display:flex; gap:16px; flex-wrap:wrap; }
.pill{ background:#0e141b; border:1px solid #263645; border-radius:999px; padding:2px 8px; line-height:20px; }

/* New review animation */
.review.fade-in{ animation: fadein .18s ease-out both; }
@keyframes fadein{ from{opacity:0; transform: translateY(4px);} to{opacity:1; transform:none;} }

/* ---------------------------
   Previous Guesses
   --------------------------- */
#guessesPanel{
  float:none !important;
  position: static !important;
  background: var(--panel);
  border: 1px solid #263645;
  border-radius: 10px;
  padding: 12px;
  margin: 12px auto 16px;
}
.guesses-header{ font-weight: 700; color:#fff; margin-bottom:8px; }
#guessesList{ list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:8px; }

.guess-item{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:10px 12px;
  background:#0e141b;
  border:1px solid #263645;
  border-radius:8px;
}
.guess-left{ display:flex; align-items:center; gap:10px; min-width:0; }
.guess-name{ font-weight:600; color: var(--text); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.guess-right{ display:flex; gap:8px; flex-wrap:wrap; }
.badge.series{ background:#417a9b; }
.badge.correct{ background:#4a9b5f; }
.badge.wrong{ background:#7a4141; }

/* ---------------------------
   Modal & Confetti
   --------------------------- */
.modal.hidden{ display:none; }
.modal .backdrop{ position:fixed; inset:0; background:rgba(0,0,0,.6); z-index:1000; }
.modal .dialog{
  position:fixed;
  top:50%; left:50%; transform:translate(-50%,-50%);
  background: var(--panel);
  color: var(--text);
  border:1px solid #263645;
  border-radius:10px;
  padding:18px;
  width: min(520px, 92vw);
  box-shadow: 0 10px 40px rgba(0,0,0,.45);
  z-index:1001;
  display:grid; gap:12px;
}
.modal .dialog h2{ margin: 4px 0 0; font-size:22px; color:#fff; }
#modalSubtitle{ margin: 0 0 4px; color: var(--muted); }
.modal .dialog .actions{ display:flex; gap:10px; justify-content:flex-end; }
.modal .dialog .close{
  position:absolute; top:6px; right:8px; background:transparent;
  color: var(--text); font-size:22px; border:none; cursor:pointer;
}
.button{ background:#263645; color: var(--text); text-decoration:none; display:inline-block; }
.button.primary{ background: linear-gradient(180deg, #66c0f4, #1b9dd9); color:#0b1722; font-weight:700; }

.artwrap{
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid #263645;
  background: #0e141b;
  aspect-ratio: 616/353; /* Steam capsule aspect */
}
.artwrap img{ width:100%; height:100%; object-fit:cover; display:block; }

.confetti{ position:fixed; inset:0; pointer-events:none; }
.confetti.hidden{ display:none; }

/* ---------------------------
   Footer chip
   --------------------------- */
.site-footer{
  position: fixed;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  padding: 6px 12px;
  font-size: 12px;
  color: var(--muted);
  background: rgba(14,20,27,0.85);
  border: 1px solid #263645;
  border-radius: 999px;
  box-shadow: 0 6px 24px rgba(0,0,0,.25);
  z-index: 900;
  text-align: center;
}
.site-footer a{
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
  border-bottom: 1px dotted transparent;
}
.site-footer a:hover{ border-bottom-color: var(--accent); }

/* ---------------------------
   Small screens
   --------------------------- */
@media (max-width: 720px){
  .input-stack{ max-width: 100%; }
  .game-controls{ gap: 8px; }
}
/* Centered input row + tidy spacing */
.input-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px 12px;
  flex-wrap: wrap;         /* wraps on small screens */
  margin: 8px auto 6px;
  width: 100%;
  max-width: 820px;
}

.input-stack {
  position: relative;      /* anchors the dropdown */
  display: block;
  flex: 1 1 520px;
  max-width: 520px;
  min-width: 260px;
}

/* Input visual */
#guessInput {
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #263645;
  background: #0e141b;
  color: #e6eef5;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}
#guessInput:focus {
  border-color: #3aa0ff;
  box-shadow: 0 0 0 2px rgba(58,160,255,0.25);
}

/* Dropdown exactly matches input width */
.datalist {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 100%;
  max-height: 240px;
  overflow-y: auto;
  background: #0e141b;
  border: 1px solid #263645;
  border-radius: 8px;
  padding: 4px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.35);
  z-index: 100;
}
.datalist > div { padding: 8px 10px; cursor: pointer; border-radius: 6px; }
.datalist > div:hover, .datalist > div.active { background: rgba(255,255,255,0.06); }

/* Rounds badge to the right of the input */
.badge.rounds {
  align-self: center;
  white-space: nowrap;
}

/* Ensure guesses panel and reviews stay centered */
#guessesPanel,
#reviews,
.game-controls {
  max-width: 820px;
  margin-left: auto;
  margin-right: auto;
}

/* Modal: clicking backdrop should be possible */
.modal .backdrop { pointer-events: auto; }

/* Review card states by recommendation */
.review.recommended {
  border-color: rgba(74, 155, 95, 0.55);           /* greenish */
  box-shadow: 0 10px 30px rgba(0, 50, 0, 0.25);
}
.review.not-recommended {
  border-color: rgba(122, 65, 65, 0.55);           /* reddish */
  box-shadow: 0 10px 30px rgba(50, 0, 0, 0.25);
}

/* Optional: tint the icon chip a little based on state */
.review.recommended .thumb { background: #254232; }
.review.not-recommended .thumb { background: #3f2626; }

/* Badges for "Recommended" vs "Not Recommended" */
.pill.reco { background: #1e3a29; border-color: #2d6643; color: #b8f3c7; }
.pill.nreco { background: #3a1f1f; border-color: #7a4141; color: #f2b9b9; }

/* Keep the rounds badge aligned to the input row */
.badge.rounds { align-self: center; white-space: nowrap; }

/* Review header badge colors (only the tiny state chip inside .review) */
.review .badge {
  background: #2d6643;     /* green-ish for Recommended */
  border: 1px solid #3a8b5a;
  color: #bff0ce;
}
.review .badge.notrec {
  background: #7a4141;     /* red-ish for Not Recommended */
  border: 1px solid #a45656;
  color: #f2c2c2;
}
/* Back-to-main link */
.topbar {
  max-width: 1024px;
  margin: 8px auto 6px;
  padding: 0 16px;
  display: flex;
  justify-content: flex-end;
}
.backlink {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}
.backlink:hover { text-decoration: underline; }

/* ===========================
   Steam: two-column layout + sidebar chat
   =========================== */

/* Grid layout: main + right rail */
.game-layout {
  display: grid;
  grid-template-columns: 1fr 340px; /* main + sidebar width */
  gap: 16px;
  align-items: start;
}

/* Sidebar sticks as you scroll (like gamer page) */
.game-side {
  position: sticky;
  top: 12px;
  align-self: start;
}

/* Responsive: stack on narrow widths */
@media (max-width: 980px) {
  .game-layout {
    grid-template-columns: 1fr;
  }
  .game-side {
    position: static;
  }
}

/* Chat card (square-ish, scrolls inside) */
.chat-card{
  width: 100%;
  background: var(--panel);
  border: 1px solid #263645;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
  max-height: 72vh;        /* keep it square-ish and visible */
  overflow: hidden;        /* header fixed, list scrolls */
}

.chat-card .guesses-header{
  font-weight: 800;
  color: #fff;
}

.chat-card .subhead{
  font-size: 12px;
  color: var(--muted);
  padding: 0 12px 8px 12px;
}

/* Chat list scroll area */
#chatList{
  list-style: none;
  margin: 0;
  padding: 6px;
  border-top: 1px solid #263645;
  max-height: calc(72vh - 48px); /* adjust to header size */
  overflow-y: auto;
}

/* Chat items (same visual language as before) */
#chatList li{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .6rem .7rem;
  background: #0e141b;
  border: 1px solid #263645;
  border-radius: 8px;
  margin: 6px 6px;
  transition: background .12s ease, border-color .12s ease;
}
#chatList li:hover{ background: #111923; border-color: #30465e; }
#chatList li .left{ display:flex; align-items:center; gap:.45rem; min-width:0; }
#chatList li .user, #chatList li .guess{
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 14rem;
}
@media (min-width: 720px){
  #chatList li .user, #chatList li .guess { max-width: 18rem; }
}
#chatList li .sep{ opacity: .6; margin: 0 .25rem; }

/* Platform badges (scoped to chat) */
.chat-badge{
  font-size: 11px; line-height: 1; padding: .25rem .45rem; border-radius: .5rem;
  font-weight: 700; letter-spacing: .02em; display: inline-flex; align-items: center; user-select: none;
}
.chat-badge--twitch { background:#9146FF; color:#fff; }
.chat-badge--tiktok { background:#111827; color:#fff; }
.chat-badge--youtube{ background:#FF0033; color:#fff; }
.chat-badge--chat   { background:#6B7280; color:#fff; } /* fallback */

/* Empty state inside the Steam chat card */
.chat-empty{
  padding: 10px 12px;
  font-size: 13px;
  color: var(--muted);
}

/* in styles.css or inside <style> on the page */
button[disabled] { opacity: .5; cursor: not-allowed; }

