:root {
  --bg-primary: #f5f5f5;
  --bg-surface: #ffffff;
  --bg-dark: #1e1e2e;
  --text-primary: #2d2d2d;
  --text-muted: #777;
  --accent: #5b6abf;
  --accent-hover: #4a59a8;
  --danger: #dc3545;
  --success: #198754;
  --toolbar-bg: #ffffff;
  --toolbar-shadow: 0 -2px 16px rgba(0,0,0,.08);
}

* { box-sizing: border-box; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  margin: 0;
}

/* ── Top bar (minimal) ──────────────────────────── */
.topbar {
  height: 48px;
  background: var(--bg-surface);
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  z-index: 100;
}
.topbar .brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--accent);
  text-decoration: none;
}
.topbar .nav-links {
  display: flex;
  align-items: center;
  gap: .75rem;
}
.topbar .nav-links a {
  color: var(--text-primary);
  text-decoration: none;
  font-size: .875rem;
  padding: .25rem .5rem;
  border-radius: 6px;
  transition: background .15s;
}
.topbar .nav-links a:hover { background: #eee; }

/* Board info in topbar */
.board-info {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex: 1;
  justify-content: center;
  min-width: 0;
}
.board-name-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.board-name-icon {
  position: absolute;
  right: 8px;
  width: 14px;
  height: 14px;
  color: #aaa;
  pointer-events: none;
  transition: opacity .15s;
}
.board-name-input:focus ~ .board-name-icon { opacity: 0; }
.board-name-input {
  border: 1px dashed #c0c4cc;
  background: rgba(0,0,0,.02);
  font-weight: 700;
  font-size: 1rem;
  padding: .3rem .6rem;
  border-radius: 8px;
  width: 260px;
  max-width: 40vw;
  text-align: center;
  color: var(--text-primary);
  transition: border-color .15s, background .15s, box-shadow .15s;
  cursor: text;
}
.board-name-input::placeholder {
  color: #a0a4b0;
  font-weight: 500;
  font-style: italic;
}
.board-name-input:hover {
  background: rgba(0,0,0,.04);
  border-color: #999;
  border-style: solid;
}
.board-name-input:focus {
  outline: none;
  border-color: var(--accent);
  border-style: solid;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(91,106,191,.15);
  text-align: left;
}
.save-status {
  font-size: .65rem;
  color: var(--success);
  white-space: nowrap;
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
}
.board-info { position: relative; }

/* Topbar text button */
.topbar-text-btn {
  display: flex;
  align-items: center;
  gap: .35rem;
  background: none;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: .25rem .6rem;
  font-size: .8rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-primary);
  transition: background .12s;
}
.topbar-text-btn:hover { background: #f0f0f0; }

/* ── Auth pages (login, register) ───────────────── */
.auth-wrapper {
  min-height: calc(100vh - 48px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}
.auth-card {
  background: var(--bg-surface);
  border-radius: 12px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 4px 24px rgba(0,0,0,.06);
}
.auth-card h2 {
  text-align: center;
  margin-bottom: 1.5rem;
  font-weight: 700;
}

/* Google sign-in button */
.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  width: 100%;
  padding: .65rem 1rem;
  border: 1px solid #dadce0;
  border-radius: 8px;
  background: #fff;
  color: #3c4043;
  font-weight: 500;
  font-size: .9rem;
  text-decoration: none;
  cursor: pointer;
  transition: box-shadow .15s, background .15s;
}
.google-btn:hover { background: #f7f8f8; box-shadow: 0 1px 3px rgba(0,0,0,.1); color: #3c4043; }
.google-btn.disabled { opacity: .5; cursor: not-allowed; }
.google-btn.disabled:hover { background: #fff; box-shadow: none; }
.google-btn svg { flex-shrink: 0; }
.google-lan-notice {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  margin-top: .5rem;
  padding: .5rem .75rem;
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: 8px;
  font-size: .78rem;
  color: #7a6200;
  line-height: 1.4;
}
.google-lan-notice svg { flex-shrink: 0; margin-top: 1px; color: #c49000; }

/* Auth divider */
.auth-divider {
  display: flex;
  align-items: center;
  margin: 1.25rem 0;
  gap: .75rem;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #ddd;
}
.auth-divider span {
  font-size: .8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* ── Landing page ───────────────────────────────── */
.landing {
  min-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
}
.landing h1 {
  font-size: 2.8rem;
  font-weight: 800;
  margin-bottom: .5rem;
}
.landing .subtitle {
  font-size: 1.15rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  max-width: 560px;
}
.btn-lg-custom { padding: .7rem 2rem; font-size: 1rem; }

/* ── Features section ─────────────────────────── */
.features-section {
  padding: 4rem 1rem;
  background: var(--bg-surface);
}
.section-title {
  text-align: center;
  font-weight: 800;
  font-size: 1.8rem;
  margin-bottom: .5rem;
}
.section-subtitle {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 2.5rem;
}
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  max-width: 900px;
  margin: 0 auto;
}
.feature-card {
  padding: 1.5rem;
  border-radius: 12px;
  background: var(--bg-primary);
  text-align: center;
}
.feature-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto .75rem;
  color: var(--accent);
}
.feature-icon svg { width: 100%; height: 100%; }
.feature-card h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: .4rem; }
.feature-card p { font-size: .875rem; color: var(--text-muted); margin: 0; }

/* ── Pricing section ──────────────────────────── */
.pricing-section {
  padding: 4rem 1rem;
  background: var(--bg-primary);
}
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  max-width: 800px;
  margin: 2rem auto 0;
}
.pricing-card {
  background: var(--bg-surface);
  border-radius: 12px;
  padding: 2rem 1.5rem;
  text-align: center;
  box-shadow: 0 2px 12px rgba(0,0,0,.04);
  border: 2px solid transparent;
}
.pricing-card-popular {
  border-color: var(--accent);
  box-shadow: 0 4px 24px rgba(91,106,191,.15);
}
.pricing-badge {
  font-weight: 700;
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--accent);
  margin-bottom: .75rem;
}
.pricing-price {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 1.25rem;
}
.pricing-price span { font-size: .9rem; font-weight: 400; color: var(--text-muted); }
.pricing-features {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
  font-size: .9rem;
}
.pricing-features li {
  padding: .35rem 0;
  border-bottom: 1px solid #eee;
}
.pricing-features li:last-child { border-bottom: none; }

