/* ================================================================
   Category Game — whiteboard / PowerPoint styling
   ================================================================ */

:root {
  --paper:      #f5f2e9;
  --paper-2:    #efeadb;
  --ink:        #26231d;
  --ink-soft:   #4a463d;
  --line:       #cfc7b3;
  --blue:       #3b6ef2;
  --red:        #e5484d;
  --green:      #1f9d5a;
  --yellow:     #ffdd57;
  --pink:       #ff8fb1;
  --card:       #fffdf7;
  --shadow:     rgba(38,35,29,.85);

  --font-title: 'Permanent Marker', cursive;
  --font-hand:  'Patrick Hand', 'Kalam', cursive;
  --font-note:  'Kalam', cursive;
}

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

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-hand);
  color: var(--ink);
  background-color: var(--paper);
  /* faint whiteboard dot grid */
  background-image:
    radial-gradient(circle, rgba(38,35,29,.07) 1.1px, transparent 1.2px);
  background-size: 26px 26px;
  font-size: 20px;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 940px;
  margin: 0 auto;
  padding: 14px 16px 60px;
}

/* ---------- Top bar (the "whiteboard header") ---------- */
#topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 4px 16px;
  border-bottom: 3px solid var(--ink);
  position: relative;
  margin-bottom: 8px;
}
#topbar::after { /* sketchy second line under the header */
  content: "";
  position: absolute;
  left: 6px; right: 24px; bottom: -8px;
  height: 3px;
  background: var(--ink);
  transform: rotate(-.4deg);
  opacity: .5;
  border-radius: 3px;
}
.brand {
  font-family: var(--font-title);
  font-size: 26px;
  letter-spacing: .5px;
  margin-right: auto;
  color: var(--ink);
  transform: rotate(-2deg);
}
.brand small { display:block; font-family: var(--font-hand); font-size: 13px; opacity:.6; letter-spacing:0; transform: rotate(2deg); }

.score-chip {
  display: flex;
  align-items: baseline;
  gap: 8px;
  background: var(--card);
  border: 2.5px solid var(--ink);
  border-radius: 14px;
  padding: 4px 12px;
  box-shadow: 3px 3px 0 var(--shadow);
}
.score-chip.me { background: var(--yellow); }
.score-chip .nm { font-size: 16px; max-width: 8ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score-chip .sc { font-family: var(--font-title); font-size: 22px; }
.score-chip .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line); display:inline-block; }
.score-chip .dot.on { background: var(--green); }

.round-badge {
  font-family: var(--font-title);
  font-size: 15px;
  background: var(--ink);
  color: var(--paper);
  padding: 3px 10px;
  border-radius: 10px;
  transform: rotate(-2deg);
}

.gear {
  font-size: 22px; cursor: pointer; background: none; border: none; padding: 4px 6px;
  line-height: 1; border-radius: 10px;
}
.gear:hover { background: rgba(0,0,0,.06); }

#menu {
  position: absolute; right: 4px; top: 54px; z-index: 30;
  background: var(--card); border: 2.5px solid var(--ink); border-radius: 14px;
  box-shadow: 4px 4px 0 var(--shadow);
  padding: 6px; min-width: 190px;
}
#menu button {
  display: block; width: 100%; text-align: left;
  background: none; border: none; font-family: var(--font-hand); font-size: 18px;
  padding: 8px 10px; border-radius: 8px; cursor: pointer; color: var(--ink);
}
#menu button:hover { background: var(--paper-2); }
#menu .danger { color: var(--red); }
#menu hr { border: none; border-top: 1.5px dashed var(--line); margin: 4px 2px; }

/* ---------- Banner (preview-mode notice) ---------- */
#banner:not(:empty) {
  background: repeating-linear-gradient(45deg, #fff6d6, #fff6d6 12px, #ffeeb0 12px, #ffeeb0 24px);
  border: 2.5px dashed var(--ink);
  border-radius: 12px;
  padding: 8px 14px;
  margin: 6px 0 12px;
  font-size: 16px;
  transform: rotate(-.3deg);
}
#banner b { font-family: var(--font-title); font-weight: normal; }

/* ---------- Stage / slides ---------- */
#stage { padding-top: 8px; }
.slide {
  animation: pop .28s ease;
  text-align: center;
}
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98);} to {opacity:1; transform:none;} }

