/* Labas design layer (loaded after game.css): a calm dashboard look. Left icon sidebar, slim top bar, white
 * rounded cards on soft grey, black pill buttons, green progress, pastel course cards. Light and dark. */

:root {
  --bg: #eeeff4;
  --surface: #ffffff;
  --surface-2: #f4f4f7;
  --line: #e9e9ef;
  --text: #16161a;
  --muted: #8b8b96;
  --navy: #16161a;
  --ink: #111114; /* primary buttons */
  --on-ink: #ffffff;
  --green: #3ecf8e;
  --green-ink: #16925f;
  --green-soft: #e6f8ef;
  --chart: #16925f; /* validated: lightness band, chroma, contrast vs #ffffff */
  --radius: 18px;
  --shadow: none;
  --font: "DM Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --tint-0: #fde3ee;
  --tint-1: #dcebfb;
  --tint-2: #fbf3c4;
  --tint-3: #d8f5dc;
  --tint-4: #ebe3fd;
  --tint-5: #ffe6d6;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0f12;
    --surface: #1c1d22;
    --surface-2: #24252b;
    --line: #2d2e35;
    --text: #f1f1f4;
    --muted: #9a9aa6;
    --navy: #f1f1f4;
    --ink: #f1f1f4;
    --on-ink: #111114;
    --green: #2fbf80;
    --green-ink: #4fd99a;
    --green-soft: #173126;
    --chart: #27a86f; /* validated against #1c1d22 */
    --tint-0: #3a2330;
    --tint-1: #1f2d3e;
    --tint-2: #37331b;
    --tint-3: #1d3523;
    --tint-4: #2c2540;
    --tint-5: #3b2a20;
  }
}
:root[data-theme="dark"] {
  --bg: #0e0f12;
  --surface: #1c1d22;
  --surface-2: #24252b;
  --line: #2d2e35;
  --text: #f1f1f4;
  --muted: #9a9aa6;
  --navy: #f1f1f4;
  --ink: #f1f1f4;
  --on-ink: #111114;
  --green: #2fbf80;
  --green-ink: #4fd99a;
  --green-soft: #173126;
  --chart: #27a86f;
  --tint-0: #3a2330;
  --tint-1: #1f2d3e;
  --tint-2: #37331b;
  --tint-3: #1d3523;
  --tint-4: #2c2540;
  --tint-5: #3b2a20;
}

body { font-size: 15px; letter-spacing: -0.005em; }
h1, h2, h3 { letter-spacing: -0.015em; font-weight: 600; }
.card { border-radius: var(--radius); border-color: var(--line); box-shadow: none; }

/* ---------------------------------------------------------------- buttons: pills */
.btn { border-radius: 999px; background: var(--ink); border-color: var(--ink); color: var(--on-ink); font-weight: 600; height: 40px; padding: 0 20px; box-shadow: none; }
.btn:hover { filter: none; opacity: 0.88; text-decoration: none; }
.btn.outline { background: var(--surface-2); border-color: var(--surface-2); color: var(--text); }
.btn.outline:hover { background: var(--line); opacity: 1; }
.btn.small { height: 34px; padding: 0 14px; }
.btn.light { background: var(--surface); border-color: var(--surface); color: var(--text); box-shadow: none; }
.btn.dashed { border-radius: 999px; border-color: var(--line); color: var(--text); background: none; }
.btn.big { border-radius: 999px; box-shadow: none; text-transform: none; letter-spacing: 0; font-size: 16px; height: 52px; padding: 0 36px; }
.btn.big:active { transform: translateY(1px); box-shadow: none; }
.btn.big[disabled] { background: var(--surface-2); border-color: var(--surface-2); color: var(--muted); box-shadow: none; }
.lesson-foot.right .btn.big { box-shadow: none; }
.lesson-foot.wrong .btn.big { box-shadow: none; }
.segmented { border-radius: 999px; padding: 4px; border: 0; background: var(--surface-2); }
.segmented button, .segmented a { border-radius: 999px; font-weight: 600; }
.segmented button[aria-checked="true"], .segmented button[aria-selected="true"], .segmented a[aria-selected="true"] { color: var(--text); box-shadow: 0 1px 2px rgb(0 0 0 / 0.08); }
input[type="text"], input[type="search"], textarea, select { border-radius: 12px; background: var(--surface-2); border-color: transparent; }
input[type="text"]:focus, input[type="search"]:focus, textarea:focus { border-color: var(--line); background: var(--surface); }
.bar { height: 6px; border: 0; border-radius: 999px; background: var(--surface-2); }
.bar i { border-radius: 999px; background: var(--green); }
.pill { border-radius: 999px; }

