:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #172033;
  --muted: #667085;
  --line: #e5e7eb;
  --primary: #4f46e5;
  --primary-soft: #eef2ff;
  --green: #16a34a;
  --red: #dc2626;
  --amber: #d97706;
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top left, #eef2ff 0, #f5f7fb 38%, #f8fafc 100%);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  max-width: 480px;
  min-height: 100vh;
  margin: 0 auto;
  padding: env(safe-area-inset-top) 14px calc(84px + env(safe-area-inset-bottom));
  position: relative;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 2px 12px;
  background: linear-gradient(to bottom, rgba(245, 247, 251, 0.98), rgba(245, 247, 251, 0.78));
  backdrop-filter: blur(14px);
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 12px;
  color: var(--primary);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.15;
}

h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

h3 {
  margin: 0;
  font-size: 16px;
}

p {
  margin: 0;
}

.app-main {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(229, 231, 235, 0.9);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 16px;
}

.card.compact {
  padding: 13px;
  border-radius: var(--radius-md);
}

.hero-card {
  overflow: hidden;
  position: relative;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 52%, #2563eb 100%);
  color: white;
  border: none;
}

.hero-card::after {
  content: "ABC";
  position: absolute;
  right: -14px;
  bottom: -24px;
  font-size: 78px;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.12);
  letter-spacing: -0.08em;
}

.hero-title {
  font-size: 24px;
  font-weight: 850;
  margin-bottom: 8px;
}

.hero-subtitle {
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.55;
  max-width: 310px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
}

.stat-card strong {
  display: block;
  font-size: 20px;
  margin-bottom: 2px;
}

.stat-card span {
  color: var(--muted);
  font-size: 12px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.item-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.learning-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.item-text {
  font-size: 24px;
  font-weight: 850;
  letter-spacing: -0.02em;
}

.item-meaning {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.45;
}

.example-box {
  background: var(--primary-soft);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.example-en {
  font-size: 16px;
  font-weight: 750;
  line-height: 1.45;
}

.example-ja {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.badge-row,
.action-row,
.filter-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 9px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
}

.badge.primary {
  background: var(--primary-soft);
  color: var(--primary);
}

.btn {
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  background: #eef2ff;
  color: var(--primary);
  font-weight: 800;
  cursor: pointer;
}

.btn.primary {
  background: var(--primary);
  color: #fff;
}

.btn.green {
  background: #dcfce7;
  color: var(--green);
}

.btn.red {
  background: #fee2e2;
  color: var(--red);
}

.btn.gray {
  background: #f1f5f9;
  color: #334155;
}

.btn.full {
  width: 100%;
  border-radius: var(--radius-md);
  padding: 13px 14px;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: var(--primary);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
  font-weight: 900;
  cursor: pointer;
}

.audio-btn {
  border: 0;
  background: #fff;
  color: var(--primary);
  border-radius: 999px;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 5px 12px rgba(15, 23, 42, 0.07);
  cursor: pointer;
}

.segmented {
  display: flex;
  padding: 4px;
  background: #e2e8f0;
  border-radius: 999px;
  gap: 4px;
}

.segmented button {
  flex: 1;
  border: 0;
  border-radius: 999px;
  padding: 8px 10px;
  background: transparent;
  color: #475569;
  font-weight: 800;
  cursor: pointer;
}

.segmented button.active {
  background: white;
  color: var(--primary);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.08);
}

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

.category-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: white;
  padding: 13px;
  text-align: left;
  cursor: pointer;
}

.category-card .icon {
  font-size: 24px;
  margin-bottom: 8px;
}

.category-card strong {
  display: block;
  margin-bottom: 5px;
}

.category-card small {
  color: var(--muted);
  line-height: 1.4;
}

.category-card.active {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.quiz-question {
  font-size: 20px;
  line-height: 1.45;
  font-weight: 850;
  margin-bottom: 12px;
}

.answer-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 13px 14px;
  font-size: 16px;
  outline: none;
  background: #fff;
}

.answer-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.choice-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.choice-btn {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
  padding: 13px;
  text-align: left;
  font-weight: 750;
  cursor: pointer;
}

.choice-btn.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.result-box {
  border-radius: var(--radius-md);
  padding: 12px;
  line-height: 1.5;
}

.result-box.correct {
  background: #dcfce7;
  color: #166534;
}

.result-box.incorrect {
  background: #fee2e2;
  color: #991b1b;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 30px 12px;
  line-height: 1.6;
}