/* ── About section ────────────────────────────── */
.about-section {
  padding: 4rem 1rem;
  background: var(--bg-surface);
}
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  max-width: 900px;
  margin: 2rem auto 0;
  align-items: start;
}
@media (max-width: 768px) {
  .about-grid { grid-template-columns: 1fr; }
}
.about-text p {
  font-size: .95rem;
  line-height: 1.7;
  color: #444;
}
.about-values { display: flex; flex-direction: column; gap: 1.25rem; }
.about-value {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
}
.about-value-icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  color: var(--accent);
}
.about-value-icon svg { width: 100%; height: 100%; }

/* ── Steps section ───────────────────────────── */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  max-width: 800px;
  margin: 0 auto;
}
.step-card {
  text-align: center;
  padding: 1.5rem 1rem;
}
.step-number {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto .75rem;
}
.step-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: .3rem; }
.step-card p { font-size: .85rem; color: var(--text-muted); margin: 0; }

/* ── FAQ section ─────────────────────────────── */
.faq-list { display: flex; flex-direction: column; gap: .5rem; margin-top: 1.5rem; }
.faq-item {
  background: var(--bg-surface);
  border-radius: 10px;
  padding: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
  border: 1px solid #eee;
}
.faq-item summary {
  padding: 1rem 1.25rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.faq-item summary::after {
  content: "+";
  font-size: 1.2rem;
  color: var(--text-muted);
  transition: transform .2s;
}
.faq-item[open] summary::after {
  content: "\2212";
}
.faq-item p {
  padding: 0 1.25rem 1rem;
  margin: 0;
  font-size: .9rem;
  color: #555;
  line-height: 1.6;
}

/* ── Scroll-down hint ─────────────────────────── */
.scroll-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2.5rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid #ddd;
  color: var(--text-muted);
  text-decoration: none;
  animation: scrollBounce 2s ease-in-out infinite;
  transition: border-color .15s, color .15s;
}
.scroll-hint:hover { border-color: var(--accent); color: var(--accent); }
.scroll-hint svg { width: 22px; height: 22px; }
@keyframes scrollBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