/* ---------------------------------------------------------------- the shell: sidebar + top bar (signed in) */
.sidebar { display: none; }
body.shell .sidebar {
  display: flex; flex-direction: column; align-items: center; gap: 18px; position: fixed; inset: 0 auto 0 0; width: 92px;
  padding: 18px 10px; background: var(--surface); border-right: 1px solid var(--line); z-index: 7;
}
.side-brand svg { width: 30px; height: 30px; display: block; }
.side-links { display: grid; gap: 6px; width: 100%; }
.side-links a {
  display: grid; justify-items: center; gap: 4px; padding: 10px 4px; border-radius: 14px; color: var(--muted); font-size: 12px; font-weight: 500;
  position: relative; text-align: center;
}
.side-links a svg { width: 21px; height: 21px; }
.side-links a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.side-links a[aria-current="page"] { color: var(--text); background: var(--surface-2); }
.side-links .badge-dot { position: absolute; top: 6px; right: 14px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--ink); color: var(--on-ink); font-size: 10.5px; font-weight: 700; display: grid; place-items: center; }
.side-bottom { margin-top: auto; display: grid; gap: 8px; justify-items: center; }
.side-bottom .icon-btn, .side-bottom .theme-btn { margin: 0; }

body.shell { padding-left: 92px; }
body.shell .nav { background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px); }
body.shell .nav-inner { max-width: none; height: 68px; gap: 20px; padding: 0 28px; }
body.shell .brand, body.shell .links { display: none; }
.page-title { display: none; }
body.shell .page-title { display: block; font-size: 22px; white-space: nowrap; }
.top-search { position: relative; flex: 0 1 380px; }
.top-search svg { position: absolute; left: 14px; top: 50%; translate: 0 -50%; width: 17px; height: 17px; color: var(--muted); }
.top-search input { padding: 10px 16px 10px 40px; border-radius: 999px; font-size: 14px; }
.top-chips { margin-left: auto; display: flex; gap: 8px; }
.top-chips:empty { display: none; }
.top-chip { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px; border-radius: 999px; background: var(--surface-2); font-weight: 600; font-size: 14px; color: var(--text); }
.top-chip svg { width: 18px; height: 18px; }
body.shell .account { margin-left: 0; gap: 10px; }
body.shell .account .avatar { width: 38px; height: 38px; }
body.shell .who span:not(.avatar) { display: none; }
body.shell .theme-btn { display: none; }
body.shell .side-bottom .theme-btn { display: inline-grid; }
body.shell .app { max-width: 1320px; padding: 26px 28px 48px; }
body.shell .footer { max-width: 1320px; padding-left: 28px; }
body.shell.focus { padding-left: 0; }
body.shell.focus .sidebar { display: none; }

