:root {
  --ink: #14100e;
  --ink-soft: #2b2420;
  --velvet: #681827;
  --curtain: #98233a;
  --gold: #f4c75f;
  --gold-deep: #b87a22;
  --cream: #fff4d8;
  --paper: #ffe9b0;
  --teal: #28b6a2;
  --teal-dark: #11695f;
  --danger: #f06d55;
  --success: #59d58b;
  --shadow: rgba(0, 0, 0, 0.4);
  --panel: rgba(26, 20, 17, 0.9);
  --line: rgba(255, 244, 216, 0.18);
  color-scheme: dark;
  font-family: "Trebuchet MS", Verdana, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--cream);
  background:
    linear-gradient(90deg, rgba(104, 24, 39, 0.5) 0 8%, transparent 8% 92%, rgba(104, 24, 39, 0.5) 92%),
    repeating-linear-gradient(90deg, rgba(255, 244, 216, 0.05) 0 2px, transparent 2px 48px),
    linear-gradient(155deg, #170e0d 0%, #2b1412 45%, #11100d 100%);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(244, 199, 95, 0.13), transparent 24%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 4px);
  mix-blend-mode: screen;
}

button,
input {
  font: inherit;
  letter-spacing: 0;
}

button {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  padding: 0 20px;
  color: #17100c;
  background: var(--gold);
  box-shadow: 0 10px 24px rgba(184, 122, 34, 0.24);
  cursor: pointer;
  font-weight: 800;
  transition: transform 160ms ease, filter 160ms ease, box-shadow 160ms ease;
}

button:hover:not(:disabled),
button:focus-visible:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.06);
  box-shadow: 0 16px 30px rgba(184, 122, 34, 0.3);
}

button:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
}

button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.8);
  opacity: 0.45;
}

button.secondary {
  color: var(--cream);
  background: rgba(255, 244, 216, 0.12);
  box-shadow: inset 0 0 0 1px var(--line);
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border: 1px solid rgba(244, 199, 95, 0.45);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(244, 199, 95, 0.25), rgba(244, 199, 95, 0.08));
  font-size: 2rem;
  box-shadow: 0 12px 30px var(--shadow);
}

.brand p {
  margin: 0 0 2px;
  color: var(--gold);
  font-size: 0.88rem;
  font-weight: 800;
  text-transform: uppercase;
}

.brand h1 {
  margin: 0;
  font-family: "Palatino Linotype", Georgia, serif;
  font-size: 2.35rem;
  line-height: 1;
  letter-spacing: 0;
}

.score-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(86px, 1fr));
  gap: 8px;
  min-width: 300px;
}

.score-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  background: rgba(20, 16, 14, 0.72);
  text-align: right;
}

.score-item span,
.hint-meter span,
.round-details dt {
  display: block;
  color: rgba(255, 244, 216, 0.68);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.score-item strong,
.hint-meter strong {
  display: block;
  margin-top: 4px;
  color: var(--gold);
  font-family: "Palatino Linotype", Georgia, serif;
  font-size: 2rem;
  line-height: 1;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.55fr);
  gap: 18px;
  align-items: stretch;
}

.stage,
.side-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 70px var(--shadow);
  backdrop-filter: blur(8px);
}

.stage {
  position: relative;
  min-height: 680px;
  padding: 22px;
  overflow: hidden;
  animation: stageRise 520ms ease both;
}

.stage::before,
.stage::after {
  content: "";
  position: absolute;
  top: 0;
  width: 82px;
  height: 100%;
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.08) 0 8px, transparent 8px 16px),
    linear-gradient(90deg, rgba(152, 35, 58, 0.8), rgba(104, 24, 39, 0.22));
  pointer-events: none;
}

.stage::before {
  left: 0;
}

.stage::after {
  right: 0;
  transform: scaleX(-1);
}

.marquee,
.emoji-board,
.guess-form,
.status,
.actions {
  position: relative;
  z-index: 1;
}

.marquee {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  margin-bottom: 26px;
  padding: 14px 18px;
  border: 1px solid rgba(244, 199, 95, 0.45);
  border-radius: 8px;
  color: #1b1109;
  background:
    linear-gradient(180deg, rgba(255, 236, 169, 0.96), rgba(244, 199, 95, 0.95)),
    repeating-linear-gradient(90deg, transparent 0 18px, rgba(184, 122, 34, 0.13) 18px 21px);
  box-shadow: 0 14px 36px rgba(244, 199, 95, 0.18);
  text-align: center;
}

