/* InkLesson — forest ink studio (not purple / cream AI defaults) */
:root {
  --ink: #0d3b2e;
  --ink-deep: #071f18;
  --leaf: #1b8a5a;
  --spark: #c8f135;
  --paper: #eef3f0;
  --paper-2: #e2ebe6;
  --line: rgba(13, 59, 46, 0.14);
  --muted: rgba(13, 59, 46, 0.62);
  --danger: #b42318;
  --radius: 12px;
  --font: "Figtree", system-ui, sans-serif;
  --display: "Syne", "Figtree", sans-serif;
  --shadow: 0 18px 40px rgba(7, 31, 24, 0.12);
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(200, 241, 53, 0.18), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(27, 138, 90, 0.16), transparent 50%),
    linear-gradient(160deg, #d7e4dc 0%, #eef3f0 42%, #dce8e1 100%);
  line-height: 1.45;
}

.noise {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 0;
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1100px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 3rem;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  background: rgba(238, 243, 240, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.brand {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.2rem;
  text-decoration: none;
  color: var(--ink-deep);
  letter-spacing: -0.03em;
}
.brand span { color: var(--leaf); }

.topnav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  flex: 1;
}
.topnav a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
}
.topnav a:hover { color: var(--leaf); }

.topbar-end {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.who { font-size: 0.9rem; color: var(--muted); }

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.55rem 1rem;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--ink);
  color: #f4faf6;
}
.btn-primary:hover { background: var(--ink-deep); }
.btn-secondary {
  background: var(--spark);
  color: var(--ink-deep);
  border-color: rgba(13, 59, 46, 0.1);
}
.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}
.btn-ghost:hover,
.btn-ghost.is-active {
  background: rgba(13, 59, 46, 0.06);
  border-color: rgba(13, 59, 46, 0.28);
}
.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: rgba(180, 35, 24, 0.35);
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-end;
  margin-bottom: 1.75rem;
}
.page-head h1,
.auth-copy h1 {
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: -0.04em;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin: 0 0 0.35rem;
  line-height: 1.05;
}
.lede { margin: 0; color: var(--muted); max-width: 36rem; }
.page-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.section-title {
  font-family: var(--display);
  font-size: 1.05rem;
  margin: 0 0 0.75rem;
  letter-spacing: -0.02em;
}

.grid-two {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}
@media (min-width: 860px) {
  .grid-two { grid-template-columns: 1fr 1fr; }
}

.panel {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

label {
  display: grid;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 0.92rem;
  margin-bottom: 0.9rem;
}
input[type="text"],
input[type="password"],
input[type="url"],
select,
textarea {
  font: inherit;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  width: 100%;
  box-sizing: border-box;
}
textarea.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
}

.list-plain {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.65rem;
}
.list-plain.compact { gap: 0.4rem; }
.list-plain.compact .btn { width: 100%; }

.row-item,
.stack-item {
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
}
.row-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.row-item .muted,
.stack-item .muted { display: block; font-size: 0.85rem; color: var(--muted); font-weight: 500; }
.row-actions { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }
.magic-link-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: stretch;
}
.magic-link-row input {
  flex: 1;
  min-width: 200px;
  font-family: ui-monospace, monospace;
  font-size: 0.85rem;
}
.inline-form {
  display: flex;
  gap: 0.4rem;
  margin: 0.6rem 0;
  flex-wrap: wrap;
}
.inline-form input { flex: 1; min-width: 140px; }

.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(13, 59, 46, 0.08);
  margin-left: 0.35rem;
}
.pill.live {
  background: var(--spark);
  color: var(--ink-deep);
}

.empty { color: var(--muted); }
.empty a { color: var(--leaf); font-weight: 700; }

.flash-stack {
  position: relative;
  z-index: 30;
  width: min(1100px, calc(100% - 2rem));
  margin: 0.75rem auto 0;
  display: grid;
  gap: 0.4rem;
}
.flash {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--leaf);
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
}
.form-error {
  background: rgba(180, 35, 24, 0.08);
  color: var(--danger);
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
}

