:root {
  --bg: #10140f;
  --panel: #f4efe3;
  --panel-dark: #203121;
  --ink: #142033;
  --muted: #667064;
  --line: rgba(20, 32, 51, 0.18);
  --good: #4f7f46;
  --warn: #b45e37;
  --blue: #276a8c;
  --shadow: 0 18px 45px rgba(0,0,0,0.22);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 0%, rgba(68, 111, 90, 0.4), transparent 34%),
    linear-gradient(135deg, #11180f, #25301f);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  font: inherit;
}

.app-shell {
  width: min(1500px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 36px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: end;
  color: #fff8eb;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: .75rem;
  color: #bad2c0;
}

h1, h2, p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 4.6rem);
  line-height: .9;
  letter-spacing: -0.045em;
}

.score-card {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  backdrop-filter: blur(14px);
}

.score-card button,
#playAgainBtn {
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  background: #fff8eb;
  color: #1b2617;
  cursor: pointer;
  font-weight: 800;
}

.game-layout {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  gap: 18px;
}

.piece-tray,
.board-panel,
.info-panel {
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.piece-tray {
  background: var(--panel-dark);
  color: #f9f4e8;
  padding: 18px;
  min-height: 680px;
}

.piece-tray h2 {
  margin-bottom: 6px;
  font-size: 1.4rem;
}

.tray-note {
  color: #cbd9c8;
  font-size: .95rem;
  line-height: 1.35;
}

.pieces {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.piece {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 10px;
  align-items: center;
  width: 100%;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 14px;
  padding: 9px;
  background: rgba(255,255,255,.1);
  color: #fff8eb;
  cursor: grab;
  user-select: none;
  touch-action: none;
  transition: transform .15s ease, opacity .2s ease, background .2s ease;
}

.piece:focus-visible {
  outline: 3px solid #d4e4ff;
  outline-offset: 3px;
}

.piece:hover {
  transform: translateY(-1px);
  background: rgba(255,255,255,.16);
}

.piece.dragging {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  width: 250px;
  box-shadow: 0 20px 45px rgba(0,0,0,.35);
  cursor: grabbing;
}

.piece.locked {
  opacity: .45;
  cursor: default;
}

.icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 42px;
  border-radius: 12px;
  background: #0e1a0e;
  color: #172317;
  font-size: 1.55rem;
  font-weight: 900;
  overflow: hidden;
  flex-shrink: 0;
}

.piece strong {
  display: block;
  font-size: .95rem;
}

.piece span {
  display: block;
  color: #cbd9c8;
  font-size: .8rem;
}

.board-panel {
  background: rgba(244, 239, 227, .95);
  padding: 14px;
}

.board {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  background: #f0ede6;
}

.board img {
  display: block;
  width: 100%;
  height: auto;
}

.zones {
  position: absolute;
  inset: 0;
}

.zone {
  position: absolute;
  background-color: rgba(10,20,10,.2);
  filter: grayscale(1) brightness(0.52) drop-shadow(0 0 5px rgba(255,255,255,0.14));
  transition: filter .45s ease;
}

.zone.hot {
  filter: grayscale(0.25) brightness(0.88) drop-shadow(0 0 10px rgba(79, 127, 70, .95)) drop-shadow(0 0 3px rgba(79, 127, 70, .6));
}

.zone.wrong {
  filter: grayscale(0.6) brightness(0.65) drop-shadow(0 0 8px rgba(180, 94, 55, .95)) drop-shadow(0 0 3px rgba(180, 94, 55, .6));
}

.zone.solved {
  filter: drop-shadow(0 0 6px rgba(79, 127, 70, .7));
}

.placed-token {
  position: absolute;
  bottom: 4px;
  right: 4px;
  z-index: 2;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 248, 235, .92);
  border: 1px solid rgba(20,32,51,.14);
  font-size: .9rem;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}

.info-panel {
  margin-top: 14px;
  padding: 18px 20px;
  background: #fff8eb;
  min-height: 132px;
  border-color: rgba(20,32,51,.12);
}

.info-panel.correct {
  border-color: rgba(79, 127, 70, .5);
}

.info-panel.try-again {
  border-color: rgba(180, 94, 55, .5);
}

.info-kicker {
  margin-bottom: 6px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: .76rem;
  font-weight: 800;
}

.info-panel h2 {
  margin-bottom: 6px;
}

dialog {
  border: 0;
  border-radius: 22px;
  padding: 28px;
  max-width: 520px;
  background: #fff8eb;
  color: var(--ink);
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(0,0,0,.55);
}

@media (max-width: 950px) {
  .topbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .game-layout {
    display: flex;
    flex-direction: column-reverse;
  }

  .score-card {
    width: max-content;
  }

  .piece-tray {
    min-height: auto;
    padding: 14px;
  }

  .piece-tray h2,
  .tray-note {
    display: none;
  }

  .pieces {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    margin-top: 0;
  }

  .piece {
    padding: 7px;
  }

  .board {
    min-height: auto;
  }
}
