:root {
  color-scheme: light;
  --bg: #f1efe8;
  --panel: rgba(255, 251, 244, 0.92);
  --text: #1c1d20;
  --muted: #66645f;
  --accent: #24524b;
  --accent-strong: #193a35;
  --border: rgba(28, 29, 32, 0.12);
  --shadow: 0 18px 55px rgba(33, 39, 35, 0.10);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Georgia", "Times New Roman", serif;
  background:
    radial-gradient(circle at top left, rgba(36, 82, 75, 0.16), transparent 30%),
    radial-gradient(circle at top right, rgba(183, 146, 79, 0.16), transparent 28%),
    linear-gradient(180deg, #faf7f0 0%, var(--bg) 100%);
  color: var(--text);
}
.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0 64px;
}
.hero h1 { margin: 0; font-size: clamp(2.2rem, 5vw, 4rem); letter-spacing: -0.03em; }
.eyebrow { text-transform: uppercase; letter-spacing: .18em; color: var(--accent); margin: 0 0 12px; }
.lead { max-width: 720px; color: var(--muted); line-height: 1.7; }
.panel, .card {
  background: color-mix(in srgb, var(--panel) 92%, white 8%);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 20px;
  box-shadow: var(--shadow);
  margin-top: 20px;
  backdrop-filter: blur(8px);
}
textarea {
  width: 100%;
  margin-top: 10px;
  border-radius: 16px;
  border: 1px solid var(--border);
  padding: 16px;
  font: inherit;
  min-height: 180px;
  background: rgba(255,255,255,0.7);
}
.actions { display: flex; gap: 16px; justify-content: space-between; align-items: center; margin-top: 16px; flex-wrap: wrap; }
button {
  background: var(--accent);
  color: white;
  border: 0;
  border-radius: 999px;
  padding: 12px 22px;
  font-weight: 700;
  cursor: pointer;
}
button:hover { background: var(--accent-strong); }
.ghost { background: transparent; color: var(--accent); border: 1px solid var(--border); }
.ghost:hover { background: rgba(36, 82, 75, 0.08); color: var(--accent-strong); }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.card h2 { margin-top: 0; }
pre { white-space: pre-wrap; word-break: break-word; margin: 0; }
.empty { color: var(--muted); }
@media (max-width: 800px) { .grid, .stats-grid { grid-template-columns: 1fr; } }

.status-line {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1rem;
  line-height: 1.5;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 6px rgba(36, 82, 75, 0.12);
  flex: 0 0 auto;
}

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

.summary-grid article {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.58);
  display: grid;
  gap: 8px;
}

.summary-grid span {
  color: var(--muted);
  font-size: 0.86rem;
}

.summary-grid strong {
  font-size: 1.55rem;
  line-height: 1;
}

.table-box {
  display: grid;
  gap: 14px;
}

.result-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.65);
  box-shadow: 0 8px 24px rgba(33, 39, 35, 0.05);
}

.result-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.result-card__header--stack {
  align-items: center;
}

.title-block {
  min-width: 0;
  flex: 1;
}

.result-card h3 {
  margin: 6px 0 0;
  font-size: 1.18rem;
  letter-spacing: 0.01em;
}

.result-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.meaning-inline {
  margin: 8px 0 0;
  color: #303236;
  line-height: 1.55;
  font-size: 0.98rem;
}

.badge {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(36, 82, 75, 0.10);
  color: var(--accent-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.badge-stack {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.hint-badge {
  min-width: 36px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(36, 82, 75, 0.06);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.hint-badge--active {
  background: rgba(36, 82, 75, 0.14);
  color: var(--accent-strong);
}

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

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

.result-grid.single-line { grid-template-columns: 1fr; }

.result-grid div {
  display: grid;
  gap: 4px;
}

.label {
  color: var(--muted);
  font-size: 0.85rem;
}

.result-grid strong {
  font-weight: 600;
  line-height: 1.55;
}

.sentence {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  color: #4d4f54;
  line-height: 1.65;
}

.word-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "header header"
    "grid badge"
    "sentence sentence";
  gap: 0 14px;
}

.word-card .result-card__header { grid-area: header; }
.word-card .result-grid { grid-area: grid; margin-top: 12px; }
.word-card .badge-stack { grid-area: badge; align-self: start; }
.word-card .sentence { grid-area: sentence; }

.phrase-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "header header"
    "sentence badge";
  gap: 0 14px;
}

.phrase-card .result-card__header { grid-area: header; }
.phrase-card .sentence { grid-area: sentence; }
.phrase-card .badge { grid-area: badge; align-self: start; }

.word-card .result-grid strong,
.phrase-card .result-grid strong {
  word-break: break-word;
}