:root {
  color-scheme: only light;
  --bg-top: #f4d7a1;
  --bg-bottom: #f7f4ec;
  --panel: rgba(255, 251, 244, 0.9);
  --ink: #22223b;
  --muted: #6e6a7f;
  --line: #ddc4a0;
  --accent: #cb5a2e;
  --accent-deep: #7f2d18;
  --accent-soft: #ffe1cf;
  --teal: #165c63;
  --teal-soft: #d9f0ee;
  --shadow: 0 22px 44px rgba(95, 58, 24, 0.16);
  font-family: "Instrument Sans", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(203, 90, 46, 0.2), transparent 30%),
    radial-gradient(circle at top right, rgba(22, 92, 99, 0.18), transparent 26%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom) 45%, #efe4d4 100%);
}

h1,
h2 {
  margin: 0;
  font-family: "Archivo Black", "Arial Black", sans-serif;
  letter-spacing: 0.02em;
}

p {
  margin: 0;
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
select,
input,
textarea {
  border-radius: 18px;
}

button {
  border: 0;
  cursor: pointer;
  font-weight: 700;
  padding: 12px 18px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

button:hover,
button:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 12px 18px rgba(77, 42, 16, 0.14);
}

button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(22, 92, 99, 0.28);
  outline-offset: 2px;
}

.hero,
.layout {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.8fr);
  gap: 22px;
  padding: 34px 0 20px;
}

.hero-copy,
.scoreboard,
.panel {
  background: var(--panel);
  border: 1px solid rgba(221, 196, 160, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  border-radius: 30px;
}

.hero-copy {
  padding: 34px;
  position: relative;
  overflow: hidden;
}

.hero-copy::after {
  content: "";
  position: absolute;
  right: -48px;
  bottom: -48px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(22, 92, 99, 0.22), transparent 70%);
}

.eyebrow,
.section-tag,
.tile-label {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--accent-deep);
}

.eyebrow,
.section-tag {
  margin-bottom: 10px;
}

h1 {
  font-size: clamp(2.5rem, 5vw, 4.8rem);
  line-height: 0.95;
  max-width: 8ch;
}

.lede {
  margin-top: 18px;
  max-width: 62ch;
  color: var(--muted);
  line-height: 1.7;
  font-size: 1.05rem;
}

.component-list {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.component-pill {
  display: inline-flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(221, 196, 160, 0.9);
  color: var(--accent-deep);
  font-weight: 700;
}

.hero-actions,
.timer-controls,
.card-actions,
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fff;
}

.secondary {
  background: #f3d8ca;
  color: #7a301a;
}

.ghost {
  background: #f7e7cf;
  color: #8b4c22;
  border: 1px solid rgba(203, 90, 46, 0.18);
}

.scoreboard {
  padding: 24px;
  display: grid;
  gap: 18px;
  align-content: start;
}

.score-tile,
.score-box,
.duration-control,
.answer-panel,
.deck-panel,
.feedback-box {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(221, 196, 160, 0.9);
}

.score-tile,
.answer-panel,
.deck-panel,
.feedback-box {
  border-radius: 24px;
  padding: 18px;
}

.timer {
  margin-top: 8px;
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  font-family: "Archivo Black", "Arial Black", sans-serif;
}

.score-box,
.duration-control {
  display: grid;
  gap: 8px;
  padding: 14px;
}

.score-box input,
.duration-control select,
.writing-panel input,
.writing-panel textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fffaf4;
  color: var(--ink);
  padding: 12px 14px;
}

#scoreValue {
  width: 100%;
  text-align: left;
  font-size: 1rem;
  font-weight: 400;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.8fr);
  gap: 22px;
  padding-bottom: 38px;
  align-items: stretch;
}

.panel {
  padding: 24px;
}

.card-panel {
  display: grid;
  grid-column: 1;
  grid-row: 1;
  align-content: start;
  height: 100%;
}

.info-panel {
  display: grid;
  grid-column: 2;
  grid-row: 1;
  align-content: start;
  height: 100%;
}

.panel-heading p:last-child {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.65;
}

.card-panel .panel-heading {
  width: 100%;
  border-radius: 28px;
  padding: 20px;
  background: linear-gradient(180deg, #fff6ec 0%, #fffaf6 100%);
  border: 1px solid rgba(221, 196, 160, 0.9);
}

.component-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--accent-deep);
}

.toggle-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-slider {
  position: relative;
  width: 52px;
  height: 30px;
  border-radius: 999px;
  background: #e8d5bd;
  border: 1px solid rgba(221, 196, 160, 0.95);
  transition: background 0.18s ease;
}

