:root {
  color-scheme: light;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: #202c2a;
  background: #f7f8f6;
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
a { color: #176b61; }
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { height: 72px; padding: 0 max(24px, calc((100vw - 1240px)/2)); display: flex; align-items: center; gap: 42px; background: #fff; border-bottom: 1px solid #e2e8e5; }
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; color: #202c2a; white-space: nowrap; }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; background: #173f3a; color: #fff; border-radius: 6px; font-size: 23px; font-weight: 800; letter-spacing: 0; }
.brand-mark span { color: #ee8867; }
.brand-name { font-size: 16px; font-weight: 500; }
.brand-name strong { font-weight: 750; }
.main-nav { display: flex; align-self: stretch; gap: 24px; }
.nav-item { display: inline-flex; align-items: center; gap: 9px; border: 0; border-bottom: 2px solid transparent; background: transparent; padding: 0 4px; color: #71817c; font-size: 14px; font-weight: 650; }
.nav-item.active { color: #174d45; border-color: #1c7569; }
.nav-item:hover { color: #174d45; }
.nav-item svg, .icon-button svg, .tiny-icon svg, .audio-button svg, .button svg { width: 18px; height: 18px; stroke-width: 1.9; }
.icon-button { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid #dbe3df; background: #fff; color: #46615b; border-radius: 6px; }
.icon-button:hover { background: #f1f6f3; }
.settings-trigger { margin-left: auto; }
.logout-trigger { margin-left: -24px; white-space: nowrap; }
.logged-out .main-nav, .logged-out .settings-trigger, .logged-out .logout-trigger { display: none; }
.logged-out .brand { margin-right: auto; }
.login-layout { min-height: calc(100vh - 230px); display: grid; place-items: center; }
.login-panel { width: min(100%, 380px); background: #fff; border: 1px solid #dfe7e2; border-radius: 8px; padding: 28px; box-shadow: 0 12px 40px rgba(30, 64, 50, .045); }
.login-panel h1 { margin: 0 0 25px; }
.login-panel .field { margin-bottom: 16px; }
.login-panel .button { margin-top: 6px; }
.login-panel .small-error { min-height: 20px; margin: 12px 0 0; font-size: 13px; }
.main-content { width: min(100% - 48px, 1188px); margin: 0 auto; flex: 1; padding: 42px 0 64px; }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 28px; }
.eyebrow { color: #138474; font-weight: 750; font-size: 12px; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 29px; line-height: 1.18; font-weight: 750; margin: 7px 0 0; }
h2 { font-size: 18px; line-height: 1.3; font-weight: 700; }
.muted { color: #73817d; }
.study-layout { display: grid; grid-template-columns: minmax(0, 1fr) 266px; gap: 32px; align-items: start; }
.study-card { min-height: 538px; background: #fff; border: 1px solid #dfe7e2; border-radius: 8px; padding: 34px 40px 36px; box-shadow: 0 12px 40px rgba(30, 64, 50, .045); display: flex; flex-direction: column; }
.study-card[data-swipeable] { position: relative; touch-action: pan-y; transition: transform .24s ease, opacity .24s ease, border-color .2s ease; }
.study-card.dragging { transition: none; user-select: none; }
.study-card.drag-left { border-color: #e68463; }
.study-card.drag-right { border-color: #6ebd96; }
.study-card.swiping-left { transform: translateX(-115%) rotate(-9deg); opacity: 0; }
.study-card.swiping-right { transform: translateX(115%) rotate(9deg); opacity: 0; }
.swipe-cue { position: absolute; top: 50%; z-index: 1; display: inline-flex; align-items: center; gap: 6px; padding: 10px 12px; border-radius: 6px; color: #fff; font-size: 13px; font-weight: 750; opacity: 0; pointer-events: none; transition: opacity .12s ease; }
.swipe-cue svg { width: 17px; height: 17px; }
.swipe-cue.left { right: 20px; background: #be684d; }
.swipe-cue.right { left: 20px; background: #248663; }
.drag-left .swipe-cue.left, .drag-right .swipe-cue.right { opacity: 1; }
.card-top { display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.card-status { display: inline-flex; align-items: center; gap: 8px; color: #1c7569; font-weight: 750; font-size: 12px; text-transform: uppercase; }
.status-dot { width: 8px; height: 8px; border-radius: 100%; background: #23a58d; }
.level-pill { border: 1px solid #dce8e3; border-radius: 4px; background: #f3f8f5; padding: 5px 8px; font-size: 11px; font-weight: 750; color: #46645d; }
.word { margin: 42px 0 10px; font-size: clamp(38px, 4.5vw, 60px); line-height: 1.08; font-weight: 760; overflow-wrap: anywhere; }
.word-type { color: #8b9692; font-size: 13px; margin-bottom: 20px; }
.pronunciation { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 24px; }
.audio-button { border: 1px solid #dce8e3; background: #fff; border-radius: 6px; min-height: 38px; padding: 0 11px; display: inline-flex; gap: 8px; align-items: center; color: #1d655a; font-size: 13px; font-weight: 700; }
.audio-button:hover { border-color: #9ecac1; background: #f5faf8; }
.ipa { color: #65746e; font-size: 14px; margin-right: 7px; }
.forms { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 14px; border-left: 3px solid #ee8867; background: #fff8f5; margin-bottom: 25px; font-size: 14px; }
.forms strong { color: #ab6048; font-size: 12px; text-transform: uppercase; }
.form-arrow { color: #be9c8e; }
.word-meanings { display: flex; flex-wrap: wrap; align-items: baseline; gap: 7px 12px; margin-bottom: 20px; padding: 12px 14px; border-left: 3px solid #54a48d; background: #f3f9f5; }
.word-meanings strong { color: #287566; font-size: 12px; text-transform: uppercase; }
.word-meanings span { color: #274c40; font-size: 15px; line-height: 1.45; }
.examples { border-top: 1px solid #edf0ee; padding-top: 21px; margin-top: 1px; }
.examples-label { color: #8b9692; font-size: 12px; text-transform: uppercase; font-weight: 750; margin-bottom: 12px; }
.examples-list { max-height: 360px; overflow-y: auto; padding-right: 12px; scrollbar-color: #b7ccc2 transparent; }
.examples-list:focus-visible { outline: 2px solid #75b4a6; outline-offset: 3px; }
.examples p { color: #4e605a; font-size: 15px; line-height: 1.55; margin: 0 0 9px; }
.example-pair { margin-bottom: 15px; }
.example-pair:last-child { margin-bottom: 0; }
.examples .example-translation { color: #287b68; font-size: 14px; padding-left: 12px; border-left: 2px solid #9bcfbe; }
.examples mark { background: #dff2ea; color: #174d45; padding: 0 2px; }
.card-bottom { margin-top: auto; padding-top: 25px; }
.button { min-height: 43px; padding: 0 17px; border-radius: 6px; border: 1px solid #dce5e0; background: #fff; color: #314b44; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700; font-size: 14px; }
.button:hover { background: #f3f7f5; }
.button.primary { border-color: #176b61; background: #176b61; color: #fff; }
.button.primary:hover { background: #105a51; }
.button.danger { color: #b84242; border-color: #edceca; }
.button.danger:hover { background: #fff3f2; }
.button.ghost { border-color: transparent; color: #72817b; }
.button.full { width: 100%; }
.button-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.translate-button { width: 100%; margin-bottom: 12px; }
.grade-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grade-button { min-width: 0; min-height: 52px; }
.grade-button.repeat { color: #a55743; border-color: #e9c8bd; }
.grade-button.repeat:hover { background: #fff3ef; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 10; transform: translateX(-50%); max-width: calc(100vw - 32px); padding: 11px 16px; border-radius: 6px; background: #263e36; color: #fff; box-shadow: 0 10px 28px #152e2633; font-size: 13px; text-align: center; }
.sidebar { padding-top: 4px; }
.sidebar-title { font-size: 12px; color: #8a9690; text-transform: uppercase; font-weight: 750; margin-bottom: 14px; }
.metric { padding: 14px 0; border-bottom: 1px solid #dce5e0; display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 14px; color: #5f716b; }
.metric strong { color: #1b302b; font-size: 21px; font-weight: 750; }
.metric.due strong { color: #e27859; }
.sidebar-divider { height: 26px; }
.step-line { display: flex; gap: 5px; margin: 15px 0 13px; }
.step { flex: 1; height: 6px; background: #dce7e1; border-radius: 3px; }
.step.filled { background: #1d8172; }
.next-due { font-size: 13px; line-height: 1.5; color: #75847d; }
.empty-state { min-height: 475px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; }
.empty-icon { width: 56px; height: 56px; background: #e9f4ef; border-radius: 8px; display: grid; place-items: center; color: #287566; margin-bottom: 22px; }
.empty-icon svg { width: 28px; height: 28px; }
.empty-state h2 { font-size: 27px; margin-bottom: 10px; }
.empty-state p { max-width: 420px; line-height: 1.55; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; margin: 22px 0 18px; }
.search { display: flex; align-items: center; gap: 8px; border: 1px solid #dce5e0; background: #fff; border-radius: 6px; padding: 0 11px; min-width: min(100%, 270px); height: 42px; }
.search svg { width: 18px; height: 18px; color: #8b9792; }
.search input { border: 0; outline: 0; width: 100%; background: transparent; color: #263b34; }
.select { border: 1px solid #dce5e0; border-radius: 6px; padding: 0 35px 0 12px; background: #fff; height: 42px; color: #42564d; }
.word-list { border-top: 1px solid #dce5e0; }
.word-row { display: grid; grid-template-columns: minmax(0, 1fr) 80px 100px 115px; align-items: center; gap: 16px; min-height: 67px; border-bottom: 1px solid #e1e8e3; }
.word-row strong { font-size: 15px; } .word-row small { color: #87958f; display: block; margin-top: 3px; }
.word-row .translation { color: #63746c; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tiny-icon { border: 0; background: transparent; color: #1c7569; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 6px; }
.tiny-icon:hover { background: #e8f4ef; }
.row-actions { display: flex; justify-content: flex-end; }
.status-text { font-size: 12px; font-weight: 650; color: #698078; }
.status-text.mastered { color: #1c8063; }
.status-text.due { color: #d97657; }
.pager { display: flex; justify-content: center; gap: 10px; margin-top: 24px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px; padding: 8px 0 30px; border-bottom: 1px solid #dce5e0; }
.profile-bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 0 0 24px; margin-bottom: 24px; border-bottom: 1px solid #dce5e0; }
.profile-bar span { display: block; color: #73817a; font-size: 12px; margin-bottom: 4px; }
.profile-bar strong { display: block; color: #20372f; font-size: 18px; overflow-wrap: anywhere; }
.stat-block { border-left: 3px solid #d6e4dd; padding-left: 14px; }
.stat-block:nth-child(2) { border-color: #1e806e; } .stat-block:nth-child(3) { border-color: #e68463; } .stat-block:nth-child(4) { border-color: #6493b3; }
.stat-block strong { display: block; font-size: 31px; margin-bottom: 4px; }
.stat-block span { color: #73817a; font-size: 13px; }
.progress-section { max-width: 780px; padding-top: 32px; }
.progress-row { display: grid; grid-template-columns: 115px 1fr 48px; align-items: center; gap: 16px; padding: 9px 0; font-size: 14px; }
.progress-track { height: 9px; border-radius: 5px; background: #e4ece7; overflow: hidden; }
.progress-fill { height: 100%; background: #258a76; border-radius: 5px; }
.activity-section { max-width: 900px; border-top: 1px solid #dce5e0; margin-top: 34px; padding-top: 30px; }
.activity-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.activity-heading h2 { margin: 0; }
.activity-range { display: grid; grid-template-columns: repeat(2, minmax(0, 180px)); gap: 12px; margin-bottom: 22px; }
.activity-range .field { margin: 0; }
.activity-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; border-top: 1px solid #dce5e0; border-bottom: 1px solid #dce5e0; padding: 17px 0; margin-bottom: 18px; }
.activity-metrics strong { display: block; font-size: 22px; color: #22413a; }
.activity-metrics span { display: block; margin-top: 2px; font-size: 12px; color: #72837a; }
.activity-days { max-height: 480px; overflow-y: auto; scrollbar-color: #b7ccc2 transparent; }
.activity-day { display: grid; grid-template-columns: 48px minmax(0, 1fr) 30px 155px; align-items: center; gap: 12px; min-height: 38px; border-bottom: 1px solid #edf0ee; font-size: 13px; }
.activity-day time { color: #60756b; }
.activity-day strong { text-align: right; }
.activity-day small { color: #7b8a82; text-align: right; }
.activity-track { height: 8px; border-radius: 4px; background: #e5ece8; overflow: hidden; }
.activity-track span { display: block; height: 100%; border-radius: 4px; background: #258a76; }
.site-footer { width: min(100% - 48px, 1188px); margin: auto auto 0; border-top: 1px solid #e0e8e3; padding: 18px 0 24px; display: flex; gap: 22px; color: #9aa6a0; font-size: 12px; }
.site-footer a { margin-left: auto; color: #7a8d84; }
.dialog { border: 1px solid #dce5e0; border-radius: 8px; padding: 0; width: min(100% - 28px, 500px); max-height: min(90vh, 760px); box-shadow: 0 28px 80px rgba(20, 45, 36, .2); }
.dialog::backdrop { background: rgba(25, 42, 35, .45); }
.dialog-head { padding: 24px 26px 18px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #e8ede9; }
.dialog-head h2 { margin: 0; }
.dialog-content { padding: 22px 26px 26px; overflow-y: auto; }
.setting-section { padding: 0 0 22px; margin-bottom: 22px; border-bottom: 1px solid #e5ece7; }
.setting-section:last-child { margin: 0; padding: 0; border: 0; }
.setting-section h3 { font-size: 14px; margin-bottom: 12px; }
.setting-section p { color: #76857d; font-size: 12px; line-height: 1.5; margin: 8px 0 0; }
.field { display: grid; gap: 6px; margin-bottom: 12px; font-size: 13px; color: #5a7065; }
.field input { width: 100%; border: 1px solid #d4e0d8; border-radius: 6px; height: 42px; padding: 0 12px; color: #233830; outline-color: #2a8e7e; }
.levels { display: flex; flex-wrap: wrap; gap: 8px; }
.level-check { display: inline-flex; align-items: center; gap: 5px; border: 1px solid #dae5de; border-radius: 5px; padding: 7px 9px; font-size: 13px; color: #455b50; }
.level-check:has(input:checked) { background: #e8f5ee; border-color: #8ac7aa; }
.small-error { color: #b7473c !important; }
.sources-page { max-width: 740px; margin: 70px auto; padding: 0 24px; line-height: 1.7; }
.sources-page h1 { margin: 25px 0; } .sources-page p { margin-bottom: 22px; }
.back-link { text-decoration: none; font-weight: 700; }
@media (max-width: 800px) {
  .topbar { gap: 18px; padding: 0 20px; }
  .brand-name { display: none; }
  .main-nav { flex: 1; justify-content: center; gap: 20px; }
  .main-content { width: min(100% - 32px, 660px); padding-top: 28px; }
  .study-layout { grid-template-columns: 1fr; gap: 24px; }
  .sidebar { order: -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 16px; }
  .sidebar-title, .sidebar-divider, .sidebar .step-line, .sidebar .next-due { display: none; }
  .metric { padding: 8px 0; display: block; font-size: 12px; }
  .metric strong { display: block; margin-top: 4px; }
  .study-card { min-height: 495px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .activity-day { grid-template-columns: 48px minmax(0, 1fr) 28px 130px; gap: 8px; }
}
@media (max-width: 520px) {
  .topbar { height: 62px; gap: 10px; padding: 0 14px; }
  .brand-mark { width: 32px; height: 32px; font-size: 21px; }
  .main-nav { gap: 5px; justify-content: space-around; }
  .nav-item { font-size: 11px; gap: 4px; flex-direction: column; justify-content: center; padding: 6px 3px 4px; min-width: 60px; }
  .nav-item svg { width: 17px; height: 17px; }
  .settings-trigger { width: 34px; height: 34px; }
  .logout-trigger { display: none; }
  .main-content { width: calc(100% - 28px); padding: 22px 0 42px; }
  h1 { font-size: 24px; }
  .page-heading { margin-bottom: 18px; }
  .study-card { padding: 22px 20px 24px; min-height: 500px; }
  .examples-list { max-height: 310px; }
  .word { margin-top: 34px; font-size: 42px; }
  .grade-button { padding: 0 10px; }
  .word-row { grid-template-columns: minmax(0, 1fr) 48px 108px; gap: 7px; }
  .word-row .translation { display: none; }
  .activity-heading .button { width: 100%; }
  .activity-range { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .activity-metrics { gap: 8px; }
  .activity-metrics strong { font-size: 18px; }
  .activity-metrics span { font-size: 11px; }
  .activity-day { grid-template-columns: 43px minmax(0, 1fr) 22px 82px; gap: 6px; font-size: 12px; }
  .activity-day small { font-size: 10px; }
  .site-footer { width: calc(100% - 28px); flex-wrap: wrap; gap: 6px 16px; }
  .site-footer a { margin-left: 0; }
}
