:root {
  color-scheme: light;
  --paper: #edf3ec;
  --card: #fcfefa;
  --ink: #19221d;
  --muted: #59625a;
  --line: #d5dfd3;
  --green: #d8f899;
  --dark: #1d3025;
  --mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; }
button, input, select { font: inherit; }
button, select, summary { cursor: pointer; }
button, a, select, summary { -webkit-tap-highlight-color: transparent; }
button:disabled, select:disabled { cursor: default; opacity: .58; }
button, a { transition: background-color .18s ease, transform .18s ease; }
button:active:not(:disabled), .button:active { transform: translateY(1px); }
:focus-visible { outline: 2px solid #276649; outline-offset: 3px; }
.skip { position: absolute; top: 8px; left: 8px; z-index: 2; padding: 12px; color: var(--ink); background: white; transform: translateY(-140%); }
.skip:focus { transform: none; }
.wrap { width: min(1240px, calc(100% - 80px)); margin-inline: auto; }

.topbar { height: 75px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); gap: 12px; }
.brand { display: flex; align-items: center; gap: 9px; font-size: 18px; font-weight: 760; letter-spacing: -.045em; }
.mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--dark); color: var(--green); font: 700 25px/1 var(--mono); }
.connection { display: flex; align-items: center; gap: 7px; color: var(--muted); font: 650 12px var(--mono); white-space: nowrap; }
.connection > span:first-child, .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #b68032; }
.connection[data-state="online"] > span:first-child { background: #438950; box-shadow: 0 0 0 3px #e1ecdc; }
.connection[data-state="offline"] > span:first-child { background: #aa493d; }
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; padding-block: 58px 40px; animation: enter .38s ease both; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(36px, 6.1vw, 88px); font-weight: 760; line-height: 1.04; letter-spacing: -.04em; }
h1 span { color: #41654b; }
.hero p { margin-top: 18px; color: var(--muted); font-size: clamp(15px, 1.6vw, 19px); line-height: 1.4; }
.button { min-height: 48px; display: inline-flex; align-items: center; justify-content: space-between; gap: 18px; padding: 0 15px; border: 1px solid transparent; border-radius: 8px; background: var(--green); color: var(--ink); font-weight: 750; text-decoration: none; }
.button:hover:not(:disabled) { background: #e6ffb8; }
.hero-action { background: transparent; border-color: #a8b0a4; white-space: nowrap; }
.hero-action:hover:not(:disabled) { background: white; }
.button span { font-size: 20px; }

.workspace { display: grid; grid-template-columns: minmax(125px, .55fr) minmax(0, 2.2fr) minmax(240px, 1fr); align-items: start; gap: 18px; padding-bottom: 44px; }
.subjects { padding: 14px 14px 14px 0; }
.section-label { display: block; font: 700 11px/1.4 var(--mono); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.subjects .section-label { margin: 0 0 12px 10px; }
.subject-buttons { display: grid; gap: 3px; }
.subject { min-height: 44px; padding: 0 10px; text-align: left; background: none; border: 1px solid transparent; border-radius: 7px; color: var(--ink); font-size: 14px; font-weight: 700; }
.subject:hover { background: #e4ece1; }
.subject[aria-pressed="true"] { border-color: #c9d2bc; background: #e4ecd8; }
#subject-select { display: none; }
.board, .join { min-width: 0; border-radius: 14px; scroll-margin-top: 14px; }
.board { border: 1px solid var(--line); background: var(--card); }
.board-head, .queue-body { padding: 20px; }
.heading-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
h2 { font-size: 27px; line-height: 1.1; letter-spacing: -.055em; }
.board-actions { display: flex; gap: 8px; }
.board-action { min-height: 44px; border-radius: 8px; border: 1px solid var(--line); background: transparent; color: var(--ink); }
.board-action:hover:not(:disabled) { background: var(--paper); }
.share { padding-inline: 12px; font-size: 13px; font-weight: 700; }
.refresh { width: 44px; font-size: 23px; }
.share-url { width: 100%; min-height: 44px; margin-top: 7px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); background: var(--paper); }
.groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.group { min-height: 60px; border: 1px solid var(--line); background: var(--card); color: var(--ink); padding: 8px 11px; text-align: left; border-radius: 8px; }
.group:hover { background: var(--paper); }
.group[aria-pressed="true"] { background: #e9f4dc; border-color: #a8be93; }
.group-number { display: block; color: var(--muted); font-size: 11px; }
.teacher { display: block; margin-top: 3px; font-size: 14px; font-weight: 720; overflow-wrap: anywhere; }
.queue-body { min-height: 252px; border-top: 1px solid var(--line); }
.stats { display: flex; flex-wrap: wrap; gap: 9px 17px; font-size: 12px; color: var(--muted); }
.stats span { display: inline-flex; align-items: center; gap: 6px; }
.stats b { color: var(--ink); font: 700 12px var(--mono); }
.dot.waiting { background: #b97a27; }
.dot.active { background: #42874b; }
.dot.done { background: #737d74; }
.empty { display: grid; justify-items: center; align-content: center; min-height: 195px; padding: 22px 3px 10px; text-align: center; }
.ticket { display: flex; margin-bottom: 16px; font: 700 13px var(--mono); }
.ticket span { display: grid; place-items: center; width: 38px; height: 32px; border: 1px solid var(--line); background: var(--paper); border-radius: 5px; }
.ticket span:first-child { background: var(--green); border-color: #b3cf80; z-index: 1; }
.ticket span + span { margin-left: -3px; color: var(--muted); }
.empty h3 { font-size: 19px; letter-spacing: -.04em; }
.empty p { margin-top: 5px; color: var(--muted); font-size: 14px; }
.entries { padding: 0; margin: 14px 0 0; list-style: none; }
.entries:empty { margin: 0; }
.entry { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 6px 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.position { display: grid; place-items: center; height: 29px; border-radius: 5px; background: var(--paper); font: 700 12px var(--mono); }
.person { font-weight: 750; font-size: 15px; overflow-wrap: anywhere; }
.you { display: inline-block; margin-left: 7px; color: var(--muted); font: 650 11px var(--mono); }
.assignment { margin-top: 3px; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.status { border-radius: 5px; padding: 4px 6px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.status.waiting { background: #fff0d2; color: #6d4619; }
.status.active { background: #e4f2d7; color: #2a5730; }
.status.away { background: #e6eff5; color: #31546a; }
.status.done { background: #edf0ea; color: #4d5a4d; }
.entry-actions { grid-column: 2 / -1; display: flex; flex-wrap: wrap; gap: 6px; margin-block: 3px; }
.row-action { padding: 0 8px; min-height: 44px; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 6px; font-size: 12px; }
.row-action:first-child { background: #e4f2d7; }
.row-action:hover { background: #e0e6d8; }
details { margin-top: 12px; padding-top: 8px; border-top: 1px solid var(--line); }
summary { min-height: 44px; align-content: center; font-weight: 700; font-size: 13px; }
details .entries { margin-top: 0; }
.join { padding: 19px; background: var(--dark); color: #f9fff0; }
.join :focus-visible { outline-color: var(--green); }
.join-title { display: flex; align-items: center; gap: 9px; }
.plus { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 6px; background: #364939; color: var(--green); font: 500 22px var(--mono); }
.join-target { margin: 9px 0 20px; color: #c7d8c5; font-size: 13px; }
form { display: grid; gap: 7px; }
form label { font-size: 13px; font-weight: 680; }
form input { width: 100%; min-height: 45px; margin-bottom: 8px; padding: 8px 10px; border: 1px solid #8a9f88; border-radius: 7px; background: #273c2d; color: white; font-size: 16px; }
form input::placeholder { color: #becdbb; font-size: 13px; }
form button { margin-top: 3px; text-align: left; font-size: 14px; }
.message { margin-top: 10px; font-size: 13px; overflow-wrap: anywhere; }
.message.error { color: #9f3328; }
.join .message.error { color: #ffd2bd; }

@keyframes enter {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 1000px) {
  .wrap { width: calc(100% - 48px); }
  .workspace { grid-template-columns: minmax(0, 1.55fr) minmax(240px, 1fr); }
  .subjects { grid-column: 1 / -1; padding: 0; }
  .subjects .section-label { margin-left: 0; }
  .subject-buttons { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .subject { text-align: center; padding-inline: 3px; }
}

@media (max-width: 620px) {
  .wrap { width: calc(100% - 30px); }
  .topbar { height: 61px; }
  .hero { display: block; padding-block: 30px 20px; }
  .hero p { margin-top: 11px; }
  .hero-action { margin-top: 14px; }
  .workspace { grid-template-columns: minmax(0, 1fr); gap: 13px; }
  .subjects .section-label { margin-bottom: 5px; }
  .subject-buttons { display: none; }
  #subject-select { display: block; min-height: 44px; width: 100%; padding: 0 10px; border: 1px solid #bec4b4; border-radius: 8px; background: var(--card); color: var(--ink); font-weight: 700; }
  .board-head, .queue-body, .join { padding: 15px; }
  .queue-body { min-height: 190px; }
  .heading-row { margin-bottom: 8px; }
  .group { min-height: 53px; }
  .empty { min-height: 148px; }
  .stats { column-gap: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