.slide h1 {
  font-family: var(--font-title);
  font-size: clamp(28px, 6vw, 46px);
  margin: 10px 0 6px;
  transform: rotate(-1.2deg);
}
.slide h2 {
  font-family: var(--font-title);
  font-size: clamp(22px, 4.5vw, 32px);
  margin: 6px 0;
}
.subtle { color: var(--ink-soft); font-size: 18px; }
.hint { font-size: 15px; color: var(--ink-soft); opacity: .85; }

/* ---------- Cards & sticky notes ---------- */
.card {
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: 18px;
  box-shadow: 6px 6px 0 var(--shadow);
  padding: 22px;
  margin: 16px auto;
  max-width: 620px;
}

.note {
  display: inline-block;
  background: var(--yellow);
  border: 2.5px solid var(--ink);
  border-radius: 6px;
  padding: 14px 26px;
  font-family: var(--font-note);
  font-weight: 700;
  font-size: clamp(22px, 5vw, 34px);
  box-shadow: 4px 6px 0 var(--shadow);
  transform: rotate(-1.6deg);
  position: relative;
  margin: 10px 0;
  max-width: 100%;
  word-break: break-word;
}
.note::before { /* tape */
  content: "";
  position: absolute; top: -14px; left: 50%; transform: translateX(-50%) rotate(3deg);
  width: 74px; height: 24px;
  background: rgba(255,255,255,.55);
  border: 1.5px solid rgba(38,35,29,.25);
}
.note.pink  { background: var(--pink); }
.note.blue  { background: #b9d0ff; }

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--font-hand);
  font-size: 20px;
  background: var(--card);
  color: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 14px;
  padding: 12px 22px;
  cursor: pointer;
  box-shadow: 0 5px 0 var(--shadow);
  transition: transform .05s, box-shadow .05s;
  margin: 6px;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--shadow); }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: 0 5px 0 var(--shadow); }
