@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;600;700&family=Noto+Sans+KR:wght@400;500;600;700&display=swap');

:root {
  --ink: #263348;
  --muted: #667085;
  --blue: #2879ec;
  --blue-hover: #1765d5;
  --line: #dfe5ed;
  --paper: #f4f6f9;
  --required: #ffe5e6;
  --next: #fff0c6;
  --later: #eee8fb;
  --manji: #e9efff;
  --fair: #e4f3df;
  --mastered: #deefff;
  --read: #ddf3f2;
  --read2: #d8e9ff;
  color: var(--ink);
  background: var(--paper);
  font: 14px/1.6 'Noto Sans JP', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }
a { color: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button, a { transition: background .15s, border-color .15s, box-shadow .15s, color .15s; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 3px solid #80b5ff;
  outline-offset: 3px;
}
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--blue); flex-shrink: 0; }
svg.icon { display: block; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[data-icon] { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: -70px; left: 12px; background: var(--blue); color: white; z-index: 50; padding: 12px; }
.skip-link:focus { top: 10px; }

.app-header {
  height: 84px;
  padding: 0 max(28px, calc((100% - 1120px) / 2));
  display: flex;
  align-items: center;
  gap: 28px;
  background: white;
  border-top: 4px solid #67b8fa;
  border-bottom: 1px solid var(--line);
}
.header-identity { display: flex; align-items: center; gap: 24px; min-width: 0; flex-shrink: 0; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; white-space: nowrap; }
.brand-mark {
  width: 42px; height: 44px; display: flex; align-items: center; justify-content: center;
  background: #e8f2ff; border: 1px solid #d6e7ff; border-radius: 12px;
  color: var(--blue); font-family: 'Noto Sans KR', sans-serif; font-size: 30px; font-weight: 500;
}
.brand > strong { font-size: 23px; letter-spacing: .02em; font-weight: 700; }
.main-nav { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.nav-item { min-height: 44px; display: flex; align-items: center; gap: 8px; border: 1px solid transparent; padding: 9px 17px; border-radius: 10px; font-size: 15px; font-weight: 600; color: #606c7f; white-space: nowrap; }
.nav-item:hover { background: #f2f5fa; }
.nav-item.active { background: var(--blue); color: white; border-color: #2770dc; box-shadow: 0 3px 8px #2879ec24; }
.nav-count { font-size: 11px; font-weight: 500; background: #edf1f6; color: #667085; padding: 1px 6px; border-radius: 5px; }
.save-status { font-size: 12px; color: #667085; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.save-status:before { content: ''; width: 6px; height: 6px; background: #55a78a; border-radius: 50%; }
main { max-width: 1176px; margin: 0 auto; padding: 24px 28px 36px; outline: 0; }

.course-tabs { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.course-tabs button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 8px 14px; border: 1px solid #dfe5ed; border-radius: 999px; background: white; color: #667085; font-size: 14px; font-weight: 600; line-height: 1.5; white-space: nowrap; }
.course-tabs button:hover { background: #f4f8fe; border-color: #b9d0ef; color: #3768a9; }
.course-tabs button:active { transform: translateY(1px); }
.course-tabs button[aria-pressed=true] { background: #edf5ff; border-color: #83b4f5; color: #2269cc; box-shadow: 0 2px 5px #2879ec12, inset 0 0 0 1px #2879ec08; }
.course-tabs span { display: inline-flex; align-items: center; justify-content: center; padding: 0 6px; border-radius: 999px; background: white; color: #2871d5; font-size: 11px; font-weight: 600; line-height: 21px; font-variant-numeric: tabular-nums; }
.course-tabs button[aria-pressed=false] span { display: none; }
.mode-toolbar { display: flex; align-items: stretch; gap: 20px; margin-bottom: 20px; }
.mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 5px; background: #e9edf3; border: 1px solid #e0e5ed; border-radius: 12px; width: 620px; max-width: 100%; }
.mode-switch button { display: flex; align-items: center; justify-content: flex-start; gap: 13px; min-width: 0; padding: 9px 18px; border: 1px solid transparent; border-radius: 8px; text-align: left; color: #526075; }
.mode-switch button:hover { background: #f5f7fa; }
.mode-switch button[aria-pressed=true] { background: white; border-color: #cdddf7; color: #2267ce; box-shadow: 0 2px 5px #182d4c0d; }
.mode-switch svg { width: 24px; height: 24px; }
.mode-copy { display: block; min-width: 0; }
.mode-copy strong { display: block; font-size: 16px; line-height: 1.5; font-weight: 700; }
.mode-copy small { display: block; font-size: 12px; line-height: 1.5; margin-top: 3px; white-space: nowrap; color: #67758b; }
.mode-switch button[aria-pressed=true] small { color: #5474a3; }
.settings-button { display: flex; align-items: center; align-self: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 16px; margin-left: auto; background: white; border: 1px solid #d7dfe9; border-radius: 9px; font-size: 14px; font-weight: 500; color: #526075; box-shadow: 0 1px 2px #24344805; white-space: nowrap; }
.settings-button:hover { border-color: #a9bfdf; background: #fafdff; }
.settings-button svg { width: 19px; height: 19px; }

.practice-stage { border: 1px solid #dbe2ec; border-radius: 16px; background: white; overflow: hidden; box-shadow: 0 3px 12px #23354d06, 0 1px 2px #23354d04; }
.session-bar { min-height: 66px; display: flex; align-items: center; gap: 22px; padding: 12px 26px; border-bottom: 1px solid #e7ebf1; color: #667085; font-size: 13px; }
.session-count { display: flex; align-items: baseline; gap: 7px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.session-label { margin-right: 8px; font-weight: 600; color: #475467; }
.session-count strong { font-size: 20px; line-height: 1; font-weight: 700; color: var(--blue); }
.session-divider { color: #a4adba; }
.session-progress { height: 8px; flex: 1; background: #e9edf3; border-radius: 8px; overflow: hidden; }
.session-progress > div { height: 100%; width: 0; background: var(--blue); border-radius: inherit; transition: width .2s; }
.session-score { font-weight: 600; color: #475467; white-space: nowrap; }
.restart-button { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 8px; color: #667085; border: 1px solid #e0e6ee; flex-shrink: 0; }
.restart-button:hover { background: #f0f5fd; color: var(--blue); }
.restart-button svg { width: 18px; height: 18px; }
.flashcard { display: flex; flex-direction: column; min-height: 346px; }
.card-topline { padding: 20px 28px 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.card-kicker { display: flex; align-items: center; gap: 12px; }
.card-type { color: #526075; font-size: 12px; font-weight: 500; }
.card-number { color: #7a8699; font-size: 12px; font-variant-numeric: tabular-nums; padding-left: 12px; border-left: 1px solid #e0e5ec; }
.rank-badge { display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; padding: 5px 10px; font-size: 12px; line-height: 1.6; font-weight: 500; white-space: nowrap; background: var(--rank-bg,#edf1f6); color: var(--rank-ink,#41516b); }
.rank-required { --rank-bg: var(--required); --rank-ink: #a4424e; }
.rank-next { --rank-bg: var(--next); --rank-ink: #876615; }
.rank-later { --rank-bg: var(--later); --rank-ink: #72559c; }
.rank-manji { --rank-bg: var(--manji); --rank-ink: #3c62aa; }
.rank-fair { --rank-bg: var(--fair); --rank-ink: #487640; }
.rank-mastered { --rank-bg: var(--mastered); --rank-ink: #386f9c; }
.rank-read { --rank-bg: var(--read); --rank-ink: #2d7b79; }
.rank-read2 { --rank-bg: var(--read2); --rank-ink: #245fb0; }
.rank-dot { width: 8px; height: 8px; display: inline-block; border-radius: 50%; background: var(--rank-ink,#667085); flex-shrink: 0; }
.question-area { min-height: 207px; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 12px 40px 24px; text-align: center; }
.question-word { font-family: 'Noto Sans KR',sans-serif; font-size: 100px; font-weight: 600; color: #24324a; line-height: 1.35; margin: 0; max-width: 100%; overflow-wrap: anywhere; }
.question-word.long { font-size: 52px; }
.question-word.reverse { font-family: inherit; font-size: 30px; font-weight: 600; line-height: 1.7; white-space: pre-wrap; }
.question-english { font-size: 18px; color: #667085; line-height: 1.7; margin: 8px 0 0; overflow-wrap: anywhere; max-width: 100%; }
.card-action-area { padding: 18px 28px 24px; }
.reveal-button { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; width: 100%; max-width: 540px; margin: 0 auto; padding: 13px 20px; border: 1px solid #2471df; border-radius: 10px; background: linear-gradient(100deg,#2675e8,#398cf3); color: white; box-shadow: 0 3px 7px #2879ec26; font-size: 16px; font-weight: 700; }
.reveal-button:hover { background: var(--blue-hover); box-shadow: 0 4px 10px #2879ec30; }
.answer-panel { border-top: 1px solid #e5eaf1; padding: 20px 24px 2px; margin: 0 28px; background: #f8faff; border-radius: 10px; }
.answer-row { display: grid; grid-template-columns: 80px minmax(0,1fr); align-items: baseline; gap: 20px; margin-bottom: 16px; text-align: left; }
.answer-label { font-size: 13px; color: #667085; }
.answer-value { margin: 0; font-size: 21px; font-weight: 500; color: #2c3d57; line-height: 1.8; overflow-wrap: anywhere; white-space: pre-wrap; }
.answer-value.hangul { font-family: 'Noto Sans KR',sans-serif; font-size: 38px; }
.answer-row:has([lang=en]) .answer-value { font-size: 18px; font-weight: 400; color: #526075; }
.revealed .question-area { min-height: 118px; padding-top: 8px; padding-bottom: 20px; }
.revealed .question-word { font-size: 62px; }
.revealed .question-word.reverse { font-size: 25px; }
.revealed .question-english { font-size: 16px; }
.rating-buttons { display: grid; grid-template-columns: 1fr 1.2fr; gap: 12px; max-width: 640px; margin: 0 auto; }
.rating-buttons.three { grid-template-columns: 1fr 1fr 1.2fr; }
.rating-buttons button { display: flex; align-items: center; justify-content: center; min-height: 50px; padding: 12px; gap: 8px; border: 1px solid #d8e0ea; border-radius: 9px; font-size: 15px; font-weight: 600; }
.rating-review { background: #f4f6f9; color: #526075; }
.rating-fair { background: #edf5e9; color: #4f7547; }
.rating-buttons .rating-right { background: var(--blue); color: white; border-color: #2471df; box-shadow: 0 2px 5px #2879ec20; }
.rating-buttons button:hover { filter: brightness(.98); }
.example-block { border-top: 1px solid #dfe6f0; padding: 12px 0; text-align: left; }
.example-block summary { cursor: pointer; font-size: 13px; color: #53729c; }
.example-block p { font-size: 16px; line-height: 1.8; color: #475467; margin: 12px 0 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.text-button { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; margin: 6px auto -8px; padding: 6px 12px; color: #667085; font-size: 13px; }
.text-button:hover { color: var(--blue); }
.write-form { width: 100%; max-width: 430px; margin-top: 22px; }
.write-form input { width: 100%; min-width: 0; padding: 10px 18px; font-size: 30px; font-family: 'Noto Sans KR',sans-serif; border: 1px solid #c6d4e7; border-radius: 10px; background: #fafcff; color: #263348; text-align: center; outline: none; }
.write-form input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px #2879ec15; }
.write-form input::placeholder { font-family: 'Noto Sans JP',sans-serif; color: #8b97a8; font-size: 15px; }
.result-banner { margin: 0 28px 16px; padding: 12px 18px; background: #eaf6ee; color: #317a4b; font-size: 14px; font-weight: 600; border-radius: 8px; }
.result-banner.wrong { background: #fff0ef; color: #b2574d; }
.write-submission { font-size: 14px; color: #667085; text-align: center; margin: 0 28px 15px; overflow-wrap: anywhere; }
.loading-state { padding: 110px 24px; text-align: center; color: #667085; font-size: 15px; }
.empty-state, .complete-state { display: flex; flex: 1; align-items: center; justify-content: center; flex-direction: column; padding: 44px 28px; text-align: center; }
.empty-state h2, .complete-state h2 { font-size: 24px; font-weight: 700; margin: 0 0 12px; }
.empty-state p, .complete-state p { font-size: 15px; color: #667085; margin: 0 0 24px; }
.complete-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 10px 16px; border: 1px solid transparent; border-radius: 8px; font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap; cursor: pointer; }
.button.primary { color: white; background: var(--blue); border-color: #2471df; }
.button.primary:hover { background: var(--blue-hover); }
.button.secondary { color: #526075; background: white; border-color: #d7dfe9; }
.button.secondary:hover { background: #f5f8fc; }
.icon-button { display: inline-flex; justify-content: center; align-items: center; width: 36px; height: 36px; font-size: 27px; line-height: 1; color: #667085; border-radius: 8px; }
.icon-button:hover { background: #f0f3f8; }

@media (max-width: 960px) {
  .app-header { padding: 0 24px; gap: 18px; }
  .header-identity { gap: 14px; }
  .brand { gap: 8px; }
  .brand-mark { width: 34px; height: 36px; font-size: 25px; border-radius: 10px; }
  .brand > strong { font-size: 20px; }
  .course-tabs button { padding: 8px 12px; font-size: 13px; gap: 6px; }
  .save-status { display: none; }
  .mode-switch { width: 570px; }
  .mode-switch button { padding-left: 13px; padding-right: 13px; gap: 10px; }
  .settings-button { padding: 10px 13px; }
}
@media (max-width: 720px) {
  .app-header { height: auto; min-height: 116px; flex-wrap: wrap; padding: 12px 18px 9px; column-gap: 12px; row-gap: 8px; }
  .header-identity { width: 100%; justify-content: flex-start; gap: 12px; }
  .brand { gap: 9px; }
  .brand-mark { width: 34px; height: 36px; font-size: 25px; border-radius: 10px; }
  .brand > strong { font-size: 20px; }
  .main-nav { width: 100%; margin-left: 0; gap: 6px; }
  .nav-item { flex: 1; justify-content: center; min-height: 44px; padding: 8px 10px; font-size: 13px; gap: 6px; border-radius: 8px; }
  .nav-item svg { display: none; }
  .nav-count { display: none; }
  main { padding: 18px 16px 28px; }
  .course-tabs button { padding: 8px 12px; }
  .mode-toolbar { gap: 8px; margin-bottom: 16px; }
  .mode-switch { flex: 1; width: auto; gap: 4px; padding: 4px; border-radius: 10px; min-width: 0; }
  .mode-switch button { justify-content: center; padding: 9px 5px; border-radius: 7px; gap: 0; }
  .mode-switch button > [data-icon] { display: none; }
  .mode-copy strong { font-size: 14px; }
  .mode-copy small { font-size: 10px; margin-top: 4px; letter-spacing: -.02em; }
  .settings-button { padding: 0; width: 42px; min-height: 42px; flex-shrink: 0; border-radius: 9px; }
  .settings-button > span:last-child { display: none; }
  .practice-stage { border-radius: 13px; }
  .session-bar { min-height: 56px; gap: 13px; padding: 10px 17px; font-size: 12px; }
  .session-label { display: none; }
  .session-count { gap: 5px; }
  .session-count strong { font-size: 18px; }
  .session-progress { height: 7px; }
  .restart-button { width: 32px; height: 32px; }
  .restart-button svg { width: 17px; height: 17px; }
  .flashcard { min-height: 350px; }
  .card-topline { padding: 18px 20px 0; }
  .card-type, .card-number { font-size: 11px; }
  .card-kicker { gap: 10px; }
  .card-number { padding-left: 10px; }
  .rank-badge { padding: 4px 8px; font-size: 11px; }
  .question-area { min-height: 215px; padding: 15px 24px 22px; }
  .question-word { font-size: 86px; }
  .question-word.long { font-size: 38px; }
  .question-word.reverse { font-size: 25px; }
  .question-english { font-size: 16px; }
  .card-action-area { padding: 16px 20px 22px; }
  .reveal-button { min-height: 50px; font-size: 15px; border-radius: 9px; }
  .answer-panel { margin: 0 20px; padding: 18px 16px 2px; }
  .answer-row { grid-template-columns: 48px minmax(0,1fr); gap: 13px; margin-bottom: 14px; }
  .answer-label { font-size: 12px; }
  .answer-value { font-size: 18px; }
  .answer-row:has([lang=en]) .answer-value { font-size: 16px; }
  .answer-value.hangul { font-size: 34px; }
  .revealed .question-area { min-height: 110px; padding-bottom: 18px; }
  .revealed .question-word { font-size: 54px; }
  .revealed .question-word.reverse { font-size: 22px; }
  .rating-buttons { gap: 9px; }
  .rating-buttons button { font-size: 14px; padding: 11px 6px; }
  .rating-buttons.three { grid-template-columns: 1fr 1fr; }
  .rating-buttons.three .rating-right { grid-column: 1/-1; }
  .write-form { margin-top: 20px; }
  .write-form input { font-size: 28px; }
  .write-form input::placeholder { font-size: 14px; }
  .result-banner { margin: 0 20px 14px; padding: 11px 15px; }
  .write-submission { font-size: 13px; margin: 0 20px 14px; }
  .complete-actions { gap: 10px; }
  .empty-state, .complete-state { padding: 34px 20px; }
  .empty-state h2, .complete-state h2 { font-size: 22px; }
}
@media (max-width: 480px) {
  .mode-direction { display: block; font-size: 11px; line-height: 1.6; }
}
@media (max-width: 374px) {
  .app-header { padding: 10px 12px 8px; gap: 8px; }
  .header-identity { gap: 10px; }
  .brand { gap: 7px; }
  .brand > strong { font-size: 18px; }
  .nav-item { padding: 8px; font-size: 12px; }
  main { padding-left: 12px; padding-right: 12px; }
  .course-tabs button { padding: 8px 10px; gap: 5px; font-size: 13px; }
  .course-tabs span { font-size: 10px; padding: 0 5px; }
  .mode-copy strong { font-size: 13px; }
  .mode-copy small { font-size: 10px; white-space: normal; line-height: 1.6; }
  .settings-button { width: 38px; min-height: 42px; }
  .session-bar { gap: 10px; padding-left: 16px; padding-right: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