/* ---------------------------------------------------------------- the Learn dashboard */
.dash { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.dash-main, .dash-side { display: grid; gap: 16px; min-width: 0; }
.dash-side { position: sticky; top: 90px; }

/* Course tiles (top row) */
.course-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.course-tile { border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); padding: 8px; display: grid; gap: 8px; color: inherit; text-align: left; font: inherit; cursor: pointer; }
.course-tile:hover { text-decoration: none; border-color: color-mix(in srgb, var(--text) 18%, var(--line)); }
.tile-art { border-radius: 14px; padding: 16px 16px 18px; min-height: 140px; display: grid; align-content: space-between; gap: 18px; position: relative; overflow: hidden; }
.tile-art h3 { font-size: 18px; max-width: 70%; }
.tile-art .meta { display: flex; gap: 12px; color: var(--text); opacity: 0.75; font-size: 13px; }
.tile-foot { padding: 4px 8px 6px; font-size: 13.5px; color: var(--muted); }
.tile-foot b { color: var(--text); }
.tag-chip { justify-self: start; display: inline-block; padding: 3px 10px; border-radius: 999px; background: color-mix(in srgb, var(--surface) 70%, transparent); font-size: 12px; font-weight: 600; color: var(--text); }
.lang-orb { position: absolute; right: 14px; top: 14px; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 20px; background: var(--surface); color: var(--text); box-shadow: 0 6px 18px rgb(0 0 0 / 0.08); }
.course-tile.add { border: 1.5px dashed var(--line); background: transparent; display: grid; place-items: center; text-align: center; padding: 20px; min-height: 196px; }
.course-tile.add .plus { width: 40px; height: 40px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; margin: 0 auto 10px; box-shadow: 0 2px 8px rgb(0 0 0 / 0.06); }
.course-tile.add .plus svg { width: 18px; height: 18px; }
.course-tile.add b { display: block; font-size: 16px; margin-bottom: 4px; }
.tint-0 { background: var(--tint-0); } .tint-1 { background: var(--tint-1); } .tint-2 { background: var(--tint-2); }
.tint-3 { background: var(--tint-3); } .tint-4 { background: var(--tint-4); } .tint-5 { background: var(--tint-5); }

/* Deck (module) cards */
.module-card { padding: 20px 22px; display: grid; gap: 14px; }
.module-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: start; cursor: pointer; }
.module-no { min-width: 44px; height: 44px; padding: 0 8px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; font-weight: 600; font-size: 15px; }
.module-no small { color: var(--muted); font-size: 12px; font-weight: 500; }
.module-head h2 { font-size: 19px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.module-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.chev { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); background: none; border: 0; cursor: pointer; }
.chev svg { width: 18px; height: 18px; transition: rotate 0.2s; }
.module-card.open .module-head .chev svg { rotate: 180deg; }
.module-progress { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 24px; align-items: center; }
.module-progress .row { font-size: 14px; }
.module-progress .bar { grid-column: 1; }
.module-progress .btn { grid-row: 1 / span 2; grid-column: 2; }
.lesson-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.module-card:not(.open) .lesson-rows, .module-card:not(.open) .module-foot { display: none; }
.lesson-row-link { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 14px; align-items: center; padding: 8px 14px 8px 8px; border: 1px solid var(--line); border-radius: 14px; color: inherit; }
.lesson-row-link:hover { text-decoration: none; background: var(--surface-2); }
.lesson-row-link.locked { cursor: default; }
.lesson-row-link.locked:hover { background: none; }
.lesson-row-link.current { border-color: color-mix(in srgb, var(--green) 55%, var(--line)); }
.lesson-num { width: 36px; height: 36px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; font-weight: 600; font-size: 14px; }
.lesson-row-link.locked .lesson-num { background: var(--ink); color: var(--on-ink); }
.lesson-title { font-weight: 500; }
.lesson-state { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.ring { width: 20px; height: 20px; display: block; }
.lesson-end svg { width: 18px; height: 18px; color: var(--muted); display: block; }
.module-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 2px; }
.module-card .unit-done { border: 0; background: var(--surface-2); border-radius: 14px; }

