* { box-sizing: border-box; }
:root {
  --ink: #0f172a;
  --paper: #f7f4ef;
  --accent: #ff8a3d;
  --accent-2: #2f80ed;
  --accent-3: #12b886;
  --shadow: 0 30px 80px rgba(15, 23, 42, 0.18);
  --ring: 0 0 0 3px rgba(255, 138, 61, 0.35);
}

body {
  margin: 0;
  color: var(--ink);
  background: radial-gradient(circle at 15% 20%, #ffe6d4 0%, #f7f4ef 40%, #f2efe9 100%);
  font-family: "Fira Sans", "Avenir Next", "Segoe UI", sans-serif;
  min-height: 100vh;
}

.bg-orbit {
  position: fixed;
  inset: -10% -10% auto auto;
  width: 420px;
  height: 420px;
  background: radial-gradient(circle at center, rgba(47, 128, 237, 0.28), transparent 60%);
  filter: blur(2px);
  pointer-events: none;
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(15, 23, 42, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.04) 1px, transparent 1px);
  background-size: 34px 34px;
  pointer-events: none;
}

.page {
  max-width: 900px;
  margin: 0 auto;
  padding: 28px 18px 48px;
  position: relative;
  z-index: 1;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: linear-gradient(135deg, #ff8a3d, #ff5a5f);
  color: #fff;
  font-weight: 800;
  display: grid;
  place-items: center;
  letter-spacing: 1px;
  box-shadow: 0 12px 30px rgba(255, 90, 95, 0.35);
}

.brand-title {
  font-family: "Baskerville", "Garamond", "Times New Roman", serif;
  font-size: 22px;
  font-weight: 700;
}

.brand-sub {
  font-size: 13px;
  opacity: 0.75;
  margin-top: 4px;
}

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

.stage {
  margin-top: 26px;
  display: grid;
  gap: 18px;
}

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

.stat {
  background: #ffffff;
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.stat-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.6;
}

.stat-value {
  margin-top: 6px;
  font-size: 26px;
  font-weight: 700;
}

.card {
  background: #ffffff;
  border-radius: 26px;
  padding: 32px 26px 28px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.card::after {
  content: "";
  position: absolute;
  inset: auto -20% -40% auto;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle at center, rgba(18, 184, 134, 0.22), transparent 65%);
}

.card-badge {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #6b7280;
}

.word {
  margin-top: 10px;
  font-size: 44px;
  font-weight: 700;
  text-align: center;
  font-family: "Baskerville", "Garamond", "Times New Roman", serif;
  word-break: break-word;
}

.source {
  margin-top: 10px;
  text-align: center;
  font-size: 15px;
  color: #4b5563;
}
.description {
  margin-top: 12px;
  text-align: center;
  font-size: 16px;
  line-height: 1.5;
  color: #1f2937;
}
.translation {
  margin-top: 10px;
  text-align: center;
  font-size: 16px;
  line-height: 1.5;
  color: #111827;
}
.description.hidden {
  display: none;
}
.translation.hidden {
  display: none;
}
.btn.small {
  margin: 12px auto 0;
  padding: 10px 16px;
  font-size: 13px;
  border-radius: 999px;
  display: block;
}

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

.btn {
  border: none;
  padding: 14px 16px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn:hover { transform: translateY(-1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn.good {
  background: linear-gradient(135deg, #12b886, #20c997);
  color: #fff;
  box-shadow: 0 12px 20px rgba(18, 184, 134, 0.22);
}

.btn.mid {
  background: linear-gradient(135deg, #f59f00, #fab005);
  color: #fff;
  box-shadow: 0 12px 20px rgba(245, 159, 0, 0.22);
}

.btn.bad {
  background: linear-gradient(135deg, #ff6b6b, #f03e3e);
  color: #fff;
  box-shadow: 0 12px 20px rgba(240, 62, 62, 0.22);
}

.btn.ghost {
  background: rgba(15, 23, 42, 0.06);
  color: #1f2937;
}

.tips {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: #374151;
}

.family-card {
  display: grid;
  gap: 16px;
}

.family-controls {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 200px;
}

.field-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #6b7280;
}

.select {
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  background: #fff;
}

.quiz-card {
  display: grid;
  gap: 14px;
}

.quiz-prompt {
  text-align: center;
  font-size: 16px;
  color: #374151;
}

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

.option-btn {
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #fff;
  padding: 14px 12px;
  border-radius: 14px;
  font-size: 15px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border 0.12s ease;
}

.option-btn:hover { transform: translateY(-1px); box-shadow: 0 10px 20px rgba(15, 23, 42, 0.12); }
.option-btn.correct { border-color: #12b886; box-shadow: 0 0 0 2px rgba(18, 184, 134, 0.25); }
.option-btn.incorrect { border-color: #ff6b6b; box-shadow: 0 0 0 2px rgba(255, 107, 107, 0.22); }
.option-btn:disabled { opacity: 0.85; cursor: not-allowed; }

.quiz-feedback {
  text-align: center;
  font-weight: 600;
  min-height: 22px;
}

.quiz-feedback.good { color: #0f8a5f; }
.quiz-feedback.bad { color: #c92a2a; }
.quiz-feedback.mid { color: #b08900; }

.quiz-details {
  text-align: center;
  font-size: 14px;
  color: #4b5563;
}

.related-wrap {
  border-top: 1px dashed rgba(15, 23, 42, 0.2);
  padding-top: 10px;
}

.related-title {
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #6b7280;
  margin-bottom: 6px;
}

.related-list {
  display: grid;
  gap: 6px;
}

.related-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.04);
}

.related-word { font-weight: 600; }
.related-freq { color: #6b7280; font-size: 12px; }

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

@media (max-width: 640px) {
  .actions {
    grid-template-columns: 1fr;
  }
  .word {
    font-size: 36px;
  }
  .option-grid {
    grid-template-columns: 1fr;
  }
  .quiz-actions {
    grid-template-columns: 1fr;
  }
}
