/* App chrome for signed-in pages (October 31, 2026), drawn by js/shell.js.
   Same brand as the homepage redesign, used with restraint:
   - a calm sidebar: plain links, the current page on a yellow pill (no shadows);
   - the account, settings, theme and sound live in one account menu;
   - phones get a bottom tab bar instead of the sidebar stacked on top;
   - no graph paper in the app; normal-weight body text; sentence-case headings.
   Also holds the Home and Library page styles. */

body.app-page { background-image: none; }
body.app-page .main { font-weight: 500; }
body.app-page .main h1, body.app-page .main h2 { text-transform: none; }

/* ---------- layout ---------- */
.shell.app-shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.app-shell .main { max-width: 1180px; width: 100%; padding: 36px clamp(20px, 3.5vw, 48px) 80px; }

/* ---------- sidebar ---------- */
.app-side {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 18px;
  padding: 20px 14px 16px;
  background: var(--bg-raised);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}
.app-brand { color: var(--text); text-decoration: none; font-size: 1.25rem; padding: 4px 8px; }
.app-brand .brand-mark { width: 32px; height: 32px; flex-basis: 32px; }
.app-nav { display: flex; flex-direction: column; gap: 4px; }
.app-link, .app-nav .side-link {
  display: flex; align-items: center; gap: 12px;
  min-height: 44px; padding: 8px 12px;
  border: 2px solid transparent; border-radius: 10px;
  color: var(--text-soft); text-decoration: none;
  font-weight: 650; font-size: .95rem;
  background: none; box-shadow: none; text-transform: none; letter-spacing: 0;
}
.app-link .icon, .app-nav .side-link .icon { width: 20px; height: 20px; flex: 0 0 20px; }
.app-link:hover, .app-nav .side-link:hover { background: var(--panel-2); color: var(--text); transform: none; box-shadow: none; }
.app-link.active, .app-nav .side-link.active, .app-nav .side-link.is-current {
  background: var(--yellow); color: var(--edge); border-color: var(--edge);
}
.app-link:focus-visible, .app-tab:focus-visible, .app-account:focus-visible, .app-menu-item:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
/* the operator's Admin group (installAdminMenu in api.js) */
.app-nav .side-admin-links { border-left-width: 2px; border-color: var(--border); margin-left: 22px; padding-left: 10px; }
.app-nav .side-admin > summary { cursor: pointer; }

