/* Palette tokens are shared with the workshop in theme.css. */
:root {
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --green: var(--primary); --soft: var(--primary-soft);
  --radius: 22px; --shadow: 0 5px 22px var(--shadow-color);
  --radius-lg: 18px; --radius-xl: 24px; --radius-pill: 999px; --shadow-sm: var(--shadow);
}
* { box-sizing: border-box; }
html { scroll-padding-top: 24px; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 18px/1.6 var(--font-ui); }
a { color: var(--primary); text-underline-offset: 4px; }
button,input,textarea,select { font: inherit; }
button,a,input,textarea,select,summary { touch-action: manipulation; }
a:focus-visible,button:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible,summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
button { cursor: pointer; }
.icon-definitions { position: absolute; width: 0; height: 0; overflow: hidden; }
.ui-icon { width: 23px; height: 23px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.app-shell { display: grid; grid-template-columns: 280px minmax(0,1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100dvh; min-width: 0; background: var(--surface); border-right: 1px solid var(--line); z-index: 20; }
.sidebar-scroll { height: 100%; overflow-y: auto; overflow-x: hidden; padding: 32px 18px 20px; display: flex; flex-direction: column; gap: 36px; }
.sidebar-collapse { position: absolute; top: 34px; right: -20px; z-index: 2; display: grid; place-items: center; width: 40px; min-height: 44px; padding: 8px; border: 1px solid var(--line-strong); border-radius: 13px; background: var(--surface); color: var(--primary); box-shadow: var(--shadow); cursor: pointer; }
.sidebar-collapse[hidden] { display: none; }
.sidebar-collapse:hover { background: var(--primary-soft); border-color: var(--primary); }
.sidebar-collapse .ui-icon { width: 22px; height: 22px; }
.sidebar-tooltip { position: fixed; z-index: 100; max-width: min(250px,calc(100vw - 24px)); padding: 9px 13px; border: 1px solid var(--line-strong); border-radius: 11px; background: var(--ink); color: var(--surface); font-size: 16px; line-height: 1.4; pointer-events: none; box-shadow: var(--shadow); }
.sidebar-tooltip[hidden] { display: none; }
.sidebar-brand-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 10px; }
.brand { display: flex; gap: 12px; align-items: center; color: var(--ink); text-decoration: none; font-size: 25px; font-weight: 760; line-height: 1.15; letter-spacing: -.6px; }
.brand-icon { display: grid; place-items: center; width: 42px; height: 44px; background: var(--soft); border-radius: 14px; color: var(--primary); font: 800 40px/1 var(--font-ui); padding-bottom: 7px; }
.brand-caption { display: block; font-size: 16px; font-weight: 500; color: var(--muted); margin-top: 7px; letter-spacing: 0; }
.sidebar-content { display: flex; flex-direction: column; flex: 1; }
.primary-nav { display: grid; gap: 7px; }
.primary-nav>a { position: relative; display: flex; align-items: center; gap: 13px; padding: 14px; border-radius: 13px; color: var(--muted); text-decoration: none; font-size: 17px; line-height: 1.4; font-weight: 550; min-height: 52px; transition: background .15s, color .15s; }
.primary-nav>a:hover { background: var(--surface-soft); color: var(--ink); }
.primary-nav>a[aria-current=page] { background: var(--soft); color: var(--primary); font-weight: 700; }
.primary-nav .support-nav-link { margin-top: 20px; }
.nav-unread { display: block; font-size: 16px; color: var(--success); }
.sidebar-bottom { margin-top: auto; padding-top: 50px; }
.sidebar-note { padding: 20px; border-radius: 18px; background: var(--primary-subtle); margin-bottom: 20px; }
.sidebar-note>.ui-icon { color: var(--primary); margin-bottom: 12px; width: 26px; height: 26px; display: block; }
.sidebar-note strong { font-size: 18px; line-height: 1.4; font-weight: 650; display: block; }
.sidebar-note p { color: var(--muted); font-size: 16px; line-height: 1.5; margin: 10px 0 0; }
.sidebar .nav-logout { background: transparent; border: 0; color: var(--muted); padding: 12px 10px; display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 500; min-height: 48px; width: 100%; text-align: left; }
.sidebar .nav-logout:hover { color: var(--primary); background: var(--primary-subtle); filter: none; }
.prototype-label { display: block; padding: 9px 10px; color: var(--muted); font-size: 16px; }
.mobile-menu-toggle { display: none; }
.main-shell { min-width: 0; }
.topbar { min-height: 88px; display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 20px 40px; }
.topbar-context { display: flex; align-items: center; gap: 14px; font-size: 16px; font-weight: 550; color: var(--muted); }
.topbar-caption { font-size: 16px; color: var(--muted); font-weight: 400; }
.topbar-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--line-strong); }
.account-chip { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 600; }
.account-avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--surface-soft); color: var(--muted); font-size: 16px; }
main { max-width: 1420px; margin: 0 auto; padding: 16px 40px 64px; }
h1,h2,h3,h4 { line-height: 1.25; letter-spacing: -.025em; }
h1 { font: 760 clamp(32px,3.5vw,44px)/1.15 var(--font-ui); margin: 12px 0 18px; letter-spacing: -.035em; }
h1 em { font-style: normal; color: var(--primary); }
h2 { font: 700 28px/1.25 var(--font-ui); margin: 8px 0 18px; }
h3 { font-size: 22px; margin: 12px 0; }
h4 { font-size: 19px; }
p { margin: 14px 0; }
.lead { font-size: 19px; color: var(--muted); max-width: 720px; line-height: 1.6; }
.eyebrow,.nav-label { font-size: 16px; color: var(--muted); font-weight: 550; letter-spacing: 0; }
.hero { padding: 12px 0 36px; }
.page-heading { margin-bottom: 30px; }
.actions,.button-row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin: 24px 0; }
.btn,.button,button[type=submit],input[type=submit] { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--primary); color: var(--on-primary); border: 1px solid var(--primary); border-radius: 12px; padding: 13px 20px; min-height: 50px; font-size: 17px; line-height: 1.45; text-decoration: none; cursor: pointer; font-weight: 650; transition: background .15s, box-shadow .15s; }
.btn:hover,.button:hover,button[type=submit]:hover { background: var(--primary-hover); border-color: var(--primary-hover); box-shadow: 0 4px 12px var(--primary-shadow); }
.btn.secondary,.button.secondary,.btn-outline-secondary,.btn-outline-primary { background: var(--surface); color: var(--primary); border-color: var(--line); }
.btn.secondary:hover,.button.secondary:hover { background: var(--surface-hover); border-color: var(--primary-line); }
.btn:disabled,button:disabled { opacity: .55; cursor: default; }
.card,.panel,.world-card { padding: 28px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); margin-bottom: 22px; box-shadow: var(--shadow); min-width: 0; }
.card p { color: var(--muted); }
.calm { background: var(--primary-soft); margin-top: 20px; }
.grid { display: grid; gap: 20px; }
.three { grid-template-columns: repeat(3,minmax(0,1fr)); }
.two,.worlds-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 20px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 28px 0 20px; }
.badge,.tag,.pill { display: inline-block; padding: 5px 11px; background: var(--soft); color: var(--primary); font-size: 16px; border-radius: 8px; font-weight: 550; }
.step-number { font-size: 28px; color: var(--primary); font-weight: 750; }
.muted,.text-muted,small.helptext { color: var(--muted); }
.text-link { font-weight: 650; }
.notice,.alert { padding: 18px 22px; background: var(--info-soft); border: 1px solid var(--info-line); border-radius: 14px; margin: 18px 0; font-size: 17px; }
.notice p:last-child { margin-bottom: 0; }
.error,.errorlist,.alert-danger { color: var(--danger); }
.errorlist { padding-left: 20px; font-size: 16px; }
.success { background: var(--success-soft); border-color: var(--success-line); }
.warning { background: var(--sun-soft); border-color: var(--sun-line); }
form p { margin: 18px 0; }
label { display: block; font-size: 18px; font-weight: 600; margin-bottom: 8px; }
input:not([type=radio]):not([type=checkbox]):not([type=hidden]),textarea,select { width: 100%; padding: 14px 16px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); color: var(--ink); max-width: 100%; font-size: 18px; }
textarea { min-height: 160px; resize: vertical; line-height: 1.7; }
input[type=radio],input[type=checkbox] { accent-color: var(--primary); width: 21px; height: 21px; margin-right: 8px; vertical-align: middle; }
.helptext,.small { font-size: 16px; line-height: 1.5; }
.helptext { display: block; color: var(--muted); }
form ul.helptext { padding-left: 20px; }
.auth-card { max-width: 600px; margin: 40px auto; padding: 36px; }
.auth-card h1 { font-size: 32px; }
.auth-card form .btn { width: 100%; margin-top: 12px; }
.option,.choice { padding: 16px; border: 1px solid var(--line); border-radius: 12px; margin: 10px 0; }
.option:has(input:checked),.choice:has(input:checked) { background: var(--soft); border-color: var(--primary-line); }
progress { width: 100%; accent-color: var(--primary); height: 9px; border: 0; border-radius: 12px; overflow: hidden; background: var(--surface-soft); }
progress::-webkit-progress-bar { background: var(--surface-soft); border-radius: 12px; }
progress::-webkit-progress-value { background: var(--primary); border-radius: 12px; }
progress::-moz-progress-bar { background: var(--primary); border-radius: 12px; }
code { word-break: break-word; background: var(--primary-soft); padding: 6px 10px; border-radius: 8px; }
table { width: 100%; border-collapse: collapse; }
th,td { padding: 14px; text-align: left; border-bottom: 1px solid var(--line); }
.app-footer { border-top: 1px solid var(--line); margin: 0 40px; padding: 24px 0; font-size: 16px; color: var(--muted); display: flex; justify-content: space-between; gap: 20px; }
.skip-link { position: absolute; left: 12px; top: -100px; }
.skip-link:focus { top: 10px; background:var(--surface); padding: 12px; z-index: 100; border-radius: 8px; }
.world-list { display: grid; gap: 16px; }
.breadcrumb { font-size: 16px; margin-bottom: 24px; }
.narrow { max-width: 780px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.stats { display: flex; gap: 16px; flex-wrap: wrap; margin: 18px 0; }
.stats span,.stats>div { background: var(--surface-soft); padding: 16px 20px; border-radius: 14px; }
.stats dt { color: var(--muted); font-size: 16px; }
.stats dd { margin: 4px 0 0; font-size: 28px; font-weight: 700; }
.tabs { display: flex; gap: 10px; flex-wrap: wrap; margin: 24px 0; }
.tabs a { padding: 10px 16px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; background: var(--surface); font-size: 17px; }
.tabs a[aria-current=page],.tabs .active { background: var(--primary); color: var(--on-primary); }
.reading { max-width: 780px; font-size: 18px; }
.reading p { margin: 22px 0; }
.feedback { padding: 18px; border-radius: 14px; margin: 16px 0; }
.feedback.hint { background: var(--sun-soft); }
.stack { display: grid; gap: 16px; }
summary { cursor: pointer; min-height: 44px; padding: 8px 0; }
@media(max-width:1100px) {
  .app-shell { grid-template-columns: 268px minmax(0,1fr); }
  .sidebar-scroll { padding: 28px 12px 18px; }
  .sidebar-brand-row { padding: 0 6px; }
  .primary-nav>a { padding: 13px 10px; font-size: 17px; }
  main { padding: 16px 28px 48px; }
  .topbar { padding: 18px 28px; }
  .topbar-caption,.topbar-dot { display: none; }
  .three { grid-template-columns: 1fr; }
}
@media(min-width:761px) {
  html[data-sidebar="collapsed"] .app-shell { grid-template-columns: 88px minmax(0,1fr); }
  html[data-sidebar="collapsed"] .sidebar-scroll { padding: 28px 12px 18px; gap: 32px; }
  html[data-sidebar="collapsed"] .sidebar-brand-row { justify-content: center; padding: 0; }
  html[data-sidebar="collapsed"] .brand-name,
  html[data-sidebar="collapsed"] .primary-nav>a>span,
  html[data-sidebar="collapsed"] .nav-logout>span,
  html[data-sidebar="collapsed"] .sidebar-note,
  html[data-sidebar="collapsed"] .prototype-label,
  html[data-sidebar="collapsed"] .theme-picker-label { display: none; }
  html[data-sidebar="collapsed"] .primary-nav>a,
  html[data-sidebar="collapsed"] .sidebar .nav-logout { justify-content: center; gap: 0; padding: 14px 10px; }
  html[data-sidebar="collapsed"] .support-nav-link:has(.nav-unread)::after { content: ""; position: absolute; right: 12px; top: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--success); border: 1px solid var(--surface); }
  html[data-sidebar="collapsed"] .theme-picker { justify-content: center; padding: 0 0 20px; }
  html[data-sidebar="collapsed"] .sidebar-collapse .ui-icon { transform: rotate(180deg); }
}
@media(max-width:760px) {
  .app-shell { display: block; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-scroll { height: auto; overflow: visible; padding: 18px; gap: 18px; }
  .sidebar-collapse,.sidebar-tooltip { display: none; }
  .sidebar-brand-row { padding: 0; }
  .brand { font-size: 23px; }
  .brand-caption { font-size: 16px; margin-top: 5px; }
  .brand-icon { width: 38px; height: 40px; font-size: 36px; }
  .sidebar-note,.prototype-label { display: none; }
  .sidebar-bottom { padding-top: 12px; }
  .primary-nav { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .primary-nav>a { font-size: 17px; padding: 13px 10px; }
  .primary-nav .support-nav-link { margin-top: 0; }
  .sidebar.menu-ready .mobile-menu-toggle { display: flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--surface); border-radius: 11px; min-height: 46px; padding: 9px 12px; font-size: 17px; color: var(--ink); }
  .sidebar.menu-ready:not(.menu-open) .sidebar-content { display: none; }
  .topbar { display: none; }
  main { padding: 26px 18px 40px; }
  .two,.worlds-grid { grid-template-columns: 1fr; }
  .card,.panel { padding: 22px; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .app-footer { margin: 0 18px; flex-direction: column; gap: 6px; font-size: 16px; }
  h1 { font-size: 32px; }
  h2 { font-size: 25px; }
  .auth-card { margin-top: 8px; }
  table { display: block; overflow-x: auto; }
}
@media(prefers-reduced-motion:reduce) { *,*::before,*::after { scroll-behavior: auto!important; transition: none!important; animation: none!important; } }
