:root {
  color-scheme: light;
  --bg: #f6f4ef;
  --panel: #ffffff;
  --ink: #1f2528;
  --muted: #5f686f;
  --line: #d8ddd6;
  --accent: #1f6f78;
  --accent-strong: #154d54;
  --warm: #d9822b;
  --correct: #18723e;
  --incorrect: #b42318;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(31, 111, 120, 0.08), transparent 260px),
    var(--bg);
  color: var(--ink);
}

a {
  color: inherit;
}

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

.home-shell {
  min-height: 100vh;
  display: grid;
  align-items: center;
}

.home-panel {
  max-width: 620px;
  padding: 56px 0;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(2.4rem, 4rem, 4rem);
  line-height: 1;
  letter-spacing: 0;
}

.lede {
  max-width: 34rem;
  margin: 18px 0 28px;
  color: var(--muted);
  font-size: 1.12rem;
  line-height: 1.55;
}

.primary-link,
.answer-form button {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #ffffff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.primary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  text-decoration: none;
}

.primary-link:hover,
.answer-form button:hover {
  background: var(--accent-strong);
}

.app-shell {
  padding: 28px 0 56px;
}

.app-header {
  display: grid;
  gap: 18px;
  margin-bottom: 28px;
}

.back-link {
  width: fit-content;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
}

.back-link:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

.control-row {
  display: grid;
  grid-template-columns: minmax(120px, 180px) minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.control-row label,
.answer-form label span {
  color: var(--ink);
  font-weight: 800;
}

select,
input {
  width: 100%;
  min-height: 44px;
  border: 1px solid #bac5c1;
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
}

select {
  padding: 0 12px;
}

input {
  padding: 0 14px;
}

input:focus,
select:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(217, 130, 43, 0.38);
  outline-offset: 2px;
}

.status-strip {
  min-height: 24px;
  margin: 14px 0 20px;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
}

.puzzle-list {
  display: grid;
  gap: 14px;
}

.puzzle-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 10px 30px rgba(31, 37, 40, 0.06);
}

.puzzle-title-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px 18px 12px;
  border-bottom: 1px solid var(--line);
}

h2 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.35;
  letter-spacing: 0;
}

.answer-count {
  flex: 0 0 auto;
  color: var(--warm);
  font-size: 0.8rem;
  font-weight: 900;
  white-space: nowrap;
}

.answer-grid {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.answer-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px minmax(160px, 220px);
  gap: 10px;
  align-items: end;
}

.answer-form label {
  display: grid;
  gap: 6px;
}

.answer-form label span {
  font-size: 0.86rem;
}

.answer-form button {
  padding: 0 12px;
}

.result {
  min-height: 44px;
  margin: 0;
  display: flex;
  align-items: center;
  border-radius: 6px;
  font-weight: 900;
  line-height: 1.2;
}

.result.correct {
  color: var(--correct);
}

.result.incorrect {
  color: var(--incorrect);
}

@media (max-width: 760px) {
  .home-shell,
  .app-shell {
    width: min(100% - 24px, 1080px);
  }

  h1 {
    font-size: 2.6rem;
  }

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

  .puzzle-title-row {
    display: grid;
  }

  .answer-count {
    white-space: normal;
  }

  .result {
    min-height: 24px;
  }
}
