:root {
  color-scheme: dark;
  --viewport-height: 100dvh;
  --bg: #101519;
  --bg-soft: #20292f;
  --border: #354047;
  --text: #f6f6ed;
  --muted: #a6b2b7;
  --correct: #f4dc60;
  --present: #e6ede9;
  --absent: #47545d;
  --typing: #293940;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; font-family: ui-rounded, "Trebuchet MS", system-ui, sans-serif; background: radial-gradient(ellipse at 12% 0, #253e3f 0, transparent 52%), var(--bg); color: var(--text); }
button, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button:focus-visible, select:focus-visible { outline: 3px solid var(--correct); outline-offset: 3px; }
button:disabled { cursor: default; }
.page { height: var(--viewport-height, 100svh); min-height: 0; display: grid; place-items: center; padding: 16px; }
.game-card { width: min(100%, 640px); height: min(880px, calc(100svh - 32px)); height: min(880px, calc(var(--viewport-height, 100dvh) - 32px)); min-height: 0; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; gap: 14px; padding: 22px; border: 1px solid #354447; border-radius: 28px; background: linear-gradient(140deg,#1d292d,#171e23 70%); box-shadow: 0 24px 70px #0004; }
.topbar, .header-actions, .game-info, .dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.brand { font-size: 10px; font-weight: 800; letter-spacing: .2em; color: var(--muted); }
.brand span { color: var(--correct); font-size: 15px; }
h1 { margin: 2px 0 0; font-size: 30px; letter-spacing: -.035em; line-height: 1.1; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 44px; border: 1px solid transparent; border-radius: 14px; padding: 10px 15px; cursor: pointer; font-weight: 700; transition: background .15s, transform .15s; }
.btn:active:not(:disabled), .key:active:not(:disabled) { transform: scale(.95); }
.btn:disabled { opacity: .55; }
.btn-primary { background: var(--correct); color: #20251a; box-shadow: 0 4px 0 #b7a444; }
.btn-primary:hover:not(:disabled) { background: #ffe77c; }
.btn-outline { border-color: var(--border); background: #ffffff05; color: var(--text); }
.btn-quiet { background: transparent; color: var(--muted); padding-inline: 10px; }
.btn-quiet:hover { background: #ffffff08; color: var(--text); }
.btn-outline svg circle { fill: #1d292d; }
.round-actions { display: flex; align-items: center; gap: 10px; }
.game-summary { min-width: 0; }
.game-info { border-top: 1px solid #ffffff0b; padding-top: 12px; font-size: 12px; }
.game-summary { color: var(--muted); }
.progress { color: var(--correct); font-weight: 700; white-space: nowrap; }
.play-area { display: grid; grid-template-rows: minmax(0,1fr) auto; gap: 10px; min-height: 0; min-width: 0; }
.board-stage { min-width: 0; min-height: 0; display: grid; place-items: center; }
.board { --word-length: 5; --tile-size: 44px; --gap: 6px; display: grid; gap: var(--gap); }
.board-row { display: grid; grid-template-columns: repeat(var(--word-length),var(--tile-size)); gap: var(--gap); }
.tile { width: var(--tile-size); height: var(--tile-size); display: grid; place-items: center; border-radius: 12px; border: 2px solid #35444b; background: #111a1e55; color: var(--text); font-size: calc(var(--tile-size) * .49); font-weight: 800; text-transform: uppercase; user-select: none; padding: 0; line-height: 1; }
.tile.typing { background: var(--typing); border-color: #667b80; }
.tile.editable { cursor: pointer; }
.tile.active { border-color: var(--correct); box-shadow: 0 0 0 2px #f4dc6015; }
.tile.correct { background: var(--correct); border-color: var(--correct); color: #20251a; }
.tile.present { background: var(--present); border-color: var(--present); color: #202a2c; }
.tile.absent { background: var(--absent); border-color: var(--absent); color: #e4ebed; }
.play-panel { min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 8px; }
.status { min-height: 34px; display: grid; place-items: center; text-align: center; font-size: 13px; line-height: 1.3; color: var(--muted); margin: 0; }
.status.positive { color: #d8f3b8; }
.status.negative { color: #ffb3a7; }
.keyboard { display: grid; gap: 6px; }
.keyboard-row { display: flex; justify-content: center; gap: 4px; }
.key { width: calc((100% - 44px) / 12); min-width: 0; height: 48px; padding: 0; border: 1px solid #4b5a63; border-bottom-width: 3px; border-radius: 9px; background: #2c3941; color: var(--text); font-weight: 750; font-size: 17px; text-transform: uppercase; cursor: pointer; transition: transform .1s, background .15s; }
.key:disabled { cursor: default; }
.key.wide { width: auto; min-width: 74px; padding: 0 20px; font-size: 14px; }
.key.submit { min-width: 140px; background: #d7e5dd; border-color: #a4bfb3; color: #202a2c; }
.key.correct, .legend .correct { background: var(--correct); color: #20251a; border-color: #c0aa43; }
.key.present, .legend .present { background: var(--present); color: #202a2c; border-color: #b9c5bf; }
.key.absent, .legend .absent { background: var(--absent); border-color: #47545d; color: #d7e0e4; }
.legend { display: flex; justify-content: center; gap: 16px; font-size: 10px; color: var(--muted); }
.legend span { display: flex; gap: 5px; align-items: center; white-space: nowrap; }
.legend i { width: 8px; height: 8px; border-radius: 3px; }
.result { text-align: center; border-radius: 22px; padding: 15px 18px 20px; background: radial-gradient(ellipse at top, #f4dc6016, transparent 75%),#ffffff03; border: 1px solid #f4dc6030; animation: arrive .35s ease-out; }
.result-icon { color: var(--correct); font-size: 30px; line-height: 1; margin-bottom: 7px; }
.result h2 { font-size: 25px; letter-spacing: -.04em; margin: 0; }
.result-word { color: var(--correct); font-size: 21px; text-transform: uppercase; letter-spacing: .15em; font-weight: 800; margin: 8px 0; overflow-wrap: anywhere; }
.result-detail { font-size: 13px; line-height: 1.4; color: var(--muted); margin: 0 0 16px; }
.result .btn { width: 100%; }
.game-card.finished .status { min-height: 0; }
dialog { width: min(440px,calc(100% - 28px)); max-height: calc(var(--viewport-height, 100dvh) - 32px); background: #1c282d; color: var(--text); border: 1px solid #485959; border-radius: 24px; padding: 24px; box-shadow: 0 25px 100px #0008; }
dialog::backdrop { background: #080e13b8; backdrop-filter: blur(5px); }
dialog h2 { font-size: 26px; margin: 0; letter-spacing: -.04em; }
.dialog-hint { font-size: 13px; line-height: 1.5; color: var(--muted); margin: 12px 0 18px; }
.controls { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.controls label { display: grid; gap: 8px; font-size: 13px; color: var(--muted); }
select { min-width: 0; width: 100%; min-height: 46px; background: var(--bg-soft); border: 1px solid #526268; color: var(--text); border-radius: 12px; padding: 10px; font-size: 16px; }
.full-width { grid-column: 1 / -1; }
.controls .checkbox-label { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 14px; color: var(--text); }
.checkbox-label input { width: 22px; height: 22px; accent-color: var(--correct); }
.checkbox-label small { display: block; color: var(--muted); font-size: 11px; margin-top: 4px; }
#settings-start { width: 100%; }
.fireworks { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 10; }
.celebration-canvas { display: block; width: 100%; height: 100%; }
.celebration-star { position: absolute; line-height: 1; text-shadow: 0 0 18px currentColor, 0 0 40px currentColor; }
@keyframes arrive { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (max-width: 600px) {
  .page { padding: 0; }
  .game-card { border: 0; border-radius: 0; width: 100%; height: 100svh; height: var(--viewport-height, 100dvh); min-height: 0; padding: max(12px,env(safe-area-inset-top)) max(10px,env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom)) max(10px,env(safe-area-inset-left)); gap: 10px; box-shadow: none; }
  h1 { font-size: 27px; }
  .header-actions { gap: 3px; }
  .btn-outline { padding: 10px; }
  .btn-outline span { display: none; }
  .game-info { padding-top: 9px; font-size: 11px; }
  .key { font-size: 15px; height: 46px; border-radius: 7px; }
  .legend { gap: 10px; }
  .tile { border-radius: 9px; }
}
@media (max-height: 700px) and (max-width: 600px) {
  .game-card { gap: 7px; }
  .brand { display: none; }
  .key { height: 40px; }
  .status { min-height: 32px; font-size: 12px; }
  .result { padding: 10px 16px 15px; }
  .result-icon { display: none; }
  .result h2 { font-size: 21px; }
  .result-detail { margin-bottom: 10px; }
}
@media (min-width: 560px) and (min-aspect-ratio: 5/4) {
  .game-card { width: min(1120px,100%); height: min(780px,calc(var(--viewport-height, 100dvh) - 32px)); }
  .play-area { grid-template-columns: minmax(0,1fr) minmax(0,1.1fr); grid-template-rows: minmax(0,1fr); gap: clamp(20px,4vw,56px); }
  .play-panel { gap: 20px; }
  .keyboard { gap: 9px; }
  .key { height: clamp(44px,7vh,58px); }
  .result { padding: 32px 24px; }
  .result h2 { font-size: 30px; }
  .result-icon { font-size: 48px; }
  .result-word { font-size: 28px; margin: 16px 0; }
  .legend { justify-content: flex-start; padding-left: 10px; }
}
@media (min-width: 560px) and (max-height: 500px) {
  .page { padding: 8px; }
  .game-card { height: calc(var(--viewport-height, 100dvh) - 16px); min-height: 0; padding: 10px 16px; border-radius: 18px; gap: 6px; }
  .brand, .legend, .result-icon { display: none; }
  h1 { font-size: 24px; }
  .game-info { padding-top: 5px; }
  .play-area { gap: 20px; }
  .play-panel { gap: 6px; }
  .keyboard { gap: 5px; }
  .key { height: 38px; font-size: 14px; }
  .status { min-height: 30px; font-size: 12px; }
  .result { padding: 15px; }
  .result h2 { font-size: 23px; }
  .result-word { font-size: 22px; margin: 9px 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Color changes continue on the same elements while a guess is checked. */
.tile { transition: background-color .22s ease, border-color .22s ease, color .22s ease; }
.tile:disabled { opacity: 1; }

.icon-btn { position: relative; padding-inline: 11px; }
.bell-slash { display: none; }
#notifications-btn[data-state="blocked"] .bell-slash { display: block; }
#notifications-btn[data-state="on"] { color: #f4dc60; border-color: #a3913f; background: #f4dc6010; }
#notifications-btn::after { content: ""; position: absolute; right: 5px; top: 5px; width: 6px; height: 6px; border-radius: 50%; background: #79888d; }
#notifications-btn[data-state="on"]::after { background: #e6d05c; }
#notifications-btn[data-state="error"]::after, #notifications-btn[data-state="blocked"]::after { background: #e59180; }
.app-notice { position: fixed; z-index: 20; bottom: max(16px,env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: max-content; max-width: min(440px,calc(100% - 24px)); padding: 14px 18px; border: 1px solid #62756c; border-radius: 15px; box-shadow: 0 8px 30px #0008; background: #243932; color: #f4f4e9; font-size: 13px; line-height: 1.4; text-align: center; pointer-events: none; }
@media (max-width: 600px) {
 .header-actions .btn span { display: none; }
 .header-actions .btn { min-width: 40px; padding-inline: 9px; }
 .header-actions { gap: 4px; }
}

.status-line { display: flex; align-items: center; gap: 6px; min-height: 40px; }
.status-line .status { flex: 1; }
#give-up-btn { min-height: 32px; padding: 5px 8px; font-size: 12px; white-space: nowrap; text-decoration: underline; text-underline-offset: 4px; }
.suggest-word { align-self: center; min-height: 40px; padding: 6px 8px; font-size: 12px; white-space: nowrap; color: var(--correct); }
.answer-label { display: block; color: var(--muted); font-size: 12px; margin-top: 12px; }
#result-report-btn { display: block; margin: 10px auto 0; font-size: 12px; }
.dialog-actions { display: flex; gap: 10px; flex-wrap: wrap; }
textarea, input[type=password] { display: block; width: 100%; padding: 12px; margin: 10px 0; background: #151f24; color: var(--text); border: 1px solid var(--border); border-radius: 10px; font: inherit; }
textarea { resize: vertical; min-height: 90px; max-height: 30vh; }
textarea:focus-visible, input:focus-visible { outline: 2px solid var(--correct); outline-offset: 2px; }
#feedback-status { color: #ffb3a7; }
#settings-report-btn { width: 100%; margin-bottom: 12px; }
@media(max-height:700px) { .answer-label { margin-top: 5px; } #result-report-btn { margin-top: 4px; min-height: 34px; } }

@media (max-width: 600px) {
  .game-info { gap: 5px; align-items: start; }
  .round-actions { gap: 0; flex-direction: column; align-items: flex-end; }
  .game-summary { padding-top: 2px; }
  #give-up-btn { font-size: 11px; padding: 3px 0; min-height: 28px; }
}
@media (max-height: 560px) and (max-width: 559px) {
  .game-card { padding-block: 7px; gap: 5px; }
  .key { height: 32px; font-size: 13px; }
  .keyboard { gap: 4px; }
  .play-panel { gap: 4px; }
  .play-area { gap: 4px; }
  .status-line { min-height: 30px; }
  .status { font-size: 11px; min-height: 28px; }
  .legend { font-size: 9px; gap: 7px; }
  .result { padding: 7px 10px; }
  .result .btn { min-height: 36px; padding: 7px; }
  .result h2 { font-size: 19px; }
  .result-detail { font-size: 11px; margin-bottom: 6px; }
}
@media (max-height: 360px) and (min-width: 560px) {
  .game-card { padding-block: 6px; gap: 4px; }
  .topbar .btn { min-height: 36px; padding-block: 6px; }
  .game-info { padding-top: 0; }
  .key { height: 32px; }
  .status-line, .status { min-height: 26px; font-size: 11px; }
  .result { padding: 8px; }
  .result-detail { margin-bottom: 6px; }
  .result .btn { min-height: 34px; padding: 6px; }
}

/* Round actions keep their row when a game ends, preventing a board jump. */
.game-info { display: grid; grid-template-columns: minmax(0,1fr) auto; row-gap: 4px; }
.round-actions { grid-column: 1 / -1; display: flex; flex-direction: row; align-items: center; justify-content: space-between; gap: 8px; }
#hint-btn, #give-up-btn { min-height: 30px; padding: 3px 0; font-size: 12px; }
#hint-btn { color: #e6d774; }
#hint-count { font-variant-numeric: tabular-nums; font-size: 11px; }
.tile.hinted { background: var(--correct); border-color: var(--correct); color: #20251a; }
.key.absent { background: #12191d; border-color: #273238; color: #89969c; text-decoration: line-through; text-decoration-thickness: 1.5px; box-shadow: inset 0 2px 3px #0004; }
/* The result replaces the keyboard within the exact same panel height. */
.game-card.finished .play-panel { min-height: 0; gap: 5px; }
.game-card.finished .status-line { min-height: 20px; flex: 0 0 auto; }
.game-card.finished .status { min-height: 20px; font-size: 11px; }
.game-card.finished .result { min-height: 0; max-height: calc(100% - 25px); width: 100%; overflow: auto; padding: 8px 14px; }
.game-card.finished .result-icon { display: none; }
.game-card.finished .result h2 { font-size: 20px; }
.game-card.finished .result-word { font-size: 24px; margin: 3px 0 5px; }
.game-card.finished .result-detail { font-size: 12px; margin: 0 0 9px; }
#result-report-btn { min-height: 30px; font-size: 11px; padding: 4px; margin-top: 6px; }
.answer-heading { display: flex; align-items: center; justify-content: center; gap: 4px; }
.definition-btn { border: 0; background: transparent; color: var(--correct); min-width: 36px; height: 32px; font-size: 23px; cursor: pointer; }
#definition-text { color: var(--text); font-size: 16px; margin-bottom: 0; }
@media (max-height: 550px) { .game-card.finished .result { padding: 6px 12px; } .game-card.finished .result h2 { font-size: 18px; } .game-card.finished .result-word { font-size: 20px; } .game-card.finished .result-detail { margin-bottom: 4px; } }

@media (max-height: 550px) { .game-card.finished .answer-label, .game-card.finished .result-detail, .game-card.finished #result-report-btn { display: none; } .game-card.finished .result .btn { min-height: 36px; padding-block: 6px; } }

#definition-text { white-space: pre-line; line-height: 1.55; }