/* Side widgets */
.widget { padding: 18px 20px; display: grid; gap: 14px; }
.widget-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.widget-head h3 { font-size: 17px; }
.widget-head select { padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); text-align: center; }
.stat-row > div { display: grid; gap: 2px; padding: 0 4px; }
.stat-row > div + div { border-left: 1px solid var(--line); }
.stat-row span { font-size: 12.5px; color: var(--muted); }
.stat-row b { font-size: 22px; font-weight: 600; }
.stat-note { font-size: 13px; color: var(--muted); }

/* Activity chart: one dot column per day, each dot a share of XP */
.activity { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; }
.activity-axis { display: grid; align-content: space-between; font-size: 11px; color: var(--muted); text-align: right; padding-bottom: 20px; }
.activity-cols { display: grid; grid-template-columns: repeat(14, 1fr); gap: 2px; align-items: end; height: 132px; border-bottom: 1px solid var(--line); position: relative; }
.activity-col { display: flex; flex-direction: column-reverse; align-items: center; gap: 2px; height: 100%; justify-content: flex-start; padding-bottom: 2px; cursor: default; border-radius: 6px; }
.activity-col:hover, .activity-col:focus-visible { background: var(--surface-2); outline: none; }
.activity-col i { width: 8px; height: 8px; border-radius: 50%; background: var(--chart); flex: none; }
.activity-col.today i { box-shadow: 0 0 0 2px var(--surface); }
.activity-x { display: grid; grid-template-columns: repeat(14, 1fr); gap: 2px; font-size: 10.5px; color: var(--muted); text-align: center; grid-column: 2; margin-top: -4px; }
.chart-tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--on-ink); font-size: 12px; font-weight: 600; padding: 5px 9px; border-radius: 8px; white-space: nowrap; translate: -50% -100%; z-index: 2; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Leaderboard podium */
.podium { display: grid; grid-template-columns: repeat(3, 1fr); align-items: end; text-align: center; gap: 6px; padding-top: 4px; }
.podium-spot { display: grid; justify-items: center; gap: 4px; color: inherit; }
.podium-spot:hover { text-decoration: none; }
.podium-spot .pic { position: relative; }
.podium-spot .avatar { width: 58px; height: 58px; font-size: 22px; background: var(--tint-2); color: var(--text); }
.podium-spot.first .avatar { width: 72px; height: 72px; font-size: 26px; background: var(--tint-3); }
.podium-spot.third .avatar { background: var(--tint-1); }
.podium-spot .rank-badge { position: absolute; right: -2px; bottom: -2px; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: var(--on-ink); font-size: 11.5px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--surface); }
.podium-spot b { font-size: 13.5px; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium-spot span { font-size: 12px; color: var(--muted); }
.rank-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.rank-list li { display: grid; grid-template-columns: 22px auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 6px 6px; border-radius: 10px; font-size: 14px; }
.rank-list li.you { background: var(--surface-2); font-weight: 600; }
.rank-list .avatar { width: 28px; height: 28px; font-size: 12px; }
.rank-list a { color: inherit; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-list .xp { font-size: 12.5px; color: var(--muted); }
.rank-list .n { color: var(--muted); font-size: 13px; }
.board-page .podium { max-width: 520px; margin: 8px auto 4px; }
.board-page .rank-list { max-width: 620px; width: 100%; margin: 0 auto; }

/* ---------------------------------------------------------------- Discover */
.discover { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 24px; align-items: start; }
.discover-hero { text-align: center; padding: 30px 20px 12px; display: grid; gap: 10px; justify-items: center; }
.discover-hero h2 { font-size: 32px; letter-spacing: -0.02em; margin: 0; }
.discover-hero p { color: var(--muted); max-width: 48ch; margin: 0; font-size: 15px; }
.discover-search { display: flex; gap: 10px; width: min(540px, 100%); margin-top: 10px; }
.discover-search input { flex: 1; height: 44px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); padding: 0 20px; font-size: 14.5px; box-sizing: border-box; }
.discover-search input:focus { border-color: color-mix(in srgb, var(--text) 35%, var(--line)); background: var(--surface); }
.discover-search .btn { height: 44px; padding: 0 24px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; font-size: 14.5px; }
.discover-main { display: grid; gap: 16px; min-width: 0; }
.filters { padding: 18px 20px; display: grid; gap: 14px; position: sticky; top: 90px; }
.filters .widget-head { display: flex; justify-content: space-between; align-items: center; }
.filters .widget-head h3 { font-size: 16px; font-weight: 700; margin: 0; }
.active-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.active-filters:empty { display: none; }
.active-filters button { border: 1px solid var(--line); background: var(--surface-2); border-radius: 999px; padding: 4px 10px; font: 500 12.5px var(--font); color: var(--text); cursor: pointer; display: inline-flex; align-items: center; gap: 4px; transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease; }
.active-filters button:hover { background: var(--line); border-color: color-mix(in srgb, var(--text) 25%, var(--line)); color: var(--text); }
.filter-group { display: grid; gap: 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.filter-group:first-of-type { border-top: 0; padding-top: 0; }
.filter-group > span { font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.filter-group label { display: flex; gap: 9px; align-items: center; font-size: 13.5px; color: var(--text); cursor: pointer; padding: 3px 6px; margin: 0 -6px; border-radius: 8px; transition: background-color 0.12s ease; user-select: none; }
.filter-group label:hover { background: var(--surface-2); }
.filter-group label input { accent-color: var(--ink); width: 16px; height: 16px; margin: 0; cursor: pointer; flex-shrink: 0; }
#f-langs { max-height: 175px; overflow-y: auto; padding-right: 4px; scrollbar-width: thin; }
#f-langs::-webkit-scrollbar { width: 5px; }
#f-langs::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; }

/* Code callout card at bottom of discover filters */
.code-callout {
  margin-top: 4px;
  padding: 14px 14px 16px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  display: grid;
  gap: 10px;
}
.code-callout h4 {
  font-size: 13.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: var(--text);
  letter-spacing: -0.01em;
}
.code-callout h4 svg {
  width: 15px;
  height: 15px;
  color: var(--muted);
  flex-shrink: 0;
}
.code-callout p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--muted);
}
.code-callout .code-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
.code-callout .code-form input {
  width: 100%;
  height: 40px;
  box-sizing: border-box;
  text-align: center;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.08em;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 0 10px;
}
.code-callout .code-form input:focus {
  border-color: color-mix(in srgb, var(--text) 35%, var(--line));
}
.code-callout .code-form .btn {
  width: 100%;
  height: 38px;
  font-size: 13.5px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.course-grid.pastel { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.pcard { border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); padding: 8px; display: grid; gap: 4px; }
.pcard .tile-art { min-height: 0; gap: 10px; padding: 16px; }
.pcard .tile-art h3 a { color: inherit; }
.pcard .tile-art p { margin: 0; font-size: 13.5px; opacity: 0.8; max-width: 75%; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pcard .progress-line { display: grid; gap: 6px; font-size: 12.5px; }
.pcard .progress-line .row { opacity: 0.8; }
.pcard .bar { background: color-mix(in srgb, var(--surface) 65%, transparent); }
.pcard .bar i { background: var(--ink); }
.pcard-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 10px 6px; font-size: 13.5px; color: var(--muted); }
.pcard-foot b { color: var(--text); font-weight: 600; }

/* ---------------------------------------------------------------- other pages pick up the look */
.page-head h1 { font-size: 26px; }
.unit-banner { border-radius: var(--radius); }
.profile-head .avatar.big { background: var(--tint-3); color: var(--text); }
.course-flag { border-radius: 14px; background: var(--ink); color: var(--on-ink); }
.official svg path:first-child { fill: #3b82f6; }

@media (max-width: 1100px) {
  .dash { grid-template-columns: 1fr; }
  .dash-side { position: static; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
  .discover { grid-template-columns: 1fr; }
  .filters { position: static; }
}
@media (max-width: 860px) {
  .course-tiles { grid-template-columns: 1fr 1fr; }
  .top-search { display: none; }
}
/* Phones: the sidebar becomes a bottom tab bar. */
@media (max-width: 640px) {
  body.shell { padding-left: 0; padding-bottom: 76px; }
  body.shell .sidebar { inset: auto 0 0 0; width: auto; height: 68px; flex-direction: row; padding: 6px 8px; border-right: 0; border-top: 1px solid var(--line); }
  body.shell .side-brand, body.shell .side-bottom { display: none; }
  .side-links { display: flex; overflow-x: auto; gap: 2px; scrollbar-width: none; }
  .side-links a { flex: 1 0 64px; padding: 6px 2px; font-size: 11px; }
  .side-links .badge-dot { right: 8px; top: 2px; }
  body.shell .nav-inner { padding: 0 16px; height: 60px; gap: 10px; }
  body.shell .page-title { font-size: 19px; }
  .top-chip { height: 34px; padding: 0 10px; font-size: 13px; }
  body.shell .app { padding: 18px 16px 32px; }
  .course-tiles { grid-template-columns: 1fr; }
  .module-card { padding: 16px; }
  .module-progress { grid-template-columns: 1fr; }
  .module-progress .btn { grid-row: auto; grid-column: 1; justify-self: start; }
  .lesson-row-link { grid-template-columns: auto minmax(0, 1fr) auto; }
  .lesson-row-link .lesson-end { display: none; }
  .discover-hero h2 { font-size: 24px; }
  .discover-hero { padding: 20px 12px 8px; }
}
@media (max-width: 440px) {
  .discover-search { flex-direction: column; }
  .discover-search .btn { width: 100%; }
}
.widget a svg, .module-foot svg, .linkbtn svg { width: 16px; height: 16px; vertical-align: -3px; }
.widget > a.small { display: inline-flex; gap: 6px; align-items: center; }

/* ---------------------------------------------------------------- course cards: one fixed size everywhere
 * Every card has the same slots (tag, one-line title, two-line description, details, progress) whether or not
 * it has a description or progress, and every card in a row is as tall as the row. */
.course-grid { grid-auto-rows: 1fr; align-items: stretch; }
.pcard { height: 100%; grid-template-rows: 1fr auto; }
.pcard .tile-art { height: 100%; grid-template-rows: auto auto calc(2 * 1.45em) auto 34px; align-content: start; gap: 8px; padding: 16px 16px 14px; }
.pcard .tile-art h3 { font-size: 17px; line-height: 1.3; max-width: calc(100% - 78px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.pcard .tile-art p { line-height: 1.45; font-size: 13.5px; max-width: calc(100% - 20px); min-height: calc(2 * 1.45em); }
.pcard .tile-art .meta { flex-wrap: nowrap; overflow: hidden; white-space: nowrap; }
.pcard .progress-line { align-self: end; }
.pcard-foot { min-height: 52px; }

.course-tiles { grid-auto-rows: 1fr; }
.course-tile { height: 100%; grid-template-rows: 1fr auto; }
.course-tile .tile-art { height: 168px; min-height: 0; grid-template-rows: auto 1fr auto; align-content: stretch; }
.course-tile .tile-art h3 { align-self: end; max-width: calc(100% - 78px); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.3; }
.course-tile.add { min-height: 0; height: 100%; }
.course-card { height: 100%; display: flex; flex-direction: column; }
.course-card .course-foot { margin-top: auto; }

/* Search: matching people above the courses, and why a course matched (in its tag) */
.people-row { display: grid; gap: 10px; }
.people-row h3 { font-size: 16px; }
.people-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.person-card { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; }
.person-card .profile-mini-head { min-width: 0; }
.person-card .profile-mini-head > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag-chip { max-width: calc(100% - 80px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------- Studio › Arrange: a board of decks and lessons */
.arrange-help { margin: 0; font-size: 14px; }
.inline-grip { width: 14px; height: 14px; vertical-align: -2px; }
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; align-items: start; }
.board-col { padding: 12px; display: grid; gap: 10px; background: var(--surface); }
.board-col-head { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto auto; gap: 8px; align-items: center; }
.board-col-head .module-no { min-width: 30px; height: 30px; border-radius: 9px; font-size: 13px; }
.drag-handle { color: var(--muted); display: grid; place-items: center; cursor: grab; touch-action: none; }
.drag-handle svg { width: 18px; height: 18px; }
.deck-handle { width: 26px; height: 30px; border-radius: 8px; }
.deck-handle:hover { background: var(--surface-2); color: var(--text); }
.rename { all: unset; cursor: text; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-radius: 6px; padding: 2px 4px; }
.rename:hover, .rename:focus-visible { background: var(--surface-2); outline: none; }
.rename-input { padding: 4px 8px !important; font-weight: 600; border-radius: 8px !important; min-width: 0; }
.board-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; min-height: 44px; border-radius: 12px; }
.board-cards:empty { border: 1.5px dashed var(--line); }
.board-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 8px; align-items: center; padding: 8px 8px 8px 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: grab; user-select: none; }
.board-card:hover { border-color: color-mix(in srgb, var(--text) 18%, var(--line)); }
.board-card .rename { font-weight: 500; }
.board-card .small { white-space: nowrap; }
.drag-ghost { opacity: 0.35; }
.sortable-chosen { box-shadow: 0 8px 22px rgb(0 0 0 / 0.12); }
.board-add input, .board-new input { padding: 8px 12px; font-size: 14px; border-radius: 10px; background: transparent; border: 1.5px dashed var(--line); }
.board-add input:focus, .board-new input:focus { border-style: solid; background: var(--surface); }
.board-new { border-style: dashed; background: transparent; }
.board-card .rename, .board-col-head .rename { display: block; }
.examples .ex-lang { display: block; font-size: 11.5px; font-weight: 500; color: var(--muted); }

/* Locked courses and access codes */
.code-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
}
.code-form input {
  font-family: var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 13.5px;
  height: 42px;
  padding: 0 14px;
  min-width: 0;
  box-sizing: border-box;
  background: var(--surface-2);
  border: 1px solid transparent;
}
.code-form input:focus {
  background: var(--surface);
  border-color: var(--line);
}
.code-form .btn {
  height: 42px;
  padding: 0 20px;
  white-space: nowrap;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.code-form .error {
  grid-column: 1 / -1;
  margin: 2px 0 0;
  font-size: 13px;
  color: #ef4444;
}
.unlock-card {
  padding: 22px 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 20px;
  align-items: center;
}
.unlock-card h3 {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0 0 6px;
  font-size: 18px;
}
.unlock-card h3 svg, .pill svg, .btn svg.lock { width: 15px; height: 15px; }
.unlock-card p { margin: 0; line-height: 1.45; }
.unlock-card .code-form input { background: var(--surface-2); }
.pill svg { vertical-align: -2px; }
.codes-card .stat-row.two, .stat-row.two { grid-template-columns: 1fr 1fr; }
.code-make { display: flex; gap: 8px; align-items: end; }
.code-make .field { flex: 1; font-size: 13px; }
input[type="number"] { width: 100%; font: 15px var(--font); color: var(--text); background: var(--surface-2); border: 1px solid transparent; border-radius: 12px; padding: 8px 12px; }
.codes-card code { font-family: var(--mono); color: var(--muted); }
.codes-card details summary { cursor: pointer; color: var(--muted); }
label.check span { font-weight: 400; }
@media (max-width: 760px) {
  .unlock-card {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}
@media (max-width: 520px) {
  .code-form {
    grid-template-columns: 1fr;
  }
  .code-form .btn {
    width: 100%;
  }
}