.app-side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.app-account {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--bg); color: var(--text); text-align: left; cursor: pointer;
}
.app-account:hover { border-color: var(--text-soft); }
.app-account .icon { width: 18px; height: 18px; margin-left: auto; color: var(--text-soft); }
.app-account-sprite { width: 30px; height: 30px; flex: 0 0 30px; }
.app-account-text { display: flex; flex-direction: column; min-width: 0; }
.app-account-text strong { font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-account-text span { font-size: .78rem; color: var(--text-soft); }
.app-guest { margin: 0; font-size: .88rem; color: var(--text-soft); }
.app-text-link { border: 0; background: none; padding: 6px 4px; color: var(--surface-link, var(--blue)); font-weight: 700; text-align: center; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.app-toggles { display: inline-flex; gap: 8px; }

/* ---------- account menu ---------- */
.app-menu {
  position: fixed; z-index: 60; left: 14px; bottom: 76px; width: 260px;
  padding: 8px; background: var(--bg-raised); color: var(--text);
  border: 3px solid var(--edge); border-radius: 12px; box-shadow: var(--shadow);
}
.app-menu-head { display: flex; flex-direction: column; padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.app-menu-head span { font-size: .8rem; color: var(--text-soft); overflow: hidden; text-overflow: ellipsis; }
.app-menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 8px 10px;
  border: 0; border-radius: 8px; background: none; color: var(--text); font: inherit; font-weight: 600;
  text-align: left; text-decoration: none; cursor: pointer;
}
.app-menu-item .icon { width: 18px; height: 18px; flex: 0 0 18px; color: var(--text-soft); }
.app-menu-item em { margin-left: auto; font-style: normal; font-size: .78rem; color: var(--text-soft); }
.app-menu-item:hover { background: var(--panel-2); }
.app-menu-danger, .app-menu-danger .icon { color: var(--wrong); }
.app-menu-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; color: var(--text-soft); font-size: .88rem; font-weight: 600; }

/* ---------- phone tab bar ---------- */
.app-tabs { display: none; }

/* ---------- account type (popup and Settings) ---------- */
.app-role-card { width: min(560px, calc(100vw - 32px)); }
.app-role-card h2 { margin: 0 0 6px; }
.app-role-card > p { margin: 0 0 18px; line-height: 1.5; font-weight: 500; }
.app-role-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.app-role {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left;
  padding: 16px; border: 3px solid var(--edge); border-radius: 12px; background: var(--bg-raised); color: var(--surface-ink);
  box-shadow: var(--shadow-sm); cursor: pointer; font: inherit;
  transition: transform .12s ease, box-shadow .12s ease;
}
.app-role:hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--edge); }
.app-role[aria-checked="true"] { background: var(--yellow); color: var(--edge); }
.app-role[aria-checked="true"] span:not(.app-role-icon) { color: var(--edge); }
.app-role strong { font-size: 1.1rem; }
.app-role > span:not(.app-role-icon) { font-size: .88rem; font-weight: 500; color: var(--surface-ink-soft, var(--text-soft)); line-height: 1.4; }
.app-role-icon { display: grid; place-items: center; width: 42px; height: 42px; border: 2px solid var(--edge); border-radius: 10px; color: var(--edge); margin-bottom: 4px; }
.app-role-icon .icon { width: 22px; height: 22px; }
.app-role-teacher { background: #67a7ff; }
.app-role-student { background: var(--mint); }
.app-role:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.app-role-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 18px; }
.app-role-actions .btn-primary:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: 4px 4px 0 var(--edge); }

/* ---------- page heads shared by Home and Library ---------- */
.app-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 28px; }
.app-head h1 { margin: 0; font-size: clamp(1.7rem, 3vw, 2.2rem); letter-spacing: -0.035em; line-height: 1.1; }
.app-head p { margin: 6px 0 0; color: var(--text-soft); }
.app-section { margin-top: 40px; }
.app-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.app-section-head h2 { margin: 0; font-size: 1.25rem; letter-spacing: -0.02em; }
.app-section-head a { color: var(--surface-link, var(--blue)); font-weight: 700; text-decoration: none; white-space: nowrap; }
.app-section-head a:hover { text-decoration: underline; }
.app-empty { padding: 28px; border: 2px dashed var(--border); border-radius: 12px; color: var(--text-soft); text-align: center; }
.app-empty p { margin: 0 0 14px; }