/* Auth */
.auth-page .topbar { display: none; }
.auth-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}
.auth-compose {
  width: min(980px, 100%);
  display: grid;
  gap: 2rem;
  align-items: center;
}
@media (min-width: 860px) {
  .auth-compose { grid-template-columns: 1.1fr 0.9fr; }
}
.brand-mark {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2.4rem, 6vw, 4rem);
  letter-spacing: -0.05em;
  margin: 0 0 0.5rem;
  color: var(--ink-deep);
  line-height: 0.95;
}
.auth-card {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.auth-card h2 {
  font-family: var(--display);
  margin: 0 0 1rem;
}

/* Room */
.room-page { background: #0b1f18; color: #e8f2ec; }
.room-page .noise { opacity: 0.05; }
.room-page .topbar {
  background: rgba(7, 31, 24, 0.92);
  border-color: rgba(232, 242, 236, 0.1);
}
.room-page .brand,
.room-page .topnav a,
.room-page .who { color: #e8f2ec; }
.room-page .brand span { color: var(--spark); }
.room-page .btn-ghost {
  color: #e8f2ec;
  border-color: rgba(232, 242, 236, 0.18);
}
.room-page .btn-secondary { color: var(--ink-deep); }

body.theme-light.room-page {
  background: #e8efe9;
  color: var(--ink);
}
body.theme-light.room-page .topbar {
  background: rgba(238, 243, 240, 0.94);
  border-color: var(--line);
}
body.theme-light.room-page .brand,
body.theme-light.room-page .topnav a,
body.theme-light.room-page .who { color: var(--ink); }
body.theme-light.room-page .brand span { color: var(--leaf); }
body.theme-light.room-page .btn-ghost {
  color: var(--ink);
  border-color: var(--line);
}
body.theme-light.room-page .muted { color: var(--muted); }
body.theme-light.room-page .room-side {
  background: rgba(255, 255, 255, 0.8);
  border-color: var(--line);
  color: var(--ink);
}
body.theme-light.room-page .room-side .hint,
body.theme-light.room-page .tool { color: var(--ink); }

.room-shell {
  position: relative;
  z-index: 1;
  width: min(1320px, calc(100% - 1rem));
  margin: 0 auto;
  padding: 0.5rem 0.6rem 1.25rem;
}

.room-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.room-bar-left {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}
.room-bar-tools { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.room-bar-right { display: flex; gap: 0.5rem; align-items: center; }
.small { font-size: 0.8rem; }
.muted { color: rgba(232, 242, 236, 0.65); }

.room-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}
.room-layout.mode-draw {
  grid-template-columns: 1fr;
}
@media (min-width: 900px) {
  .room-layout.mode-draw {
    grid-template-columns: 168px 1fr;
  }
}
.room-layout:not(.mode-draw) #draw-tools {
  display: none !important;
}

.room-side {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(232, 242, 236, 0.12);
  border-radius: 14px;
  padding: 0.75rem;
  display: grid;
  gap: 0.55rem;
  align-content: start;
  height: fit-content;
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
}
.room-side .side-title {
  font-family: var(--display);
  font-weight: 700;
  margin: 0;
  font-size: 0.95rem;
}
.room-side .hint {
  font-size: 0.78rem;
  color: rgba(232, 242, 236, 0.55);
  margin: 0;
  line-height: 1.35;
}
.room-side .hint-active { color: var(--spark); font-weight: 650; }
.room-side .btn {
  width: 100%;
  box-sizing: border-box;
  justify-content: center;
  padding: 0.5rem 0.65rem;
  font-size: 0.88rem;
}
.tool {
  margin: 0;
  color: #e8f2ec;
  display: grid;
  gap: 0.35rem;
  font-size: 0.88rem;
  font-weight: 650;
  min-width: 0;
}
.tool input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 42px;
  padding: 0;
  border: 2px solid rgba(232, 242, 236, 0.35);
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  overflow: hidden;
  box-sizing: border-box;
}
.tool input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}
.tool input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 8px;
}
.tool input[type="color"]::-moz-color-swatch {
  border: none;
  border-radius: 8px;
}
.tool input[type="range"] {
  width: 100%;
  max-width: 100%;
  margin: 0.15rem 0 0;
  box-sizing: border-box;
  accent-color: var(--spark);
}
.toolbar-row { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.video-form-stack { display: grid; gap: 0.5rem; }
.video-form-stack .btn { width: 100%; }

.room-stage {
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid rgba(232, 242, 236, 0.2);
  overflow: hidden;
  color: var(--ink);
  position: relative;
}
.stage-panel { min-height: 0; }
.stage-panel.is-active { display: block; }

/* Доска: один сплошной блок 16:9, без пустоты и полосы посередине */
#draw-layer.is-active {
  display: flex;
  flex-direction: column;
}
#text-layer.is-active,
#video-layer.is-active,
#game-layer.is-active {
  min-height: calc(100vh - 9.5rem);
}
.board-stack {
  position: relative;
  width: min(100%, calc((100vh - 11.5rem) * 16 / 9));
  max-width: 100%;
  max-height: calc(100vh - 11.5rem);
  aspect-ratio: 16 / 9;
  margin: 0 auto;
  background: #ffffff;
}
.board-stack.placing-photo { cursor: crosshair; }

