/* Shared look of every page: colours, type, top bar, cards, buttons, form fields, badges. */
:root {
  --bg: #f6f7fb;
  --surface: #fff;
  --text: #1b2333;
  --muted: #5f6b7e;
  --border: #e4e7f0;
  --border-strong: #cdd3e0;
  --accent: #4f46e5;
  --accent-dark: #4338ca;
  --accent-soft: #eef0ff;
  --ok: #1b7a3c;
  --ok-soft: #e3f6ea;
  --warn: #8a5a00;
  --warn-soft: #fff3d6;
  --bad: #b42318;
  --bad-soft: #fdeceb;
  --radius: 16px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
body { margin: 0; line-height: 1.5; }
main { width: min(960px, calc(100% - 32px)); margin: 28px auto 56px; }
h1 { margin: 0 0 6px; font-size: clamp(1.6rem, 4vw, 2rem); letter-spacing: -.03em; line-height: 1.2; }
h2, h3 { letter-spacing: -.01em; }
a { color: var(--accent-dark); }
.muted { color: var(--muted); line-height: 1.55; }
.hint { font-size: .85rem; color: var(--muted); }
.hidden { display: none; }
.error { color: var(--bad); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: 0 1px 2px #1b23330a, 0 8px 24px #1b23330a; margin-top: 18px; }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 10; background: #ffffffe6; backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.topbar-inner { width: min(960px, calc(100% - 32px)); margin: 0 auto; display: flex; align-items: center; gap: 22px; min-height: 58px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; letter-spacing: -.02em; color: var(--text); text-decoration: none; white-space: nowrap; }
.brand::before { content: ""; width: 26px; height: 26px; border-radius: 8px; background: linear-gradient(135deg, #6366f1, #4338ca); }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 8px 14px; border-radius: 999px; color: var(--muted); font-weight: 650; font-size: .93rem; text-decoration: none; white-space: nowrap; }
.tabs a:hover { background: var(--accent-soft); color: var(--accent-dark); }
.tabs a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-dark); }
.account { margin-left: auto; display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.account .who { font-weight: 650; color: var(--muted); max-width: 160px; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
.account .who:hover { color: var(--accent-dark); text-decoration: underline; }
.account button { padding: 6px 12px; font-size: .85rem; }
@media (max-width: 560px) { .topbar-inner { gap: 10px; } .brand span { display: none; } .account .who { max-width: 70px; } }

/* Buttons and fields */
button { border: 0; border-radius: 10px; padding: 11px 20px; background: var(--accent); color: white; font: inherit; font-weight: 700; cursor: pointer; transition: background .15s, box-shadow .15s; }
button:hover { background: var(--accent-dark); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid #4f46e555; outline-offset: 2px; }
button:disabled { opacity: .5; cursor: default; }
button.secondary { background: var(--surface); color: var(--accent-dark); border: 1px solid var(--border-strong); }
button.secondary:hover { background: var(--accent-soft); }
input[type=text], input[type=number], input[type=email], input[type=password], select { font: inherit; border: 1px solid var(--border-strong); border-radius: 10px; padding: 10px 12px; background: var(--surface); color: inherit; }
input[type=text]:focus, input[type=number]:focus, input[type=email]:focus, input[type=password]:focus, select:focus { border-color: var(--accent); }

/* Badges */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; white-space: nowrap; vertical-align: middle; }
.badge.due, .badge.unused { background: var(--warn-soft); color: var(--warn); }
.badge.learning { background: var(--accent-soft); color: var(--accent-dark); }
.badge.mastered, .badge.used { background: var(--ok-soft); color: var(--ok); }

/* Loading placeholder and empty state */
.loading { min-height: 180px; border-radius: 10px; background: linear-gradient(90deg, #eceef6 25%, #f6f7fb 37%, #eceef6 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) { .loading { animation: none; } }
.empty-state { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty-state strong { display: block; color: var(--text); font-size: 1.1rem; margin-bottom: 4px; }
