:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #586174;
  --surface: #ffffff;
  --canvas: #f4f6fa;
  --border: #d9dfeb;
  --primary: #3157c8;
  --primary-dark: #24439d;
  --soft: #e9eefc;
  --success: #176b3a;
  --success-bg: #e8f7ee;
  --warning: #7a4515;
  --warning-bg: #fff4df;
  --danger: #a22929;
  --danger-bg: #fdecec;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--canvas); line-height: 1.5; }
a { color: #244fb8; }
button, input { font: inherit; }
button, .button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  padding: .7rem 1.05rem;
  border: 1px solid transparent;
  border-radius: .65rem;
  cursor: pointer;
  color: #fff;
  background: var(--primary);
  font-weight: 650;
  text-decoration: none;
}
button:hover, .button:hover { background: var(--primary-dark); }
button:disabled { cursor: wait; opacity: .65; }
.button-secondary { color: var(--ink); background: var(--surface); border-color: var(--border); }
.button-secondary:hover { background: #eef1f6; }
.button-danger { color: #fff; background: var(--danger); }
:focus-visible { outline: 3px solid #e29a17; outline-offset: 3px; }

.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 10; padding: .7rem 1rem; background: var(--ink); color: #fff; }
.skip-link:focus { top: 1rem; }
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.nav-shell { max-width: 76rem; margin: auto; padding: .75rem clamp(1rem, 4vw, 2rem); display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.brand { margin-right: auto; color: var(--ink); font-weight: 750; text-decoration: none; }
.site-nav { display: flex; align-items: center; gap: .25rem; flex-wrap: wrap; }
.site-nav a { padding: .5rem .65rem; border-radius: .45rem; color: var(--ink); text-decoration: none; }
.site-nav a[aria-current="page"] { color: var(--primary-dark); background: var(--soft); font-weight: 700; }
.logout-form { display: inline; margin: 0; }
.logout-button { min-height: 38px; padding: .45rem .7rem; color: var(--ink); background: transparent; border-color: var(--border); }

.page-container { width: min(100% - 2rem, 72rem); margin: 2rem auto 4rem; }
.narrow { max-width: 38rem; }
.study-container { width: min(100% - 2rem, 42rem); margin: 1.5rem auto 4rem; text-align: center; }
.panel { padding: clamp(1.25rem, 4vw, 2rem); background: var(--surface); border: 1px solid var(--border); border-radius: 1rem; box-shadow: 0 8px 28px rgba(32, 45, 77, .07); }
.panel + .panel, section + section { margin-top: 1.5rem; }
h1, h2, h3 { line-height: 1.18; }
h1 { margin-top: 0; }
.lede { color: var(--muted); font-size: 1.08rem; }
.muted, .help { color: var(--muted); }
.help { margin: .35rem 0 0; font-size: .9rem; }
.eyebrow { margin: 0 0 .6rem; color: var(--primary-dark); font-weight: 750; letter-spacing: .04em; text-transform: uppercase; font-size: .78rem; }
.badge { display: inline-block; padding: .3rem .65rem; color: var(--primary-dark); background: var(--soft); border-radius: 999px; font-weight: 750; }
.direction-hint { margin: .5rem 0 1.3rem; color: var(--muted); }
.greek-prompt { margin: .2em 0; font-family: "Noto Sans", "Segoe UI", Arial, sans-serif; font-size: clamp(5rem, 22vw, 8.5rem); line-height: 1.1; font-weight: 500; }
.name-prompt { margin: 1.2rem 0; font-size: clamp(2.2rem, 10vw, 4rem); }
.study-progress { display: flex; justify-content: center; gap: .7rem 1.2rem; flex-wrap: wrap; margin: 0 0 1rem; color: var(--muted); font-size: .92rem; }
.recall-input { display: block; width: min(100%, 24rem); min-height: 48px; margin: .5rem auto 1rem; padding: .7rem .85rem; border: 1px solid #aeb8ca; border-radius: .6rem; text-align: center; }
.recall-input:focus { border-color: var(--primary); }
.answer-feedback { margin: 0 auto 1rem; padding: .75rem 1rem; border-radius: .6rem; font-size: 1.1rem; font-weight: 750; }
.answer-feedback.correct { color: var(--success); background: var(--success-bg); }
.answer-feedback.not-matched { color: var(--warning); background: var(--warning-bg); }
.answer-details { padding: 1rem; background: #f8f9fc; border-radius: .7rem; }
.answer-details p { margin: .35rem 0; }
.rating-prompt { margin-bottom: .4rem; }
.rating-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .65rem; margin-top: 1rem; }
.rating-grid button { min-width: 0; padding: .75rem .45rem; color: var(--ink); }
.rating-grid .again { background: #f8dada; }
.rating-grid .hard { background: #fff0bd; }
.rating-grid .good { background: #d7f3df; }
.rating-grid .easy { background: #dce6ff; }
.rating-label, .rating-interval { display: block; }
.rating-interval { color: #4d5668; font-size: .78rem; font-weight: 500; }
.shortcut-help { margin-top: 1.2rem; color: var(--muted); font-size: .88rem; }
.shortcut-help summary { cursor: pointer; }
.pronunciation { margin: 1rem auto 1.5rem; }
.pronunciation-native { font-size: 1.45rem; }
.pronunciation-ipa { font-size: 1.08rem; }
.pronunciation-system { color: var(--muted); font-size: .85rem; }
.pronunciation-play { min-height: 38px; margin-top: .6rem; padding: .45rem .7rem; color: var(--ink); background: var(--soft); }

.status { padding: .8rem 1rem; border-radius: .6rem; }
.status-success { color: var(--success); background: var(--success-bg); }
.status-error { color: var(--danger); background: var(--danger-bg); }
.status-info { color: #294777; background: #e9f0fb; }
.clock-notice { width: min(100% - 2rem, 72rem); margin: 1rem auto; padding: .7rem 1rem; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: .6rem; }
.clock-error { color: var(--danger); }
.action-row { display: flex; justify-content: center; gap: .7rem; flex-wrap: wrap; margin-top: 1.25rem; }
.onboarding-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; margin: 1.5rem 0; text-align: left; }
.onboarding-example { padding: 1rem; background: #f7f8fc; border: 1px solid var(--border); border-radius: .75rem; }
.onboarding-example .example { font-size: 1.3rem; }
.rating-explainer { text-align: left; padding-left: 1.4rem; }

.form-group { margin-top: 1.15rem; }
.form-group label { display: block; margin-bottom: .35rem; font-weight: 700; }
.form-control { width: 100%; min-height: 46px; padding: .65rem .75rem; border: 1px solid #aeb8ca; border-radius: .55rem; background: #fff; }
.checkbox-row { display: flex; align-items: flex-start; gap: .65rem; }
.checkbox-row input { margin-top: .32rem; }
.provider-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.provider { padding: 1.1rem; border: 1px solid var(--border); border-radius: .75rem; }
.provider h2 { margin-top: 0; }
.connected { color: var(--success); font-weight: 750; }

.table-scroll, .heatmap-scroll { overflow-x: auto; padding-bottom: .4rem; }
table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { padding: .65rem; border: 1px solid var(--border); text-align: left; }
th { background: #f1f3f8; }
.alphabet-character { font-family: "Noto Sans", "Segoe UI", Arial, sans-serif; font-size: 2rem; }
.card-info-header { margin-bottom: 1.5rem; }
.card-info-character { font-family: "Noto Sans", "Segoe UI", Arial, sans-serif; font-size: 1.4em; font-weight: 500; }
.card-info-section h2 { margin-top: 0; }
.card-info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: .75rem; margin: 1rem 0; }
.card-info-grid div { padding: .8rem; background: #f7f8fc; border: 1px solid var(--border); border-radius: .55rem; }
.card-info-grid dt { color: var(--muted); font-size: .82rem; }
.card-info-grid dd { margin: .2rem 0 0; font-weight: 700; overflow-wrap: anywhere; }
.card-info-limitation { margin-top: 1.5rem; }
.review-summary, .analytics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: .75rem; margin: 1rem 0 2rem; }
.review-summary div, .metric { padding: .8rem; background: var(--surface); border: 1px solid var(--border); border-radius: .55rem; }
.review-summary dt, .metric dt { color: var(--muted); font-size: .82rem; }
.review-summary dd, .metric dd { margin: .2rem 0 0; font-size: 1.35rem; font-weight: 750; }
.distribution-row { display: grid; grid-template-columns: 7em 1fr 7em; gap: .5rem; align-items: center; margin: .45rem 0; }
.distribution-track { height: .75rem; background: #ebedf0; border-radius: 1rem; overflow: hidden; }
.distribution-fill { height: 100%; background: #40c463; }
.heatmap-layout { display: flex; gap: .35rem; width: max-content; }
.weekday-labels, .heatmap-week { display: grid; grid-template-rows: repeat(7, .9rem); gap: .25rem; }
.weekday-labels { padding-right: .2rem; color: #666; font-size: .65rem; line-height: .9rem; }
.heatmap-weeks { display: flex; gap: .25rem; }
.heatmap-cell, .heatmap-spacer { width: .9rem; height: .9rem; border-radius: 2px; }
.heatmap-cell { border: 1px solid rgba(0, 0, 0, .08); }
.intensity-0 { background: #ebedf0; } .intensity-1 { background: #9be9a8; }
.intensity-2 { background: #40c463; } .intensity-3 { background: #30a14e; } .intensity-4 { background: #216e39; }
.heatmap-cell.is-today { outline: 2px solid #0969da; outline-offset: 1px; }
.heatmap-legend { display: flex; align-items: center; gap: .35rem; margin-top: .6rem; color: var(--muted); font-size: .75rem; }
.legend-cell { display: inline-block; width: .9rem; height: .9rem; border: 1px solid rgba(0, 0, 0, .08); border-radius: 2px; }
.due-now { background: #e8f7ee; } .due-soon { background: #fff8dd; } .later { background: #edf3ff; } .fresh { background: #f1f2f4; font-style: italic; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 42rem) {
  .page-container, .study-container { width: min(100% - 1rem, 72rem); margin-top: 1rem; }
  .nav-shell { align-items: flex-start; }
  .brand { width: 100%; }
  .site-nav { width: 100%; }
  .site-nav a { flex: 1 1 auto; text-align: center; }
  .logout-form { width: 100%; }
  .logout-button { width: 100%; }
  .rating-grid { grid-template-columns: repeat(2, 1fr); }
  .onboarding-grid, .provider-grid { grid-template-columns: 1fr; }
  .distribution-row { grid-template-columns: 6em 1fr; }
  .distribution-row > span:last-child { grid-column: 2; }
}

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