#board-canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: crosshair;
  background: #ffffff;
}

.photo-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.board-photo {
  position: absolute;
  pointer-events: auto;
  cursor: grab;
  z-index: 2;
  touch-action: none;
  user-select: none;
}
.board-photo:active { cursor: grabbing; }
.board-photo img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  border: 2px solid rgba(13, 59, 46, 0.25);
  background: #fff;
}
.board-photo-x {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: none;
  background: var(--ink);
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}
.board-photo-resize {
  position: absolute;
  right: -6px;
  bottom: -6px;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: var(--spark);
  border: 2px solid var(--ink);
  cursor: nwse-resize;
  touch-action: none;
}

.page-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  padding: 0.45rem 0.65rem;
  background: #24352e;
  color: #e8f2ec;
  flex-shrink: 0;
}
.page-bar .btn-ghost {
  color: #e8f2ec;
  border-color: rgba(232, 242, 236, 0.22);
}
.page-bar .btn-ghost:hover,
.page-bar .btn-ghost.is-active {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(232, 242, 236, 0.35);
  color: #fff;
}
.page-bar-doc {
  background: #ececec;
  color: #222;
  border-bottom: 1px solid #ccc;
}
.page-bar-doc .btn-ghost {
  color: #222;
  border-color: #c8c8c8;
}
.page-bar-doc .btn-ghost:hover {
  background: #fff;
  color: #111;
}
.page-title-input {
  flex: 1 1 140px;
  min-width: 120px;
  max-width: 240px;
  height: 28px;
  padding: 0 0.5rem;
  border-radius: 8px;
  border: 1px solid rgba(232, 242, 236, 0.25);
  background: rgba(255, 255, 255, 0.12);
  color: inherit;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
}
.page-bar-doc .page-title-input {
  background: #fff;
  border-color: #c8c8c8;
  color: #222;
}

.page-bar .btn {
  padding: 0.3rem 0.65rem;
  font-size: 0.8rem;
}

.asset-chip {
  position: relative;
  flex: 0 0 auto;
}
.asset-del {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: none;
  background: #b42318;
  color: #fff;
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}


.doc-chrome {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 9.5rem);
  background: #cfcfcf;
}

.word-ribbon {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  align-items: center;
  padding: 0.45rem 0.65rem;
  background: linear-gradient(180deg, #f7f7f7, #ebebeb);
  border-bottom: 1px solid #c8c8c8;
  position: sticky;
  top: 0;
  z-index: 5;
}

.ribbon-group {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding-right: 0.65rem;
  border-right: 1px solid #d0d0d0;
}
.ribbon-group:last-child { border-right: 0; }

.ribbon-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 4px;
  min-width: 28px;
  height: 28px;
  padding: 0 0.4rem;
  cursor: pointer;
  color: #222;
  font: inherit;
  font-size: 0.85rem;
}
.ribbon-btn:hover {
  background: #fff;
  border-color: #c0c0c0;
}