/* ---------- Home ---------- */
.home-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.home-action {
  display: flex; align-items: center; gap: 14px; min-height: 84px; padding: 16px 18px;
  border: 3px solid var(--edge); border-radius: 12px; box-shadow: var(--shadow-sm);
  background: var(--bg-raised); color: var(--surface-ink); text-decoration: none; text-align: left;
  font: inherit; cursor: pointer; transition: transform .12s ease, box-shadow .12s ease;
}
.home-action:hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--edge); }
.home-action strong { display: block; font-size: 1.02rem; }
.home-action span:not(.home-action-icon) { display: block; font-size: .85rem; color: var(--surface-ink-soft, var(--text-soft)); font-weight: 500; }
.home-action-icon { display: grid; place-items: center; flex: 0 0 44px; height: 44px; border: 2px solid var(--edge); border-radius: 10px; color: var(--edge); }
.home-action-icon .icon { width: 22px; height: 22px; }
.home-action.is-primary { background: var(--yellow); color: var(--edge); }
.home-action.is-primary span:not(.home-action-icon) { color: #3a3828; }
.hi-yellow { background: var(--yellow); } .hi-blue { background: #67a7ff; } .hi-mint { background: var(--mint); } .hi-coral { background: var(--coral); }
.home-action.is-primary .home-action-icon { background: #fff; }

.home-join {
  max-width: 560px; padding: 20px;
  background: var(--yellow); color: var(--edge); border: 3px solid var(--edge); border-radius: 12px; box-shadow: var(--shadow);
}
.home-join label { display: block; margin-bottom: 8px; font-weight: 800; }
.home-join .home-join-field { min-width: 0; }
.home-join-row { display: flex; gap: 10px; }
.home-join-row input {
  flex: 1; min-width: 0; min-height: 52px; padding: 0 14px; border: 3px solid var(--edge); border-radius: 8px;
  background: #fff; color: #111114; font-family: "Arial Black", Inter, system-ui, sans-serif; font-size: 1.25rem; letter-spacing: .14em; text-transform: uppercase;
}
.home-join-row input::placeholder { color: #8a8798; }
.home-join-row .btn { min-height: 52px; background: var(--blue); color: #fff; }
.home-join .error-text { margin: 8px 0 0; color: #8f1d1d; font-weight: 700; }
.home-join .error-text:empty { display: none; }

.home-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.home-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 16px; padding: 14px 4px; border-bottom: 1px solid var(--border); }
.home-list strong { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-list .home-meta { grid-column: 1; color: var(--text-soft); font-size: .86rem; }
.home-list .home-list-end { grid-column: 2; grid-row: 1 / span 2; display: flex; align-items: center; gap: 10px; }
.home-list .home-score { font-variant-numeric: tabular-nums; font-weight: 800; }
.home-list .btn { min-height: 40px; padding: 6px 14px; font-size: .82rem; }

/* Compact Home (Oct 30): greeting and actions share a row, then side-by-side
   panels of short rows, so a laptop screen shows everything without scrolling. */
.home-top { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; margin-bottom: 24px; }
.home-top h1 { margin: 0; font-size: clamp(1.6rem, 2.6vw, 2rem); letter-spacing: -0.035em; line-height: 1.1; }
.home-top p { margin: 6px 0 0; color: var(--text-soft); }
.home-quick { display: flex; flex-wrap: wrap; gap: 10px; }
.home-quick .btn { min-height: 44px; padding: 8px 16px; font-size: .88rem; }
.home-top .home-join { flex: 0 1 380px; min-width: 0; max-width: 380px; padding: 12px 14px; box-shadow: var(--shadow-sm); }
/* width: 0 + flex: 1 so the input's built-in minimum width can't push the box past a phone screen */
.home-join-row input { width: 0; }
.home-top .home-join label { margin-bottom: 6px; font-size: .88rem; }
.home-top .home-join-row input { min-height: 44px; font-size: 1.05rem; }
.home-top .home-join-row .btn { min-height: 44px; padding: 0 16px; }

.home-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.home-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.home-panel { border: 2px solid var(--edge); border-radius: 12px; background: var(--bg-raised); color: var(--surface-ink); overflow: hidden; }
.home-panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 14px 16px 10px; }
.home-panel-head h2 { margin: 0; font-size: 1.05rem; letter-spacing: -0.02em; color: var(--surface-ink); }
.home-panel-head a { color: var(--surface-link, var(--blue)); font-weight: 700; font-size: .88rem; text-decoration: none; white-space: nowrap; }
.home-panel-head a:hover { text-decoration: underline; }
.home-panel-empty { padding: 4px 16px 18px; color: var(--surface-ink-soft, var(--text-soft)); }
.home-panel-empty p { margin: 0 0 12px; }
.home-rows { list-style: none; margin: 0; padding: 0; }
.home-row { display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 8px 16px; border-top: 1px solid var(--border); }
.home-row:hover { background: color-mix(in srgb, var(--panel-2) 60%, transparent); }
.home-row .set-cover.home-thumb { width: 64px; flex: 0 0 64px; border-width: 2px; border-radius: 6px; }
.home-thumb .set-cover-mark { font-size: .9rem; }
.home-row-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.home-row-text a, .home-row-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--surface-ink); font-weight: 700; text-decoration: none; }
.home-row-text a:hover { text-decoration: underline; }
.home-row-text span { color: var(--surface-ink-soft, var(--text-soft)); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-row .home-score { font-variant-numeric: tabular-nums; font-weight: 800; font-size: .92rem; }
.home-row-btn { min-height: 36px; padding: 4px 12px; font-size: .78rem; box-shadow: 3px 3px 0 var(--edge); }
.home-row-btn .icon { width: 15px; height: 15px; }
.home-row-flag { font-size: .76rem; font-weight: 800; color: var(--wrong); }
.home-foot { margin: 18px 0 0; }
.home-foot a { display: inline-flex; align-items: center; gap: 8px; color: var(--surface-link, var(--blue)); font-weight: 700; text-decoration: none; }
.home-foot a:hover { text-decoration: underline; }
.home-foot .icon { width: 18px; height: 18px; }
@media (max-width: 1180px) { .home-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) { .home-grid, .home-grid-3 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 520px) {
  .home-top .home-join { flex-basis: 100%; max-width: none; }
  .home-quick { width: 100%; }
  .home-quick .btn { flex: 1; padding: 8px 10px; font-size: .8rem; white-space: nowrap; }
  .home-row { padding: 8px 12px; gap: 10px; }
  .home-row .set-cover.home-thumb { display: none; }
}

/* Home banner (third pass, Oct 30): greeting, the two main actions and a few
   numbers, in one card, like the welcome panel on Kahoot's home. */
.home-hero {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px 32px;
  padding: clamp(20px, 3vw, 30px);
  border: 2px solid var(--edge); border-radius: 16px; box-shadow: var(--shadow-sm);
  background: var(--bg-raised); color: var(--surface-ink);
}
.home-hero-text { flex: 1 1 340px; min-width: 0; }
.home-hero h1 { margin: 0; font-size: clamp(1.6rem, 2.6vw, 2.1rem); letter-spacing: -0.035em; line-height: 1.1; color: var(--surface-ink); }
.home-hero p { margin: 8px 0 0; color: var(--surface-ink-soft, var(--text-soft)); }
.home-hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.home-stats { display: grid; grid-template-columns: repeat(3, minmax(96px, 1fr)); gap: 10px; margin: 0; }
.home-stat { padding: 12px 14px; border-radius: 12px; background: var(--panel-2); text-align: left; }
.home-stat dd { margin: 0; font-weight: 800; font-family: "Arial Black", Inter, system-ui, sans-serif; font-size: 1.6rem; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--surface-ink); }
.home-stat dt { margin-top: 2px; font-size: .8rem; font-weight: 700; color: var(--surface-ink-soft, var(--text-soft)); }
.home-stats-inline { margin-top: 16px; max-width: 460px; }
.home-stats-inline .home-stat dd { font-size: 1.25rem; }
.home-hero .home-join { flex: 0 1 380px; min-width: 0; box-shadow: var(--shadow-sm); }
.home-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.home-cards .set-cover { aspect-ratio: 16 / 7; }
.home-cards .lib-card h3 { font-size: .98rem; }
.home-panel .home-rows .home-row:first-child { border-top: 0; }
@media (max-width: 1180px) { .home-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } .home-cards .lib-card:nth-child(4) { display: none; } }
@media (max-width: 900px) { .home-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } .home-cards .lib-card:nth-child(4) { display: flex; } }
@media (max-width: 520px) {
  .home-cards { grid-template-columns: minmax(0, 1fr); }
  .home-cards .lib-card:nth-child(n+3) { display: none; }
  .home-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
  .home-stat { padding: 10px; }
  .home-stat dd { font-size: 1.25rem; }
  .home-hero .home-join { flex-basis: 100%; }
}

/* ---------- set cards (Home and Library) ---------- */
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.lib-card {
  position: relative; display: flex; flex-direction: column;
  border: 3px solid var(--edge); border-radius: 12px; box-shadow: var(--shadow-sm);
  background: var(--bg-raised); color: var(--surface-ink);
}
.lib-card .set-cover { border: 0; border-bottom: 3px solid var(--edge); border-radius: 9px 9px 0 0; }
.lib-card-body { display: flex; flex-direction: column; gap: 4px; flex: 1; padding: 12px 14px 14px; }
.lib-card h3 { margin: 0; font-size: 1.02rem; line-height: 1.3; color: var(--surface-ink); letter-spacing: -0.01em; }
.lib-card h3 a { color: inherit; text-decoration: none; }
.lib-card h3 a:hover { text-decoration: underline; }
.lib-meta { color: var(--surface-ink-soft, var(--text-soft)); font-size: .84rem; }
.lib-note { margin: 4px 0 0; color: var(--wrong); font-size: .82rem; }
.lib-actions { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 12px; }
.lib-actions .btn { min-height: 40px; padding: 6px 14px; font-size: .82rem; }
.lib-actions .more-menu { margin-left: auto; }
.lib-icon-btn, .lib-more .more-trigger { min-width: 40px; padding: 6px 9px !important; justify-content: center; }
.lib-icon-btn .icon, .lib-more .more-trigger .icon { width: 18px; height: 18px; margin: 0; }
.lib-more .more-trigger span:empty { display: none; }
.lib-more .more-pop { left: auto; right: 0; }
.lib-badge {
  position: absolute; top: 10px; left: 10px; display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border: 2px solid var(--edge); border-radius: 4px; background: var(--bg-raised); color: var(--surface-ink);
  font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
}
.lib-badge .icon { width: 13px; height: 13px; }
.lib-badge.is-public { background: var(--mint); color: var(--edge); }
.lib-badge.is-removed { background: var(--coral); color: var(--edge); }

/* Library toolbar */
.lib-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 20px; }
.lib-tabs { display: inline-flex; gap: 4px; padding: 4px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-raised); }
.lib-tab { min-height: 36px; padding: 4px 14px; border: 0; border-radius: 7px; background: none; color: var(--text-soft); font: inherit; font-weight: 700; }
.lib-tab[aria-selected="true"] { background: var(--panel-2); color: var(--text); }
.lib-tab[disabled] { cursor: default; opacity: .7; }
.lib-tab small { margin-left: 4px; font-size: .7rem; font-weight: 700; color: var(--text-soft); }
.lib-search { flex: 1 1 220px; min-height: 44px; padding: 0 14px; border: 2px solid var(--border); border-radius: 10px; background: var(--input-bg, var(--bg-raised)); color: var(--text); font: inherit; }
.lib-search:focus { outline: none; border-color: var(--blue); }
.lib-sort { min-height: 44px; padding: 0 10px; border: 2px solid var(--border); border-radius: 10px; background: var(--input-bg, var(--bg-raised)); color: var(--text); font: inherit; font-weight: 600; }