/* ── Pricing popular tag ─────────────────────── */
.pricing-popular-tag {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: .2rem .75rem;
  border-radius: 20px;
  white-space: nowrap;
}
.pricing-card { position: relative; }

/* ── Footer ──────────────────────────────────── */
.site-footer {
  background: var(--bg-dark);
  color: #ccc;
  padding: 3rem 1rem 0;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2rem;
  max-width: 900px;
  margin: 0 auto;
}
@media (max-width: 768px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
.footer-brand .footer-logo {
  font-weight: 800;
  font-size: 1.2rem;
  color: #fff;
  display: block;
  margin-bottom: .5rem;
}
.footer-brand p {
  font-size: .85rem;
  line-height: 1.5;
  margin: 0;
  color: #999;
}
.footer-links h4 {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: #fff;
  margin-bottom: .75rem;
}
.footer-links a {
  display: block;
  color: #999;
  text-decoration: none;
  font-size: .85rem;
  padding: .2rem 0;
  transition: color .12s;
}
.footer-links a:hover { color: #fff; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.1);
  margin-top: 2rem;
  padding: 1.25rem 0;
  text-align: center;
}
.footer-bottom p {
  margin: 0;
  font-size: .8rem;
  color: #777;
}

/* ── Buttons ────────────────────────────────────── */
.btn-accent {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: .6rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
  text-decoration: none;
  display: inline-block;
}
.btn-accent:hover { background: var(--accent-hover); color: #fff; }
.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 2px solid var(--accent);
  padding: .55rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
  display: inline-block;
}
.btn-outline:hover { background: var(--accent); color: #fff; }
.btn-danger-outline {
  background: transparent;
  color: var(--danger);
  border: 2px solid var(--danger);
  padding: .55rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
  display: inline-block;
}
.btn-danger-outline:hover { background: var(--danger); color: #fff; }

/* ── Classroom layout ───────────────────────────── */
.classroom-screen {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #f9f9fb;
}

.classroom-main {
  flex: 1 1 0;
  min-height: 0;
  position: relative;
  overflow: auto;
}

.canvas-wrapper {
  position: relative;
  width: 4000px;
  height: 3000px;
  min-width: 100%;
  min-height: 100%;
}

#whiteboardCanvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #fff;
  cursor: crosshair;
  touch-action: none;
}

#blockLayer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

/* ── Bottom toolbar (Classroomscreen style) ─────── */
.bottom-toolbar {
  position: relative;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .25rem;
  padding: .5rem 1rem;
  background: var(--toolbar-bg);
  box-shadow: var(--toolbar-shadow);
  border-top: 1px solid #e8e8e8;
  flex-wrap: nowrap;
  flex-shrink: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.toolbar-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  padding: .4rem .65rem;
  border-radius: 10px;
  cursor: pointer;
  color: var(--text-primary);
  font-size: .65rem;
  transition: background .12s;
  min-width: 56px;
}
.toolbar-btn:hover { background: #f0f0f0; }
.toolbar-btn.active {
  background: #eef0ff;
  color: var(--accent);
}
.toolbar-btn svg {
  width: 26px;
  height: 26px;
}
.toolbar-sep {
  width: 1px;
  height: 36px;
  background: #ddd;
  margin: 0 .35rem;
}

/* Paint sub-toolbar (colors + sizes) */
.paint-options {
  display: none;
  align-items: center;
  gap: .5rem;
  padding: .4rem .75rem;
  background: var(--toolbar-bg);
  border-top: 1px solid #eee;
  justify-content: center;
  flex-wrap: nowrap;
  flex-shrink: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.paint-options.visible { display: flex; }

#drawOptions, #eraserOptions {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color .15s, transform .1s;
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.active { border-color: #333; }

.size-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e0e0e0;
  border: 2px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color .15s;
}
.size-btn.active { border-color: var(--accent); }
.size-dot {
  border-radius: 50%;
  background: #333;
}
.size-dot-outline {
  background: transparent;
  border: 2px solid #666;
}

.tool-slider {
  width: 100px;
  accent-color: var(--accent);
  cursor: pointer;
}
.slider-label {
  font-size: .75rem;
  color: var(--text-muted);
  min-width: 32px;
  text-align: center;
}

/* ── Block cards (draggable widgets) ────────────── */
.wb-block {
  position: absolute;
  background: var(--bg-surface);
  border-radius: 10px;
  box-shadow: 0 2px 12px rgba(0,0,0,.1);
  min-width: 200px;
  overflow: hidden;
  pointer-events: auto;
}
.wb-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .4rem .6rem;
  background: #f5f5f5;
  cursor: grab;
  font-size: .8rem;
  font-weight: 600;
  border-bottom: 1px solid #eee;
}
.wb-block-header:active { cursor: grabbing; }
.wb-block-close {
  background: none;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  color: #999;
  line-height: 1;
}
.wb-block-close:hover { color: var(--danger); }
.wb-block-body { padding: .75rem; }

/* Text block formatting toolbar */
.wb-text-toolbar {
  display: flex;
  gap: 2px;
  margin-bottom: .4rem;
  padding-bottom: .4rem;
  border-bottom: 1px solid #eee;
}
.wb-text-toolbar button {
  background: #f0f0f0;
  border: none;
  border-radius: 4px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: .8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .12s;
}
.wb-text-toolbar button:hover { background: #ddd; }
.wb-text-editor {
  min-height: 80px;
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: .5rem;
  font-size: .9rem;
  outline: none;
}
.wb-text-editor:focus { border-color: var(--accent); }

/* Background color picker popup */
.bg-picker-popup {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  border-radius: 12px;
  padding: .75rem;
  box-shadow: 0 4px 24px rgba(0,0,0,.15);
  z-index: 200;
  width: 240px;
}
.bg-picker-popup.visible { display: block; }
.bg-picker-popup .bg-label {
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  margin-bottom: .4rem;
}
.bg-picker-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: .5rem;
}
.bg-picker-swatch {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color .12s, transform .1s;
}
.bg-picker-swatch:hover { transform: scale(1.1); }
.bg-picker-swatch.active { border-color: var(--accent); }
.bg-picker-custom {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.bg-picker-custom label {
  font-size: .8rem;
  color: var(--text-muted);
}
.bg-picker-custom input[type="color"] {
  width: 36px;
  height: 28px;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 0;
  cursor: pointer;
}

/* ── Boards page ─────────────────────────────────── */
.boards-page {
  max-width: 960px;
  margin: 2rem auto;
  padding: 0 1rem;
}
.boards-page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}
.boards-page-header h2 { font-weight: 700; margin: 0; }
.boards-new-btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem 1.25rem;
  font-size: .9rem;
  border: none;
  border-radius: 8px;
  text-decoration: none;
}
.boards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
}
.board-card {
  position: relative;
  background: var(--bg-surface);
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
  overflow: hidden;
  transition: box-shadow .15s, transform .15s;
}
.board-card:hover {
  box-shadow: 0 6px 24px rgba(0,0,0,.12);
  transform: translateY(-2px);
}
.board-card-link {
  display: block;
  text-decoration: none;
  color: inherit;
}
.board-card-preview {
  width: 100%;
  height: 140px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid #eee;
}
.board-card-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.board-card-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}
.board-card-info {
  padding: .75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .15rem;
}
.board-card-name {
  font-weight: 600;
  font-size: .95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.board-card-date {
  font-size: .75rem;
  color: var(--text-muted);
}
.board-card-delete {
  position: absolute;
  top: .5rem;
  right: .5rem;
  opacity: 0;
  transition: opacity .15s;
}
.board-card:hover .board-card-delete { opacity: 1; }
.board-card-delete button {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,.9);
  color: #666;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  transition: color .12s, background .12s;
}
.board-card-delete button:hover {
  color: var(--danger);
  background: #fff;
}
.boards-empty {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}
.boards-empty p {
  font-size: 1.1rem;
  margin: 0;
}