.ribbon-select {
  font: inherit;
  font-size: 0.85rem;
  height: 28px;
  border: 1px solid #c8c8c8;
  border-radius: 4px;
  background: #fff;
  padding: 0 0.35rem;
  max-width: 140px;
}
.ribbon-select-sm { max-width: 64px; }

.ribbon-color {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  border: 1px solid #c8c8c8;
  background: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  overflow: hidden;
}
.ribbon-color input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
}
.ribbon-hl { color: #b8860b; }

.doc-stack {
  position: relative;
  flex: 1;
  background: #cfcfcf;
  padding: 1.25rem 1rem 2rem;
  min-height: calc(100vh - 14rem);
}
.doc-stack.placing-photo { cursor: crosshair; }

.doc-editor {
  min-height: calc(100vh - 15rem);
  max-width: 900px;
  margin: 0 auto;
  padding: 2.25rem 2.75rem;
  outline: none;
  font-size: 15px;
  line-height: 1.65;
  background: #ffffff;
  color: #111111;
  box-shadow: 0 2px 10px rgba(0,0,0,0.18);
  border: 1px solid #bbb;
  position: relative;
  z-index: 1;
  /* OS/Chrome dark mode не должен перекрашивать цвета текста внутри Word */
  color-scheme: only light;
  forced-color-adjust: none;
}
.doc-editor span[style*="color"],
.doc-editor font[color] {
  forced-color-adjust: none;
}
.doc-editor:empty::before {
  content: attr(data-placeholder);
  color: #999;
}

.ribbon-file {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  margin: 0;
}

.video-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0a0a0a;
  min-height: 280px;
  overflow: hidden;
}
.video-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.video-bar {
  display: flex;
  gap: 0.5rem;
  padding: 0.65rem 0.75rem;
  background: #111;
  align-items: center;
}
.video-bar input {
  flex: 1;
  margin: 0;
  background: #1a1a1a;
  color: #eee;
  border-color: #333;
}
.video-history {
  padding: 0.75rem 0.85rem 1rem;
  background: #111;
  border-top: 1px solid #2a2a2a;
  color: #e8f2ec;
}
.video-history-head {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #9eb0a4;
  margin-bottom: 0.55rem;
}
.video-history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.55rem;
  max-height: 220px;
  overflow-y: auto;
}
.video-history-list li { margin: 0; }
.video-hist-btn {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 0.45rem;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 0.35rem;
  border: 1px solid #2e2e2e;
  border-radius: 10px;
  background: #1a1a1a;
  color: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.video-hist-btn:hover,
.video-hist-btn.is-current {
  border-color: var(--accent, #b7f06e);
  background: #222;
}
.video-hist-btn img {
  width: 72px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
  background: #000;
}
.video-hist-meta {
  min-width: 0;
  font-size: 0.75rem;
  line-height: 1.25;
}
.video-hist-meta strong {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}
.video-hist-meta span {
  color: #8a9a90;
  font-size: 0.7rem;
}

.game-chrome {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.75rem;
  padding: 0.75rem;
  min-height: 55vh;
  background: #fff;
  color: var(--ink);
}
/* Перебиваем светлые кнопки комнаты — сцена на белом */
.game-chrome .btn-ghost {
  color: var(--ink);
  border-color: var(--line);
  background: #fff;
}
.game-chrome .btn-ghost:hover,
.game-chrome .btn-ghost.is-active,
.game-chrome .quiz-options .is-picked {
  background: rgba(27, 138, 90, 0.1);
  border-color: var(--leaf);
  color: var(--ink);
}
.game-chrome .btn-ghost:disabled {
  opacity: 1;
  color: var(--ink);
}
.games-rail-inline {
  flex: 0 0 180px;
  max-width: 100%;
  background: #f4f6f5;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem;
  height: fit-content;
}
#game-stage {
  flex: 1 1 280px;
  min-width: 0;
  padding: 0.5rem 0.75rem 1rem;
}
.games-rail-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.doc-photo-hint {
  margin: 0;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  background: #fff8c5;
  color: #333;
  text-align: center;
}
.doc-photo-hint.hint-active { display: block; }

.doc-assets {
  background: #ebebeb;
  margin: 0;
  padding: 0.5rem 0.75rem;
  border-top: 1px solid #ccc;
}

#draw-layer .asset-strip {
  background: #f2f4f3;
  border-top: 1px solid #dde3df;
  margin: 0;
  padding: 0.45rem 0.65rem;
  flex-shrink: 0;
}
/* Пустая лента не режет доску серой полосой */
#draw-layer .asset-strip:not(:has(.asset-chip)) {
  display: none;
}

