/* ===================== Root ===================== */
:root {
  --bg: #fff8fb;
  --bg-alt: #fdf1f8;
  --surface: #ffffff;
  --surface-2: #fdeef7;
  --border: rgba(236, 72, 153, 0.16);
  --text: #4a3b52;
  --muted: #92808f;
  --primary: #ec4899;
  --primary-soft: #f9a8d4;
  --accent: #a78bfa;
  --mint: #34d399;
  --red: #ef4444;
  --grad: linear-gradient(135deg, #f472b6 0%, #a78bfa 100%);
  --shadow: 0 18px 44px rgba(236, 72, 153, 0.13);
  --shadow-sm: 0 8px 20px rgba(236, 72, 153, 0.09);
  --r-lg: 26px;
  --r-md: 18px;
  --r-sm: 12px;
  --t: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  overflow-x: hidden;
}
h1, h2, h3, h4, .btn, .tab, .ghost-btn { font-family: "Quicksand", "Nunito", sans-serif; }
.jp, .kana-big, .vocab-big, .kanji-face { font-family: "Noto Sans JP", "Hiragino Sans", "Yu Gothic", sans-serif; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button, input { font: inherit; color: inherit; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.small { font-size: 0.86rem; }
.grad {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ===================== Petals ===================== */
.petals { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.petal {
  position: absolute;
  top: -40px;
  font-size: 16px;
  opacity: 0.55;
  animation: fall linear infinite;
}
@keyframes fall {
  0%   { transform: translateY(-40px) rotate(0deg); }
  100% { transform: translateY(105vh) rotate(420deg); }
}

/* ===================== Header ===================== */
.jd-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(255, 248, 251, 0.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.jd-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  height: 62px;
}
.back-link {
  font-size: 0.9rem;
  color: var(--muted);
  transition: color var(--t);
}
.back-link:hover { color: var(--primary); }
.jd-logo {
  font-family: "Noto Sans JP", sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.jd-logo small {
  display: block;
  font-family: "Quicksand", sans-serif;
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  -webkit-text-fill-color: var(--muted);
}

/* ===================== Buttons ===================== */
.btn {
  border: none;
  cursor: pointer;
  padding: 10px 22px;
  border-radius: 999px;
  background: var(--grad);
  color: #fff;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
  transition: transform var(--t), box-shadow var(--t), opacity var(--t);
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); }
.ghost-btn {
  cursor: pointer;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  transition: all var(--t);
}
.ghost-btn:hover { border-color: var(--primary-soft); color: var(--primary); }
.ghost-btn.danger:hover { border-color: rgba(239, 68, 68, 0.4); color: var(--red); }

/* ===================== Sync badge ===================== */
.header-actions { display: flex; align-items: center; gap: 8px; }
.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  border: 1.5px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  transition: all var(--t);
}
.sync-badge:hover { border-color: var(--primary-soft); color: var(--primary); }
.sync-badge i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  flex: none;
}
.sync-badge.is-ok { color: #0f7a5c; border-color: rgba(52, 211, 153, 0.45); }
.sync-badge.is-ok i { background: var(--mint); }
.sync-badge.is-busy i { background: var(--accent); animation: pulse 1s infinite; }
.sync-badge.is-error { color: #b91c1c; border-color: rgba(239, 68, 68, 0.4); }
.sync-badge.is-error i { background: var(--red); }
@keyframes pulse { 50% { opacity: 0.25; } }

/* ===================== Hero ===================== */
.hero { position: relative; z-index: 1; padding: 54px 0 34px; }
.eyebrow {
  color: var(--primary);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
}
.hero h1 { font-size: clamp(1.9rem, 5vw, 3rem); line-height: 1.2; margin: 6px 0 12px; }
.lead { color: var(--muted); max-width: 640px; }

/* Countdown */
.countdown-card {
  margin-top: 26px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 22px;
}
.countdown-head {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.cd-label {
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.cd-date { font-weight: 700; font-size: 1.05rem; }
.date-picker { display: flex; flex-direction: column; gap: 4px; }
.date-picker span {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.date-picker input {
  border: 1.5px solid var(--border);
  background: var(--bg-alt);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  outline: none;
  transition: border-color var(--t);
}
.date-picker input:focus { border-color: var(--primary-soft); }
.cd-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.cd-unit {
  background: var(--bg-alt);
  border-radius: var(--r-md);
  padding: 14px 6px;
  text-align: center;
}
.cd-unit b {
  display: block;
  font-family: "Quicksand", sans-serif;
  font-size: clamp(1.5rem, 5vw, 2.2rem);
  line-height: 1.1;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.cd-unit span {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.cd-note { margin-top: 12px; font-size: 0.88rem; color: var(--primary); font-weight: 600; }

/* Stats */
.stats-row {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 18px 14px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.stat-big {
  font-family: "Quicksand", sans-serif;
  font-size: 2rem;
  line-height: 1.1;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.stat-big small { font-size: 1rem; }
.stat-title { font-weight: 700; font-size: 0.9rem; margin-top: 4px; }
.stat-sub { font-size: 0.74rem; color: var(--muted); }

.ring { position: relative; width: 84px; height: 84px; margin: 0 auto 4px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 10; stroke-linecap: round; }
.ring-bg { stroke: var(--surface-2); }
.ring-fg {
  stroke: var(--primary);
  stroke-dasharray: 327;
  stroke-dashoffset: 327;
  transition: stroke-dashoffset 0.6s ease;
}
.ring span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: "Quicksand", sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
}

/* ===================== Tabs ===================== */
.tabs {
  position: sticky;
  top: 62px;
  z-index: 55;
  background: rgba(255, 248, 251, 0.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  margin-top: 20px;
}
.tabs-inner {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-top: 10px;
  padding-bottom: 10px;
  scrollbar-width: none;
}
.tabs-inner::-webkit-scrollbar { display: none; }
.tab {
  flex: none;
  cursor: pointer;
  border: 1.5px solid transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 8px 16px;
  border-radius: 999px;
  white-space: nowrap;
  transition: all var(--t);
}
.tab:hover { color: var(--primary); background: var(--surface-2); }
.tab.is-active {
  background: var(--grad);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

/* ===================== Panels ===================== */
.main { position: relative; z-index: 1; padding: 32px 20px 80px; }
.panel { display: none; animation: fadeUp 0.35s ease; }
.panel.is-active { display: block; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
.panel-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  justify-content: space-between;
  margin: 26px 0 16px;
}
.panel-head:first-child { margin-top: 0; }
.panel-head h2 { font-size: 1.5rem; }
.panel-head h3 { font-size: 1.15rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 22px;
}
.card h3 { margin-bottom: 8px; font-size: 1.08rem; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 18px; }
.bullets { display: grid; gap: 8px; font-size: 0.92rem; color: var(--muted); }
.bullets li { padding-left: 18px; position: relative; }
.bullets li::before { content: "🌸"; position: absolute; left: 0; font-size: 0.7rem; top: 4px; }
.bullets b { color: var(--text); }

/* ===================== Weekend cards ===================== */
.weekends { display: grid; gap: 14px; }
.wk {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow var(--t);
}
.wk.done { border-color: rgba(52, 211, 153, 0.45); }
.wk-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
}
.wk-emoji { font-size: 1.6rem; }
.wk-titles { flex: 1; min-width: 0; }
.wk-num {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--primary);
  font-weight: 700;
}
.wk-title { display: block; font-family: "Quicksand", sans-serif; font-weight: 700; font-size: 1.06rem; }
.wk-goal {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wk-meta { display: flex; align-items: center; gap: 12px; }
.wk-bar { width: 90px; height: 7px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.wk-bar i { display: block; height: 100%; width: 0; background: var(--grad); transition: width 0.4s ease; }
.wk-count { font-size: 0.78rem; color: var(--muted); font-weight: 700; min-width: 34px; text-align: right; }
.wk-caret { color: var(--muted); transition: transform var(--t); }
.wk.open .wk-caret { transform: rotate(180deg); }
.wk-body { display: none; padding: 0 20px 20px; }
.wk.open .wk-body { display: block; }
.day-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.day {
  background: var(--bg-alt);
  border-radius: var(--r-md);
  padding: 16px;
}
.day h4 {
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 10px;
}
.wk-goal-line {
  margin-top: 14px;
  font-size: 0.88rem;
  background: var(--surface-2);
  border-radius: var(--r-sm);
  padding: 10px 14px;
}

/* Task checkboxes */
.tasks { display: grid; gap: 8px; }
.task {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  cursor: pointer;
  font-size: 0.91rem;
  line-height: 1.45;
}
.task input { position: absolute; opacity: 0; pointer-events: none; }
.box {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  border-radius: 7px;
  border: 2px solid var(--primary-soft);
  background: var(--surface);
  display: grid;
  place-items: center;
  transition: all var(--t);
}
.box::after {
  content: "";
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg) scale(0);
  transition: transform var(--t);
  margin-top: -2px;
}
.task input:checked + .box { background: var(--grad); border-color: transparent; }
.task input:checked + .box::after { transform: rotate(45deg) scale(1); }
.task input:checked ~ .task-text { color: var(--muted); text-decoration: line-through; }
.task:hover .box { border-color: var(--primary); }

.checklist { display: grid; gap: 10px; margin-bottom: 12px; }

/* Streak grid */
.streak-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin: 14px 0 8px;
}
.streak-day {
  aspect-ratio: 1;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--border);
  background: var(--bg-alt);
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  display: grid;
  place-items: center;
  transition: all var(--t);
}
.streak-day:hover { border-color: var(--primary-soft); }
.streak-day.on { background: var(--grad); color: #fff; border-color: transparent; }
.streak-day.today { box-shadow: 0 0 0 2px var(--primary-soft); }

/* ===================== Quiz ===================== */
.quiz-card { text-align: center; }
.quiz-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.seg {
  display: inline-flex;
  gap: 4px;
  background: var(--bg-alt);
  border-radius: 999px;
  padding: 4px;
  flex-wrap: wrap;
}
.seg.wide { display: flex; margin-bottom: 16px; }
.seg-btn {
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.84rem;
  padding: 6px 14px;
  border-radius: 999px;
  transition: all var(--t);
}
.seg-btn:hover { color: var(--primary); }
.seg-btn.is-on { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 0.86rem; color: var(--muted); cursor: pointer; }
.switch input { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; }

.quiz-prompt { font-size: 0.8rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.kana-big { font-size: clamp(4rem, 16vw, 7rem); line-height: 1.1; font-weight: 500; }
.vocab-big { font-size: clamp(1.8rem, 7vw, 2.8rem); line-height: 1.2; font-weight: 500; }
.vocab-kanji { color: var(--muted); font-size: 1rem; }
.answer-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 12px;
}
.answer-row input {
  border: 1.5px solid var(--border);
  background: var(--bg-alt);
  border-radius: 999px;
  padding: 10px 20px;
  width: min(220px, 60vw);
  text-align: center;
  outline: none;
  transition: border-color var(--t);
}
.answer-row input:focus { border-color: var(--primary); }
.feedback { min-height: 26px; font-weight: 700; font-size: 0.94rem; margin-top: 10px; }
.feedback.ok { color: var(--mint); }
.feedback.no { color: var(--red); }

.choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}
.choice {
  cursor: pointer;
  border: 1.5px solid var(--border);
  background: var(--bg-alt);
  border-radius: var(--r-md);
  padding: 12px 14px;
  font-weight: 600;
  font-size: 0.92rem;
  transition: all var(--t);
}
.choice:hover:not(:disabled) { border-color: var(--primary-soft); transform: translateY(-2px); }
.choice.ok { background: rgba(52, 211, 153, 0.16); border-color: var(--mint); color: #0f7a5c; }
.choice.no { background: rgba(239, 68, 68, 0.12); border-color: var(--red); color: #b91c1c; }
.choice:disabled { cursor: default; }

.score-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 20px;
  border-top: 1px dashed var(--border);
  padding-top: 16px;
}
.score-row > div b {
  display: block;
  font-family: "Quicksand", sans-serif;
  font-size: 1.4rem;
  color: var(--primary);
}
.score-row > div span {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.miss-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-top: 14px;
}
.miss-chip {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #b91c1c;
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 0.8rem;
  font-weight: 700;
}

/* ===================== Kana chart ===================== */
.kana-chart { display: grid; gap: 16px; }
.chart-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}
.chart-row h4 {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.chart-cells { display: flex; flex-wrap: wrap; gap: 8px; }
.cell {
  min-width: 58px;
  flex: 0 0 auto;
  background: var(--bg-alt);
  border-radius: var(--r-sm);
  padding: 8px 4px;
  text-align: center;
  transition: transform var(--t), background var(--t);
}
.cell:hover { transform: translateY(-3px); background: var(--surface-2); }
.cell b { display: block; font-family: "Noto Sans JP", sans-serif; font-size: 1.5rem; font-weight: 500; }
.cell span { font-size: 0.7rem; color: var(--muted); }

/* ===================== Kanji ===================== */
.kanji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.kanji-card { perspective: 900px; cursor: pointer; height: 190px; }
.kanji-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.5s;
  transform-style: preserve-3d;
}
.kanji-card.flipped .kanji-inner { transform: rotateY(180deg); }
.kanji-face,
.kanji-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px;
  text-align: center;
}
.kanji-face b { font-size: 3.2rem; line-height: 1; font-weight: 500; }
.kanji-face i { font-style: normal; font-size: 0.68rem; color: var(--muted); letter-spacing: 0.12em; text-transform: uppercase; margin-top: 6px; }
.kanji-back { transform: rotateY(180deg); background: var(--bg-alt); gap: 2px; }
.kanji-back .m { font-weight: 800; font-size: 0.98rem; }
.kanji-back .r { font-size: 0.78rem; color: var(--muted); font-family: "Noto Sans JP", sans-serif; }
.kanji-back .ex {
  margin-top: 6px;
  font-size: 0.68rem;
  line-height: 1.45;
  color: var(--muted);
  background: var(--surface);
  border-radius: var(--r-sm);
  padding: 5px 7px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.know-btn {
  margin-top: 8px;
  cursor: pointer;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.74rem;
  font-weight: 700;
  transition: all var(--t);
}
.know-btn:hover { border-color: var(--mint); color: var(--mint); }
.kanji-card.known .kanji-face,
.kanji-card.known .kanji-back { border-color: var(--mint); box-shadow: 0 0 0 1.5px rgba(52, 211, 153, 0.3); }
.kanji-card.known .know-btn { background: var(--mint); color: #fff; border-color: transparent; }

/* ===================== Vocab list ===================== */
.vocab-list { display: grid; gap: 22px; }
.vocab-group h4 {
  font-size: 0.76rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 10px;
}
.vocab-group-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
}
.vocab-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
}
.vocab-item b { font-family: "Noto Sans JP", sans-serif; font-size: 1.05rem; font-weight: 500; }
.vocab-item .kj { font-family: "Noto Sans JP", sans-serif; color: var(--muted); font-size: 0.82rem; margin-left: 6px; }
.vocab-item p { font-size: 0.84rem; color: var(--muted); }

/* ===================== Grammar ===================== */
.grammar-list { display: grid; gap: 20px; }.gr-week h3 {
  font-size: 0.76rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 10px;
}
.gr-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.gr-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--t);
}
.gr-card:hover { transform: translateY(-3px); }
.gr-card b { font-family: "Noto Sans JP", sans-serif; font-size: 1.1rem; }
.gr-card p { font-size: 0.86rem; color: var(--muted); margin-top: 4px; }
.gr-card .ex {
  margin-top: 10px;
  font-family: "Noto Sans JP", sans-serif;
  font-size: 0.86rem;
  background: var(--bg-alt);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  color: var(--text);
}

/* ===================== Exam facts ===================== */
.exam-sections { display: grid; gap: 10px; margin-top: 12px; }
.exam-sec {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 12px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 14px;
}
.exam-sec-no {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
}
.exam-sec b { font-family: "Noto Sans JP", sans-serif; font-size: 0.98rem; font-weight: 500; }
.exam-sec p { font-size: 0.82rem; color: var(--muted); margin-top: 2px; }
.exam-sec-min {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--primary);
  white-space: nowrap;
}
#panel-exam .card + .card,
#panel-exam .card + .split { margin-top: 16px; }

/* ===================== Timer ===================== */
.timer-card { text-align: center; }
.timer-phase {
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--primary);
  font-weight: 700;
}
.timer-clock {
  font-family: "Quicksand", sans-serif;
  font-weight: 700;
  font-size: clamp(3rem, 14vw, 5.5rem);
  line-height: 1.1;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-variant-numeric: tabular-nums;
}
.timer-card.break .timer-phase { color: var(--mint); }
.timer-dots { display: flex; gap: 8px; justify-content: center; margin: 10px 0 18px; }
.timer-dots i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
}
.timer-dots i.on { background: var(--grad); border-color: transparent; }
.timer-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 12px; }

/* ===================== Notes ===================== */
.note-form { display: flex; gap: 10px; flex-wrap: wrap; }
.note-form input {
  flex: 1;
  min-width: 200px;
  border: 1.5px solid var(--border);
  background: var(--bg-alt);
  border-radius: 999px;
  padding: 10px 20px;
  outline: none;
  transition: border-color var(--t);
}
.note-form input:focus { border-color: var(--primary); }
.notes-list { display: grid; gap: 10px; margin-top: 16px; }
.note {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary-soft);
  border-radius: var(--r-md);
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  box-shadow: var(--shadow-sm);
}
.note.solved { border-left-color: var(--mint); opacity: 0.62; }
.note.solved .note-text { text-decoration: line-through; }
.note-text { flex: 1; font-size: 0.94rem; }
.note-date { display: block; font-size: 0.72rem; color: var(--muted); }
.note-actions { display: flex; gap: 6px; flex: none; }
.icon-btn {
  cursor: pointer;
  border: 1.5px solid var(--border);
  background: var(--surface);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  color: var(--muted);
  transition: all var(--t);
}
.icon-btn:hover { border-color: var(--primary-soft); color: var(--primary); }
.empty { color: var(--muted); font-size: 0.9rem; text-align: center; padding: 24px; }

/* ===================== Footer / Toast ===================== */
.jd-footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
  padding: 34px 0;
  text-align: center;
}
.jd-footer .jp { font-size: 1.1rem; font-weight: 700; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 30px);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 999px;
  padding: 12px 24px;
  font-weight: 700;
  font-size: 0.92rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t), transform var(--t);
  z-index: 200;
  max-width: 90vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ===================== Sync dialog ===================== */