/* ── Profile page ───────────────────────────────── */
.profile-page {
  max-width: 600px;
  margin: 2rem auto;
  padding: 0 1rem;
}
.profile-card {
  background: var(--bg-surface);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 2px 12px rgba(0,0,0,.05);
  margin-bottom: 1.5rem;
}
.profile-card h3 { margin-bottom: 1rem; font-weight: 700; }
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .75rem 0;
  border-bottom: 1px solid #eee;
}
.info-row:last-child { border-bottom: none; }
.info-label { color: var(--text-muted); font-size: .875rem; }
.info-value { font-weight: 600; }

/* ── Admin table ────────────────────────────────── */
.admin-page {
  max-width: 900px;
  margin: 2rem auto;
  padding: 0 1rem;
}
.admin-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--bg-surface);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,.05);
}
.admin-table th {
  background: #f5f5f5;
  padding: .75rem 1rem;
  text-align: left;
  font-size: .8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.admin-table td {
  padding: .75rem 1rem;
  border-top: 1px solid #eee;
  vertical-align: middle;
}
.badge-admin {
  background: var(--accent);
  color: #fff;
  padding: .15rem .5rem;
  border-radius: 4px;
  font-size: .75rem;
  font-weight: 600;
}
.badge-user {
  background: #e0e0e0;
  color: #555;
  padding: .15rem .5rem;
  border-radius: 4px;
  font-size: .75rem;
  font-weight: 600;
}

/* ── Fullscreen tweaks ──────────────────────────── */
.classroom-screen:-webkit-full-screen .topbar,
.classroom-screen:fullscreen .topbar { display: none; }
.classroom-screen:-webkit-full-screen .classroom-main,
.classroom-screen:fullscreen .classroom-main { height: calc(100vh - 80px); }

/* ── Eraser cursor ────────────────────────────────── */
.eraser-cursor {
  position: absolute;
  pointer-events: none;
  border: 2px solid rgba(0,0,0,.35);
  border-radius: 50%;
  z-index: 20;
  box-shadow: 0 0 0 1px rgba(255,255,255,.5);
}

/* ── QR overlay (fullscreen) ─────────────────────── */
.qr-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,10,20,.92);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.qr-overlay-content {
  text-align: center;
  color: #fff;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 20px;
  padding: 2.5rem 3rem;
  max-width: 420px;
  width: 90%;
}
.qr-overlay-content h2 {
  font-weight: 700;
  font-size: 1.5rem;
  margin-bottom: .25rem;
  line-height: 1.3;
}
.qr-overlay-subtitle {
  font-size: .85rem;
  color: rgba(255,255,255,.5);
  margin-bottom: 1.5rem;
}
.qr-overlay-url {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: .3px;
  color: #adf;
  word-break: break-all;
  background: rgba(0,0,0,.3);
  padding: .5rem .75rem;
  border-radius: 8px;
  font-family: 'Consolas', 'Courier New', monospace;
}
.qr-overlay-content canvas,
.qr-overlay-content img {
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,.4);
}

