:root {
  color-scheme: light dark;
  --bg: #F4F3FA; --surface: #FFFFFF; --surface2: #F9F8FE; --ink: #1F1B3D; --muted: #6B678A; --line: #E4E1F2;
  --primary: #5B3FD9; --primary-d: #4A31BC; --primary-soft: #ECE8FF; --on-primary: #FFFFFF;
  --good: #12946F; --good-soft: #DCF4EC; --bad: #D9453C; --bad-soft: #FDE6E4; --sun: #E8962A; --sun-soft: #FDF0DA;
  --shadow: 0 1px 2px rgba(31,27,61,.06), 0 10px 28px -14px rgba(31,27,61,.22);
  --font: ui-rounded, "SF Pro Rounded", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14122A; --surface: #1E1B3A; --surface2: #25224A; --ink: #F0EEFF; --muted: #A5A1C8; --line: #342F61;
    --primary: #9680FF; --primary-d: #8068F0; --primary-soft: #2C2757; --on-primary: #14122A;
    --good: #3CCBA2; --good-soft: #173B3A; --bad: #FF7F75; --bad-soft: #47232F; --sun: #F5B44E; --sun-soft: #44341F;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.5; -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; min-height: 100dvh; }
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0; letter-spacing: -.015em; }
h1 { font-size: 1.9rem; font-weight: 800; } h2 { font-size: 1.3rem; font-weight: 800; } h3 { font-size: 1.1rem; font-weight: 700; }
p { margin: 0 0 .75em; }
a { color: var(--primary); }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 8px; }
.muted { color: var(--muted); } .small { font-size: .875rem; } .center { text-align: center; }
.hidden { display: none !important; }
svg.ico { width: 1.25em; height: 1.25em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Layout */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.nav { position: sticky; top: 0; height: 100vh; height: 100dvh; padding: 22px 14px; display: flex; flex-direction: column; gap: 4px; border-right: 1px solid var(--line); background: var(--surface); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.25rem; padding: 0 10px 18px; letter-spacing: -.02em; }
.brand img { width: 34px; height: 34px; border-radius: 10px; }
.nav a.link { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; color: var(--muted); text-decoration: none; font-weight: 700; }
.nav a.link:hover { background: var(--surface2); color: var(--ink); }
.nav a.link.active { background: var(--primary-soft); color: var(--primary); }
.nav .spacer { flex: 1; }
.nav .me { padding: 10px 12px; font-size: .875rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
main { padding: 32px clamp(16px, 4vw, 44px) 64px; max-width: 1040px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-weight: 700; margin-bottom: 14px; }
.back:hover { color: var(--ink); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } .row.end { justify-content: flex-end; } .row.between { justify-content: space-between; }
.stack { display: grid; gap: 14px; }

/* Buttons & Felder */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer; padding: 11px 18px; border-radius: 12px; font-weight: 700; background: var(--primary); color: var(--on-primary); text-decoration: none; transition: background .15s, transform .1s; min-height: 44px; }
.btn:hover { background: var(--primary-d); } .btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); } .btn.ghost:hover { background: var(--surface2); }
.btn.soft { background: var(--primary-soft); color: var(--primary); } .btn.soft:hover { filter: brightness(.97); }
.btn.good { background: var(--good); color: #fff; } .btn.bad { background: var(--bad); color: #fff; }
.btn.danger { background: var(--bad); color: #fff; }
.btn.sm { padding: 7px 12px; min-height: 36px; font-size: .9rem; border-radius: 10px; }
.btn.icon { padding: 8px; min-height: 36px; min-width: 36px; border-radius: 10px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.field { display: grid; gap: 6px; } .field > span { font-weight: 700; font-size: .9rem; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], textarea, select {
  width: 100%; padding: 11px 13px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); min-height: 44px;
}
textarea { resize: vertical; min-height: 96px; line-height: 1.5; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.hint { color: var(--muted); font-size: .85rem; }
.error { background: var(--bad-soft); color: var(--bad); padding: 10px 14px; border-radius: 12px; font-weight: 600; }

/* Karten & Kacheln */
.panel { background: var(--surface); border-radius: 20px; padding: 22px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.set-card { display: flex; flex-direction: column; gap: 12px; padding: 0; overflow: hidden; text-decoration: none; color: inherit; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); transition: transform .15s; }
.set-card:hover { transform: translateY(-3px); }
.set-card .band { height: 10px; }
.set-card .body { padding: 4px 20px 20px; display: grid; gap: 4px; }
.set-card h3 { font-size: 1.15rem; }
.set-card .meta { color: var(--muted); font-size: .9rem; }
.set-card .due { display: inline-block; margin-top: 8px; font-weight: 700; font-size: .85rem; padding: 4px 10px; border-radius: 99px; background: var(--sun-soft); color: var(--sun); justify-self: start; }
.set-card .due.done { background: var(--good-soft); color: var(--good); }
.bar { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; margin-top: 10px; } .bar > i { display: block; height: 100%; background: var(--good); border-radius: 99px; }
.new-card { display: grid; place-items: center; gap: 6px; min-height: 150px; border-radius: 20px; border: 2px dashed var(--line); color: var(--muted); cursor: pointer; background: transparent; font-weight: 700; }
.new-card:hover { border-color: var(--primary); color: var(--primary); }
.empty { text-align: center; padding: 44px 20px; color: var(--muted); display: grid; gap: 10px; justify-items: center; }
.empty h3 { color: var(--ink); }

/* Heute-Block */
.today { display: grid; grid-template-columns: auto 1fr auto; gap: 24px; align-items: center; margin-bottom: 28px; }
.ring { position: relative; width: 112px; height: 112px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 11; stroke-linecap: round; } .ring .track { stroke: var(--line); } .ring .val { stroke: var(--primary); transition: stroke-dashoffset .6s; }
.ring .lbl { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; font-weight: 800; font-size: 1.5rem; line-height: 1.1; }
.ring .lbl small { display: block; font-size: .75rem; font-weight: 600; color: var(--muted); }
.chips { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px; font-weight: 700; font-size: .9rem; background: var(--surface2); border: 1px solid var(--line); }
.chip.fire { background: var(--sun-soft); color: var(--sun); border-color: transparent; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1.5px solid var(--line); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.tabs a { display: flex; gap: 8px; align-items: center; padding: 11px 16px; text-decoration: none; color: var(--muted); font-weight: 700; border-bottom: 3px solid transparent; margin-bottom: -1.5px; white-space: nowrap; }
.tabs a.active { color: var(--primary); border-color: var(--primary); }
.banner { display: flex; gap: 14px; align-items: center; padding: 14px 18px; border-radius: 16px; background: var(--primary-soft); color: var(--ink); margin-bottom: 20px; }
.banner .ico { color: var(--primary); width: 1.6em; height: 1.6em; }

/* Listen */
.list { display: grid; gap: 10px; }
.item { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: start; padding: 14px 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.item .q { font-weight: 700; white-space: pre-wrap; } .item .a { color: var(--muted); margin-top: 4px; white-space: pre-wrap; }
.item a.title { font-weight: 700; color: var(--ink); text-decoration: none; } .item a.title:hover { color: var(--primary); }
.boxpill { display: inline-flex; gap: 3px; margin-top: 8px; } .boxpill i { width: 14px; height: 6px; border-radius: 3px; background: var(--line); } .boxpill i.on { background: var(--good); }
.badge { display: inline-block; font-size: .78rem; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: var(--primary-soft); color: var(--primary); }

/* Lernen */
.study { display: grid; gap: 20px; max-width: 700px; margin: 0 auto; }
.study-top { display: flex; align-items: center; gap: 14px; }
.progress { flex: 1; height: 10px; border-radius: 99px; background: var(--line); overflow: hidden; } .progress > i { display: block; height: 100%; width: 0; background: var(--primary); border-radius: 99px; transition: width .3s; }
.ladder { display: flex; justify-content: center; gap: 8px; align-items: center; font-size: .85rem; font-weight: 700; color: var(--muted); }
.ladder span { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface2); border: 1.5px solid var(--line); transition: all .25s; }
.ladder span.on { background: var(--primary); border-color: var(--primary); color: var(--on-primary); transform: translateY(-4px); }
.fc-wrap { touch-action: pan-y; user-select: none; -webkit-user-select: none; transition: transform .25s ease, opacity .25s; }
.fc-wrap.dragging { transition: none; }
.fc { perspective: 1400px; width: 100%; height: min(54vh, 380px); min-height: 260px; cursor: pointer; }
.fc-inner { position: relative; width: 100%; height: 100%; transition: transform .55s cubic-bezier(.3,.7,.2,1); transform-style: preserve-3d; }
.fc.flipped .fc-inner { transform: rotateY(180deg); }
.fc-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; display: grid; place-items: center; padding: 28px; text-align: center; border-radius: 26px; background: var(--surface); border: 1.5px solid var(--line); box-shadow: var(--shadow); overflow: auto; }
.fc-face .txt { font-size: clamp(1.15rem, 3.4vw, 1.6rem); font-weight: 700; white-space: pre-wrap; word-break: break-word; max-height: 100%; }
.fc-face .tag { position: absolute; top: 14px; left: 18px; font-size: .78rem; font-weight: 700; color: var(--muted); }
.fc-back { transform: rotateY(180deg); background: var(--primary-soft); border-color: transparent; }
.answer-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.answer-row .btn { min-height: 56px; font-size: 1.05rem; }
.kbd { font-size: .75rem; opacity: .75; border: 1px solid currentColor; border-radius: 6px; padding: 0 6px; }
.result-ring { width: 150px; height: 150px; margin: 0 auto 6px; }
.big { font-size: 2.4rem; font-weight: 800; letter-spacing: -.03em; }

/* Quiz */
.opt { display: flex; gap: 12px; align-items: flex-start; text-align: left; width: 100%; padding: 14px 16px; border-radius: 14px; background: var(--surface); border: 1.5px solid var(--line); cursor: pointer; font-weight: 600; }
.opt:hover:not([disabled]) { border-color: var(--primary); }
.opt .l { width: 28px; height: 28px; border-radius: 8px; background: var(--surface2); display: grid; place-items: center; font-size: .85rem; flex: none; }
.opt.right { background: var(--good-soft); border-color: var(--good); } .opt.wrong { background: var(--bad-soft); border-color: var(--bad); }
.explain { padding: 14px 16px; border-radius: 14px; background: var(--surface2); border: 1px solid var(--line); }

/* Text (Markdown) */
.md { line-height: 1.65; } .md h2, .md h3, .md h4, .md h5 { margin: 1.2em 0 .4em; } .md ul, .md ol { padding-left: 1.3em; margin: 0 0 .9em; } .md li { margin: .2em 0; }
.md code { background: var(--surface2); padding: 1px 6px; border-radius: 6px; font-size: .92em; } .md blockquote { margin: 0 0 .9em; padding: 4px 14px; border-left: 4px solid var(--primary-soft); color: var(--muted); } .md hr { border: 0; border-top: 1px solid var(--line); margin: 1.2em 0; }
.md > :first-child { margin-top: 0; } .md > :last-child { margin-bottom: 0; }

/* Tutor */
.chat { display: grid; gap: 12px; margin-bottom: 14px; }
.msg { max-width: 88%; padding: 12px 16px; border-radius: 18px; } .msg.me { justify-self: end; background: var(--primary); color: var(--on-primary); border-bottom-right-radius: 6px; white-space: pre-wrap; }
.msg.ai { justify-self: start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.suggest { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chat-input { display: flex; gap: 10px; align-items: flex-end; position: sticky; bottom: 76px; background: var(--bg); padding: 8px 0; }
.chat-input textarea { min-height: 48px; max-height: 160px; }
.typing { display: inline-flex; gap: 4px; } .typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; } .typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

/* Statistik */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.tile { padding: 18px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); } .tile .v { font-size: 1.9rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; } .tile .k { color: var(--muted); font-size: .9rem; margin-top: 4px; }
.chart { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding-top: 10px; } .chart .col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; height: 100%; }
.chart .stack-bar { width: 100%; max-width: 34px; display: flex; flex-direction: column-reverse; border-radius: 8px 8px 4px 4px; overflow: hidden; min-height: 3px; background: var(--line); } .chart .stack-bar .r { background: var(--good); } .chart .stack-bar .w { background: var(--bad); }
.chart .d { font-size: .68rem; color: var(--muted); }
.hbar { display: grid; grid-template-columns: 74px 1fr 40px; gap: 10px; align-items: center; margin: 8px 0; font-weight: 700; font-size: .9rem; } .hbar .t { height: 14px; background: var(--line); border-radius: 99px; overflow: hidden; } .hbar .t i { display: block; height: 100%; border-radius: 99px; background: var(--primary); }

/* Timer */
.timer { max-width: 440px; margin: 0 auto; text-align: center; display: grid; gap: 22px; }
.timer .ring { width: 280px; height: 280px; margin: 0 auto; } .timer .ring .lbl { font-size: 3.4rem; font-variant-numeric: tabular-nums; }
.seg { display: inline-flex; padding: 4px; background: var(--surface2); border-radius: 14px; border: 1px solid var(--line); gap: 4px; justify-self: center; } .seg button { border: 0; background: transparent; padding: 8px 16px; border-radius: 10px; font-weight: 700; cursor: pointer; color: var(--muted); } .seg button.on { background: var(--primary); color: var(--on-primary); }

/* Modal, Toast, Login */
.modal-bg { position: fixed; inset: 0; background: rgba(20,18,42,.55); display: grid; place-items: center; padding: 16px; z-index: 50; overflow-y: auto; }
.modal { background: var(--surface); width: min(520px, 100%); border-radius: 22px; padding: 24px; display: grid; gap: 16px; max-height: calc(100dvh - 32px); overflow-y: auto; box-shadow: 0 30px 80px -20px rgba(0,0,0,.45); }
.modal.wide { width: min(720px, 100%); }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; } .swatches label { cursor: pointer; } .swatches input { position: absolute; opacity: 0; } .swatches span { display: block; width: 34px; height: 34px; border-radius: 50%; border: 3px solid transparent; box-shadow: inset 0 0 0 2px var(--surface); } .swatches input:checked + span { border-color: var(--ink); } .swatches input:focus-visible + span { outline: 3px solid var(--primary); outline-offset: 2px; }
.source-tabs { display: flex; gap: 6px; flex-wrap: wrap; } .source-tabs button { border: 1.5px solid var(--line); background: transparent; padding: 8px 14px; border-radius: 99px; font-weight: 700; cursor: pointer; color: var(--muted); } .source-tabs button.on { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.preview-card { display: grid; grid-template-columns: auto 1fr; gap: 12px; padding: 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface2); } .preview-card textarea { min-height: 56px; margin-bottom: 6px; padding: 8px 10px; }
.drop { display: grid; place-items: center; gap: 4px; padding: 26px 16px; border: 2px dashed var(--line); border-radius: 16px; color: var(--muted); cursor: pointer; text-align: center; } .drop.has { border-color: var(--good); color: var(--good); }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--primary); animation: spin .8s linear infinite; display: inline-block; } @keyframes spin { to { transform: rotate(360deg); } }
.loading { display: grid; place-items: center; padding: 80px 0; }
#toasts { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 80; width: min(92vw, 420px); pointer-events: none; }
.toast { padding: 12px 16px; border-radius: 14px; background: var(--ink); color: var(--bg); font-weight: 600; box-shadow: 0 10px 30px -10px rgba(0,0,0,.5); } .toast.err { background: var(--bad); color: #fff; }
.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.auth .box { width: min(420px, 100%); display: grid; gap: 18px; }
.auth .brand { justify-content: center; padding: 0; font-size: 1.7rem; } .auth .brand img { width: 48px; height: 48px; border-radius: 14px; }
.auth form { display: grid; gap: 14px; }

/* Mobil */
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .nav { position: fixed; z-index: 30; top: auto; bottom: 0; left: 0; right: 0; height: auto; flex-direction: row; justify-content: space-around; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); gap: 0; }
  .nav .brand, .nav .spacer, .nav .me { display: none; }
  .nav a.link, .nav button.link { flex: 1; flex-direction: column; gap: 2px; font-size: .72rem; padding: 7px 4px; text-align: center; }
  main { padding: 20px 16px calc(92px + env(safe-area-inset-bottom)); }
  h1 { font-size: 1.6rem; }
  .today { grid-template-columns: auto 1fr; } .today .go { grid-column: 1 / -1; } .today .go .btn { width: 100%; }
  .chat-input { bottom: calc(70px + env(safe-area-inset-bottom)); }
  .item { grid-template-columns: 1fr; }
}
.nav button.link { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; color: var(--muted); font-weight: 700; background: none; border: 0; cursor: pointer; text-align: left; }
.nav button.link:hover { background: var(--surface2); color: var(--ink); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Feinschliff */
.new-card { align-content: center; gap: 4px; }
@media (hover: none) { .kbd { display: none; } }
@media (max-width: 820px) { .nav button.link { justify-content: center; align-items: center; } .nav button.link span, .nav a.link span { line-height: 1.2; } }

/* Verwaltung */
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th { text-align: left; color: var(--muted); font-weight: 700; font-size: .85rem; padding: 8px 12px 8px 0; border-bottom: 1.5px solid var(--line); white-space: nowrap; }
.table td { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.explain a { word-break: break-all; }

/* ───── Notizen ───── */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.searchbox { display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); min-width: 240px; }
.searchbox input { border: 0; background: transparent; box-shadow: none !important; padding: 10px 0; min-height: 44px; }
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 20px; }
.nbwrap { position: relative; }
.nb { display: block; text-decoration: none; color: inherit; }
.nb .cover { aspect-ratio: 3 / 4; border-radius: 6px 14px 14px 6px; background: var(--c); position: relative; overflow: hidden; box-shadow: var(--shadow); border-left: 9px solid rgba(0,0,0,.2); transition: transform .15s; }
.nb:hover .cover { transform: translateY(-3px); }
.nb .cover .paper { position: absolute; inset: 16% 10% 10% 14%; border-radius: 4px; }
.nb-title { font-weight: 700; margin-top: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge-pdf { position: absolute; top: 8px; right: 8px; z-index: 1; background: #fff; color: #D9453C; font-size: .7rem; font-weight: 800; padding: 2px 7px; border-radius: 6px; }
.paper { background: #fff; border: 1px solid rgba(0,0,0,.08); }
.paper-lined { background: repeating-linear-gradient(#fff 0 9px, #CBD5E8 9px 10px); }
.paper-grid { background: linear-gradient(#CBD5E8 1px, transparent 1px) 0 0 / 10px 10px, linear-gradient(90deg, #CBD5E8 1px, transparent 1px) 0 0 / 10px 10px, #fff; }
.paper-dots { background: radial-gradient(#B5C0D8 1.2px, transparent 1.4px) 0 0 / 10px 10px, #fff; }
.nbdel { position: absolute; top: 6px; left: 14px; z-index: 2; background: var(--surface); opacity: 0; min-height: 32px; min-width: 32px; padding: 6px; }
.nbwrap:hover .nbdel, .nbdel:focus-visible { opacity: 1; }
@media (hover: none) { .nbdel { opacity: .95; } }
.papers { display: flex; gap: 10px; flex-wrap: wrap; } .papers label { cursor: pointer; } .papers input { position: absolute; opacity: 0; }
.papers .pp { display: grid; gap: 6px; justify-items: center; padding: 10px; border: 2px solid var(--line); border-radius: 14px; font-weight: 700; color: var(--muted); }
.papers .pp .paper { width: 54px; height: 70px; border-radius: 4px; }
.papers input:checked + .pp { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.papers input:focus-visible + .pp { outline: 3px solid var(--primary); outline-offset: 2px; }

/* Editor */
.shell.editor { grid-template-columns: 1fr; }
.shell.editor .nav { display: none; }
.shell.editor main { max-width: none; padding: 0; margin: 0; height: 100vh; height: 100dvh; overflow: hidden; }
.editor-wrap { display: flex; flex-direction: column; height: 100%; }
.ed-bar, .ed-tools { display: flex; align-items: center; gap: 12px; padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--line); overflow-x: auto; flex: none; scrollbar-width: none; }
.ed-bar::-webkit-scrollbar, .ed-tools::-webkit-scrollbar { display: none; }
.ed-title { display: grid; min-width: 90px; max-width: 220px; line-height: 1.2; } .ed-title strong, .ed-title small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .ed-title small { color: var(--muted); }
.ed-status { font-size: .82rem; color: var(--muted); white-space: nowrap; margin-right: auto; display: flex; align-items: center; gap: 8px; min-width: 120px; }
.ed-group { display: flex; align-items: center; gap: 4px; flex: none; }
.ed-bar select { min-height: 36px; padding: 4px 8px; width: auto; border-radius: 10px; }
.pgno { font-weight: 700; font-size: .9rem; min-width: 52px; text-align: center; font-variant-numeric: tabular-nums; }
.btn.icon.on { background: var(--primary-soft); color: var(--primary); box-shadow: inset 0 0 0 1.5px var(--primary); }
.tool { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 8px; border-radius: 12px; border: 1.5px solid transparent; background: transparent; cursor: pointer; font-size: .72rem; font-weight: 700; color: var(--muted); min-width: 60px; }
.tool:hover { background: var(--surface2); } .tool.on { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); }
.col { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 1.5px var(--line); cursor: pointer; padding: 0; } .col.on { box-shadow: 0 0 0 3px var(--ink); }
.ed-size { display: flex; align-items: center; gap: 10px; flex: none; } .ed-size input[type=range] { width: 120px; min-height: 0; padding: 0; border: 0; accent-color: var(--primary); }
.ed-size .preview { display: inline-block; border-radius: 50%; flex: none; }
.ed-tools .seg button { white-space: nowrap; font-size: .85rem; padding: 7px 12px; }
.ink-scroll { flex: 1; overflow: auto; background: #E4E1F2; padding: 12px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
@media (prefers-color-scheme: dark) { .ink-scroll { background: #0E0C21; } }
.stage { position: relative; margin: 0 auto; background: #fff; box-shadow: 0 8px 30px -12px rgba(0,0,0,.45); touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; cursor: crosshair; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage .l-hi { mix-blend-mode: multiply; }
.stage.tool-eraser { cursor: cell; } .stage.tool-text { cursor: text; }
.text-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.tbox { position: absolute; pointer-events: none; line-height: 1.3; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; }
.tool-text .tbox { pointer-events: auto; outline: 1.5px dashed rgba(91,63,217,.5); border-radius: 6px; }
.tbox textarea { display: block; width: 100%; border: 0; background: transparent; resize: none; overflow: hidden; font: inherit; color: inherit; line-height: 1.3; padding: 0 2px; min-height: 0; outline: none; box-shadow: none; border-radius: 0; }
.tbox textarea:focus { border: 0; box-shadow: none; }
.tbox .th, .tbox .tx { display: none; position: absolute; width: 22px; height: 22px; place-items: center; background: var(--primary); color: #fff; border-radius: 7px; font-size: 13px; line-height: 1; border: 0; cursor: grab; padding: 0; }
.tbox .th { left: -26px; top: 0; } .tbox .tx { right: -26px; top: 0; cursor: pointer; background: var(--bad); font-size: 16px; }
.tool-text .tbox .th, .tool-text .tbox .tx { display: grid; }
@media (max-width: 820px) { .ed-size input[type=range] { width: 90px; } .shell.editor main { padding-bottom: 0; } }
