/* LingoCat — the live whiteboard (student app and teacher dashboard). */

.wb {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  background:
    radial-gradient(60% 50% at 10% 0%, var(--blob-1) 0%, transparent 70%),
    radial-gradient(60% 50% at 100% 100%, var(--blob-3) 0%, transparent 70%),
    linear-gradient(168deg, var(--bg-a), var(--bg-b) 55%, var(--bg-c));
}
.wb-top { display: flex; align-items: center; gap: 10px; padding: calc(8px + env(safe-area-inset-top)) 12px 6px; }
.wb-heading { flex: 1; min-width: 0; display: grid; }
.wb-title { overflow: hidden; color: var(--title); font-size: 1.1rem; text-shadow: var(--title-shadow); text-overflow: ellipsis; white-space: nowrap; }
.wb-status { color: var(--ink-2); font-size: var(--t-xs); font-weight: 700; }
.wb-people { display: flex; align-items: center; padding-left: 8px; }
.wb-avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin-left: -8px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: hsl(var(--h, 280) 65% 58%);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  box-shadow: 0 4px 10px -4px rgb(var(--shade) / 0.5);
}
.wb-avatar.is-teacher { background: linear-gradient(180deg, var(--pink-a), var(--pink-b)); }
.wb-avatar.is-more { background: var(--ink-3); }
.wb-count { margin-left: 8px; color: var(--ink-2); font-size: var(--t-xs); font-weight: 800; white-space: nowrap; }
.wb-perm { padding: 4px 10px 4px 4px; border-radius: 99px; background: var(--glass); font-size: var(--t-s); }
.wb-perm input { width: 40px; height: 24px; }
.wb-perm input::after { top: 2px; left: 2px; width: 20px; height: 20px; }
.wb-perm input:checked::after { transform: translateX(16px); }
.wb-banner { margin: 0 12px 6px; padding: 8px 12px; border-radius: 14px; background: var(--warn-tint); color: var(--warn); font-weight: 800; text-align: center; }