.stage.round-pop .marquee {
  animation: marqueePop 520ms cubic-bezier(0.2, 0.9, 0.2, 1.1) both;
}

.marquee h2 {
  margin: 2px 0 0;
  font-family: "Palatino Linotype", Georgia, serif;
  font-size: 1.75rem;
  line-height: 1;
  letter-spacing: 0;
}

.marquee span {
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
}

.bulb-row {
  height: 14px;
  border-radius: 999px;
  background: repeating-linear-gradient(90deg, #1b1109 0 7px, transparent 7px 16px);
  opacity: 0.75;
  animation: bulbRun 2200ms linear infinite;
}

.emoji-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(88px, 1fr));
  gap: 12px;
  width: min(760px, 100%);
  margin: 0 auto 24px;
}

.emoji-tile {
  display: grid;
  aspect-ratio: 1;
  min-height: 118px;
  place-items: center;
  border: 1px solid rgba(255, 244, 216, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 244, 216, 0.11), rgba(255, 244, 216, 0.035)),
    #1d1714;
  box-shadow: inset 0 0 0 1px rgba(244, 199, 95, 0.08), 0 18px 34px rgba(0, 0, 0, 0.28);
  font-size: 3.8rem;
  line-height: 1;
  animation: tileEnter 560ms cubic-bezier(0.2, 0.9, 0.2, 1.1) both;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.emoji-tile:hover {
  border-color: rgba(244, 199, 95, 0.5);
  box-shadow: inset 0 0 0 1px rgba(244, 199, 95, 0.12), 0 22px 40px rgba(0, 0, 0, 0.34);
  transform: translateY(-4px);
}

.guess-form {
  width: min(760px, 100%);
  margin: 0 auto;
}

.guess-form label {
  display: block;
  margin-bottom: 8px;
  color: var(--paper);
  font-weight: 800;
}

.answer-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.answer-row input {
  width: 100%;
  min-height: 52px;
  border: 1px solid rgba(255, 244, 216, 0.28);
  border-radius: 8px;
  padding: 0 16px;
  color: var(--cream);
  background: rgba(255, 244, 216, 0.08);
  outline: none;
}

.answer-row input::placeholder {
  color: rgba(255, 244, 216, 0.42);
}

.answer-row input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(244, 199, 95, 0.14);
}

.suggestions {
  display: grid;
  gap: 6px;
  max-height: 240px;
  margin: 8px 0 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

.suggestions[hidden] {
  display: none;
}

.suggestions button {
  display: flex;
  width: 100%;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  color: var(--cream);
  background: rgba(255, 244, 216, 0.1);
  box-shadow: inset 0 0 0 1px rgba(255, 244, 216, 0.12);
  text-align: left;
}

.suggestions li {
  animation: suggestionEnter 180ms ease both;
}

.suggestions button.attempted,
.suggestions button.attempted:hover {
  color: rgba(255, 244, 216, 0.58);
  background: rgba(240, 109, 85, 0.1);
  box-shadow: inset 0 0 0 1px rgba(240, 109, 85, 0.28);
  transform: none;
}

.suggestions small {
  flex: 0 0 auto;
  color: var(--gold);
  font-weight: 800;
}

.attempt-feedback {
  margin: 8px 0 0;
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--cream);
  background: rgba(255, 244, 216, 0.09);
  font-size: 0.92rem;
  font-weight: 800;
  animation: statusSlide 180ms ease both;
}

.attempt-feedback[hidden] {
  display: none;
}

.attempt-feedback.warning {
  color: #fff0c5;
  background: rgba(244, 199, 95, 0.14);
  box-shadow: inset 0 0 0 1px rgba(244, 199, 95, 0.25);
}

.attempt-feedback.error {
  color: #ffe5df;
  background: rgba(126, 36, 25, 0.24);
  box-shadow: inset 0 0 0 1px rgba(240, 109, 85, 0.34);
}

.attempted-tray {
  margin-top: 12px;
  border: 1px solid rgba(255, 244, 216, 0.16);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 244, 216, 0.055);
}

.attempted-tray > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.attempted-tray h3 {
  margin: 0;
  color: var(--paper);
  font-size: 0.88rem;
  text-transform: uppercase;
}

.attempted-tray span {
  display: grid;
  min-width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 999px;
  color: #17100c;
  background: var(--gold);
  font-weight: 900;
}

