:root {
  --ink: #17324d;
  --ink-soft: #294b61;
  --paper: #f8f3e9;
  --surface: #fffdf8;
  --surface-soft: #f2ede3;
  --line: #e2d8c8;
  --muted: #586a75;
  --red: #dc5a3b;
  --red-dark: #b6422c;
  --teal: #4f7c77;
  --gold: #d3a23f;
  --success: #2f7a63;
  --danger: #b64736;
  --action-bg: #b44833;
  --action-hover: #963723;
  --shadow-sm: 0 8px 24px rgba(23, 50, 77, .07);
  --shadow-md: 0 18px 42px rgba(23, 50, 77, .13);
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Be Vietnam Pro", "Noto Sans", Arial, sans-serif;
  --serif: "Iowan Old Style", "Noto Serif", Georgia, serif;
  --jp: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif;
  color-scheme: light;
}

html[data-mode="dark"] {
  --ink: #f2eadc;
  --ink-soft: #d8cfbf;
  --paper: #0b1322;
  --surface: #14243a;
  --surface-soft: #101d30;
  --line: #31435c;
  --muted: #b6ad9d;
  --red: #c6533d;
  --red-dark: #f09a82;
  --teal: #80bdb4;
  --gold: #d6b66f;
  --success: #76c69d;
  --danger: #f19a86;
  --action-bg: #b44833;
  --action-hover: #963723;
  --shadow-sm: 0 8px 24px rgba(0, 0, 0, .24);
  --shadow-md: 0 18px 42px rgba(0, 0, 0, .34);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
  scroll-padding-bottom: calc(100px + env(safe-area-inset-bottom));
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 0 0, rgba(220, 90, 59, .055), transparent 26rem),
    radial-gradient(circle at 100% 20%, rgba(79, 124, 119, .055), transparent 26rem),
    #e8e2d7;
  font-family: var(--sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button { color: inherit; }
svg { display: block; }

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 2px;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.app-shell {
  width: min(100%, 720px);
  min-height: 100dvh;
  margin: 0 auto;
  background:
    linear-gradient(rgba(23, 50, 77, .018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 50, 77, .018) 1px, transparent 1px),
    var(--paper);
  background-size: 36px 36px;
  box-shadow: 0 0 70px rgba(23, 50, 77, .12);
  position: relative;
}

.offline-banner {
  position: fixed;
  z-index: 80;
  top: max(8px, env(safe-area-inset-top));
  left: 50%;
  width: min(calc(100% - 24px), 680px);
  transform: translateX(-50%);
  padding: 10px 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 12px;
  color: white;
  background: #283c4c;
  box-shadow: var(--shadow-md);
  font-size: 12px;
  font-weight: 650;
}
.offline-banner[hidden] { display: none !important; }

.offline-banner svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }

.app-header {
  position: relative;
  z-index: 40;
  min-height: calc(67px + env(safe-area-inset-top));
  padding: max(12px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) 10px max(20px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--paper);
  border-bottom: 1px solid rgba(23, 50, 77, .075);
}

.app-brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
}

.brand-seal {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #fff9ef;
  background: var(--red);
  font: 700 17px/1 var(--jp);
  letter-spacing: -2px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .38), 0 6px 16px rgba(220, 90, 59, .16);
}

.app-brand strong { display: block; font: 650 18px/1.05 var(--serif); }
.app-brand small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }

.avatar-button {
  width: 43px;
  height: 43px;
  border: 0;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--ink);
  position: relative;
  cursor: pointer;
  overflow: visible;
  font: 700 17px/1 var(--jp);
}

.avatar-button img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.avatar-button i { position: absolute; right: -2px; top: -2px; width: 10px; height: 10px; border-radius: 50%; background: var(--red); border: 2px solid var(--paper); }

.app-main { padding: 0 max(20px, env(safe-area-inset-right)) calc(100px + env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left)); }
.app-view { padding: 28px 0 22px; }
.app-view.is-active { animation: view-in .22s ease both; }
.app-view[hidden] { display: none !important; }

