:root {
  color-scheme: light;
  --bg: #f3f4f6;
  --panel: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --dark: #111827;
  --dark-2: #1f2937;
  --soft: #f9fafb;
  --danger: #991b1b;
  --warn: #92400e;
  --success: #166534;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button, input, textarea { font: inherit; }

button {
  cursor: pointer;
  border: 0;
  border-radius: 14px;
  transition: transform 120ms ease, opacity 120ms ease;
}

button:active { transform: scale(0.98); }

.shell {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 20px 14px 42px;
}

.topbar, .studyHeader, .progressMeta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.topbar { margin-bottom: 16px; }

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(1.55rem, 5vw, 2.2rem); }
h2 { margin-bottom: 8px; }

.eyebrow {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 18px;
  box-shadow: 0 14px 38px rgba(17, 24, 39, 0.07);
}

.intro p, .hint { color: var(--muted); line-height: 1.55; }

.field {
  display: block;
  margin-top: 16px;
}

.field span {
  display: block;
  margin-bottom: 7px;
  font-size: 0.86rem;
  font-weight: 800;
}

input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--soft);
  padding: 13px;
  color: var(--text);
}

textarea {
  resize: vertical;
  min-height: 210px;
  line-height: 1.45;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.83rem;
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.wrap { flex-wrap: wrap; }

.primary, .secondary, .ghost {
  padding: 12px 15px;
  font-weight: 800;
}

.primary {
  background: var(--dark);
  color: white;
}

.primary.large {
  width: 100%;
  padding: 16px;
}

.secondary {
  background: #e5e7eb;
  color: var(--text);
}

.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--dark-2);
  padding: 9px 11px;
}

.error {
  color: var(--danger);
  margin: 13px 0 0;
  font-weight: 700;
}

.progressBlock { margin-top: 18px; }

.progressMeta {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.progressTrack {
  height: 9px;
  overflow: hidden;
  margin-top: 8px;
  border-radius: 999px;
  background: #e5e7eb;
}

.progressFill {
  width: 0;
  height: 100%;
  background: var(--dark);
  transition: width 180ms ease;
}

.card {
  min-height: 300px;
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--soft);
  padding: 19px;
}

.cardLabel {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.front, .back {
  white-space: pre-wrap;
  line-height: 1.55;
}

.front {
  font-size: clamp(1.25rem, 4vw, 1.72rem);
  font-weight: 800;
}

.back { font-size: 1.08rem; }

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 22px 0;
}

.extras {
  display: grid;
  grid-template-columns: minmax(80px, 0.3fr) 1fr;
  gap: 8px 12px;
  margin: 18px 0 0;
  font-size: 0.93rem;
}

.extras dt {
  color: var(--muted);
  font-weight: 800;
}

.extras dd {
  margin: 0;
  white-space: pre-wrap;
}

.ratingGrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin-top: 18px;
}

.rating {
  min-height: 78px;
  padding: 11px 8px;
  border: 1px solid var(--line);
  background: var(--soft);
}

.rating strong, .rating span { display: block; }
.rating strong { font-size: 0.96rem; }
.rating span { margin-top: 4px; color: var(--muted); font-size: 0.72rem; line-height: 1.25; }
.rating.forgot strong { color: var(--danger); }
.rating.difficult strong { color: var(--warn); }
.rating.easy strong { color: var(--success); }

.hint {
  margin: 16px 0 0;
  text-align: center;
  font-size: 0.78rem;
}

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

.summaryItem {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--soft);
  padding: 14px;
}

.summaryItem strong, .summaryItem span { display: block; }
.summaryItem strong { font-size: 1.45rem; }
.summaryItem span { margin-top: 3px; color: var(--muted); font-size: 0.8rem; }

.hidden { display: none !important; }

@media (max-width: 460px) {
  .shell { padding: 14px 10px 32px; }
  .panel { padding: 15px; border-radius: 18px; }
  .ratingGrid { gap: 6px; }
  .rating { min-height: 82px; padding: 9px 5px; }
  .rating span { font-size: 0.66rem; }
}
