:root {
  --bg: #f4efe3;
  --paper: #fffaf1;
  --ink: #1f2a2a;
  --muted: #6f776c;
  --line: #d7cdb8;
  --accent: #0d6b66;
  --accent-2: #d97841;
  --shadow: 0 18px 50px rgba(58, 48, 24, 0.12);
  --cell: 42px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
  background:
    radial-gradient(circle at top left, rgba(217, 120, 65, 0.16), transparent 28%),
    radial-gradient(circle at bottom right, rgba(13, 107, 102, 0.14), transparent 24%),
    linear-gradient(180deg, #f8f4ea 0%, var(--bg) 100%);
  color: var(--ink);
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

.shell {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
}

.hero {
  padding: 32px 0 16px;
}

.hero__topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.hero__badge {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(13, 107, 102, 0.09);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hero__badge--soft {
  background: rgba(217, 120, 65, 0.12);
  color: #8d4d2b;
}

.hero h1,
.page-title {
  margin: 16px 0 10px;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-size: clamp(2.2rem, 4vw, 4.2rem);
  line-height: 0.95;
  letter-spacing: -0.05em;
}

.hero p,
.page-subtitle {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-size: 1.04rem;
  line-height: 1.6;
}

.card {
  background: rgba(255, 250, 241, 0.9);
  border: 1px solid rgba(215, 205, 184, 0.95);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.stack {
  display: grid;
  gap: 24px;
}

.home-grid {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 24px;
  padding-bottom: 48px;
}

.panel {
  padding: 24px;
}

.panel h2,
.panel h3 {
  margin: 0 0 12px;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
}

.muted {
  color: var(--muted);
}

.config-form {
  display: grid;
  gap: 16px;
}

.config-form__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  font-size: 0.92rem;
  font-weight: 700;
}

.field input,
.field select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fffdf8;
}

.form-error {
  margin: 0;
  color: #b03030;
  font-weight: 700;
}

.actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.button {
  border: 0;
  border-radius: 16px;
  padding: 13px 18px;
  background: var(--accent);
  color: white;
  font-weight: 700;
  cursor: pointer;
}

.button--secondary {
  background: #ece2cc;
  color: var(--ink);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.kpi-grid--play {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.kpi {
  padding: 18px;
  border-radius: 18px;
  background: #fffdf8;
  border: 1px solid var(--line);
}

.kpi strong {
  display: block;
  font-size: 1.7rem;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
}

.play-header,
.play-overview,
.play-stage,
.play-sidebar,
.solution-topbar {
  padding: 22px;
}

.play-overview {
  display: grid;
  gap: 18px;
}

.play-overview__header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
  flex-wrap: wrap;
}

.play-overview__header h2,
.play-stage__header h2 {
  margin: 10px 0 8px;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-size: 1.45rem;
}

.play-overview__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.play-stage,
.play-sidebar {
  display: grid;
  gap: 16px;
}

.play-stage__header {
  display: grid;
  gap: 6px;
}

.play-stage__header--tight h2 {
  margin-top: 0;
}

.play-sidebar--bottom {
  padding-bottom: 24px;
}

.player-shell {
  display: grid;
  gap: 16px;
}

.grid-board-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
}

.grid-board {
  display: grid;
  gap: 2px;
  padding: 14px;
  border-radius: 22px;
  background: #e3d8c1;
  align-self: start;
  width: 100%;
  max-width: 100%;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.grid-board--solution {
  background: #d7d1bf;
}

.grid-cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  aspect-ratio: 1 / 1;
  border: 0;
  padding: 0;
  background: #fffefb;
  color: var(--ink);
  cursor: pointer;
  text-transform: uppercase;
  font-weight: 800;
  font-size: 1.05rem;
}

.grid-cell--block {
  background: #273636;
  cursor: default;
}

.grid-cell--active {
  background: #dff2ef;
}

.grid-cell--filled {
  color: var(--accent);
}

.grid-cell--revealed {
  color: #273636;
  background: #fff8e9;
}

.grid-cell__number {
  position: absolute;
  top: 3px;
  left: 4px;
  font-size: 0.58rem;
  font-weight: 700;
  color: var(--muted);
}

.clue-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.clue-section h3 {
  margin: 0 0 10px;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
}

.clue-section__list {
  margin: 0;
  padding-left: 0;
  list-style: none;
  display: grid;
  gap: 10px;
  max-height: 420px;
  overflow: auto;
  padding-right: 8px;
}

.clue-item {
  color: var(--ink);
  font-size: 0.97rem;
  line-height: 1.55;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(215, 205, 184, 0.8);
}

.chip-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  padding: 8px 10px;
  border-radius: 999px;
  background: #f0e7d4;
  color: #5f573f;
  font-size: 0.86rem;
}

.lang-switcher {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.lang-switcher__link {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.66);
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.lang-switcher__link--active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.contract-note {
  border-left: 4px solid var(--accent-2);
  padding-left: 14px;
}

.solution-topbar {
  display: flex;
  justify-content: flex-end;
}

.answer-key {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.answer-key__section h3 {
  margin: 0 0 12px;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
}

.answer-key__list {
  margin: 0;
  padding-left: 0;
  list-style: none;
  display: grid;
  gap: 12px;
  max-height: 420px;
  overflow: auto;
  padding-right: 8px;
}

.answer-key__item {
  line-height: 1.55;
}

.answer-key__heading {
  display: flex;
  gap: 8px;
  align-items: baseline;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.answer-key__answer {
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  letter-spacing: 0.04em;
}

@media (max-width: 980px) {
  .home-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 640px) {
  :root {
    --cell: 30px;
  }

  .shell {
    width: min(100% - 20px, 1200px);
  }

  .config-form__grid,
  .kpi-grid,
  .kpi-grid--play {
    grid-template-columns: 1fr;
  }

  .play-overview__actions,
  .solution-topbar {
    justify-content: stretch;
  }

  .play-overview__actions .button,
  .solution-topbar .button {
    width: 100%;
    text-align: center;
  }
}