.asset-strip {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.75rem 0;
}
.asset-thumb {
  border: 1px solid rgba(232, 242, 236, 0.2);
  background: rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 0;
  cursor: pointer;
  flex: 0 0 auto;
}
.asset-thumb img {
  display: block;
  width: 72px;
  height: 54px;
  object-fit: cover;
  border-radius: 10px;
}

body.theme-light {
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(200, 241, 53, 0.22), transparent 55%),
    linear-gradient(160deg, #f4f8f5 0%, #eef3f0 50%, #e4ece7 100%);
}

#pusher-quota {
  font-size: 0.72rem;
  background: rgba(200, 241, 53, 0.15);
}

/* Games */
.game-watch-bar {
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--leaf);
}
.match-board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  max-width: 920px;
  margin: 0 auto;
}
.match-board.is-spectate .match-card,
.quiz-card.is-spectate button {
  cursor: default;
}
.quiz-options .is-picked {
  border-color: var(--leaf) !important;
  background: rgba(27, 138, 90, 0.14) !important;
}

.match-col { display: grid; gap: 0.5rem; }
.match-card {
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem;
  background: #fff;
  cursor: pointer;
  font-weight: 650;
  text-align: left;
  color: var(--ink);
}
.match-card.selected { border-color: var(--leaf); background: rgba(27, 138, 90, 0.08); }
.match-card.matched { opacity: 0.45; pointer-events: none; border-color: var(--spark); }
.match-card .emoji { font-size: 1.4rem; margin-right: 0.35rem; }

.quiz-card {
  background: #fafcfb;
  border-radius: 14px;
  border: 1px solid var(--line);
  padding: 1.35rem 1.5rem;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  color: var(--ink);
  box-sizing: border-box;
}
.quiz-card h2 {
  color: var(--ink);
  margin: 0.35rem 0 0;
}
.quiz-options { display: grid; gap: 0.55rem; margin-top: 1rem; }
.quiz-options button {
  text-align: left;
  width: 100%;
  justify-content: flex-start;
}

.file-btn { cursor: pointer; }

.prose p { margin: 0 0 0.75rem; }

.hw-create .hw-editor-wrap { margin: 0.75rem 0 1rem; }
.hw-editor-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 0.35rem;
}
.hw-editor {
  min-height: 160px;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: #111;
  outline: none;
  line-height: 1.5;
  color-scheme: only light;
}
.hw-editor:empty::before {
  content: attr(data-placeholder);
  color: #999;
}
.hw-type-fieldset {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  margin: 0 0 1rem;
}
.hw-type-fieldset legend {
  padding: 0 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
}
.hw-type-option {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.35rem 0;
  cursor: pointer;
}
.hw-quiz-pick .hint {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: var(--muted);
}
.hw-review-list .pill.ok {
  background: rgba(27, 138, 90, 0.18);
  color: var(--leaf);
}
.hw-assignment .hw-body {
  color: #111;
  color-scheme: only light;
}
.hw-photo-preview {
  display: block;
  max-width: min(100%, 520px);
  border-radius: 12px;
  border: 1px solid var(--line);
  margin-top: 0.5rem;
}
.hw-quiz-review { padding-left: 1.2rem; }
.hw-quiz-review li { margin: 0.55rem 0; }
.hw-quiz-review .is-ok .muted { color: var(--leaf); }
.hw-quiz-review .is-bad .muted { color: var(--danger); }
.quiz-opt.is-picked {
  border-color: var(--leaf) !important;
  background: rgba(27, 138, 90, 0.12) !important;
}

