/* Product shell — exam / learning app */
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
}
.app-sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: var(--space-6) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  position: sticky;
  top: 0;
  height: 100vh;
}
.app-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding-inline: var(--space-2);
}
.app-brand-mark {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-on);
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
}
.app-brand-text strong {
  display: block;
  font-size: 15px;
  font-weight: 600;
}
.app-brand-text span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.app-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.app-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  transition: background var(--motion-fast) var(--ease-standard), color var(--motion-fast) var(--ease-standard);
}
.app-nav a:hover { background: var(--fg-soft); color: var(--fg); }
.app-nav a.is-active {
  background: var(--accent-soft);
  color: var(--accent);
}
.app-nav a svg { width: 18px; height: 18px; flex-shrink: 0; }
.app-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border-top: 1px solid var(--border);
  margin-top: auto;
}
.app-avatar {
  width: 36px; height: 36px;
  border-radius: var(--radius-pill);
  background: var(--fg-soft);
  border: 1px solid var(--border);
  display: grid; place-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.app-user-meta { min-width: 0; }
.app-user-meta strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-user-meta span {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.app-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 5;
}
.app-topbar h1 {
  font-size: var(--text-xl);
  font-weight: 600;
}
.app-topbar-actions { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.app-content {
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  max-width: 1280px;
  width: 100%;
  margin-inline: auto;
}

.menu-toggle {
  display: none;
  width: 40px; height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
}
.menu-toggle svg { width: 18px; height: 18px; }

.panel-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.panel-title h2 { font-size: var(--text-lg); }
.panel-title .meta { white-space: nowrap; }

.heatmap {
  display: grid;
  grid-template-columns: repeat(14, 1fr);
  gap: 4px;
}
.heat-cell {
  aspect-ratio: 1;
  border-radius: 3px;
  background: var(--fg-soft);
  border: 1px solid transparent;
}
.heat-cell[data-level="1"] { background: color-mix(in oklab, var(--accent) 22%, var(--surface)); }
.heat-cell[data-level="2"] { background: color-mix(in oklab, var(--accent) 42%, var(--surface)); }
.heat-cell[data-level="3"] { background: color-mix(in oklab, var(--accent) 68%, var(--surface)); }
.heat-cell[data-level="4"] { background: var(--accent); }
.heat-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: var(--space-3);
  color: var(--muted);
  font-size: 12px;
}
.heat-legend .heat-cell { width: 12px; height: 12px; }

.question-stem {
  font-size: var(--text-lg);
  font-weight: 600;
  line-height: 1.45;
  margin-bottom: var(--space-5);
}
.option-list { display: flex; flex-direction: column; gap: var(--space-2); }
.option {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  text-align: left;
  transition: border-color var(--motion-fast) var(--ease-standard), background var(--motion-fast) var(--ease-standard);
}
.option:hover { border-color: color-mix(in oklab, var(--accent), var(--border)); }
.option.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.option.is-correct {
  border-color: var(--success);
  background: color-mix(in oklab, var(--success) 10%, var(--surface));
}
.option.is-wrong {
  border-color: var(--danger);
  background: color-mix(in oklab, var(--danger) 8%, var(--surface));
}
.option-key {
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  display: grid; place-items: center;
  font-family: var(--font-mono);
  font-size: 12px;
  flex-shrink: 0;
  background: var(--bg);
}
.option.is-selected .option-key {
  border-color: var(--accent);
  color: var(--accent);
}

.list-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: 0; }
.list-item h3 { font-size: 15px; margin-bottom: 4px; }
.list-item p { font-size: 13px; color: var(--muted); }

.plan-placeholder {
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  background: color-mix(in oklab, var(--bg), var(--surface));
}
.plan-placeholder h3 { margin-bottom: 6px; }
.plan-placeholder p { color: var(--muted); font-size: 14px; margin-bottom: var(--space-4); }

/* Home enrichment modules */
.home-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: color-mix(in oklab, var(--warn) 10%, var(--surface));
  border: 1px solid color-mix(in oklab, var(--warn) 24%, var(--border));
  font-size: 13px;
  color: var(--fg);
}
.home-banner strong { font-weight: 600; }
.home-banner span { color: var(--muted); }
.home-banner .btn { flex-shrink: 0; }