.small-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(480px, 100%);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.94);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.nav-item {
  border: 0;
  border-radius: 15px;
  padding: 7px 4px;
  background: transparent;
  color: #64748b;
  cursor: pointer;
}

.nav-item span {
  display: block;
  font-size: 20px;
  line-height: 1;
  margin-bottom: 4px;
}

.nav-item small {
  display: block;
  font-size: 10px;
  font-weight: 750;
}

.nav-item.active {
  background: var(--primary-soft);
  color: var(--primary);
}

@media (max-width: 360px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

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

  .item-text {
    font-size: 21px;
  }
}

.quiz-mode-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quiz-mode-card {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
  padding: 14px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.quiz-mode-card strong {
  color: var(--text);
  font-size: 16px;
}

.quiz-mode-card span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.quiz-mode-card.primary {
  border-color: rgba(79, 70, 229, 0.35);
  background: var(--primary-soft);
}

.quiz-mode-card.review-mode {
  border-color: rgba(217, 119, 6, 0.35);
  background: #fffbeb;
}

.quiz-card {
  gap: 12px;
}

.quiz-progress {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
  margin: 4px 0 12px;
}

.quiz-progress span {
  display: block;
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
  transition: width 0.25s ease;
}

.quiz-meta {
  margin-bottom: 10px;
}

.hint-box {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin: 0 0 12px;
  font-weight: 800;
  line-height: 1.45;
}

.answer-detail-box {
  margin-top: 10px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.answer-detail-box strong {
  font-size: 17px;
}

.answer-detail-box span,
.answer-detail-box small {
  color: var(--muted);
  line-height: 1.45;
}

.answer-detail-box p {
  font-weight: 750;
  line-height: 1.45;
}

.summary-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.summary-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
  padding: 11px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.summary-item strong {
  line-height: 1.4;
}

.summary-item span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.quiz-translation-box {
  margin: 14px 0 12px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.14);
}

.quiz-translation-box span {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: 0.03em;
}

.quiz-translation-box strong {
  display: block;
  color: var(--text);
  font-size: 18px;
  line-height: 1.45;
}

.review-insight {
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  line-height: 1.45;
}

.review-insight strong {
  font-size: 13px;
}

.review-insight span {
  color: var(--muted);
  font-size: 12px;
}

.review-insight.high {
  background: #fee2e2;
  border: 1px solid #fecaca;
}

.review-insight.high strong {
  color: #991b1b;
}

.review-insight.medium {
  background: #fffbeb;
  border: 1px solid #fde68a;
}

.review-insight.medium strong {
  color: #92400e;
}

.review-insight.low {
  background: #ecfdf5;
  border: 1px solid #bbf7d0;
}

.review-insight.low strong {
  color: #166534;
}

.result-focus-card {
  border-color: rgba(220, 38, 38, 0.16);
}

.quiz-result-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.quiz-summary-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quiz-summary-item.focus {
  background: #fffafa;
  border-color: #fecaca;
}

.quiz-summary-item.correct {
  border-left: 5px solid var(--green);
}

.quiz-summary-item.almost {
  border-left: 5px solid var(--amber);
}

.quiz-summary-item.incorrect,
.quiz-summary-item.shown {
  border-left: 5px solid var(--red);
}

.summary-item-head {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.result-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.result-status-badge.correct {
  background: #dcfce7;
  color: #166534;
}

.result-status-badge.almost {
  background: #fffbeb;
  color: #92400e;
}

.result-status-badge.incorrect,
.result-status-badge.shown {
  background: #fee2e2;
  color: #991b1b;
}

.summary-question-box {
  background: rgba(37, 99, 235, 0.07);
  border: 1px solid rgba(37, 99, 235, 0.12);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}

.summary-question-box span,
.summary-answer-block span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.summary-question-box strong {
  display: block;
  font-size: 15px;
  line-height: 1.45;
}

.summary-answer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.summary-answer-block {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  background: #f8fafc;
}

.summary-answer-block strong {
  display: block;
  font-size: 15px;
  line-height: 1.45;
}

.summary-answer-block.correct-answer {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.summary-answer-block.user-answer {
  background: #fff;
}

.summary-expression-line {
  display: flex;
  flex-direction: column;
  gap: 3px;
  line-height: 1.45;
}

.summary-expression-line strong {
  font-size: 16px;
}

.summary-expression-line span {
  color: var(--muted);
  font-size: 13px;
}

.summary-caution {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  border-radius: var(--radius-md);
  padding: 9px 10px;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.45;
}

.summary-actions {
  margin-top: 2px;
}

.result-note-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.result-mini-note {
  display: inline-flex;
  border-radius: 999px;
  background: #f8fafc;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 800;
}

@media (min-width: 420px) {
  .summary-answer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.progress-overview-card {
  overflow: hidden;
}

.big-progress-row {
  display: grid;
  grid-template-columns: 106px 1fr;
  align-items: center;
  gap: 14px;
}

.big-progress-ring {
  --progress: 0;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: conic-gradient(var(--primary) calc(var(--progress) * 1%), #e2e8f0 0);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-direction: column;
  overflow: hidden;
}

.big-progress-ring::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: #fff;
}

.big-progress-ring strong,
.big-progress-ring span {
  position: relative;
  z-index: 1;
}

.big-progress-ring strong {
  font-size: 22px;
  line-height: 1;
}

.big-progress-ring span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.progress-overview-text {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.progress-overview-text strong {
  line-height: 1.35;
}

.progress-overview-text span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.mini-progress {
  width: 100%;
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.mini-progress span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--primary);
  min-width: 0;
}

.progress-stats-grid {
  grid-template-columns: repeat(2, 1fr);
}

.week-activity {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  align-items: end;
  margin-top: 4px;
}

.week-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.week-bar-wrap {
  height: 62px;
  width: 100%;
  display: flex;
  align-items: end;
  justify-content: center;
  background: #f1f5f9;
  border-radius: 999px;
  padding: 4px;
}

.week-bar {
  width: 100%;
  max-width: 22px;
  border-radius: 999px;
  background: #cbd5e1;
  display: block;
  transition: height 0.25s ease;
}

.week-bar.active {
  background: var(--primary);
}

.week-day strong {
  font-size: 12px;
}

.week-day small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.week-note {
  margin-top: 10px;
}

.category-progress-list,
.weak-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.category-progress-row {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.category-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.category-progress-name {
  font-weight: 850;
}

.category-progress-head strong {
  color: var(--primary);
}

.category-progress-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.category-progress-meta span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 7px;
}

.selected-category-progress {
  margin-top: 12px;
}

.weak-item-row {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 11px 12px;
  background: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.weak-item-row div {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.weak-item-row strong {
  font-size: 15px;
  line-height: 1.35;
}

.weak-item-row span:not(.badge) {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.badge.red-badge {
  background: #fee2e2;
  color: #991b1b;
}

@media (max-width: 360px) {
  .big-progress-row {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .progress-stats-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== v1.8 Design polish: Modern Study UI ===== */
:root {
  --bg: #f3f7ff;
  --card: rgba(255, 255, 255, 0.92);
  --text: #111827;
  --muted: #64748b;
  --line: rgba(148, 163, 184, 0.22);
  --primary: #2563eb;
  --primary-2: #7c3aed;
  --primary-soft: #eff6ff;
  --green: #059669;
  --red: #dc2626;
  --amber: #d97706;
  --shadow: 0 18px 42px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 10px 24px rgba(15, 23, 42, 0.06);
  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 13px;
}

html {
  background: #f3f7ff;
}

body {
  background:
    radial-gradient(circle at 12% -8%, rgba(37, 99, 235, 0.20) 0, transparent 34%),
    radial-gradient(circle at 86% 4%, rgba(124, 58, 237, 0.18) 0, transparent 30%),
    linear-gradient(180deg, #f8fbff 0%, #eef4ff 48%, #f8fafc 100%);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.app-shell {
  max-width: 500px;
  padding: env(safe-area-inset-top) 14px calc(98px + env(safe-area-inset-bottom));
}

.app-header {
  padding: 14px 2px 12px;
  background: linear-gradient(to bottom, rgba(248, 251, 255, 0.94), rgba(248, 251, 255, 0.66));
  border-bottom: 1px solid rgba(255, 255, 255, 0.7);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.app-mark {
  width: 42px;
  height: 42px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: white;
  font-weight: 950;
  letter-spacing: -0.08em;
  box-shadow: 0 14px 26px rgba(37, 99, 235, 0.24);
  flex: 0 0 auto;
}

.eyebrow {
  font-size: 11px;
  color: #2563eb;
  opacity: 0.9;
}

h1 {
  font-size: 25px;
  letter-spacing: -0.04em;
}

h2 {
  letter-spacing: -0.02em;
}

.card {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.70);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.card.compact {
  box-shadow: var(--shadow-soft);
}

.hero-card {
  min-height: 138px;
  padding: 20px;
  background:
    radial-gradient(circle at 86% 20%, rgba(255,255,255,0.24) 0, transparent 25%),
    linear-gradient(135deg, #2563eb 0%, #4f46e5 48%, #7c3aed 100%);
  box-shadow: 0 20px 48px rgba(37, 99, 235, 0.26);
}

.hero-card::before {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 22px;
  pointer-events: none;
}

.hero-card::after {
  content: "Aa";
  right: -10px;
  bottom: -26px;
  font-size: 104px;
  opacity: 0.92;
  color: rgba(255, 255, 255, 0.10);
  letter-spacing: -0.11em;
}

.hero-title {
  font-size: 25px;
  line-height: 1.22;
  letter-spacing: -0.045em;
}

.hero-subtitle {
  font-size: 13px;
  color: rgba(255,255,255,0.86);
}

.section-title {
  margin-bottom: 2px;
}

.badge {
  background: rgba(241, 245, 249, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.16);
  color: #475569;
}

.badge.primary {
  background: rgba(37, 99, 235, 0.10);
  border-color: rgba(37, 99, 235, 0.13);
  color: #1d4ed8;
}

.badge.red-badge {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}

.stat-card {
  position: relative;
  overflow: hidden;
  background: rgba(255,255,255,0.92);
  border-color: rgba(255, 255, 255, 0.76);
  border-radius: 20px;
  box-shadow: var(--shadow-soft);
}

.stat-card::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 0;
  width: 34px;
  height: 4px;
  border-radius: 0 0 999px 999px;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
}

.stat-card strong {
  font-size: 22px;
  letter-spacing: -0.04em;
}

.stat-card span {
  font-weight: 750;
}

.icon-button {
  background: rgba(255,255,255,0.86);
  color: #334155;
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-soft);
}

.btn,
.audio-btn,
.choice-btn,
.quiz-mode-card,
.category-card,
.segmented button,
.nav-item {
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn:active,
.audio-btn:active,
.choice-btn:active,
.quiz-mode-card:active,
.category-card:active,
.nav-item:active,
.icon-button:active {
  transform: scale(0.975);
}

.btn {
  min-height: 42px;
  box-shadow: 0 8px 16px rgba(37, 99, 235, 0.08);
}

.btn.primary {
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  box-shadow: 0 12px 22px rgba(37, 99, 235, 0.22);
}

.btn.green {
  background: #ecfdf5;
  color: #047857;
  box-shadow: 0 8px 16px rgba(5, 150, 105, 0.08);
}

.btn.red {
  background: #fef2f2;
  color: #b91c1c;
}

.btn.gray {
  background: rgba(241, 245, 249, 0.88);
  color: #334155;
}

.learning-card {
  position: relative;
  gap: 12px;
  overflow: hidden;
  border-left: 5px solid rgba(37, 99, 235, 0.56);
}

.learning-card::before {
  content: "";
  position: absolute;
  right: -34px;
  top: -42px;
  width: 120px;
  height: 120px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.055);
  pointer-events: none;
}

.learning-card.needs-review {
  border-left-color: rgba(217, 119, 6, 0.72);
}

.learning-card.is-learned {
  border-left-color: rgba(5, 150, 105, 0.72);
}

.item-top {
  position: relative;
  z-index: 1;
}

.item-text {
  font-size: 26px;
  line-height: 1.12;
  letter-spacing: -0.055em;
}

.item-meaning {
  color: #475569;
  font-weight: 650;
}

.example-box {
  position: relative;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.09), rgba(124, 58, 237, 0.055));
  border: 1px solid rgba(37, 99, 235, 0.11);
  padding: 13px 14px 13px 15px;
}

.example-box::before {
  content: "“";
  position: absolute;
  right: 13px;
  top: -5px;
  color: rgba(37, 99, 235, 0.13);
  font-size: 54px;
  font-family: Georgia, serif;
  line-height: 1;
}

.example-en {
  font-size: 16px;
  color: #1e293b;
  padding-right: 24px;
}

.example-ja {
  color: #64748b;
}

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

.audio-action-grid .audio-btn {
  width: 100%;
  justify-content: center;
}

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

.learning-action-grid .btn {
  width: 100%;
}

.audio-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  background: rgba(255,255,255,0.96);
  border: 1px solid rgba(37, 99, 235, 0.11);
  color: #1d4ed8;
  box-shadow: 0 8px 15px rgba(15, 23, 42, 0.06);
}

.segmented {
  background: rgba(226, 232, 240, 0.78);
  border: 1px solid rgba(148, 163, 184, 0.18);
  padding: 5px;
}

.segmented button.active {
  color: #1d4ed8;
}

.category-grid {
  gap: 11px;
}

.category-card {
  min-height: 132px;
  background: rgba(255,255,255,0.92);
  border-color: rgba(255, 255, 255, 0.70);
  box-shadow: var(--shadow-soft);
}

.category-card .icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: rgba(37, 99, 235, 0.08);
}

.category-card.active {
  background: linear-gradient(135deg, rgba(37,99,235,0.11), rgba(124,58,237,0.08));
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.12);
}

.quiz-mode-card {
  min-height: 74px;
  border-color: rgba(255, 255, 255, 0.72);
  background: rgba(255,255,255,0.92);
  box-shadow: var(--shadow-soft);
  position: relative;
  overflow: hidden;
}

.quiz-mode-card::after {
  content: "›";
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(37, 99, 235, 0.32);
  font-size: 28px;
  font-weight: 900;
}

.quiz-mode-card.primary {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(124, 58, 237, 0.08));
  border-color: rgba(37, 99, 235, 0.18);
}

.quiz-mode-card.review-mode {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.13), rgba(251, 191, 36, 0.08));
  border-color: rgba(217, 119, 6, 0.18);
}

.quiz-progress {
  height: 10px;
  background: rgba(226, 232, 240, 0.82);
}

.quiz-progress span {
  background: linear-gradient(90deg, #2563eb, #7c3aed);
}

.quiz-question {
  font-size: 21px;
  color: #111827;
  letter-spacing: -0.025em;
}

.quiz-translation-box,
.summary-question-box {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.09), rgba(14, 165, 233, 0.045));
  border-color: rgba(37, 99, 235, 0.13);
}

.answer-input {
  min-height: 50px;
  background: rgba(255,255,255,0.95);
  border-color: rgba(148, 163, 184, 0.32);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.75);
}

