:root {
  --bg: #fff9ef;
  --panel: rgba(255, 255, 255, 0.9);
  --panel-strong: #ffffff;
  --ink: #19202a;
  --ink-soft: #445161;
  --brand: #f8b400;
  --brand-deep: #db7c00;
  --accent: #1677ff;
  --success: #17895b;
  --danger: #b93d36;
  --celebration: #ff6f61;
  --border: rgba(25, 32, 42, 0.12);
  --shadow: 0 20px 60px rgba(25, 32, 42, 0.14);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(248, 180, 0, 0.28), transparent 28%),
    radial-gradient(circle at top right, rgba(22, 119, 255, 0.16), transparent 24%),
    linear-gradient(180deg, #fffdf8 0%, var(--bg) 100%);
}

body {
  min-height: 100vh;
}

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

button {
  cursor: pointer;
}

.page-shell {
  width: min(100%, 920px);
  margin: 0 auto;
  padding: 24px 16px 56px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

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

h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  line-height: 0.98;
  margin-bottom: 0;
}

h2 {
  font-size: clamp(1.6rem, 4vw, 2.3rem);
  margin-bottom: 12px;
}

.top-link,
.ghost-link {
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
}

.card-stack {
  display: grid;
  gap: 20px;
}

.card {
  background: var(--panel);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.hero {
  display: grid;
  gap: 16px;
}

.hero p,
.meta-text,
.helper-text,
label,
li,
textarea,
input,
select {
  font-size: 1.05rem;
  line-height: 1.5;
}

.controls,
.button-row,
.form-grid,
.stats-grid,
.bucket-grid {
  display: grid;
  gap: 12px;
}

.button-row {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.controls {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  align-items: end;
}

.form-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.stats-grid,
.bucket-grid {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.panel-stat {
  padding: 18px;
  border-radius: 18px;
  background: var(--panel-strong);
  border: 1px solid var(--border);
}

.panel-stat strong {
  display: block;
  font-size: 2rem;
  margin-bottom: 4px;
}

.btn,
.btn-secondary,
.btn-danger {
  min-height: 54px;
  border-radius: 999px;
  border: none;
  padding: 14px 20px;
  font-weight: 700;
  transition: transform 120ms ease, box-shadow 120ms ease, opacity 120ms ease;
}

.btn:hover,
.btn-secondary:hover,
.btn-danger:hover {
  transform: translateY(-1px);
}

.btn {
  background: linear-gradient(135deg, var(--brand) 0%, #ffd95a 100%);
  color: #2f2300;
  box-shadow: 0 14px 30px rgba(248, 180, 0, 0.32);
}

.btn-secondary {
  background: #eef5ff;
  color: #093a7a;
}

.btn-danger {
  background: #ffe9e6;
  color: #7d211b;
}

.text-input,
.text-area,
.select-input {
  width: 100%;
  border: 1px solid rgba(25, 32, 42, 0.18);
  border-radius: 18px;
  padding: 14px 16px;
  background: #fff;
  min-height: 54px;
}

.text-area {
  min-height: 220px;
  resize: vertical;
}

.progress-pill,
.feedback,
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 700;
}

.progress-pill {
  background: rgba(25, 32, 42, 0.06);
}

.feedback {
  width: 100%;
  margin: 18px 0 0;
}

.feedback-success {
  background: rgba(23, 137, 91, 0.12);
  color: #0b5e3c;
}

.feedback-error {
  background: rgba(185, 61, 54, 0.12);
  color: #84211c;
}

.feedback-neutral {
  background: rgba(22, 119, 255, 0.1);
  color: #0f4ea7;
}

.word-answer {
  font-size: clamp(1.6rem, 3vw, 2rem);
  font-weight: 700;
}

.list {
  padding-left: 20px;
  margin-bottom: 0;
}

.empty-state {
  padding: 18px;
  border-radius: 18px;
  background: rgba(25, 32, 42, 0.05);
}

.celebration-card {
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.2), transparent 28%),
    linear-gradient(135deg, #ff9966 0%, #ff5e62 100%);
  color: #fff;
}

.celebration-copy {
  font-size: 1.2rem;
}

.small-text {
  font-size: 0.95rem;
  color: var(--ink-soft);
}

.divider {
  height: 1px;
  margin: 8px 0;
  background: rgba(25, 32, 42, 0.1);
}

.word-list {
  display: grid;
  gap: 10px;
}

.history-list {
  display: grid;
  gap: 12px;
}

.history-item {
  border: 1px solid var(--border);
  border-radius: 20px;
  background: #fff;
  overflow: hidden;
}

.history-item summary {
  display: grid;
  grid-template-columns: minmax(180px, 1.3fr) minmax(120px, 0.8fr) minmax(140px, 1fr);
  gap: 12px;
  padding: 16px 18px;
  cursor: pointer;
  list-style: none;
}

.history-item summary::-webkit-details-marker {
  display: none;
}

.history-item-body {
  padding: 0 18px 18px;
}

.attempt-table {
  display: grid;
  gap: 8px;
}

.attempt-table-head,
.attempt-row {
  display: grid;
  grid-template-columns: minmax(100px, 0.8fr) minmax(90px, 0.6fr) minmax(220px, 1.8fr) minmax(120px, 0.9fr);
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(25, 32, 42, 0.04);
}

.attempt-table-head {
  font-weight: 700;
  background: rgba(25, 32, 42, 0.08);
}

.word-list-item {
  padding: 14px 16px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid var(--border);
}

.word-list-item strong {
  display: block;
  font-size: 1.15rem;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 640px) {
  .page-shell {
    padding-inline: 12px;
  }

  .card {
    padding: 20px;
    border-radius: 22px;
  }

  .topbar {
    flex-direction: column;
  }

  .history-item summary,
  .attempt-table-head,
  .attempt-row {
    grid-template-columns: 1fr;
  }
}