/* Game editor — looks like student stage */
.game-editor-page .shell {
  width: min(1280px, calc(100% - 1.5rem));
}
.ge-head { margin-bottom: 1rem; }
.ge-layout {
  display: grid;
  gap: 1rem;
}
.ge-topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 0.85rem;
  align-items: end;
  padding: 0.75rem 0.9rem;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: 14px;
}
body.theme-dark .ge-topbar,
.room-page .ge-topbar {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(232, 242, 236, 0.12);
}
.game-editor-page:not(.theme-light) .ge-topbar {
  background: rgba(13, 59, 46, 0.06);
}
.ge-top-field {
  display: grid;
  gap: 0.25rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  margin: 0;
  min-width: 140px;
}
.ge-top-wide { flex: 1 1 220px; min-width: 180px; }
.ge-top-field input,
.ge-top-field select {
  margin: 0;
  min-width: 160px;
}
.ge-top-help {
  flex: 1 1 180px;
  margin: 0;
  align-self: center;
  font-size: 0.8rem;
}
.ge-top-save { margin-left: auto; }

.ge-stage-shell {
  background: #0b1f18;
  border-radius: 18px;
  padding: 0.75rem;
  border: 1px solid rgba(232, 242, 236, 0.12);
}
body.theme-light .ge-stage-shell {
  background: #d5e2da;
  border-color: var(--line);
}
.ge-stage-label {
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(232, 242, 236, 0.55);
  margin: 0 0 0.55rem 0.35rem;
}
body.theme-light .ge-stage-label { color: var(--muted); }

.ge-stage {
  background: #fff;
  color: var(--ink);
  border-radius: 14px;
  min-height: 62vh;
  padding: 1rem 1.1rem 1.25rem;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.18);
}

.ge-edit-title input {
  width: 100%;
  border: 0;
  border-bottom: 2px dashed transparent;
  background: transparent;
  font: inherit;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.25rem;
  color: inherit;
  padding: 0.15rem 0;
  margin: 0 0 0.75rem;
  border-radius: 0;
}
.ge-edit-title input:hover,
.ge-edit-title input:focus {
  border-bottom-color: var(--leaf);
  outline: none;
}

.ge-card {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  text-align: left;
  cursor: default;
}
.ge-card input[data-f] {
  flex: 1;
  min-width: 4rem;
  border: 0;
  background: transparent;
  font: inherit;
  font-weight: 650;
  color: inherit;
  padding: 0.15rem 0;
  margin: 0;
  border-radius: 0;
  box-shadow: none;
}
.ge-card input[data-f]:focus {
  outline: none;
  border-bottom: 1px solid var(--leaf);
}
.ge-card-media {
  display: flex;
  gap: 0.25rem;
  width: 100%;
  margin-bottom: 0.25rem;
}
.ge-emoji {
  width: 3rem !important;
  flex: 0 0 auto !important;
  text-align: center;
  font-size: 1.1rem;
  border: 1px dashed #ccc !important;
  border-radius: 8px !important;
  padding: 0.15rem !important;
}
.ge-url {
  flex: 1 !important;
  font-size: 0.75rem !important;
  font-weight: 500 !important;
  border: 1px dashed #ccc !important;
  border-radius: 8px !important;
  padding: 0.25rem 0.4rem !important;
  color: var(--muted) !important;
}
.ge-card-del {
  position: absolute;
  top: -0.35rem;
  right: -0.35rem;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 999px;
  background: #b42318;
  color: #fff;
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.ge-card:hover .ge-card-del { opacity: 1; }

.ge-stage-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--line);
}