/* ── Resizable blocks ────────────────────────────── */
.wb-block {
  resize: both;
  overflow: auto;
  min-width: 160px;
  min-height: 80px;
}

/* ── Poll block buttons ──────────────────────────── */
.poll-actions {
  display: flex;
  gap: .35rem;
  flex-wrap: wrap;
  margin-top: .5rem;
}
.poll-actions button {
  font-size: .7rem;
  padding: .2rem .5rem;
  border-radius: 5px;
  border: 1px solid #ddd;
  background: #f5f5f5;
  cursor: pointer;
  transition: background .12s;
}
.poll-actions button:hover { background: #e0e0e0; }
.poll-actions .poll-btn-danger { color: var(--danger); border-color: var(--danger); }
.poll-actions .poll-btn-success { color: var(--success); border-color: var(--success); }

/* ── Shape options bar (inline) ──────────────── */
#shapeOptions {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.shape-bar-btn {
  width: 32px;
  height: 32px;
  border: 2px solid transparent;
  border-radius: 8px;
  background: #e8e8e8;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #555;
  padding: 3px;
  transition: border-color .12s, background .12s, color .12s;
}
.shape-bar-btn:hover { background: #eef0ff; border-color: var(--accent); color: var(--accent); }
.shape-bar-btn svg { width: 100%; height: 100%; }
.shape-outline-label {
  display: flex;
  align-items: center;
  gap: .25rem;
  font-size: .75rem;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
}

/* ── Shape block (on canvas) ─────────────────── */
.wb-shape-block {
  position: absolute;
  pointer-events: auto;
  cursor: move;
  user-select: none;
}
.wb-shape-block svg {
  width: 100%;
  height: 100%;
  display: block;
}
.wb-shape-rotate {
  position: absolute;
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
  width: 18px;
  height: 18px;
  background: var(--accent);
  border-radius: 50%;
  cursor: grab;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.wb-shape-rotate:active { cursor: grabbing; }
.wb-shape-delete {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 20px;
  height: 20px;
  background: var(--danger);
  color: #fff;
  border: 2px solid #fff;
  border-radius: 50%;
  font-size: .7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
  opacity: 0;
  transition: opacity .15s;
}
.wb-shape-block:hover .wb-shape-delete,
.wb-shape-block:hover .wb-shape-rotate { opacity: 1; }
.wb-shape-resize {
  position: absolute;
  bottom: -6px;
  right: -6px;
  width: 14px;
  height: 14px;
  background: var(--accent);
  border: 2px solid #fff;
  border-radius: 3px;
  cursor: nwse-resize;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
  opacity: 0;
  transition: opacity .15s;
}
.wb-shape-block:hover .wb-shape-resize { opacity: 1; }
.wb-shape-selected { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.wb-shape-selected .wb-shape-delete,
.wb-shape-selected .wb-shape-rotate,
.wb-shape-selected .wb-shape-resize { opacity: 1; }

/* ── Tablet / iPad responsive ───────────────────── */
@media (max-width: 1024px) {
  .topbar {
    height: 42px;
    padding: 0 .5rem;
  }
  .topbar .brand { font-size: .95rem; }
  .board-name-input {
    width: 160px;
    max-width: 30vw;
    font-size: .85rem;
    padding: .2rem .4rem;
  }
  .topbar .nav-links { gap: .35rem; }
  .topbar .nav-links a { font-size: .75rem; padding: .2rem .35rem; }
  .topbar-text-btn { font-size: .7rem; padding: .2rem .4rem; }

  .bottom-toolbar {
    padding: .35rem .5rem;
    gap: .15rem;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    justify-content: flex-start;
    flex-wrap: nowrap;
  }
  .toolbar-btn {
    min-width: 44px;
    padding: .3rem .4rem;
    font-size: .55rem;
    flex-shrink: 0;
  }
  .toolbar-btn svg { width: 22px; height: 22px; }
  .toolbar-sep { height: 28px; margin: 0 .2rem; }

  .paint-options {
    padding: .3rem .5rem;
    gap: .35rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    justify-content: flex-start;
  }
  .color-swatch { width: 24px; height: 24px; }
  .size-btn { width: 24px; height: 24px; }
  .tool-slider { width: 70px; }

  .bg-picker-popup {
    bottom: calc(100% + 4px);
    width: 200px;
    padding: .5rem;
  }
  .bg-picker-swatch { width: 30px; height: 30px; }

  .classroom-screen .topbar { height: 42px; }
  .classroom-main { height: calc(100vh - 42px - 70px); }
}

@media (max-width: 768px) {
  .topbar { height: 38px; }
  .board-name-input { width: 120px; max-width: 25vw; font-size: .8rem; }
  .topbar .nav-links a { font-size: .7rem; }
  .board-name-icon { width: 12px; height: 12px; }

  .bottom-toolbar { padding: .25rem .4rem; }
  .toolbar-btn {
    min-width: 38px;
    padding: .25rem .3rem;
    font-size: .5rem;
  }
  .toolbar-btn svg { width: 20px; height: 20px; }
  .toolbar-btn span { display: none; }
  .toolbar-sep { height: 24px; }
}

/* Ensure toolbar is always visible and above canvas on touch devices */
@media (pointer: coarse) {
  .bottom-toolbar {
    padding-bottom: max(.5rem, env(safe-area-inset-bottom));
  }
  .paint-options {
    padding-bottom: .25rem;
  }
}

/* ── Flash messages ─────────────────────────────── */
.flash-container {
  position: fixed;
  top: 56px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  max-width: 500px;
  width: 90%;
}