.wb-middle { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.wb-stage { flex: 1; min-height: 0; display: grid; place-items: center; padding: 6px 10px; }
.wb-sheet {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 26px 60px -26px rgb(var(--shade) / 0.65), 0 0 0 1px rgb(var(--shade) / 0.08);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.wb-layer { position: absolute; inset: 0; width: 100%; height: 100%; }
.wb-live { cursor: crosshair; }
.wb-sheet[data-tool="eraser"] .wb-live { cursor: cell; }
.wb-sheet[data-tool="text"] .wb-live { cursor: text; }
.wb-text-input {
  position: absolute;
  z-index: 3;
  min-width: 140px;
  max-width: 70%;
  padding: 0 6px;
  border: 2px dashed var(--accent);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  font-family: var(--font-ui);
  font-weight: 800;
  line-height: 1.18;
  resize: none;
  outline: none;
}
.wb-follow {
  position: absolute;
  top: 12px;
  left: 50%;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 8px;
  border: 1.5px solid var(--glass-line);
  border-radius: 99px;
  background: var(--glass-strong);
  color: var(--ink);
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transform: translateX(-50%);
  box-shadow: 0 12px 24px -12px rgb(var(--shade) / 0.6);
}
.wb-follow .icon { color: var(--accent-ink); }
.wb-follow strong { color: var(--accent-ink); }
.wb-rotate { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 0 16px 6px; color: var(--ink-2); font-size: var(--t-s); font-weight: 700; text-align: center; }

.wb-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; padding: 4px 12px; }
.wb-next .icon { transform: rotate(180deg); }
.wb-page-label { min-width: 96px; font-size: var(--t-s); text-align: center; }
.wb-mode { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px 5px 10px; border-radius: 99px; background: var(--glass); color: var(--ink-2); font-size: var(--t-xs); font-weight: 800; }
.wb-mode.is-on { background: var(--good-tint); color: var(--good-ink); }

.wb-tools {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 20px);
  margin: 6px auto calc(10px + env(safe-area-inset-bottom));
  padding: 8px 10px;
  overflow-x: auto;
  border: 1.5px solid var(--glass-line);
  border-radius: 26px;
  background: linear-gradient(180deg, var(--glass-strong), var(--glass));
  box-shadow: 0 18px 36px -18px rgb(var(--shade) / 0.6);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  scrollbar-width: none;
}
.wb-tools::-webkit-scrollbar { display: none; }
.wb-group { display: flex; flex: none; gap: 4px; }
.wb-tool { display: grid; place-items: center; width: 46px; height: 46px; flex: none; border: 0; border-radius: 16px; background: transparent; color: var(--ink); cursor: pointer; }
.wb-tool:hover { background: var(--glass-2); }
.wb-tool[aria-pressed="true"] { color: var(--accent-ink); background: var(--glass-strong); box-shadow: inset 0 0 0 2px var(--accent), 0 6px 12px -8px rgb(var(--shade) / 0.6); }
.wb-sep { width: 1.5px; height: 30px; flex: none; background: var(--line-strong); }
.wb-colors,
.wb-sizes { display: flex; flex: none; align-items: center; gap: 5px; }
.wb-color { width: 28px; height: 28px; border: 3px solid #fff; border-radius: 50%; background: var(--c); cursor: pointer; box-shadow: 0 0 0 1px rgb(var(--shade) / 0.25); transition: transform 0.12s ease; }
.wb-color[aria-checked="true"] { box-shadow: 0 0 0 3px var(--accent); transform: scale(1.1); }
.wb-size { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 12px; background: transparent; cursor: pointer; }
.wb-size i { display: block; border-radius: 50%; background: var(--ink); }
.wb-size[aria-checked="true"] { background: var(--glass-strong); box-shadow: inset 0 0 0 2px var(--accent); }
.wb-readonly { display: flex; align-items: center; gap: 8px; padding: 0 8px; color: var(--ink-2); font-size: var(--t-s); font-weight: 700; }

/* pages panel (teacher) */
.wb-page-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.wb-page-tile { position: relative; padding: 0; overflow: hidden; aspect-ratio: 16 / 9; border: 2px solid var(--glass-line); border-radius: 10px; background: #fff; cursor: pointer; }
.wb-page-tile[aria-current="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.wb-page-tile img { width: 100%; height: 100%; object-fit: contain; }
.wb-page-num { position: absolute; bottom: 4px; left: 6px; padding: 0 6px; border-radius: 99px; background: rgba(40, 20, 60, 0.72); color: #fff; font-size: 0.7rem; font-weight: 800; }
.wb-mini { display: block; width: 100%; height: 100%; background: #fff; }
.btn .wb-mini { width: 26px; height: 16px; border-radius: 3px; box-shadow: 0 0 0 1px rgb(var(--shade) / 0.2); }
.wb-mini.is-grid { background-image: linear-gradient(rgba(98, 70, 140, 0.25) 1px, transparent 1px), linear-gradient(90deg, rgba(98, 70, 140, 0.25) 1px, transparent 1px); background-size: 12px 12px; }
.wb-mini.is-lines { background-image: linear-gradient(rgba(47, 111, 228, 0.35) 1px, transparent 1px); background-size: 100% 12px; }
.wb-sub { margin: 16px 0 8px; font-size: 1rem; }
.wb-materials { display: grid; gap: 8px; }
.wb-material { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1.5px solid var(--glass-line); border-radius: 16px; background: var(--glass-strong); color: var(--ink); text-align: left; cursor: pointer; }
.wb-material:hover { border-color: var(--accent); }
.wb-material img { width: 80px; height: 45px; flex: none; border-radius: 6px; background: #fff; object-fit: contain; }
.wb-material span { display: grid; }
.wb-delete-page { margin-top: 16px; }

@media (max-width: 600px) {
  .wb-count { display: none; }
  .wb-perm span { font-size: var(--t-xs); }
  .wb-tool { width: 42px; height: 42px; }
}
[data-theme="night"] .wb-banner { color: #ffe2a8; }
