:root {
  color-scheme: light;
  --ink: #14213d;
  --muted: #5e6677;
  --paper: #f6f7f2;
  --white: #ffffff;
  --blue: #174ea6;
  --coral: #e84a3a;
  --green: #16855b;
  --yellow: #f1bd2b;
  --line: #d9dde5;
  --shadow: 0 10px 24px rgba(20, 33, 61, .12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: Inter, "Segoe UI", system-ui, sans-serif; }
button, input, select { font: inherit; letter-spacing: 0; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }
.skip-link { position: fixed; z-index: 20; left: 1rem; top: -5rem; padding: .7rem 1rem; background: var(--ink); color: white; }
.skip-link:focus { top: 1rem; }

.topbar { min-height: 72px; padding: 0 clamp(16px, 4vw, 56px); display: flex; align-items: center; justify-content: space-between; gap: 24px; background: white; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.brand { display: inline-flex; gap: 10px; align-items: center; color: var(--ink); text-decoration: none; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; background: var(--coral); color: white; border-radius: 8px; font-weight: 900; font-size: 1.3rem; }
.brand strong { display: block; font-size: 1.12rem; }
.brand small { display: block; color: var(--blue); font-weight: 800; }
.topbar nav { display: flex; gap: 6px; }
.level-nav, .search-jump { min-width: 44px; min-height: 44px; border: 0; background: transparent; border-radius: 8px; color: var(--ink); font-weight: 850; }
.level-nav:hover, .level-nav.active, .search-jump:hover { background: #e9eff9; color: var(--blue); }
.search-jump { font-size: 1.7rem; }

.hero { position: relative; min-height: min(62vh, 570px); display: flex; align-items: center; background-image: url("assets/hero-edubox.png"); background-position: center; background-size: cover; color: white; padding: clamp(36px, 7vw, 92px) clamp(18px, 6vw, 88px); }
.hero::before { content: ""; position: absolute; inset: 0; background: rgba(13, 29, 62, .62); }
.hero-copy { position: relative; z-index: 1; max-width: 660px; }
.eyebrow { margin: 0 0 10px; font-size: .78rem; font-weight: 900; text-transform: uppercase; letter-spacing: .09em; color: #ffe073; }
.eyebrow.dark { color: var(--blue); }
.hero h1 { margin: 0; font-size: clamp(3rem, 8vw, 6.6rem); line-height: .95; letter-spacing: 0; text-wrap: balance; }
.instruction { max-width: 640px; margin: 22px 0 28px; font-size: clamp(1.05rem, 2vw, 1.35rem); line-height: 1.55; font-weight: 650; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.hero-actions button { border: 2px solid white; min-height: 46px; padding: 0 16px; border-radius: 8px; background: white; color: var(--ink); font-weight: 850; }
.hero-actions button:nth-child(2) { background: var(--green); color: white; }
.hero-actions button:nth-child(3) { background: var(--coral); color: white; }

.explorer { max-width: 1320px; margin: 0 auto; padding: 48px clamp(16px, 4vw, 56px) 76px; }
.section-heading { display: flex; justify-content: space-between; gap: 24px; align-items: end; }
.section-heading h2 { margin: 0; font-size: clamp(1.7rem, 4vw, 2.7rem); line-height: 1.1; }
.section-heading > p { color: var(--muted); font-weight: 750; }
.tool-row { margin: 26px 0 22px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.search-field { flex: 1; max-width: 600px; min-height: 50px; display: flex; align-items: center; gap: 10px; padding: 0 16px; background: white; border: 1px solid var(--line); border-radius: 8px; }
.search-field span { font-size: 1.5rem; }
.search-field input { border: 0; outline: 0; width: 100%; min-width: 0; background: transparent; }
.filters { display: flex; gap: 8px; align-items: center; }
select { min-height: 50px; border: 1px solid var(--line); border-radius: 8px; background: white; padding: 0 34px 0 12px; color: var(--ink); }
.view-switch { display: flex; border: 1px solid var(--line); background: white; border-radius: 8px; padding: 3px; }
.view-switch button { width: 42px; height: 42px; border: 0; border-radius: 5px; background: transparent; font-size: 1.35rem; }
.view-switch button.active { background: var(--ink); color: white; }

.collection-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.collection-card { grid-column: span 4; min-height: 292px; display: flex; flex-direction: column; background: white; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; box-shadow: var(--shadow); }
.collection-card:nth-child(1), .collection-card:nth-child(2), .collection-card:nth-child(3) { grid-column: span 4; }
.collection-card .visual { min-height: 118px; display: flex; align-items: center; justify-content: space-between; padding: 18px; color: white; background: var(--card-color); }
.visual-icon { width: 72px; height: 72px; display: grid; place-items: center; border: 2px solid rgba(255,255,255,.8); border-radius: 50%; background: rgba(255,255,255,.18); font-size: 2.1rem; }
.visual-levels { align-self: flex-start; display: flex; gap: 5px; flex-wrap: wrap; }
.visual-levels span { padding: 5px 8px; border-radius: 6px; background: white; color: var(--ink); font-weight: 850; font-size: .76rem; }
.card-copy { flex: 1; padding: 18px; display: flex; flex-direction: column; }
.card-copy h3 { margin: 0 0 7px; font-size: 1.23rem; }
.card-copy p { margin: 0; color: var(--muted); line-height: 1.5; }
.card-foot { margin-top: auto; padding-top: 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-foot span { color: var(--muted); font-size: .88rem; font-weight: 700; }
.card-foot button { min-height: 42px; border: 0; border-radius: 8px; padding: 0 13px; background: var(--ink); color: white; font-weight: 800; }
.collection-grid.list { display: block; }
.collection-grid.list .collection-card { min-height: 0; margin-bottom: 10px; display: grid; grid-template-columns: 170px 1fr; }
.collection-grid.list .visual { min-height: 164px; }
.empty { padding: 54px 20px; text-align: center; color: var(--muted); background: white; border: 1px dashed var(--line); }

dialog { width: min(1000px, calc(100vw - 28px)); max-height: calc(100vh - 28px); padding: 0; border: 0; border-radius: 8px; color: var(--ink); background: white; box-shadow: 0 24px 70px rgba(0,0,0,.28); }
dialog::backdrop { background: rgba(20,33,61,.68); }
.dialog-shell { min-height: 440px; }
.dialog-head { padding: 28px; display: flex; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin: 0; font-size: clamp(1.7rem, 4vw, 2.5rem); }
.dialog-head p:last-child { max-width: 700px; color: var(--muted); line-height: 1.5; }
.icon-button { flex: 0 0 auto; width: 44px; height: 44px; border: 0; border-radius: 8px; background: #eef1f5; color: var(--ink); font-size: 1.7rem; }
.dialog-body { padding: 22px 28px 32px; }
.resource-tabs { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 18px; }
.resource-tabs button { border: 1px solid var(--line); border-radius: 8px; min-height: 40px; padding: 0 12px; background: white; color: var(--ink); font-weight: 750; }
.resource-tabs button.active { background: var(--blue); border-color: var(--blue); color: white; }
.resource-list { display: grid; gap: 9px; }
.resource { display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; }
.resource-symbol { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 8px; background: #eef3fb; font-weight: 900; color: var(--blue); font-size: .76rem; }
.resource h3 { margin: 0 0 4px; font-size: 1rem; }
.resource p { margin: 0; color: var(--muted); font-size: .9rem; }
.resource a, .resource .pending { min-height: 40px; display: inline-flex; align-items: center; padding: 0 13px; border-radius: 8px; text-decoration: none; font-weight: 800; }
.resource a { background: var(--green); color: white; }
.resource .pending { background: #f1f2f4; color: #707681; }
footer { display: flex; justify-content: space-between; gap: 14px; padding: 26px clamp(16px, 4vw, 56px); background: var(--ink); color: white; }

@media (max-width: 950px) {
  .collection-card { grid-column: span 6; }
  .tool-row { align-items: stretch; flex-direction: column; }
  .search-field { max-width: none; }
}
@media (max-width: 680px) {
  .topbar { min-height: 64px; padding: 0 12px; gap: 8px; }
  .brand small { display: none; }
  .hero { min-height: 520px; align-items: end; background-position: 58% center; padding: 34px 18px; }
  .hero h1 { font-size: clamp(2.7rem, 15vw, 4.5rem); }
  .hero-actions button { flex: 1 1 130px; }
  .section-heading { align-items: start; flex-direction: column; gap: 6px; }
  .filters { align-items: stretch; display: grid; grid-template-columns: 1fr 1fr auto; }
  select { width: 100%; }
  .collection-grid { display: block; }
  .collection-card { margin-bottom: 14px; min-height: 0; }
  .collection-grid.list .collection-card { display: block; }
  .collection-grid.list .visual { min-height: 110px; }
  .dialog-head, .dialog-body { padding: 20px 16px; }
  .resource { grid-template-columns: 42px 1fr; }
  .resource > a, .resource > .pending { grid-column: 2; justify-self: start; }
  footer { flex-direction: column; }
}
@media (max-width: 430px) {
  .topbar nav .level-nav { min-width: 38px; padding: 0 8px; }
  .search-jump { display: none; }
  .filters { grid-template-columns: 1fr; }
  .view-switch { width: max-content; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