@keyframes view-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: none; }
}

.greeting-row { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; }
.section-kicker { margin: 0 0 7px; color: var(--red-dark); font-size: 12px; font-weight: 850; letter-spacing: .13em; text-transform: uppercase; }

.greeting-row h1,
.view-heading h1 {
  margin: 0;
  font: 600 clamp(31px, 8vw, 42px)/1.04 var(--serif);
  letter-spacing: -.035em;
}

.greeting-row h1 span { color: var(--red); }
.section-lead, .view-heading p { margin: 8px 0 0; color: var(--muted); font-size: 14px; }

.streak-ring {
  width: 66px;
  height: 66px;
  flex: 0 0 auto;
  border-radius: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.streak-ring:after { content: "続"; position: absolute; right: -5px; bottom: -11px; color: rgba(220, 90, 59, .09); font: 700 54px/1 var(--jp); }
.streak-ring strong { font-size: 20px; line-height: 1; position: relative; z-index: 1; }
.streak-ring span { margin-top: 4px; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; position: relative; z-index: 1; }

.status-chips { display: flex; gap: 8px; margin: 18px 0; overflow-x: auto; scrollbar-width: none; }
.status-chips::-webkit-scrollbar { display: none; }
.status-chip { min-height: 36px; padding: 7px 11px; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 12px; font-weight: 750; }
.status-chip b { color: var(--red); font-family: var(--jp); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--red); }