/* "Host a game": choose a set */
.pick-list { list-style: none; margin: 0; padding: 0; max-height: 60vh; overflow-y: auto; }
.pick-list button {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 8px 10px;
  border: 0; border-bottom: 1px solid var(--border); background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.pick-list button:hover { background: var(--panel-2); }
.pick-list .set-cover { width: 72px; flex: 0 0 72px; border-width: 2px; }
.pick-list strong { display: block; }
.pick-list span { color: var(--text-soft); font-size: .84rem; }

/* ---------- phones and small tablets ---------- */
@media (max-width: 820px) {
  .shell.app-shell { display: block; }
  .app-side { display: none; }
  .app-shell .main { padding: 22px 16px calc(96px + env(safe-area-inset-bottom, 0px)); }
  .app-tabs {
    position: fixed; z-index: 50; left: 0; right: 0; bottom: 0;
    display: flex; gap: 2px;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
    background: var(--bg-raised); border-top: 3px solid var(--edge);
  }
  .app-tab {
    flex: 1 1 0; min-width: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-height: 52px; padding: 4px 2px; border: 2px solid transparent; border-radius: 10px;
    background: none; color: var(--text-soft); font: inherit; font-size: .7rem; font-weight: 700; text-decoration: none; cursor: pointer;
  }
  .app-tab .icon { width: 22px; height: 22px; }
  .app-tab span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .app-tab.active { background: var(--yellow); color: var(--edge); border-color: var(--edge); }
  .app-tab[hidden] { display: none; }
  .app-menu { left: 8px; right: 8px; width: auto; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
  .home-actions { grid-template-columns: minmax(0, 1fr); }
  body.app-page .modal-shell { padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 520px) {
  .app-role-grid { grid-template-columns: minmax(0, 1fr); }
  .lib-grid { grid-template-columns: minmax(0, 1fr); }
  .home-join-row .btn { padding: 0 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .app-role, .home-action { transition: none; }
}
#appRoleTitle:focus { outline: none; }

/* Library in "Host a game" mode (library.html?host=1) */
.lib-host-banner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: -8px 0 20px; padding: 12px 16px;
  border: 2px solid var(--edge); border-radius: 12px; background: color-mix(in srgb, #67a7ff 22%, var(--bg-raised)); color: var(--text);
}
.lib-host-banner > span:nth-child(2) { flex: 1 1 280px; }
.lib-host-banner a { color: var(--surface-link, var(--blue)); font-weight: 700; white-space: nowrap; }
.lib-host-icon { display: grid; place-items: center; width: 36px; height: 36px; border: 2px solid var(--edge); border-radius: 8px; background: #67a7ff; color: var(--edge); }
.lib-host-icon .icon { width: 20px; height: 20px; }

/* The one Create button, top of the sidebar on every app page (Kahoot / Wayground pattern) */
.app-create { width: 100%; justify-content: center; min-height: 46px; }

/* Student Home: progress summary (same numbers as Reports → Your stats) */
.home-progress {
  display: grid; grid-template-columns: auto minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; align-items: stretch;
  padding: 18px; border: 2px solid var(--edge); border-radius: 16px; background: var(--bg-raised); color: var(--surface-ink);
}
.home-progress-score {
  display: flex; flex-direction: column; justify-content: center; gap: 4px; min-width: 150px; padding: 14px 18px;
  border: 2px solid var(--edge); border-radius: 12px; background: var(--yellow); color: var(--edge);
}
.home-progress-score .eyebrow { color: var(--edge); }
.home-progress-big strong { font-family: "Arial Black", Inter, system-ui, sans-serif; font-size: 2.4rem; line-height: 1; }
.home-progress-big span { margin-left: 4px; font-weight: 800; }
.home-progress-tier { font-weight: 800; font-size: .9rem; }
.home-progress-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: center; }
.home-progress-stats dd small { font-size: .9rem; color: var(--surface-ink-soft, var(--text-soft)); }
.home-progress-stats dt { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
.home-trend { font-size: .75rem; font-weight: 800; }
.home-trend.up { color: var(--right); }
.home-trend.down { color: var(--wrong); }
.home-next h3 { margin: 0 0 8px; font-size: .95rem; color: var(--surface-ink); }
.home-next ul { list-style: none; margin: 0; padding: 0; }
.home-next li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); }
.home-next li span { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.home-next li strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-next li small { color: var(--surface-ink-soft, var(--text-soft)); font-size: .8rem; }
.home-progress-note { margin: 8px 0 0; font-size: .85rem; color: var(--text-soft); }
@media (max-width: 1180px) { .home-progress { grid-template-columns: auto minmax(0, 1fr); } .home-next { grid-column: 1 / -1; } }
@media (max-width: 620px) { .home-progress { grid-template-columns: minmax(0, 1fr); } .home-progress-score { min-width: 0; } }
.home-progress.no-next { grid-template-columns: auto minmax(0, 1fr); }
.home-progress.no-next .home-progress-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .home-progress.no-next .home-progress-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .home-progress.no-next { grid-template-columns: minmax(0, 1fr); } }
