:root {
  color-scheme: light;
  --bg: #f6f8f5;
  --surface: #ffffff;
  --surface-strong: #eef4f1;
  --text: #15211d;
  --muted: #66746d;
  --line: #d8e2dd;
  --primary: #087c76;
  --primary-dark: #045d59;
  --good: #0a7f55;
  --bad: #c44a32;
  --skip: #9b6b16;
  --spell: #5b5ea8;
  --shadow: 0 18px 60px rgba(31, 53, 46, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

button {
  font: inherit;
}

.app-shell {
  width: min(100%, 560px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  align-items: stretch;
}

.screen {
  display: none;
  width: 100%;
}

.screen.is-active {
  display: flex;
  flex-direction: column;
}

.topline,
.direction-label,
.session-bar {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 8px 0 28px;
  font-size: 2.6rem;
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  margin: 0 0 10px;
  font-size: 1rem;
  letter-spacing: 0;
}

.control-group {
  margin-bottom: 22px;
}

.segmented,
.amount-grid {
  display: grid;
  gap: 10px;
}

.segmented {
  grid-template-columns: repeat(3, 1fr);
}

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

.choice {
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 12px 10px;
  font-weight: 800;
  box-shadow: none;
}

.choice span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 650;
}

.choice.is-selected {
  border-color: var(--primary);
  background: #e5f4f1;
  color: var(--primary-dark);
}

.primary-action,
.quiet-action,
.rating,
.tiny-answer {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.primary-action {
  min-height: 62px;
  margin-top: auto;
  background: var(--primary);
  color: #fff;
  font-size: 1.22rem;
  font-weight: 850;
}

.status-text {
  min-height: 20px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.session-bar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.word-card {
  flex: 1;
  min-height: 360px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 24px;
  box-shadow: var(--shadow);
}

.prompt-text {
  margin: 12px 0 20px;
  font-size: clamp(2.7rem, 16vw, 5.9rem);
  line-height: 0.96;
  overflow-wrap: anywhere;
}

.tiny-answer {
  align-self: flex-start;
  max-width: 100%;
  background: var(--surface-strong);
  color: #24312c;
  padding: 8px 10px;
  font-size: 0.72rem;
  font-weight: 750;
  text-align: left;
  overflow-wrap: anywhere;
}

.answer-panel {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.answer-main {
  margin: 0 0 14px;
  font-size: 2.1rem;
  line-height: 1.06;
  font-weight: 850;
}

.detail-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.detail-row {
  display: grid;
  gap: 3px;
}

.detail-row dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.detail-row dd {
  margin: 0;
  font-size: 1rem;
  line-height: 1.25;
}

.rating-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.rating {
  min-height: 58px;
  color: #fff;
  padding: 10px;
  font-size: 1.03rem;
  font-weight: 850;
}

.good {
  background: var(--good);
}

.bad {
  background: var(--bad);
}

.skip {
  background: var(--skip);
}

.spelling {
  background: var(--spell);
}

.quiet-action {
  min-height: 48px;
  margin-top: 10px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.summary-content {
  display: grid;
  gap: 16px;
  margin-bottom: 24px;
}

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

.summary-stat,
.problem-list {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
}

.summary-stat strong {
  display: block;
  font-size: 1.75rem;
}

.summary-stat span {
  color: var(--muted);
  font-weight: 700;
}

.problem-list h2 {
  margin-bottom: 8px;
}

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

.problem-list li + li {
  margin-top: 4px;
}

@media (max-width: 390px) {
  .app-shell {
    padding: 14px;
  }

  h1 {
    font-size: 2.25rem;
  }

  .segmented {
    grid-template-columns: 1fr;
  }

  .word-card {
    min-height: 330px;
    padding: 18px;
  }

  .rating-grid,
  .summary-grid {
    grid-template-columns: 1fr;
  }
}