.resume-card {
  min-height: 244px;
  padding: 23px;
  border-radius: 25px;
  color: white;
  background: linear-gradient(145deg, #173852, #102c45);
  box-shadow: 0 18px 38px rgba(23, 50, 77, .2);
  position: relative;
  overflow: hidden;
}

.resume-decoration { position: absolute; right: -9px; bottom: -38px; color: rgba(255, 255, 255, .055); font: 700 155px/1 var(--jp); }
.card-kicker { margin: 0; color: #c8d6dd; font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; position: relative; z-index: 1; }
.resume-card h2 { max-width: 420px; margin: 10px 0 7px; font: 600 clamp(27px, 7.5vw, 37px)/1.1 var(--serif); letter-spacing: -.025em; position: relative; z-index: 1; }
.resume-meta { max-width: 410px; margin: 0; color: #d8e2e6; font-size: 13px; line-height: 1.55; position: relative; z-index: 1; }
.resume-progress { margin: 17px 0 0; display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; position: relative; z-index: 1; }
.resume-progress span { color: #d6e0e5; font-size: 12px; font-weight: 750; }
.progress-track { height: 6px; border-radius: 999px; overflow: hidden; background: rgba(255, 255, 255, .14); }
.progress-track i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--gold); transition: width .35s ease; }

.primary-button {
  min-height: 48px;
  margin-top: 18px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 14px;
  color: white;
  background: var(--red);
  text-decoration: none;
  font-size: 14px;
  font-weight: 800;
  position: relative;
  z-index: 2;
  box-shadow: 0 9px 24px rgba(220, 90, 59, .23);
}

.primary-button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; }
.primary-button:active, .quick-action:active, .plan-item:active, .course-card:active { transform: scale(.985); }

.content-section { margin-top: 27px; }
.content-section.compact { margin-top: 23px; }
.section-heading { min-height: 27px; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.section-heading h2 { margin: 0; font-size: 18px; letter-spacing: -.015em; }
.section-heading button, .section-heading > span, .section-heading > a { min-height: 44px; border: 0; padding: 10px 0; display: inline-flex; align-items: center; color: var(--red-dark); background: transparent; text-decoration: none; font-size: 12px; font-weight: 750; cursor: pointer; }

.quick-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.quick-action { min-width: 0; padding: 0; border: 0; display: flex; flex-direction: column; align-items: center; color: var(--ink); background: transparent; text-decoration: none; cursor: pointer; transition: transform .12s ease; }
.quick-symbol { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-sm); font: 700 20px/1 var(--jp); }
.quick-symbol.coral { color: var(--red); background: #fff6f2; }
.quick-symbol.teal { color: var(--teal); background: #eff7f4; }
.quick-symbol.gold { color: #9a6b16; background: #fff8e7; }
.quick-symbol.navy { color: var(--ink); background: #f1f5f7; }
.quick-action strong { max-width: 100%; margin-top: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.quick-action small { max-width: 100%; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 12px; }

.daily-plan { display: grid; gap: 9px; }
.plan-item { width: 100%; min-height: 68px; padding: 10px 11px; display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 11px; border: 1px solid var(--line); border-radius: 17px; color: var(--ink); background: rgba(255, 253, 248, .9); text-align: left; cursor: pointer; transition: .16s ease; }
.task-check { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 12px; color: transparent; background: #eef3f4; border: 1px solid #dce6e7; }
.task-check svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; }
.task-copy { min-width: 0; }
.task-copy strong { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 13px; }
.task-copy small { display: block; margin-top: 4px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); font-size: 12px; }
.task-time { color: var(--muted); font-size: 12px; }
.plan-item.is-done { border-color: rgba(47, 122, 99, .28); background: #f2f8f5; }
.plan-item.is-done .task-check { color: white; background: var(--success); border-color: var(--success); }
.plan-item.is-done .task-copy strong { color: var(--muted); text-decoration: line-through; }

.week-chart { height: 112px; padding: 13px 9px 7px; display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; align-items: end; border: 1px solid var(--line); border-radius: 18px; background: rgba(255, 253, 248, .8); }
.week-day { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; }
.week-bar { width: min(22px, 72%); min-height: 6px; border-radius: 999px; background: #d8dedc; transition: height .3s ease; }
.week-day.is-today .week-bar { background: var(--red); }
.week-day span { color: var(--muted); font-size: 12px; font-weight: 750; text-transform: uppercase; }

.view-heading { margin-bottom: 22px; }
.view-heading h1 { font-size: clamp(34px, 8.5vw, 45px); }
.view-heading > p:last-child { max-width: 540px; line-height: 1.65; }

.journey-banner { min-height: 145px; margin-bottom: 18px; border: 1px solid var(--line); border-radius: 22px; overflow: hidden; background: var(--surface); position: relative; box-shadow: var(--shadow-sm); }
.journey-banner img { width: 100%; height: 145px; display: block; object-fit: cover; filter: saturate(.82) contrast(.96); }
.journey-banner:after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(14, 39, 58, .93) 0, rgba(14, 39, 58, .68) 51%, transparent 82%); }
.journey-banner div { position: absolute; z-index: 2; left: 18px; top: 21px; width: 58%; color: white; }
.journey-banner small { display: block; color: #f0d38f; font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.journey-banner strong { display: block; margin-top: 8px; font: 600 23px/1.08 var(--serif); }
.journey-banner a { min-height: 44px; margin-top: 5px; display: inline-flex; align-items: center; color: white; font-size: 12px; font-weight: 750; text-decoration: none; }

.filter-row { margin: 0 -20px 14px; padding: 0 20px; display: flex; gap: 7px; overflow-x: auto; scrollbar-width: none; }
.filter-row::-webkit-scrollbar { display: none; }
.filter-row button { min-width: 48px; min-height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: var(--surface); font-size: 12px; font-weight: 750; cursor: pointer; }
.filter-row button.is-active { color: white; background: var(--ink); border-color: var(--ink); }

.course-list { display: grid; gap: 9px; }
.course-card { min-height: 88px; padding: 11px 13px; display: grid; grid-template-columns: 55px minmax(0, 1fr) 19px; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: 18px; background: rgba(255, 253, 248, .88); text-decoration: none; transition: transform .12s ease, opacity .18s ease; }
.course-card.is-filtered { display: none; }
.level-mark { width: 55px; height: 55px; display: grid; place-items: center; border-radius: 17px; color: white; font: 700 17px/1 var(--serif); }
.level-mark.n5 { background: #5a8982; }
.level-mark.n4 { background: #3d6f7b; }
.level-mark.n3 { background: #294f72; }
.level-mark.n2 { background: #203e62; }
.level-mark.n1 { background: #d45a3d; }
.course-copy { min-width: 0; }
.course-copy strong { display: block; font-size: 14px; }
.course-copy small { display: block; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 12px; }
.course-progress { display: inline-block; margin-top: 6px; color: #356b66; font-size: 12px; font-weight: 800; }
.course-card > svg { width: 19px; height: 19px; fill: none; stroke: #a4afb5; stroke-width: 1.8; }

.path-grid, .exam-mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.path-grid a, .exam-mode-grid a { min-height: 95px; padding: 13px; display: grid; grid-template-columns: 42px 1fr; grid-template-rows: auto auto; align-content: center; column-gap: 10px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); text-decoration: none; }
.path-grid a > span, .mode-icon { grid-row: 1 / 3; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; color: var(--red); background: #fff0eb; font: 700 17px/1 var(--jp); }
.path-grid strong, .exam-mode-grid strong { align-self: end; font-size: 13px; }
.path-grid small, .exam-mode-grid small { align-self: start; margin-top: 2px; color: var(--muted); font-size: 12px; }

.exam-hero { min-height: 128px; padding: 18px; display: grid; grid-template-columns: 62px minmax(0, 1fr) 22px; gap: 14px; align-items: center; border-radius: 22px; color: white; background: linear-gradient(135deg, var(--ink), #244b67); box-shadow: var(--shadow-md); text-decoration: none; }
.exam-hero-icon { width: 62px; height: 62px; display: grid; place-items: center; border-radius: 20px; color: #3c2a0b; background: var(--gold); font: 700 27px/1 var(--jp); }
.exam-hero small { display: block; color: #d6e1e6; font-size: 12px; font-weight: 800; letter-spacing: .1em; }
.exam-hero strong { display: block; margin-top: 6px; font: 600 21px/1.15 var(--serif); }
.exam-hero span { display: block; margin-top: 4px; color: #d6e1e6; font-size: 12px; }
.exam-hero > svg { width: 22px; height: 22px; fill: none; stroke: white; stroke-width: 1.8; }
.mode-icon.coral { color: var(--red); background: #fff0eb; }
.mode-icon.teal { color: var(--teal); background: #edf7f4; }
.mode-icon.gold { color: #96681a; background: #fff6dc; }
.mode-icon.navy { color: var(--ink); background: #eef3f6; }

.recent-exams { display: grid; gap: 9px; }
.exam-result-item { min-height: 66px; padding: 11px 13px; display: grid; grid-template-columns: 42px 1fr auto; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.exam-score { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; color: white; background: var(--teal); font-size: 12px; font-weight: 800; }
.exam-result-copy strong { display: block; font-size: 12px; }
.exam-result-copy small { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.exam-result-item > span:last-child { color: var(--muted); font-size: 12px; }

.empty-card, .lookup-empty { padding: 25px 18px; text-align: center; border: 1px dashed #d6ccbc; border-radius: 18px; background: rgba(255, 253, 248, .55); }
.empty-card > span, .lookup-empty > span { width: 45px; height: 45px; margin: 0 auto 9px; display: grid; place-items: center; border-radius: 14px; color: var(--teal); background: #edf5f3; font: 700 19px/1 var(--jp); }
.empty-card strong, .lookup-empty strong { display: block; font-size: 13px; }
.empty-card p, .lookup-empty p { max-width: 360px; margin: 5px auto 0; color: var(--muted); font-size: 12px; line-height: 1.55; }

.focus-note { margin-top: 20px; padding: 13px 15px; display: flex; align-items: center; gap: 11px; border-radius: 15px; color: #6c5521; background: #fff6dc; border: 1px solid #ecdbab; }
.focus-note span { color: #936b1c; font: 700 16px/1 var(--jp); }
.focus-note p { margin: 0; font-size: 12px; line-height: 1.55; }

.lookup-heading { margin-bottom: 17px; }
.lookup-types { padding: 4px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; border-radius: 14px; background: #ece6dc; }
.lookup-types button { min-height: 44px; border: 0; border-radius: 10px; color: var(--muted); background: transparent; font-size: 12px; font-weight: 800; cursor: pointer; }
.lookup-types button.is-active { color: white; background: var(--ink); box-shadow: 0 5px 13px rgba(23, 50, 77, .16); }

.lookup-form { margin-top: 13px; padding: 6px; display: grid; grid-template-columns: 1fr 49px; gap: 6px; border: 1.5px solid #d5c9b7; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-sm); }
.lookup-form:focus-within { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(79, 124, 119, .1); }
.lookup-form input { min-width: 0; height: 47px; padding: 0 10px; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 15px; }
.lookup-form input::placeholder { color: #96a0a6; }
.lookup-form button { width: 49px; height: 47px; display: grid; place-items: center; border: 0; border-radius: 13px; color: white; background: var(--red); cursor: pointer; }
.lookup-form button svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 2; }
.lookup-form button:disabled { opacity: .55; }
.lookup-quota { margin-top: 7px; color: var(--muted); font-size: 12px; text-align: right; }

.popular-queries { margin: 13px 0 17px; display: flex; gap: 6px; align-items: center; overflow-x: auto; scrollbar-width: none; }
.popular-queries::-webkit-scrollbar { display: none; }
.popular-queries span { flex: 0 0 auto; color: var(--muted); font-size: 12px; }
.popular-queries button { min-width: 44px; min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); background: var(--surface); font: 600 14px/1 var(--jp); cursor: pointer; }

.lookup-result { min-height: 180px; }
.lookup-loading { min-height: 160px; display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.lookup-loading:before { content: ""; width: 28px; height: 28px; border: 3px solid #dce2e2; border-top-color: var(--red); border-radius: 50%; animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.dictionary-card { padding: 19px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow-sm); }
.dictionary-card + .dictionary-card { margin-top: 10px; }
.dictionary-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.dictionary-word { min-width: 0; }
.dictionary-word strong { display: block; font: 600 31px/1.15 var(--jp); }
.dictionary-word ruby rt { color: var(--muted); font-size: .35em; }
.dictionary-reading { display: block; margin-top: 5px; color: var(--teal); font: 600 13px/1.3 var(--jp); }
.dictionary-badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.dictionary-badges span { padding: 5px 7px; border-radius: 999px; color: var(--red-dark); background: #faebe6; font-size: 12px; font-weight: 800; }
.dictionary-meaning { margin: 14px 0 0; color: var(--ink-soft); font-size: 13px; line-height: 1.65; }
.dictionary-example { margin-top: 13px; padding: 12px; border-left: 3px solid var(--teal); border-radius: 0 11px 11px 0; background: #f0f6f4; }
.dictionary-example .ja { font: 500 14px/1.75 var(--jp); }
.dictionary-example .vi { margin-top: 4px; color: var(--muted); font-size: 12px; }
.lookup-error { padding: 16px; border: 1px solid #efd0c8; border-radius: 15px; color: var(--danger); background: #fff3ef; font-size: 12px; line-height: 1.55; }

.lookup-history-section { padding-bottom: 12px; }
.lookup-history { display: flex; flex-wrap: wrap; gap: 7px; }
.lookup-history p { margin: 0; color: var(--muted); font-size: 12px; }
.lookup-history button { min-height: 44px; padding: 0 13px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); background: var(--surface); font-size: 12px; cursor: pointer; }

.account-heading { margin-bottom: 17px; }
.account-card { min-height: 83px; padding: 13px; display: grid; grid-template-columns: 53px minmax(0, 1fr) auto; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow-sm); }
.account-avatar { width: 53px; height: 53px; display: grid; place-items: center; overflow: hidden; border-radius: 17px; color: white; background: var(--ink); font: 700 20px/1 var(--jp); }
.account-avatar img { width: 100%; height: 100%; object-fit: cover; }
.account-copy { min-width: 0; }
.account-copy strong, .account-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-copy strong { font-size: 14px; }
.account-copy span { margin-top: 4px; color: var(--muted); font-size: 12px; }
.small-primary { min-height: 44px; padding: 0 14px; display: inline-flex; align-items: center; border-radius: 11px; color: white; background: var(--red); text-decoration: none; font-size: 12px; font-weight: 800; }

.account-stats { margin-top: 11px; padding: 13px 5px; display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: 18px; background: rgba(255, 253, 248, .8); }
.account-stats div { text-align: center; border-right: 1px solid var(--line); }
.account-stats div:last-child { border: 0; }
.account-stats strong { display: block; font: 600 21px/1 var(--serif); }
.account-stats span { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; }

.settings-card { margin-top: 22px; padding: 17px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); }
.settings-card h2 { margin: 0 0 9px; font-size: 14px; }
.setting-row { min-height: 65px; display: grid; grid-template-columns: 41px minmax(0, 1fr) auto; gap: 11px; align-items: center; border-top: 1px solid #eee5d8; }
.setting-row:first-of-type { border-top: 0; }
.setting-icon { width: 41px; height: 41px; display: grid; place-items: center; border-radius: 13px; color: var(--teal); background: #edf5f3; font: 700 16px/1 var(--jp); }
.setting-copy { min-width: 0; }
.setting-copy strong { display: block; font-size: 13px; }
.setting-copy small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.setting-select select { min-width: 82px; height: 44px; padding: 0 8px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: var(--paper); font-size: 12px; }

.switch { width: 52px; height: 44px; display: block; position: relative; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch > span { position: absolute; inset: 6px 0; border-radius: 999px; background: #cdd2d1; transition: .18s ease; cursor: pointer; }
.switch > span:after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: white; box-shadow: 0 2px 7px rgba(23, 50, 77, .18); transition: .18s ease; }
.switch input:checked + span { background: var(--teal); }
.switch input:checked + span:after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 3px solid var(--teal); outline-offset: 2px; }

.account-links { margin-top: 14px; border: 1px solid var(--line); border-radius: 20px; overflow: hidden; background: var(--surface); }
.account-links a { min-height: 67px; padding: 10px 13px; display: grid; grid-template-columns: 39px minmax(0, 1fr) 18px; gap: 11px; align-items: center; border-bottom: 1px solid #eee5d8; text-decoration: none; }
.account-links a:last-child { border: 0; }
.account-links a > span:first-child { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 12px; color: var(--red); background: #fff0eb; font: 700 15px/1 var(--jp); }
.account-links strong, .account-links small { display: block; }
.account-links strong { font-size: 13px; }
.account-links small { margin-top: 4px; color: var(--muted); font-size: 12px; }
.account-links svg { width: 18px; height: 18px; fill: none; stroke: #a3adb2; stroke-width: 1.8; }

.logout-button { width: 100%; min-height: 48px; margin-top: 14px; border: 1px solid #efcfc6; border-radius: 14px; display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--danger); background: #fff5f2; font-size: 13px; font-weight: 800; cursor: pointer; }
.logout-button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.app-version { margin: 21px 0 0; color: var(--muted); font-size: 12px; text-align: center; }

.bottom-nav {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: 0;
  width: min(100%, 720px);
  min-height: calc(70px + env(safe-area-inset-bottom));
  padding: 8px max(10px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  background: rgba(255, 253, 248, .96);
  border-top: 1px solid var(--line);
  box-shadow: 0 -10px 35px rgba(23, 50, 77, .08);
  backdrop-filter: blur(19px) saturate(1.15);
}

.bottom-nav button { min-width: 0; min-height: 52px; padding: 4px 2px; border: 0; border-radius: 13px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; color: #64747d; background: transparent; font-size: 12px; font-weight: 750; cursor: pointer; }
.bottom-nav button svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bottom-nav button.is-active { color: var(--red-dark); background: #fff2ed; }

.app-toast { position: fixed; z-index: 100; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); width: min(calc(100% - 30px), 500px); padding: 12px 14px; transform: translate(-50%, 16px); border-radius: 13px; color: white; background: var(--ink); box-shadow: var(--shadow-md); opacity: 0; pointer-events: none; font-size: 12px; text-align: center; transition: .2s ease; }
.app-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.noscript { margin: 30px; padding: 15px; border-radius: 12px; color: var(--danger); background: #fff1ed; }

.app-header-actions { display: flex; align-items: center; gap: 8px; }
.theme-button { min-width: 44px; min-height: 44px; padding: 0 11px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); background: var(--surface); font-size: 12px; font-weight: 800; cursor: pointer; }

html[data-mode="dark"] body { background: #070d18; }
html[data-mode="dark"] .app-shell { background: linear-gradient(rgba(211, 183, 121, .025) 1px, transparent 1px), linear-gradient(90deg, rgba(211, 183, 121, .025) 1px, transparent 1px), var(--paper); box-shadow: 0 0 70px rgba(0, 0, 0, .42); }
html[data-mode="dark"] .app-header { background: rgba(11, 19, 34, .92); border-color: var(--line); }
html[data-mode="dark"] .avatar-button { color: #f8f0e1; background: #081321; }
html[data-mode="dark"] .avatar-button i { border-color: var(--paper); }
html[data-mode="dark"] .brand-seal { background: #a9412e; }
html[data-mode="dark"] .bottom-nav { background: rgba(11, 19, 34, .96); border-color: var(--line); box-shadow: 0 -10px 35px rgba(0, 0, 0, .3); }
html[data-mode="dark"] .bottom-nav button { color: #aeb6c2; }
html[data-mode="dark"] .bottom-nav button.is-active { color: #f09a82; background: #1d2b42; }
html[data-mode="dark"] .plan-item,
html[data-mode="dark"] .account-stats { background: color-mix(in srgb, var(--surface) 92%, transparent); }
html[data-mode="dark"] .plan-item.is-done { border-color: rgba(118, 198, 157, .34); background: #142d2b; }
html[data-mode="dark"] .task-check { background: #1d3148; border-color: #38506a; }
html[data-mode="dark"] .dictionary-badges span { color: #f2ab94; background: #3a211f; }
html[data-mode="dark"] .dictionary-example { background: #132d30; }
html[data-mode="dark"] .lookup-error { border-color: #633d39; background: #351e1d; }
html[data-mode="dark"] .setting-row,
html[data-mode="dark"] .account-links a { border-color: var(--line); }
html[data-mode="dark"] .setting-icon { background: #18353b; }
html[data-mode="dark"] .account-links a > span:first-child { background: #3a211f; }
html[data-mode="dark"] .logout-button { border-color: #623c35; background: #351e1b; }
html[data-mode="dark"] .noscript { background: #351e1b; }

@media (min-width: 721px) {
  .app-shell { border-inline: 1px solid rgba(23, 50, 77, .08); }
  .app-main { padding-inline: 32px; }
  .app-header { padding-inline: 32px; }
  .resume-card { padding: 28px; }
  .quick-grid { gap: 14px; }
  .quick-symbol { width: 62px; height: 62px; }
}

@media (max-width: 380px) {
  .app-main { padding-inline: 15px; }
  .app-header { padding-inline: 15px; }
  .filter-row { margin-inline: -15px; padding-inline: 15px; }
  .resume-card { padding: 20px; }
  .quick-symbol { width: 51px; height: 51px; border-radius: 16px; }
  .task-time { display: none; }
  .plan-item { grid-template-columns: 38px minmax(0, 1fr); }
  .course-card { grid-template-columns: 50px minmax(0, 1fr) 17px; padding-inline: 10px; }
  .level-mark { width: 50px; height: 50px; }
  .exam-hero { grid-template-columns: 55px minmax(0, 1fr) 18px; padding: 15px; }
  .exam-hero-icon { width: 55px; height: 55px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *:before, *:after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media print {
  .app-header, .bottom-nav, .offline-banner, .app-toast { display: none !important; }
  .app-main { padding: 0; }
}