.attempted-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.attempted-list li {
  max-width: 100%;
  border: 1px solid rgba(240, 109, 85, 0.32);
  border-radius: 999px;
  padding: 7px 11px;
  color: #ffe5df;
  background: rgba(240, 109, 85, 0.13);
  font-size: 0.86rem;
  font-weight: 800;
  animation: chipEnter 220ms ease both;
}

.empty-attempts {
  margin: 0;
  color: rgba(255, 244, 216, 0.56);
  font-size: 0.9rem;
}

.status {
  width: min(760px, 100%);
  min-height: 58px;
  margin: 18px auto 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 15px 16px;
  color: rgba(255, 244, 216, 0.82);
  background: rgba(0, 0, 0, 0.18);
  font-weight: 800;
  animation: statusSlide 220ms ease both;
}

.status.success {
  border-color: rgba(89, 213, 139, 0.5);
  color: #eaffef;
  background: rgba(25, 126, 67, 0.28);
}

.status.error {
  border-color: rgba(240, 109, 85, 0.55);
  color: #ffe5df;
  background: rgba(126, 36, 25, 0.28);
}

.status.hint {
  border-color: rgba(40, 182, 162, 0.55);
  color: #e6fffb;
  background: rgba(17, 105, 95, 0.3);
}

.actions {
  display: flex;
  width: min(760px, 100%);
  justify-content: flex-end;
  gap: 10px;
  margin: 18px auto 0;
}

.side-panel {
  display: flex;
  min-height: 680px;
  flex-direction: column;
  gap: 18px;
  padding: 18px;
}

.hint-meter {
  display: grid;
  min-height: 110px;
  place-items: center;
  border: 1px solid rgba(40, 182, 162, 0.45);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(40, 182, 162, 0.18), rgba(17, 105, 95, 0.12)),
    rgba(0, 0, 0, 0.18);
  text-align: center;
}

.hint-meter strong {
  color: var(--teal);
  font-size: 3.2rem;
}

.hints-section {
  flex: 1;
}

.hints-section h2 {
  margin: 0 0 10px;
  font-family: "Palatino Linotype", Georgia, serif;
  font-size: 1.6rem;
  letter-spacing: 0;
}

.hints-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 24px;
}

.hints-list li {
  padding: 10px 0 10px 8px;
  border-bottom: 1px solid var(--line);
  color: rgba(255, 244, 216, 0.88);
  line-height: 1.45;
}

.empty-hints {
  margin: 0;
  border: 1px dashed rgba(255, 244, 216, 0.22);
  border-radius: 8px;
  padding: 14px;
  color: rgba(255, 244, 216, 0.58);
}

.round-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0;
}

.round-details div {
  min-height: 84px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 244, 216, 0.06);
}

.round-details dd {
  margin: 8px 0 0;
  color: var(--paper);
  font-family: "Palatino Linotype", Georgia, serif;
  font-size: 1.45rem;
  line-height: 1.1;
}

.sparkle {
  position: absolute;
  left: 50%;
  top: 48%;
  z-index: 4;
  color: var(--gold);
  font-size: 1.4rem;
  font-weight: 900;
  pointer-events: none;
  text-shadow: 0 0 18px rgba(244, 199, 95, 0.8);
  animation: sparkleFly 860ms ease-out var(--delay) both;
}

@keyframes stageRise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes marqueePop {
  0% {
    transform: scale(0.98);
  }
  55% {
    transform: scale(1.015);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes bulbRun {
  from {
    background-position: 0 0;
  }
  to {
    background-position: 32px 0;
  }
}

@keyframes tileEnter {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes suggestionEnter {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes chipEnter {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes statusSlide {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes sparkleFly {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.4);
  }
  20% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) scale(1.2) rotate(24deg);
  }
}

@media (max-width: 860px) {
  .app-shell {
    width: min(100% - 20px, 680px);
    padding: 16px 0;
  }

  .topbar,
  .game-layout {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .brand h1 {
    font-size: 1.8rem;
  }

  .score-strip {
    min-width: 0;
  }

  .stage,
  .side-panel {
    min-height: 0;
  }

  .stage {
    padding: 14px;
  }

  .stage::before,
  .stage::after {
    width: 28px;
  }

  .marquee {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .bulb-row {
    display: none;
  }

  .emoji-board {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .emoji-tile {
    min-height: 116px;
    font-size: 3.35rem;
  }
}

@media (max-width: 560px) {
  .score-strip,
  .round-details {
    grid-template-columns: 1fr;
  }

  .answer-row {
    grid-template-columns: 1fr;
  }

  .actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .emoji-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .emoji-tile {
    min-height: 96px;
    font-size: 2.65rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