.sync-dialog {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  background: var(--surface);
  color: var(--text);
  padding: 26px;
  width: min(420px, 92vw);
  margin: auto; /* the global reset kills the UA centering */
}
.sync-dialog::backdrop { background: rgba(74, 59, 82, 0.35); backdrop-filter: blur(3px); }
.sync-dialog h3 { font-size: 1.2rem; margin-bottom: 6px; }
.ghost-btn.danger { color: var(--primary); border-color: rgba(236, 72, 153, 0.35); }
.sync-dialog input {
  width: 100%;
  margin-top: 14px;
  border: 1.5px solid var(--border);
  background: var(--bg-alt);
  border-radius: 999px;
  padding: 10px 20px;
  outline: none;
  transition: border-color var(--t);
}
.sync-dialog input:focus { border-color: var(--primary); }
.dialog-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 18px;
}

/* ===================== Responsive ===================== */
@media (max-width: 860px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .split { grid-template-columns: 1fr; }
  .day-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .jd-header-inner { height: 56px; }
  .tabs { top: 56px; }
  .jd-logo { display: none; }
  #loveBtn { display: none; }
  .cd-grid { grid-template-columns: repeat(2, 1fr); }
  .choices { grid-template-columns: 1fr; }
  .wk-head { padding: 14px 16px; gap: 10px; }
  .wk-bar { width: 54px; }
  .wk-goal { display: none; }
  .score-row { grid-template-columns: repeat(2, 1fr); row-gap: 14px; }
  .kanji-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