.ge-pager {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  margin-bottom: 0.75rem;
}
.ge-prompt {
  width: 100%;
  border: 0;
  border-bottom: 2px dashed var(--line);
  background: transparent;
  font: inherit;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.35rem;
  line-height: 1.3;
  resize: vertical;
  margin: 0 0 0.75rem;
  padding: 0.25rem 0;
  color: inherit;
  border-radius: 0;
}
.ge-prompt:focus {
  outline: none;
  border-bottom-color: var(--leaf);
}
.ge-opt {
  display: flex !important;
  align-items: center;
  gap: 0.55rem;
  text-align: left !important;
  width: 100%;
}
.ge-opt-row {
  display: flex;
  gap: 0.35rem;
  align-items: stretch;
}
.ge-opt-row .ge-opt { flex: 1; }
.ge-opt-del {
  flex: 0 0 auto;
  min-width: 2rem;
  padding: 0 0.5rem;
  color: var(--danger);
}
.ge-add-opt {
  margin: 0.55rem 0 0.75rem;
}
.ge-explain-label {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.75rem;
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--ink);
}
.ge-explain-label textarea {
  font: inherit;
  font-weight: 500;
  line-height: 1.45;
  min-height: 4.5rem;
  border: 1px solid rgba(27, 138, 90, 0.35);
  border-radius: 10px;
  background: rgba(27, 138, 90, 0.06);
  padding: 0.65rem 0.75rem;
}

.game-teacher-note {
  margin-top: 0.9rem;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  border: 1px solid rgba(200, 241, 53, 0.45);
  background: linear-gradient(180deg, rgba(200, 241, 53, 0.18), rgba(27, 138, 90, 0.08));
  color: var(--ink);
}
.game-teacher-note strong {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--leaf);
  margin-bottom: 0.35rem;
}
.game-teacher-note p {
  margin: 0;
  line-height: 1.45;
  font-size: 0.95rem;
  white-space: pre-wrap;
}
.ge-opt input {
  flex: 1;
  border: 0;
  background: transparent;
  font: inherit;
  font-weight: 600;
  margin: 0;
  padding: 0;
  box-shadow: none;
  border-radius: 0;
}
.ge-opt input:focus { outline: none; }
.ge-opt-mark {
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(13, 59, 46, 0.08);
  flex: 0 0 auto;
}
.ge-opt.is-picked .ge-opt-mark {
  background: var(--leaf);
  color: #fff;
}
.ge-field-label {
  display: grid;
  gap: 0.25rem;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.65rem;
}
.ge-flash .ge-flash-text {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: center;
  font: inherit;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.4rem;
  margin-top: 0.5rem;
  padding: 0.25rem;
  border-radius: 0;
  box-shadow: none;
}
.ge-flash .ge-flash-text:focus {
  outline: none;
  border-bottom: 2px solid var(--leaf);
}

.game-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 8px;
  margin-right: 0.4rem;
  vertical-align: middle;
  background: #eee;
}
.match-card-media {
  min-height: 72px;
  justify-content: center;
  font-size: 1.8rem;
}
.gap-sentence { font-weight: 650; line-height: 1.5; }
.gap-blank {
  display: inline-block;
  min-width: 3.5rem;
  border-bottom: 2px solid var(--leaf);
  color: var(--leaf);
  text-align: center;
}

.flash-card {
  display: block;
  width: min(100%, 420px);
  margin: 0.75rem auto;
  min-height: 200px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  cursor: pointer;
  padding: 0;
}
.flash-inner { padding: 1.5rem; min-height: 200px; display: grid; place-items: center; }
.flash-face { text-align: center; width: 100%; }
.flash-front strong { display: block; font-size: 1.4rem; margin-top: 0.5rem; }
.flash-back { font-size: 1.25rem; color: var(--ink); }
.flash-card.is-flipped .flash-front { display: none; }
.flash-card:not(.is-flipped) .flash-back { display: none; }

.order-built,
.order-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  min-height: 2.5rem;
  margin-top: 0.75rem;
  padding: 0.55rem;
  border-radius: 10px;
  border: 1px dashed var(--line);
  background: #f7faf8;
}
.order-built { border-style: solid; background: #fff; }
.order-chip { margin: 0; }

@media (max-width: 700px) {
  .topnav { display: none; }
  .room-bar-tools .btn { padding: 0.45rem 0.7rem; font-size: 0.85rem; }
  .shell { width: calc(100% - 1.25rem); }
}
