:root {
  --bg: #f6f7f9; --card: #fff; --ink: #1d2433; --muted: #667085; --line: #e4e7ec;
  --brand: #1f6feb; --brand-ink: #fff; --danger: #c0362c;
  --hl-yellow: rgba(255, 214, 0, .38); --hl-green: rgba(46, 204, 113, .35);
  --hl-pink: rgba(255, 99, 172, .32); --hl-blue: rgba(52, 152, 219, .32);
  --radius: 10px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  color: var(--ink); background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
h1 { font-size: 1.4rem; margin: .2rem 0 1rem; }
h2 { font-size: 1.1rem; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.error { color: var(--danger); min-height: 1.2em; }

.brand { font-weight: 700; letter-spacing: .2px; }
.brand span { color: var(--brand); }

.btn { border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 8px; padding: .5rem .85rem;
  font: inherit; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: .3rem; min-height: 38px; }
.btn:hover { border-color: #c9ced6; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-quiet { background: transparent; }
input, select { font: inherit; border: 1px solid var(--line); border-radius: 8px; padding: .5rem .6rem; min-height: 38px; background: #fff; }
label { display: grid; gap: .3rem; margin-bottom: .8rem; font-size: .9rem; }

/* ---------- dashboard ---------- */
.topbar { display: flex; justify-content: space-between; align-items: center; padding: .8rem 1rem; background: #fff; border-bottom: 1px solid var(--line); }
.topbar-right { display: flex; gap: .6rem; align-items: center; }
.container { max-width: 960px; margin: 1.2rem auto; padding: 0 1rem; display: grid; gap: 1rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; }
.card.narrow { max-width: 420px; margin: 2rem auto; width: 100%; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: .8rem; flex-wrap: wrap; }
.row { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .8rem; }
.row input:not([type=file]) { flex: 1 1 220px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: .8rem; padding: .7rem 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { text-align: left; padding: .45rem .4rem; border-top: 1px solid var(--line); }
progress { width: 100%; }

/* ---------- class ---------- */
.page-room { height: 100dvh; overflow: hidden; }
.join { min-height: 100dvh; display: grid; place-items: center; padding: 1rem; }
.class { display: flex; flex-direction: column; height: 100dvh; }
.class-bar { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .5rem .8rem; background: #fff; border-bottom: 1px solid var(--line); }
.class-title { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.class-title strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.class-bar-right { display: flex; align-items: center; gap: .8rem; }
.net { width: 10px; height: 10px; border-radius: 50%; flex: none; background: #b0b7c3; }
.net-good { background: #22a06b; } .net-ok { background: #e2b203; } .net-bad { background: #e5484d; } .net-off { background: #b0b7c3; }
.stars { font-weight: 600; color: #b7791f; }
.stars.pop { animation: pop .6s ease; }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.5); } 100% { transform: scale(1); } }

.tools { display: flex; align-items: center; gap: .35rem; padding: .4rem .6rem; background: #fff; border-bottom: 1px solid var(--line); overflow-x: auto; flex-wrap: nowrap; }
.tools .btn { min-height: 36px; padding: .35rem .6rem; flex: none; }
.tools select { max-width: 220px; flex: none; }
.tools .sep { width: 1px; height: 24px; background: var(--line); flex: none; margin: 0 .2rem; }
#page-input { width: 4.2rem; flex: none; }
.tool.active { background: #e8f0fe; border-color: var(--brand); }
.colors { display: inline-flex; gap: .25rem; flex: none; }
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.swatch.active { box-shadow: 0 0 0 2px var(--brand); }
.swatch[data-color=yellow] { background: #ffd600; } .swatch[data-color=green] { background: #2ecc71; }
.swatch[data-color=pink] { background: #ff63ac; } .swatch[data-color=blue] { background: #3498db; }
.file-btn { cursor: pointer; }

.viewer { flex: 1; overflow: auto; padding: 8px; background: #e9ecf1; -webkit-overflow-scrolling: touch; }
.empty { text-align: center; padding: 3rem 1rem; }
.page { position: relative; margin: 0 auto; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.15); }
.page canvas, .page img { display: block; }
.marks { position: absolute; inset: 0; pointer-events: none; }
.laser { position: absolute; width: 18px; height: 18px; border-radius: 50%; background: rgba(229, 30, 30, .85);
  box-shadow: 0 0 10px 4px rgba(229, 30, 30, .45); transform: translate(-50%, -50%); pointer-events: none;
  transition: left 80ms linear, top 80ms linear; }
.marks.tool-laser { pointer-events: auto; touch-action: none; cursor: none; }
.marks.tool-hl, .marks.tool-star, .marks.tool-erase { pointer-events: auto; touch-action: none; cursor: crosshair; }
.mark { position: absolute; }
.hl { border-radius: 2px; mix-blend-mode: multiply; }
.hl-yellow { background: var(--hl-yellow); } .hl-green { background: var(--hl-green); }
.hl-pink { background: var(--hl-pink); } .hl-blue { background: var(--hl-blue); }
.hl.ghost { outline: 1px dashed rgba(0,0,0,.35); }
.star { transform: translate(-50%, -50%); font-size: clamp(18px, 3.2vw, 34px); color: #f5b301; text-shadow: 0 1px 2px rgba(0,0,0,.35); animation: starpop .6s ease; }
@keyframes starpop { 0% { transform: translate(-50%, -50%) scale(.4); } 50% { transform: translate(-50%, -50%) scale(1.5); } 100% { transform: translate(-50%, -50%) scale(1); } }
.marks.tool-erase .mark { cursor: pointer; outline: 1px dashed rgba(192,54,44,.6); }

.toast { position: fixed; left: 50%; bottom: 1rem; transform: translateX(-50%); background: #1d2433; color: #fff; padding: .6rem 1rem; border-radius: 8px; max-width: 90vw; font-size: .9rem; }

@media (max-width: 600px) {
  .class-bar-right #people { display: none; }
}
