@import url('https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible+Next:wght@400;500;600;700&family=Pixelify+Sans:wght@400;500;600;700&display=swap');

:root {
  color-scheme: dark;
  --ink: #fff0ce;
  --muted: #b9c8cf;
  --gold: #efbd62;
  --edge: #a9743e;
  --font: 'Atkinson Hyperlegible Next', Arial, sans-serif;
  --display: 'Pixelify Sans', Georgia, serif;
  --wood: repeating-linear-gradient(0deg, #0000 0 14px, #21120855 14px 17px, #ba824518 17px 21px, #0000 21px 37px), linear-gradient(100deg, #392419, #62422b 40%, #3b281e);
  --landscape: url('assets/pixel-meadow.png');
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; background: #071e37; }
body { margin: 0; color: var(--ink); font: 18px var(--font); background: #071e37; }
button, input { font: inherit; }
button { cursor: pointer; color: inherit; }
a, button, input { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid var(--gold); outline-offset: 5px; }
/* Paint on the overlay itself: OBS's default CSS makes body transparent. */
.overlay {
  min-height: 100vh;
  max-width: 1920px;
  margin: auto;
  padding: 0 90px;
  position: relative;
  isolation: isolate;
  background: #071e37 var(--landscape) center / cover no-repeat;
}
.overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background: radial-gradient(ellipse at 37% 44%, #041c35d9 0%, #041c35a6 30%, #041c3530 51%, transparent 68%);
}
header { height: 140px; display: flex; align-items: center; gap: 30px; }
.brand {
  position: relative;
  width: 370px;
  padding: 14px 35px 13px;
  background: var(--wood);
  border: 4px solid #332017;
  outline: 2px solid #b38149;
  box-shadow: inset 0 3px #b78a52, inset 0 -4px #261a13, 5px 7px 0 #04132180;
  text-align: center;
  flex-shrink: 0;
}
.brand::before, .brand::after { content: ''; position: absolute; width: 6px; height: 6px; background: #bd945d; box-shadow: 1px 2px #281d13; top: 50%; }
.brand::before { left: 11px; }
.brand::after { right: 11px; }
.brand-name { display: block; font: 400 43px/1 var(--display); letter-spacing: 0; text-shadow: 1px 2px #21160e; }
.brand-name small { display: block; font: 500 21px var(--font); color: #ecc18a; margin-top: 7px; letter-spacing: 3px; }
.game-meta { display: flex; align-items: center; gap: 18px; }
.round-label { background: #071e32e8; border: 3px solid #9b6a3d; outline: 2px solid #241b18; box-shadow: inset 2px 2px #d59d5333, 4px 4px #03101c80; padding: 12px 18px; white-space: nowrap; }
.round-label { display: flex; align-items: center; gap: 18px; font: 500 22px var(--font); color: #e5d3b0; }
.round-label b { font-weight: 500; margin-left: 7px; }


.session { margin-left: auto; display: flex; align-items: center; gap: 10px; color: #c8d8dd; font-size: 13px; text-shadow: 1px 2px #06142c; max-width: 340px; }
.status-dot { width: 7px; height: 7px; background: #9b9b8a; flex-shrink: 0; }
.status-dot.connected { background: #9de1a8; box-shadow: 0 0 8px #78c99777; }
.status-dot.error { background: #f6a27e; }
main { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 65px; }
.game { min-width: 0; }
#word-progress { font: 500 16px var(--font); color: #b9cbd1; white-space: nowrap; }
#word-progress b { font-weight: 700; color: #f3cf8f; margin: 0; }
.board-area { height: 595px; display: flex; align-items: center; justify-content: center; position: relative; }
#board { display: grid; gap: 6px; }
.cell {
  width: var(--cell); height: var(--cell); display: flex; align-items: center; justify-content: center;
  background: #09243aea; border: 2px solid #b48048; border-radius: 1px;
  box-shadow: inset 1px 1px #f3cb784d, inset -2px -2px #020f21aa, 2px 3px #041322aa;
  font: 700 calc(var(--cell) * .65)/1 var(--font); color: #fff1cc;
}
.cell.revealed { background: #294e4f; border-color: #e5b96c; color: #fff1cc; text-shadow: none; box-shadow: inset 2px 2px #71917b66, inset -2px -2px #092b33, 2px 3px #041322aa; animation: discover .3s ease-out; }
.cell.hinted { background: #394247; color: #c4c3a2; }
.letters-section { text-align: center; padding-top: 10px; }
#letters {
  display: inline-flex; gap: 12px; padding: 13px 16px 17px; background: var(--wood);
  border: 4px solid #281b16; outline: 2px solid #9d6d3b;
  box-shadow: inset 0 3px #c29052, inset 0 -4px #241915, 5px 6px #03142288;
}
.letter-tile {
  width: 76px; height: 79px; display: flex; align-items: center; justify-content: center;
  font: 700 47px/1 var(--font); color: #382719; text-shadow: none;
  border: 3px solid #cb903e;
  background: linear-gradient(135deg, #ffe1a0, #efb95a 62%, #d99a40);
  box-shadow: inset 3px 3px #fff0bc, inset -3px -3px #bb7d35, 0 4px #402819;
}
.letters-section > p { margin: 15px auto 0; padding: 7px 21px 9px; width: fit-content; background: var(--wood); border: 2px solid #a47342; font: 500 21px var(--font); text-shadow: 0 1px #21160e; box-shadow: 3px 4px #02132166; }
#feedback { min-height: 29px; width: fit-content; max-width: 100%; margin: 10px auto 0; padding: 5px 12px; text-align: center; color: #f1cf8a; background: #041b30e6; font: 400 18px var(--font); text-shadow: none; }
#feedback:empty { background: transparent; }
aside { padding-top: 4px; }
.leaderboard, .bonus {
  position: relative; padding: 0 22px 18px; background: #061e30f5;
  border: 6px ridge #95673d; outline: 2px solid #241c17;
  box-shadow: inset 0 0 0 2px #d69d583b, 6px 8px #04132488;
}
h2 { margin: 0; font: 400 29px var(--display); text-shadow: 1px 2px #24170d; }
.leaderboard h2, .bonus h2 {
  background: var(--wood); margin: -1px -23px 0; padding: 14px 22px 17px;
  border-top: 2px solid #bc8a50; border-bottom: 3px solid #261c16;
  box-shadow: 0 2px #c5975044; text-align: center;
}
.leaderboard h2 > span { color: #ffd169; font-size: 25px; margin-right: 8px; }
#leaders { margin-top: 10px; }
.leader-row { display: flex; align-items: center; gap: 13px; padding: 15px 0; min-height: 62px; }
.leader-row + .leader-row { border-top: 1px solid #9f865b44; }
.rank { width: 20px; flex-shrink: 0; font: 500 21px var(--font); color: #b8c3c4; }
.avatar { display: none; }
.leader-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 500 21px var(--font); }
.leader-score { font: 600 25px var(--font); font-variant-numeric: tabular-nums; color: #f3cf80; }
.leader-row:first-child .rank { color: #ffd777; }
.empty-leaders { margin: 30px 0 18px; color: #afc0c5; font: 400 20px var(--font); text-align: center; }
.bonus { margin-top: 35px; min-height: 150px; }
.bonus h2 { display: flex; align-items: center; justify-content: space-between; font-size: 27px; }
.bonus h2 > span { color: #d2b481; font-size: 19px; }
#bonus-words { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 19px; max-height: 155px; overflow: auto; }
.bonus-word { color: #f8deb0; border: 2px solid #99734d; padding: 5px 11px; font: 500 20px var(--font); background: #102b3b; box-shadow: inset 1px 1px #d59b4333, 2px 2px #020e20; }
.waiting { text-align: center; max-width: 760px; padding: 35px; text-shadow: 0 1px #031a30; }

.waiting h1 { font: 400 45px var(--display); margin: 0 0 24px; color: #fff0d3; }
.waiting > p { color: #ccdadc; font: 400 22px/1.7 var(--font); margin: 0; }
.waiting .small-rule { margin-top: 16px; color: #a6c0c7; font-size: 20px; }
.start-command { margin-top: 35px; display: flex; align-items: center; flex-direction: column; gap: 22px; }
.start-command kbd { font: 600 34px var(--font); color: #3e2c1c; text-shadow: none; background: #efbe6c; border: 3px solid #bb873e; box-shadow: inset 2px 2px #ffe6a0, inset -2px -2px #b57b36, 0 4px #35271d; padding: 8px 28px; }
.start-command > span { color: #b8d0d5; font: 400 21px var(--font); }
.round-end { position: absolute; inset: 30px; display: flex; align-items: center; justify-content: center; flex-direction: column; background: #061e32f5; text-align: center; z-index: 2; border: 3px solid #bc8a4c; box-shadow: 4px 5px #03132077; }

.round-end h2 { font-size: 45px; }
.round-end p { font: 400 25px var(--font); color: #c9d8d8; }
.settings-button { position: fixed; bottom: 20px; left: 24px; border: 0; background: #071f32b3; color: #e0bf83; font-size: 24px; opacity: 0; transition: opacity .2s; }
.settings-button:hover, .settings-button:focus-visible, body:has(dialog[open]) .settings-button { opacity: 1; }
.settings-button::before { content: ''; position: absolute; inset: -20px; }
.sign-in { position: fixed; inset: 0; display: grid; place-items: center; background: linear-gradient(#04182d66, #04182d88), var(--landscape) center / cover; z-index: 10; text-align: center; }
.sign-in > div { max-width: 650px; padding: 32px 45px; background: #082034eb; border: 6px ridge #a87a43; box-shadow: 9px 10px #03132180; }
.sign-in h1 { font: 400 44px var(--display); margin: 20px 0 12px; }
.sign-in p { color: #c0d0d4; }
.twitch-button { display: flex; align-items: center; justify-content: space-between; gap: 40px; padding: 16px 25px; margin: 30px auto 20px; width: fit-content; color: #33271d; background: #e9b96a; border: 3px solid #b37c3e; text-decoration: none; font-weight: 600; box-shadow: inset 2px 2px #ffdfa1, 0 4px #42301e; }
.sign-in .sign-in-note { font-size: 14px; }
.sign-in #auth-error { font-size: 14px; color: #ffb99a; max-width: 480px; line-height: 1.6; }
dialog { color: var(--ink); background: #09263a; border: 5px ridge #a57945; padding: 30px; width: 560px; max-width: calc(100vw - 32px); box-shadow: 8px 10px #020d1c99; }
dialog::backdrop { background: #021425aa; }
dialog h2 { font-size: 32px; }
dialog p { font-size: 14px; line-height: 1.8; color: #b9cdd1; }
.close { position: absolute; right: 12px; top: 8px; font-size: 26px; background: transparent; border: 0; color: #d1bc94; }
.url-field { display: flex; border: 1px solid #9e7847; margin: 22px 0; }
.url-field input { width: 0; flex: 1; padding: 12px; font-size: 12px; color: #c9d6d7; border: 0; background: #051a2c; }
.url-field button { background: #cba15e; color: #2b221a; border: 0; padding: 10px 14px; font-size: 13px; }
.settings-help { margin-bottom: 25px; }
.sign-out { font-size: 13px; color: #dbb77a; }
.overlay-url-mode .sign-out { display: none; }
.obs-source { display: flex; align-items: center; gap: 16px; margin-top: 22px; padding: 18px 20px; border: 2px dashed #bf965a; background: #153447; color: #f1d4a0; text-decoration: none; cursor: grab; user-select: none; -webkit-user-drag: element; }
.obs-source:hover { background: #1b3e4e; border-color: #f1c77e; }
.obs-source:active { cursor: grabbing; }
.obs-source strong { display: block; font-size: 16px; font-weight: 600; }
.obs-source small { display: block; margin-top: 5px; color: #b9c8c8; font-size: 12px; }
.drag-handle { font-size: 30px; color: #c5a573; }
.drag-arrow { margin-left: auto; font-size: 23px; }
dialog .drag-status { font-size: 12px; margin: 8px 0 0; }
dialog .drag-status:empty { display: none; }
@keyframes discover { 0% { transform: scale(.85); } 65% { transform: scale(1.08); } 100% { transform: scale(1); } }
@media (max-width: 1500px) {
  .overlay { padding: 0 55px; }
  header { height: 115px; gap: 22px; }
  .brand { width: 300px; padding: 12px 25px; }
  .brand-name { font-size: 35px; }
  .brand-name small { font-size: 17px; margin-top: 5px; }
  .round-label { font-size: 19px; padding: 10px 13px; }

  .session { font-size: 11px; }
  main { grid-template-columns: minmax(0, 1fr) 320px; gap: 35px; }
  .board-area { height: min(58vh, 590px); }
  .letter-tile { width: 61px; height: 65px; font-size: 42px; }
  #letters { padding: 10px 13px 14px; gap: 10px; }
  .letters-section > p { font-size: 19px; }
  .leaderboard, .bonus { padding: 0 17px 15px; }
  .leaderboard h2, .bonus h2 { margin-left: -18px; margin-right: -18px; padding: 12px 17px 15px; font-size: 26px; }
  .leader-row { gap: 10px; padding: 12px 0; min-height: 55px; }
  .leader-name { font-size: 20px; }
  .leader-score { font-size: 23px; }
  .waiting h1 { font-size: 39px; }
  .waiting > p { font-size: 22px; }
  .waiting .small-rule { font-size: 18px; }
  .start-command > span { font-size: 18px; }
}
@media (max-width: 1000px) {
  .overlay { padding: 0 32px; }
  header { gap: 17px; height: 105px; }
  .brand { width: 260px; }
  .brand-name { font-size: 30px; }
  .game-meta { gap: 10px; }
  .round-label { font-size: 16px; padding: 9px; }

  .session { font-size: 10px; max-width: 170px; }
  main { grid-template-columns: minmax(0, 1fr) 245px; gap: 24px; }
  .leaderboard h2, .bonus h2 { font-size: 21px; }
  .leader-name { font-size: 16px; }
  .leader-score { font-size: 19px; }
  .rank { font-size: 17px; width: 12px; }
  .leader-row { gap: 7px; }
  .bonus-word { font-size: 17px; }
  .letter-tile { width: 49px; height: 53px; font-size: 33px; }
  #letters { gap: 7px; padding: 8px 10px 12px; }
  .waiting { padding: 20px 8px; }
  .waiting h1 { font-size: 31px; }
  .waiting > p { font-size: 18px; }
  .waiting .small-rule, .start-command > span { font-size: 16px; }

  .start-command { margin-top: 24px; gap: 17px; }
  .start-command kbd { font-size: 28px; }
}
@media (max-width: 650px) {
  .overlay { padding: 0 20px; }
  header { height: auto; min-height: 135px; flex-wrap: wrap; gap: 13px; padding: 23px 0 14px; }
  .brand { width: 225px; margin-right: auto; }
  .brand-name { font-size: 28px; }
  .brand-name small { font-size: 14px; }
  .game-meta { order: 3; }
  .round-label { font-size: 15px; }

  .session { max-width: 140px; margin-left: 0; }
  main { display: block; }
  .board-area { height: 52vh; min-height: 350px; }
  .waiting h1 { font-size: 31px; }
  .waiting > p { font-size: 19px; }
  .letter-tile { width: 43px; height: 49px; font-size: 31px; }
  #letters { gap: 6px; padding: 8px 9px 12px; }
  .letters-section > p { font-size: 17px; }
  #feedback { font-size: 15px; }
  aside { display: grid; grid-template-columns: 1fr 1fr; gap: 17px; padding: 25px 0 35px; }
  .leaderboard, .bonus { padding: 0 12px 12px; }
  .leaderboard h2, .bonus h2 { margin: 0 -13px; padding: 12px 8px; font-size: 19px; }
  .leaderboard h2 > span { display: none; }
  .bonus { margin: 0; min-height: 140px; }
  .leader-name { font-size: 15px; }
  .leader-score { font-size: 17px; }
  .rank { font-size: 14px; }
  .empty-leaders { font-size: 17px; }
  .sign-in > div { margin: 20px; padding: 25px; }
  .sign-in h1 { font-size: 37px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

.round-health { display: flex; align-items: center; justify-content: center; gap: 13px; width: min(650px, 90%); margin: 14px auto 0; padding-bottom: 20px; }
.health-heart { width: 29px; height: 29px; flex-shrink: 0; image-rendering: pixelated; filter: drop-shadow(2px 3px 0 #041221bb); }
.health-track { flex: 1; height: 25px; padding: 4px; border: 3px solid #a67b46; outline: 2px solid #241b17; background: #041725; box-shadow: inset 0 2px #020e18, 2px 3px #03122299; }
.health-fill { width: 100%; height: 100%; background: repeating-linear-gradient(90deg, #0000 0 23px, #082c2b88 23px 26px), linear-gradient(#a9dea3 0 24%, #67b77a 24% 73%, #3d805b 73%); transition: width 1s linear; }
.round-health.warning .health-fill { background: repeating-linear-gradient(90deg, #0000 0 23px, #5c3e2288 23px 26px), linear-gradient(#ffe19a 0 24%, #dcad55 24% 73%, #a97a35 73%); }
.round-health.danger .health-fill { background: repeating-linear-gradient(90deg, #0000 0 23px, #56261f88 23px 26px), linear-gradient(#ffbd9c 0 24%, #dc8068 24% 73%, #a95048 73%); }
@media (max-width: 650px) { .round-health { gap: 10px; width: 95%; margin-top: 12px; padding-bottom: 0; } .health-heart { width: 24px; height: 24px; } .health-track { height: 23px; } }

.letter-tile, .cell { position: relative; }
.tile-points { position: absolute; right: 5px; bottom: 3px; font: 600 13px/1 var(--font); text-shadow: none; }
.cell .tile-points { right: 3px; bottom: 2px; font-size: clamp(7px, calc(var(--cell) * .22), 11px); }
.break-track { width: min(230px, 70%); height: 12px; margin-top: 18px; padding: 2px; background: #031524; border: 1px solid #9f7748; box-shadow: 2px 2px #020e1a; }
#break-fill { width: 100%; height: 100%; background: #dcb66f; transition: width .2s linear; }
@media (max-width: 1000px) { .letter-tile .tile-points { font-size: 10px; right: 3px; bottom: 3px; } }

.cell.missed { background: #824b48; border-color: #d5947d; color: #ffe7d0; box-shadow: inset 2px 2px #bd7c6866, inset -2px -2px #532d31, 2px 3px #041322aa; }
.reviewing .cell.revealed { animation: none; }
.cell.answer-pop { animation: answer-reveal 420ms ease-out both; animation-delay: var(--reveal-delay, 0ms); }
@keyframes answer-reveal { 0% { opacity: 0; transform: translateY(-9px) scale(.88); } 65% { opacity: 1; transform: translateY(2px) scale(1.05); } 100% { opacity: 1; transform: translateY(0) scale(1); } }

.round-divider { position: relative; display: block; width: 2px; height: 22px; flex-shrink: 0; background: #9d7546; box-shadow: 1px 0 #e9ba6540; }
.round-divider::before, .round-divider::after { content: ''; position: absolute; left: -1px; width: 4px; height: 4px; background: #d3a265; }
.round-divider::before { top: 0; }
.round-divider::after { bottom: 0; }
@media (max-width: 1000px) { .round-label { gap: 12px; } #word-progress { font-size: 13px; } .round-divider { height: 19px; } }