.toggle-slider::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 6px 12px rgba(72, 38, 14, 0.14);
  transition: transform 0.18s ease;
}

.toggle-switch input:checked + .toggle-slider {
  background: #dfeee5;
}

.toggle-switch input:checked + .toggle-slider::after {
  transform: translateX(22px);
}

.toggle-switch input:focus-visible + .toggle-slider {
  outline: 3px solid rgba(22, 92, 99, 0.28);
  outline-offset: 2px;
}

.toggle-switch input:disabled + .toggle-slider {
  opacity: 0.55;
}

.toggle-label {
  white-space: nowrap;
}

.forbidden-shell {
  width: 100%;
  margin-top: 22px;
  border-radius: 28px;
  padding: 20px;
  background: linear-gradient(180deg, #fff6ec 0%, #fffaf6 100%);
  border: 1px solid rgba(221, 196, 160, 0.9);
}

.word-ribbon {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-weight: 700;
}

.word-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.word-chip {
  padding: 16px 14px;
  border-radius: 20px;
  background: #fff;
  border: 1px solid var(--line);
  text-align: center;
  font-weight: 700;
  min-height: 76px;
  display: grid;
  place-items: center;
}

.placeholder-chip {
  grid-column: 1 / -1;
  color: var(--muted);
  font-weight: 600;
  background: rgba(255, 255, 255, 0.68);
  border-style: dashed;
}

.card-actions {
  margin-top: 18px;
}

#correctBtn {
  margin-left: auto;
}

#newCardBtn {
  background: linear-gradient(135deg, #cb5a2e, #9f3d1f);
}

#hintBtn {
  background: #f6e3c6;
  color: #8b4c22;
}

#correctBtn {
  background: #e5f2df;
  color: #245b2a;
  border: 1px solid rgba(36, 91, 42, 0.14);
}

#skipBtn {
  background: #f4d9d2;
  color: #8a2f21;
  border: 1px solid rgba(138, 47, 33, 0.14);
}

.hint-panel {
  margin-top: 14px;
  padding: 16px 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(221, 196, 160, 0.9);
  color: var(--muted);
  line-height: 1.6;
}

.timer-controls {
  justify-content: center;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(34, 34, 59, 0.42);
  z-index: 20;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-card {
  width: min(420px, 100%);
  padding: 28px;
  border-radius: 28px;
  background: rgba(255, 251, 244, 0.98);
  border: 1px solid rgba(221, 196, 160, 0.95);
  box-shadow: 0 24px 60px rgba(47, 28, 12, 0.22);
  text-align: center;
}

.modal-copy {
  margin-top: 12px;
  color: var(--muted);
  line-height: 1.6;
}

#gameOverTitle {
  margin-top: 12px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 22px;
  justify-content: center;
}

.answer-panel {
  margin-top: 18px;
}

.answer-word {
  margin-top: 8px;
  font-size: 1.8rem;
  font-weight: 700;
}

.rules {
  margin: 18px 0 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.7;
}

.deck-panel {
  margin-top: 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}

.deck-count {
  margin-top: 6px;
  font-size: 2rem;
  font-family: "Archivo Black", "Arial Black", sans-serif;
}

.mini-list {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.mini-list-empty,
.used-pill {
  border-radius: 999px;
  padding: 10px 14px;
}

.mini-list-empty {
  background: rgba(255, 255, 255, 0.8);
  color: var(--muted);
}

.used-pill {
  background: var(--teal-soft);
  color: var(--teal);
  font-weight: 700;
}

@media (max-width: 900px) {
  .hero,
  .layout {
    grid-template-columns: 1fr;
  }

  .card-panel {
    grid-row: auto;
  }

  .info-panel {
    grid-column: auto;
    grid-row: auto;
  }
}

@media (max-width: 640px) {
  body {
    background:
      radial-gradient(circle at top left, rgba(203, 90, 46, 0.2), transparent 36%),
      linear-gradient(180deg, var(--bg-top), var(--bg-bottom) 42%, #efe4d4 100%);
  }

  .hero,
  .layout {
    width: min(100vw - 20px, 1180px);
  }

  .hero-copy,
  .scoreboard,
  .panel {
    border-radius: 24px;
  }

  .hero-copy,
  .scoreboard,
  .panel {
    padding: 20px;
  }

  .deck-panel {
    flex-direction: column;
    align-items: flex-start;
  }

  .component-header {
    align-items: flex-start;
    flex-direction: column;
  }
}
