:root {
      color-scheme: light;
      --ink: #14243c;
      --muted: #4c5d70;
      --soft: #687789;
      --navy: #11213b;
      --blue: #254ebe;
      --blue-dark: #183b9d;
      --cyan: #82e3eb;
      --paper: #f4f7fb;
      --white: #ffffff;
      --line: #dce3eb;
      --line-strong: #cbd5e0;
      --focus: #a34a00;
      --danger: #a52b36;
      --radius: 19px;
      font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
      font-size: 16px;
    }
    *, *::before, *::after { box-sizing: border-box; }
    html { scroll-behavior: smooth; }
    body { margin: 0; background: var(--paper); color: var(--ink); line-height: 1.55; }
    button, input, select, textarea { font: inherit; }
    button { cursor: pointer; }
    a { color: var(--blue-dark); }
    :focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; box-shadow: 0 0 0 6px #fff; }
    .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
    .skip { position: fixed; top: .6rem; left: .6rem; z-index: 100; transform: translateY(-180%); background: #fff; color: var(--ink); padding: .7rem 1rem; border-radius: .6rem; font-weight: 700; }
    .skip:focus { transform: none; }
    .topbar { background: var(--navy); color: #fff; }
    .topbar-inner { max-width: 1420px; min-height: 78px; margin: auto; padding: .75rem clamp(1rem, 3vw, 2.5rem); display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
    .brand { display: flex; align-items: center; gap: .8rem; min-width: 0; }
    .brand-mark { width: 42px; height: 42px; border: 1px solid #aac0dd; border-radius: 12px; display: grid; place-items: center; font-weight: 800; letter-spacing: -.08em; color: var(--cyan); flex: none; }
    .brand-name { font-size: 1rem; font-weight: 760; letter-spacing: -.015em; line-height: 1.22; }
    .brand-sub { font-size: .79rem; color: #bac9db; line-height: 1.3; }
    .edit-trigger { background: #fff; color: var(--navy); border: 1px solid #fff; border-radius: .7rem; min-height: 44px; padding: .55rem .9rem; font-size: .9rem; font-weight: 730; white-space: nowrap; }
    .edit-trigger:hover { background: #e8f2ff; }
    .page { max-width: 1420px; margin: 0 auto; padding: clamp(1rem, 3vw, 2.5rem); display: grid; grid-template-columns: 235px minmax(0,1fr); gap: clamp(1.2rem, 2.6vw, 2.5rem); align-items: start; }
    .rail { padding-top: .2rem; }
    .rail-label { color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .13em; font-weight: 800; margin: .2rem .75rem 1rem; }
    .class-nav { display: grid; gap: .35rem; }
    .class-button { width: 100%; min-height: 58px; background: transparent; color: var(--ink); border: 1px solid transparent; border-radius: 13px; display: flex; align-items: center; justify-content: space-between; gap: .7rem; text-align: left; padding: .7rem .85rem; }
    .class-button:hover { background: #e7edf5; }
    .class-button[aria-current="page"] { background: #fff; border-color: var(--line); box-shadow: 0 3px 12px rgba(17,33,59,.06); }
    .class-button strong { font-size: 1.08rem; letter-spacing: -.015em; }
    .class-button small { color: var(--muted); font-size: .77rem; white-space: nowrap; }
    .class-button[aria-current="page"]::before { content: ""; width: 4px; height: 26px; background: var(--blue); border-radius: 4px; margin-left: -.4rem; }
    .rail-note { margin: 1.6rem .75rem 0; border-top: 1px solid var(--line-strong); padding-top: 1.1rem; color: var(--muted); font-size: .85rem; }
    .main { min-width: 0; }
    .hero { position: relative; overflow: hidden; background: var(--navy); color: #fff; border-radius: 23px; padding: clamp(1.4rem, 3vw, 2.3rem); min-height: 194px; }
    .hero::after { content: ""; position: absolute; width: 370px; height: 370px; right: -100px; top: -225px; border: 64px solid rgba(130,227,235,.12); border-radius: 50%; pointer-events: none; }
    .eyebrow { margin: 0 0 .75rem; text-transform: uppercase; color: var(--cyan); letter-spacing: .16em; font-size: .76rem; font-weight: 850; }
    h1, h2, h3, p { margin-top: 0; }
    .hero h1 { max-width: 700px; margin: 0; font-size: clamp(1.75rem, 3.2vw, 2.75rem); line-height: 1.15; letter-spacing: -.045em; }
    .hero-bottom { display: flex; gap: 1rem 1.6rem; flex-wrap: wrap; margin-top: 1.55rem; color: #deebf7; font-size: .91rem; }
    .hero-bottom strong { color: #fff; font-size: 1rem; }
    .section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin: 2rem 0 .9rem; }
    .section-heading h2 { font-size: 1.22rem; letter-spacing: -.025em; margin: 0; }
    .section-heading span { color: var(--muted); font-size: .86rem; }
    .subject-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: .75rem; }
    .subject-card { position: relative; background: #fff; border: 1px solid var(--line); color: var(--ink); border-radius: var(--radius); text-align: left; padding: 1.1rem 1.2rem; min-height: 158px; display: flex; flex-direction: column; align-items: flex-start; box-shadow: 0 1px 2px rgba(17,33,59,.025); }
    .subject-card:hover { border-color: #879ed2; transform: translateY(-1px); }
    .subject-card[aria-current="page"] { border: 2px solid var(--blue); padding: calc(1.1rem - 1px) calc(1.2rem - 1px); box-shadow: 0 5px 17px rgba(37,78,190,.09); }
    .subject-number { color: var(--blue); font-size: .79rem; letter-spacing: .08em; font-weight: 850; }
    .subject-title { display: block; margin: .75rem 0 .8rem; font-size: 1rem; font-weight: 780; line-height: 1.32; letter-spacing: -.02em; overflow-wrap: anywhere; }
    .subject-count { margin-top: auto; color: var(--muted); font-size: .82rem; }
    .subject-arrow { position: absolute; right: 1.1rem; top: 1.04rem; font-size: 1.15rem; line-height: 1; color: var(--blue); }
    .workspace { margin-top: 1.9rem; }
    .workspace-head { display: flex; justify-content: space-between; align-items: end; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
    .workspace-head .overline { color: var(--blue-dark); font-size: .77rem; letter-spacing: .12em; font-weight: 840; text-transform: uppercase; margin: 0 0 .35rem; }
    .workspace-head h2 { font-size: clamp(1.3rem, 2.1vw, 1.8rem); letter-spacing: -.035em; margin: 0; line-height: 1.24; }
    .search-wrap { display: flex; align-items: center; gap: .6rem; border: 1px solid var(--line-strong); background: #fff; border-radius: .75rem; padding: 0 .85rem; min-height: 46px; width: min(100%, 300px); }
    .search-wrap:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
    .search-wrap svg { flex: none; color: var(--muted); }
    .search-wrap input { min-width: 0; width: 100%; border: 0; outline: none; background: transparent; color: var(--ink); font-size: .9rem; }
    .search-wrap input::placeholder { color: #58687b; opacity: 1; }
    .results-status { min-height: 1.25rem; color: var(--muted); font-size: .85rem; margin: 0 0 .55rem; }
    .columns { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 1rem; }
    .panel { min-width: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
    .panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1.1rem 1.2rem; border-bottom: 1px solid var(--line); }
    .panel-heading h3 { font-size: 1.05rem; margin: 0; letter-spacing: -.02em; }
    .count-pill { color: var(--blue-dark); background: #eaf0ff; border-radius: 99px; padding: .15rem .6rem; font-weight: 800; font-size: .8rem; }
    .entry-list { padding: .25rem 1.15rem; }
    .entry { padding: 1.12rem .1rem 1.2rem; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
    .entry:last-child { border-bottom: 0; }
    .entry-title { font-weight: 780; font-size: 1rem; line-height: 1.35; margin: 0 0 .45rem; }
    .entry-description { color: var(--muted); font-size: .9rem; white-space: pre-line; margin: 0 0 .65rem; }
    .entry-meta { display: flex; gap: .4rem; flex-wrap: wrap; margin: 0 0 .7rem; }
    .due { display: inline-flex; border-radius: .45rem; background: #eaf0ff; color: #173779; padding: .18rem .5rem; font-size: .8rem; font-weight: 760; }
    .due.overdue { background: #ffebed; color: #932531; }
    .due.today { background: #fff1db; color: #744000; }
    .entry-link { font-size: .89rem; font-weight: 750; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
    .empty { padding: 1.35rem 1.15rem 1.6rem; }
    .empty strong { display: block; margin-bottom: .35rem; font-size: .94rem; }
    .empty p { color: var(--muted); font-size: .87rem; margin: 0; }
    .empty-mark { width: 37px; height: 37px; display: grid; place-items: center; border-radius: 10px; background: #edf3ff; color: var(--blue-dark); font-size: 1.2rem; margin-bottom: .9rem; }
    .footer { max-width: 1420px; margin: .7rem auto 0; padding: 1.4rem clamp(1rem, 3vw, 2.5rem) 2rem; color: var(--muted); border-top: 1px solid var(--line); display: flex; justify-content: space-between; flex-wrap: wrap; gap: .3rem 1rem; font-size: .82rem; }
    .footer p { margin: 0; }
    dialog { border: 0; border-radius: 20px; width: min(95vw, 670px); max-height: min(90vh, 950px); padding: 0; color: var(--ink); background: var(--white); box-shadow: 0 24px 90px rgba(11,26,47,.25); }
    dialog::backdrop { background: rgba(8,22,41,.66); }
    .dialog-inner { padding: clamp(1.2rem, 3vw, 2rem); }
    .dialog-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
    .dialog-top h2 { margin: 0 0 .35rem; font-size: 1.55rem; letter-spacing: -.035em; }
    .dialog-close { min-width: 44px; min-height: 44px; border: 1px solid var(--line-strong); background: #fff; border-radius: .7rem; color: var(--ink); font-size: 1.4rem; line-height: 1; }
    .dialog-close:hover { background: var(--paper); }
    .editor-intro { color: var(--muted); font-size: .89rem; margin: .35rem 0 1.2rem; }
    .editor-info { background: #edf3ff; border-left: 4px solid var(--blue); padding: .8rem .9rem; border-radius: 0 .55rem .55rem 0; color: #19345b; font-size: .86rem; margin-bottom: 1.35rem; }
    .editor-form { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .85rem; }
    .field { min-width: 0; display: flex; flex-direction: column; gap: .3rem; }
    .field.full { grid-column: 1 / -1; }
    .field label { font-size: .9rem; font-weight: 780; }
    .field input, .field textarea, .field select { width: 100%; min-height: 44px; border: 1px solid #acb9c8; background: #fff; border-radius: .6rem; color: var(--ink); padding: .58rem .7rem; }
    .field textarea { resize: vertical; min-height: 82px; }
    .field small { color: var(--muted); font-size: .77rem; }
    .actions { display: flex; gap: .6rem; flex-wrap: wrap; grid-column: 1/-1; margin-top: .25rem; }
    .button { min-height: 44px; border-radius: .65rem; border: 1px solid var(--line-strong); padding: .58rem .9rem; background: #fff; color: var(--ink); font-size: .88rem; font-weight: 760; }
    .button:hover { background: #edf3ff; }
    .button.primary { color: #fff; background: var(--blue); border-color: var(--blue); }
    .button.primary:hover { background: var(--blue-dark); }
    .button.danger { color: var(--danger); }
    .editor-bottom { margin-top: 1.4rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
    .editor-bottom h3 { font-size: 1.03rem; margin: 0 0 .6rem; }
    .editor-entries { list-style: none; padding: 0; margin: 0 0 1rem; max-height: 190px; overflow: auto; }
    .editor-entries li { display: flex; justify-content: space-between; gap: .6rem; align-items: center; padding: .58rem 0; border-bottom: 1px solid var(--line); }
    .editor-entries li:last-child { border: 0; }
    .editor-entries .item-name { font-size: .86rem; font-weight: 680; overflow-wrap: anywhere; }
    .editor-entries .item-type { display: block; color: var(--muted); font-size: .76rem; font-weight: 450; }
    .editor-entries .item-buttons { flex: none; display: flex; gap: .3rem; }
    .editor-entries button { min-height: 40px; border: 1px solid var(--line-strong); background: #fff; border-radius: .5rem; color: var(--blue-dark); padding: .35rem .5rem; font-size: .79rem; font-weight: 730; }
    .editor-entries button.delete { color: var(--danger); }
    .editor-empty { color: var(--muted); font-size: .85rem; margin: .4rem 0 1rem; }
    .export-row { display: flex; align-items: center; flex-wrap: wrap; gap: .7rem 1rem; background: var(--paper); border: 1px solid var(--line); padding: .9rem; border-radius: .8rem; }
    .export-row p { margin: 0; color: var(--muted); font-size: .81rem; flex: 1 1 200px; }
    .toast { position: fixed; z-index: 50; right: 1rem; bottom: 1rem; max-width: min(420px, calc(100% - 2rem)); background: var(--navy); color: #fff; padding: .8rem 1rem; border-radius: .75rem; box-shadow: 0 10px 28px rgba(17,33,59,.24); font-size: .87rem; }
    .toast[hidden], [hidden] { display: none !important; }
    @media (max-width: 1050px) { .subject-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } .page { grid-template-columns: 190px minmax(0,1fr); } }
    @media (max-width: 780px) { .page { display: block; } .rail { padding: 0; margin-bottom: 1.1rem; } .rail-label { margin: .1rem 0 .55rem; } .class-nav { display: flex; overflow-x: auto; padding-bottom: .2rem; gap: .55rem; } .class-button { width: auto; min-width: 96px; min-height: 46px; padding: .55rem .75rem; gap: .5rem; flex: none; justify-content: center; } .class-button[aria-current="page"]::before, .class-button small, .rail-note { display: none; } .hero { min-height: auto; } }
    @media (max-width: 590px) { .brand-sub { display: none; } .topbar-inner { min-height: 68px; } .edit-trigger { padding: .5rem .62rem; font-size: .8rem; } .brand-name { font-size: .9rem; } .brand-mark { width: 36px; height: 36px; } .hero { border-radius: 17px; } .subject-grid, .columns { grid-template-columns: minmax(0,1fr); } .subject-card { min-height: 119px; } .workspace-head { align-items: stretch; gap: .85rem; } .search-wrap { width: 100%; } .editor-form { grid-template-columns: minmax(0,1fr); } .field { grid-column: 1 / -1; } .dialog-inner { padding: 1.1rem; } .footer { margin-top: 1.2rem; } }
    @media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .subject-card { transform: none !important; } }
    .class-button, .subject-card, a.edit-trigger, a.button { text-decoration: none; }
    .search-wrap { width: min(100%, 410px); }
    .search-button { border: 0; border-radius: .5rem; padding: .38rem .55rem; background: var(--blue); color: #fff; font-size: .82rem; font-weight: 750; }
    .search-button:hover { background: var(--blue-dark); }
    .entry-link { display: block; margin-top: .55rem; }
    .entry-link.entry-link-game { display: inline-flex; align-items: center; gap: .45rem; min-height: 44px; padding: .55rem .9rem; border-radius: .65rem; background: var(--blue-dark); color: #fff; text-decoration: none; }
    .entry-link.entry-link-game:hover { background: var(--navy); }
    .results-status { margin: .1rem 0 .8rem; }

    .admin-main { max-width: 1420px; margin: 0 auto; padding: clamp(1.2rem, 3vw, 2.5rem); }
    .admin-main h1 { font-size: clamp(1.75rem, 3vw, 2.35rem); line-height: 1.2; letter-spacing: -.04em; margin: 0 0 .55rem; }
    .admin-main h2 { font-size: 1.2rem; letter-spacing: -.025em; margin: 0 0 1.1rem; }
    .admin-main .overline { color: var(--blue-dark); font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; font-weight: 800; margin-bottom: .3rem; }
    .admin-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(1.1rem, 2vw, 1.7rem); min-width: 0; }
    .login-card { max-width: 470px; margin: clamp(1rem, 6vh, 4rem) auto; }
    .login-card p { color: var(--muted); }
    .login-card .field { margin: 1rem 0; }
    .admin-head { display: flex; gap: 1rem; justify-content: space-between; align-items: start; flex-wrap: wrap; margin-bottom: 1.4rem; }
    .admin-head p:not(.overline) { color: var(--muted); margin: 0; }
    .admin-layout { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); align-items: start; gap: 1rem; }
    .admin-form { display: grid; gap: .9rem; }
    .admin-form .field input, .admin-form .field textarea, .admin-form .field select { max-width: 100%; }
    .admin-form .field input[type=file] { padding: .6rem; }
    .admin-form .field input[type=file]::file-selector-button { margin-right: .7rem; padding: .38rem .6rem; border: 1px solid var(--line-strong); border-radius: .45rem; background: var(--paper); color: var(--ink); font: inherit; font-size: .82rem; }
    .admin-form .actions { margin-top: .3rem; align-items: center; }
    .form-alert, .form-success { padding: .78rem .95rem; border-radius: .7rem; margin: 0 0 1rem; font-weight: 680; }
    .form-alert { background: #ffebed; color: #7f1d27; border: 1px solid #f0a8af; }
    .form-success { background: #e8f7ee; color: #15512f; border: 1px solid #99d7ad; }
    .attached { margin: .1rem 0 0; font-size: .86rem; overflow-wrap: anywhere; }
    .check-row { display: flex; align-items: start; gap: .6rem; font-size: .86rem; }
    .check-row input { width: 19px; height: 19px; flex: none; }
    .admin-list { list-style: none; margin: 0; padding: 0; }
    .admin-item { padding: .9rem 0; display: flex; justify-content: space-between; align-items: center; gap: .8rem; border-bottom: 1px solid var(--line); }
    .admin-item:last-child { border-bottom: 0; }
    .admin-item strong { display: block; overflow-wrap: anywhere; line-height: 1.35; }
    .admin-item span:not(.sr-only) { display: block; color: var(--muted); font-size: .82rem; margin-top: .25rem; overflow-wrap: anywhere; }
    .item-actions { display: flex; gap: .4rem; flex: none; }
    .item-actions .button { font-size: .82rem; padding: .4rem .55rem; min-height: 40px; display: inline-flex; align-items: center; }
    .delete-confirm summary { list-style: none; cursor: pointer; }
    .delete-confirm summary::-webkit-details-marker { display: none; }
    .delete-confirm form { margin-top: .5rem; padding: .65rem; background: #fff4f4; border: 1px solid #e8adb3; border-radius: .6rem; max-width: 220px; }
    .delete-confirm form p { font-size: .82rem; margin: 0 0 .5rem; }
    @media (max-width: 880px) { .admin-layout { grid-template-columns: 1fr; } }
    @media (max-width: 590px) { .topbar-inner { flex-wrap: wrap; } .admin-item { align-items: start; flex-direction: column; } .item-actions { width: 100%; } }