.answer-input:focus {
  border-color: rgba(37, 99, 235, 0.72);
  box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.10);
}

.choice-list {
  gap: 10px;
}

.choice-btn {
  min-height: 52px;
  background: rgba(255,255,255,0.94);
  border-color: rgba(148, 163, 184, 0.24);
  box-shadow: var(--shadow-soft);
}

.choice-btn.selected {
  border-color: rgba(37, 99, 235, 0.46);
  background: rgba(37, 99, 235, 0.09);
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.12);
}

.result-box,
.answer-detail-box,
.quiz-summary-item,
.summary-answer-block,
.review-insight,
.category-progress-row,
.weak-item-row {
  border-radius: 18px;
}

.result-box.correct {
  background: linear-gradient(135deg, #dcfce7, #ecfdf5);
}

.result-box.incorrect {
  background: linear-gradient(135deg, #fee2e2, #fff1f2);
}

.answer-detail-box {
  background: rgba(248, 250, 252, 0.92);
}

.quiz-summary-item {
  background: rgba(255,255,255,0.94);
  border-color: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-soft);
}

.quiz-summary-item.focus {
  background: linear-gradient(135deg, rgba(254,242,242,0.96), rgba(255,255,255,0.94));
}

.summary-answer-block {
  background: rgba(248, 250, 252, 0.92);
}

.summary-answer-block.correct-answer {
  background: rgba(236, 253, 245, 0.92);
}

.progress-overview-card {
  background:
    linear-gradient(135deg, rgba(255,255,255,0.96), rgba(239,246,255,0.86));
}

.big-progress-ring {
  background: conic-gradient(#2563eb calc(var(--progress) * 1%), #dbeafe 0);
  box-shadow: inset 0 0 0 1px rgba(37,99,235,0.08), 0 12px 24px rgba(37,99,235,0.12);
}

.big-progress-ring::before {
  background: rgba(255,255,255,0.96);
}

.mini-progress {
  background: rgba(226, 232, 240, 0.86);
}

.mini-progress span {
  background: linear-gradient(90deg, #2563eb, #7c3aed);
}

.week-bar-wrap {
  background: rgba(241, 245, 249, 0.82);
}

.week-bar.active {
  background: linear-gradient(180deg, #7c3aed, #2563eb);
}

.category-progress-row,
.weak-item-row {
  background: rgba(255,255,255,0.92);
  border-color: rgba(255, 255, 255, 0.72);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.045);
}

.weak-item-row {
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.weak-item-row strong {
  display: block;
  font-size: 15px;
  line-height: 1.35;
}

.weak-item-row span:not(.badge) {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  margin-top: 3px;
}

.category-progress-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.category-progress-meta span {
  background: rgba(241,245,249,0.92);
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 999px;
  padding: 4px 8px;
}

.category-progress-name {
  font-weight: 850;
}

.bottom-nav {
  bottom: 8px;
  width: min(472px, calc(100% - 20px));
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.14);
  padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
}

.nav-item {
  border-radius: 18px;
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(124, 58, 237, 0.10));
  color: #1d4ed8;
}

.nav-item.active span {
  transform: translateY(-1px);
}

.empty-state {
  background: rgba(255,255,255,0.82);
}

@media (max-width: 380px) {
  .app-shell {
    padding-left: 12px;
    padding-right: 12px;
  }

  .hero-title {
    font-size: 22px;
  }

  .hero-subtitle {
    font-size: 12.5px;
  }

  .item-text {
    font-size: 23px;
  }

  .audio-action-grid,
  .learning-action-grid {
    grid-template-columns: 1fr;
  }

  .big-progress-row {
    grid-template-columns: 88px 1fr;
    gap: 12px;
  }

  .big-progress-ring {
    width: 84px;
    height: 84px;
  }

  .big-progress-ring strong {
    font-size: 19px;
  }
}

/* v1.9 settings / data management */
.bottom-nav {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.nav-item small {
  font-size: 9px;
}

.settings-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.setting-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 13px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
}

.setting-row strong {
  display: block;
  font-size: 14px;
  line-height: 1.4;
}

.setting-row span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.setting-row b {
  color: #1d4ed8;
}

.setting-input,
.setting-row select,
.setting-row input[type="number"] {
  width: 86px;
  min-height: 42px;
  border: 1px solid rgba(148, 163, 184, 0.32);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  padding: 8px 10px;
  text-align: center;
  font-weight: 800;
  outline: none;
}

.setting-row select {
  width: 132px;
  text-align: left;
}

.range-row {
  grid-template-columns: 1fr;
}

.range-row input[type="range"] {
  width: 100%;
  accent-color: #2563eb;
}

.switch-row input[type="checkbox"] {
  width: 24px;
  height: 24px;
  accent-color: #2563eb;
}

.data-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 14px 0;
}

.data-summary-grid div {
  padding: 12px 8px;
  border-radius: 16px;
  background: rgba(248, 250, 252, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.14);
  text-align: center;
}

.data-summary-grid strong {
  display: block;
  font-size: 16px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-summary-grid span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.data-action-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.import-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.settings-details {
  margin-top: 12px;
  border-radius: 16px;
  background: rgba(248, 250, 252, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.14);
  overflow: hidden;
}

.settings-details summary {
  cursor: pointer;
  padding: 12px 13px;
  color: #334155;
  font-weight: 850;
}

.settings-details pre {
  margin: 0;
  padding: 12px 13px;
  border-top: 1px solid rgba(148, 163, 184, 0.14);
  color: #475569;
  font-size: 11px;
  line-height: 1.45;
  overflow: auto;
}

.danger-zone {
  border-color: rgba(220, 38, 38, 0.14);
  background: linear-gradient(135deg, rgba(255,255,255,0.96), rgba(254,242,242,0.86));
}

.badge.danger {
  background: #fee2e2;
  color: #b91c1c;
}

@media (max-width: 380px) {
  .bottom-nav {
    width: min(472px, calc(100% - 12px));
    padding-left: 5px;
    padding-right: 5px;
    gap: 2px;
  }

  .nav-item {
    padding-left: 2px;
    padding-right: 2px;
  }

  .nav-item span {
    font-size: 18px;
  }

  .nav-item small {
    font-size: 8px;
  }

  .setting-row {
    grid-template-columns: 1fr;
  }

  .setting-input,
  .setting-row select,
  .setting-row input[type="number"] {
    width: 100%;
  }

  .data-action-row {
    grid-template-columns: 1fr;
  }
}