.btn.big { font-size: 24px; padding: 16px 30px; border-radius: 16px; }
.btn.primary { background: var(--blue); color: #fff; }
.btn.yes { background: var(--green); color: #fff; }
.btn.no  { background: var(--red);  color: #fff; }
.btn.ghost { background: transparent; box-shadow: 0 4px 0 var(--shadow); }
.btn.wide { width: 100%; max-width: 420px; justify-content: center; }

/* ---------- Inputs ---------- */
input[type="text"], input:not([type]) {
  font-family: var(--font-hand);
  font-size: 20px;
  padding: 12px 14px;
  border: 3px solid var(--ink);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  width: 100%;
  max-width: 460px;
  box-shadow: inset 2px 2px 0 rgba(0,0,0,.04);
}
input:focus { outline: none; border-color: var(--blue); }
label.field { display:block; text-align:left; max-width:460px; margin: 10px auto 4px; font-size:16px; color: var(--ink-soft); }

/* ---------- Seat picker ---------- */
.seat-row { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.seat-card {
  background: var(--card); border: 3px solid var(--ink); border-radius: 16px;
  box-shadow: 5px 5px 0 var(--shadow); padding: 20px 26px; cursor: pointer;
  min-width: 150px; transition: transform .08s;
}
.seat-card:hover { transform: translateY(-3px) rotate(-1deg); }
.seat-card .big-emoji { font-size: 40px; }
.seat-card.taken { opacity: .55; }
.seat-card .taken-tag { font-size: 13px; color: var(--red); }

/* ---------- Picking / thumbnails ---------- */
.dropzone {
  border: 3px dashed var(--ink);
  border-radius: 16px;
  padding: 26px 16px;
  margin: 14px auto;
  max-width: 520px;
  background: rgba(255,255,255,.5);
  transition: background .1s, border-color .1s;
}
.dropzone.drag { background: #dff0ff; border-color: var(--blue); }
.filebtn {
  display: inline-block; cursor: pointer; text-decoration: underline dotted; color: var(--blue);
}
.urlrow { display: flex; gap: 8px; align-items: center; justify-content: center; max-width: 520px; margin: 8px auto; flex-wrap: wrap; }
.urlrow input { max-width: 320px; }

.pics {
  display: flex; flex-wrap: wrap; gap: 14px; justify-content: center;
  margin: 18px auto; max-width: 720px;
}
.pic {
  position: relative;
  width: 130px;
  background: #fff;
  border: 2.5px solid var(--ink);
  border-radius: 8px;
  padding: 8px 8px 6px;
  box-shadow: 3px 4px 0 var(--shadow);
}
.pic:nth-child(even) { transform: rotate(1.5deg); }
.pic:nth-child(odd)  { transform: rotate(-1.5deg); }
.pic img { width: 100%; height: 108px; object-fit: cover; border-radius: 4px; display: block; background: var(--paper-2); }
.pic .lbl { font-size: 13px; margin-top: 4px; color: var(--ink-soft); min-height: 16px; word-break: break-word; }
.pic .rm {
  position: absolute; top: -10px; right: -10px;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--red); color: #fff; border: 2px solid var(--ink);
  font-size: 15px; cursor: pointer; line-height: 1; box-shadow: 2px 2px 0 var(--shadow);
}
.pic .ph { display:flex; align-items:center; justify-content:center; height:108px; color: var(--ink-soft); font-size: 13px; }

.ready-line { margin-top: 8px; font-size: 17px; }
.tick { color: var(--green); font-weight: bold; }
.cross-w { color: var(--ink-soft); }

/* ---------- Guessing ---------- */
.guess-wrap { max-width: 640px; margin: 0 auto; }
.progress { font-size: 17px; color: var(--ink-soft); margin-bottom: 6px; }
.guess-frame {
  background: #fff; border: 3px solid var(--ink); border-radius: 14px;
  box-shadow: 6px 6px 0 var(--shadow); padding: 12px; margin: 10px auto;
  display: inline-block; max-width: 100%;
}
.guess-frame img {
  max-width: 100%; max-height: 52vh; border-radius: 8px; display: block; margin: 0 auto;
  background: var(--paper-2);
}
.guess-frame .loading { padding: 60px 40px; color: var(--ink-soft); }
.role-tag {
  display: inline-block; font-family: var(--font-title); font-size: 17px;
  padding: 4px 14px; border-radius: 20px; margin: 6px 0; transform: rotate(-1deg);
}
.role-tag.guesser { background: var(--blue); color: #fff; }
.role-tag.judge   { background: var(--yellow); border: 2px solid var(--ink); }
.answer-hint { font-size: 16px; color: var(--ink-soft); margin: 6px 0; }
.judge-btns { display: flex; gap: 14px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }

/* ---------- Round recap ---------- */
.recap { display: flex; gap: 26px; justify-content: center; flex-wrap: wrap; margin: 16px 0; }
.recap-col { }
.recap-col h3 { font-family: var(--font-title); font-size: 18px; margin: 6px 0; }
.mini-pics { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; max-width: 320px; }
.mini {
  position: relative; width: 66px; height: 66px; border: 2px solid var(--ink); border-radius: 6px;
  overflow: hidden; background: var(--paper-2);
}
.mini img { width: 100%; height: 100%; object-fit: cover; }
.mini .mark { position: absolute; inset: 0; display:flex; align-items:center; justify-content:center; font-size: 30px; font-weight: bold; }
.mini .mark.ok  { color: var(--green); text-shadow: 0 0 3px #fff, 0 0 3px #fff; }
.mini .mark.bad { color: var(--red);   text-shadow: 0 0 3px #fff, 0 0 3px #fff; }

.points-pop { font-family: var(--font-title); font-size: 22px; }

/* ---------- Game over ---------- */
.crown { font-size: 70px; animation: bob 1.4s ease-in-out infinite; }
@keyframes bob { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-10px)} }
.confetti { font-size: 30px; letter-spacing: 6px; animation: pop .5s ease; }

/* ---------- Waiting animation ---------- */
.dots span { animation: blink 1.2s infinite; }
.dots span:nth-child(2){ animation-delay:.2s } .dots span:nth-child(3){ animation-delay:.4s }
@keyframes blink { 0%,100%{opacity:.2} 50%{opacity:1} }

/* ---------- Mobile ---------- */
@media (max-width: 560px) {
  body { font-size: 18px; }
  .brand { font-size: 21px; }
  .score-chip .sc { font-size: 19px; }
  .btn { font-size: 18px; padding: 11px 18px; }
  .pic { width: 108px; }
  .pic img { height: 90px; }
}