.notice-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
}
.notice-mini {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--motion-fast) var(--ease-standard), box-shadow var(--motion-fast) var(--ease-standard);
}
.notice-mini:hover,
.notice-mini.is-active {
  border-color: color-mix(in oklab, var(--accent), var(--border));
  box-shadow: var(--elev-raised);
}
.notice-mini .when {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
}
.notice-mini strong { font-size: 14px; }
.notice-mini p { font-size: 12px; color: var(--muted); margin: 0; }
.notice-mini .tag-urgent {
  align-self: flex-start;
  font-size: 11px;
  font-weight: 600;
  color: var(--danger);
  background: color-mix(in oklab, var(--danger) 10%, var(--surface));
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

.match-row-home {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
}
.match-card {
  padding: var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--motion-fast) var(--ease-standard), background var(--motion-fast) var(--ease-standard);
}
.match-card:hover,
.match-card.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.match-card .score {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.03em;
}
.match-card h3 { font-size: 15px; margin: 6px 0 4px; }
.match-card p { font-size: 12px; color: var(--muted); margin: 0; }
.match-reasons {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.match-reasons li {
  font-size: 12px;
  color: var(--fg);
  padding-left: 12px;
  position: relative;
}
.match-reasons li::before {
  content: "";
  position: absolute;
  left: 0; top: 0.5em;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.path-bar {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
.path-step {
  padding: 12px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  min-height: 88px;
  transition: border-color var(--motion-fast) var(--ease-standard), background var(--motion-fast) var(--ease-standard);
}
.path-step:hover,
.path-step.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.path-step .n {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.06em;
}
.path-step strong {
  display: block;
  font-size: 13px;
  margin: 6px 0 4px;
}
.path-step span {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}
.path-note {
  margin-top: var(--space-3);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
}
.path-note strong { color: var(--fg); }

.peer-live {
  position: relative;
  height: 168px;
  border-radius: var(--radius-md);
  background:
    radial-gradient(ellipse 70% 50% at 50% 0%, color-mix(in oklab, var(--accent) 10%, transparent), transparent 60%),
    var(--bg);
  border: 1px solid var(--border);
  overflow: hidden;
  isolation: isolate;
}
.peer-live::before,
.peer-live::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  width: 28px;
  z-index: 2;
  pointer-events: none;
}
.peer-live::before {
  left: 0;
  background: linear-gradient(90deg, var(--bg), transparent);
}
.peer-live::after {
  right: 0;
  background: linear-gradient(270deg, var(--bg), transparent);
}
.peer-danmaku-lane {
  position: absolute;
  left: 0;
  display: flex;
  gap: 12px;
  width: max-content;
  animation: peer-danmaku-scroll linear infinite;
  will-change: transform;
}
.peer-danmaku-lane:nth-child(1) { top: 12px;  animation-duration: 22s; }
.peer-danmaku-lane:nth-child(2) { top: 64px;  animation-duration: 28s; animation-direction: reverse; }
.peer-danmaku-lane:nth-child(3) { top: 116px; animation-duration: 24s; }
.peer-live:hover .peer-danmaku-lane { animation-play-state: paused; }
@keyframes peer-danmaku-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
.peer-live-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 6px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px color-mix(in oklab, var(--fg) 5%, transparent);
  white-space: nowrap;
  flex-shrink: 0;
  font-size: 12px;
}
.peer-live-av {
  width: 28px; height: 28px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.peer-live-av.tone-2 {
  background: color-mix(in oklab, var(--success) 16%, transparent);
  color: var(--success);
}
.peer-live-av.tone-3 {
  background: color-mix(in oklab, var(--warn) 18%, transparent);
  color: color-mix(in oklab, var(--warn) 70%, black);
}
.peer-live-item p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.25; }
.peer-live-item strong { font-size: 12px; color: var(--fg); display: block; line-height: 1.2; }

@media (max-width: 920px) {
  .notice-strip,
  .match-row-home,
  .path-bar { grid-template-columns: 1fr; }
}
@media (min-width: 641px) and (max-width: 920px) {
  .notice-strip,
  .match-row-home { grid-template-columns: 1fr 1fr; }
  .path-bar { grid-template-columns: 1fr 1fr; }
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
.filter-chip {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 13px;
  color: var(--muted);
  background: var(--surface);
}
.filter-chip.is-active {
  border-color: var(--fg);
  color: var(--fg);
  background: var(--bg);
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--fg);
  color: var(--surface);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  box-shadow: var(--elev-raised);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity var(--motion-base) var(--ease-standard), transform var(--motion-base) var(--ease-standard);
  z-index: 50;
}
.toast.is-show { opacity: 1; transform: translateY(0); }

.overlay {
  position: fixed; inset: 0;
  background: color-mix(in oklab, var(--fg), transparent 55%);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  z-index: 40;
}
.overlay.is-open { display: flex; }
.modal {
  width: min(480px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  box-shadow: var(--elev-raised);
}
.modal h2 { font-size: var(--text-xl); margin-bottom: var(--space-2); }
.modal p { color: var(--muted); font-size: 14px; margin-bottom: var(--space-5); }
.modal-actions { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-5); }

@media (max-width: 920px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(280px, 86vw);
    transform: translateX(-105%);
    transition: transform var(--motion-base) var(--ease-standard);
    z-index: 30;
    height: 100%;
  }
  .app-sidebar.is-open { transform: translateX(0); }
  .menu-toggle { display: inline-flex; }
  .app-content { padding: var(--space-4); }
  .app-topbar { padding: var(--space-3) var(--space-4); }
  .heatmap { grid-template-columns: repeat(10, 1fr); }
  .sidebar-backdrop {
    position: fixed; inset: 0;
    background: color-mix(in oklab, var(--fg), transparent 60%);
    z-index: 25;
    display: none;
  }
  .sidebar-backdrop.is-open { display: block; }
}

@media (min-width: 921px) and (max-width: 1180px) {
  .app-content .home-grid { grid-template-columns: 1fr !important; }
}
