/* Study hall scene HUD. Uses the shell's palette variables from styles.css. */
.sh { position: absolute; inset: 0; overflow: hidden; background: linear-gradient(#a9d8f0, #e8f1e2 55%, #9acb6a); user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.sh-gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; outline: none; touch-action: none; }
.sh button { touch-action: manipulation; }
.sh-gl:focus-visible { outline: 3px solid #7c9db7aa; outline-offset: -3px; border-radius: 0; }

/* name tag + seat markers */
.sh-tags, .sh-marks { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.sh-tags { z-index: 3; }
.sh-marks { z-index: 2; }
.sh-tag {
  position: absolute; left: 0; top: 0; display: flex; align-items: center; gap: 5px;
  height: 24px; padding: 0 10px 0 8px; border-radius: 15px; border: 1px solid #e4b69b;
  background: var(--coral); color: var(--coral-ink); font-size: 12px; font-weight: 800; letter-spacing: .02em; white-space: nowrap;
  box-shadow: 0 2px 0 #c0775b; transition: opacity .3s; will-change: transform;
}
.sh-tag i { width: 7px; height: 7px; border-radius: 50%; background: #fffbe8; opacity: .85; }
.sh-tag::after { content: ""; position: absolute; left: 50%; bottom: -4px; width: 7px; height: 7px; margin-left: -3.5px; background: inherit; transform: rotate(45deg); border-radius: 1.5px; z-index: -1; }
.sh-mark {
  position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; background: #fff9ebee; color: var(--blue-deep);
  box-shadow: 0 2px 0 #c6bb97, 0 4px 10px #5149321f; opacity: 0; transition: opacity .25s; will-change: transform;
}
.sh-mark svg { width: 17px; height: 17px; stroke-width: 2; }
.sh-mark.on { opacity: 1; animation: sh-bob 1.8s ease-in-out infinite; }
.sh-mark.mine { background: var(--coral); color: var(--coral-ink); box-shadow: 0 2px 0 var(--coral-deep); }
@keyframes sh-bob { 50% { margin-top: -4px; } }

/* camera controls */
.sh-cam {
  position: absolute; z-index: 5; right: max(14px, env(safe-area-inset-right)); bottom: calc(var(--safe-b) + 18px);
  display: grid; grid-template-columns: 44px; gap: 6px; padding: 6px; border-radius: 22px;
  background: #fff9ebe6; border: 1px solid #fffbe4; box-shadow: var(--chip-shadow);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.sh-cam button { width: 44px; height: 44px; border-radius: 16px; display: grid; place-items: center; color: var(--ink); transition: background .15s, transform .12s; }
.sh-cam button:hover { background: var(--soft); }
.sh-cam button:active { transform: scale(.94); background: var(--soft); }
.sh-cam svg { width: 22px; height: 22px; stroke-width: 2.1; }
.sh-cam [data-cam="reset"] { color: var(--blue-deep); }

/* bottom dock */
.sh-dock {
  position: absolute; z-index: 5; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--safe-b) + 18px); width: min(480px, calc(100% - 28px));
  display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 16px; min-height: 64px;
  border-radius: 24px; border: 1px solid #fffbe4; background: var(--panel); box-shadow: var(--panel-shadow);
}
.sh-line { flex: 1; min-width: 0; margin: 0; display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 800; color: var(--ink); line-height: 1.4; }
.sh-btn { flex: none; height: 44px; padding: 0 18px; border-radius: 16px; font-weight: 900; font-size: 14.5px; letter-spacing: .03em; font-family: var(--display); white-space: nowrap; transition: transform .12s, box-shadow .12s; }
.sh-btn.primary { background: var(--coral); color: var(--coral-ink); box-shadow: 0 3px 0 var(--coral-deep); }
.sh-btn.primary:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--coral-deep); }
.sh-btn.big { flex: 1; height: 48px; font-size: 16px; }
.sh-btn.ghost { color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.sh-btn.ghost:hover { background: var(--soft); }
.sh-timer { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.sh-timer span { font-size: 12px; font-weight: 800; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sh-timer span b { font-family: var(--num); font-variant-numeric: tabular-nums; color: var(--ink); }
.sh-timer > b { font-family: var(--num); font-size: 24px; font-weight: 900; letter-spacing: .02em; color: var(--ink-strong); font-variant-numeric: tabular-nums; line-height: 1.1; }
.sh-timer.rest > b { color: var(--blue-deep); }
.sh-today { flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; height: 44px; padding: 0 10px; margin-left: -6px; border-radius: 14px; background: var(--soft); color: var(--ink-soft); font-size: 10.5px; font-weight: 800; line-height: 1.1; }
.sh-today b { font-family: var(--num); font-size: 15px; font-weight: 900; color: var(--ink-strong); font-variant-numeric: tabular-nums; }
.sh-dots { display: inline-flex; gap: 4px; }
.sh-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--coral); animation: ld .9s ease-in-out infinite alternate; }
.sh-dots i:nth-child(2) { animation-delay: .15s; } .sh-dots i:nth-child(3) { animation-delay: .3s; }

/* messages */
.sh-toast, .sh-hint {
  position: absolute; z-index: 6; left: 50%; max-width: calc(100% - 40px); width: max-content; padding: 10px 16px; border-radius: 16px;
  font-size: 13.5px; font-weight: 700; text-align: center; line-height: 1.45;
  opacity: 0; transform: translate(-50%, -8px); transition: opacity .3s, transform .3s; pointer-events: none;
}
.sh-toast { top: calc(var(--bar-h) + 10px); background: #78664f; color: #fff7dc; }
.sh-hint { top: calc(var(--bar-h) + 10px); background: var(--glass); color: var(--ink); box-shadow: var(--chip-shadow); }
.sh-toast.show ~ .sh-hint.show, .sh-hint.show:has(~ .sh-toast.show) { top: calc(var(--bar-h) + 62px); }
.sh-toast.show, .sh-hint.show { opacity: 1; transform: translate(-50%, 0); }

/* today sheet */
.sh-scrim { position: absolute; inset: 0; z-index: 7; background: #51493226; opacity: 0; transition: opacity .25s; }
.sh-scrim.open { opacity: 1; }
.sh-sheet {
  position: absolute; z-index: 8; left: 50%; bottom: calc(var(--safe-b) + 14px); width: min(420px, calc(100% - 24px));
  max-height: calc(100% - var(--bar-h) - 40px); overflow: auto; padding: 18px 20px 16px;
  border-radius: 26px; border: 1px solid #fffbe4; background: var(--panel); box-shadow: var(--panel-shadow);
  transform: translate(-50%, 16px); opacity: 0; transition: transform .25s cubic-bezier(.2, .9, .3, 1.15), opacity .2s;
}
.sh-sheet.open { transform: translate(-50%, 0); opacity: 1; }
.sh-x { position: absolute; right: 10px; top: 10px; width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center; color: var(--ink-soft); }
.sh-x:hover { background: var(--soft); }
.sh-x svg { width: 20px; height: 20px; }
.sh-eyebrow { margin: 0 0 4px; font-size: 13px; font-weight: 800; color: var(--ink-soft); }
.sh-total { display: flex; align-items: baseline; gap: 4px; margin-bottom: 12px; color: var(--ink-soft); font-weight: 800; font-size: 14px; }
.sh-total b { font-family: var(--num); font-size: 36px; font-weight: 900; color: var(--ink-strong); line-height: 1; }
.sh-tl-bar { position: relative; height: 14px; border-radius: 7px; background: var(--soft); overflow: hidden; }
.sh-tl-bar i { position: absolute; top: 0; bottom: 0; border-radius: 7px; background: var(--blue); }
.sh-tl-bar i.open { background: var(--coral); }
.sh-tl-scale { display: flex; justify-content: space-between; margin-top: 5px; font-size: 11px; font-weight: 700; color: var(--ink-soft); font-family: var(--num); }
.sh-log { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.sh-log li { display: flex; justify-content: space-between; gap: 10px; padding: 9px 12px; border-radius: 14px; background: var(--soft); font-size: 13.5px; font-weight: 700; color: var(--ink); }
.sh-log li b { font-weight: 900; color: var(--ink-strong); }
.sh-log li.open { background: #fbe9df; }
.sh-log li.empty { justify-content: center; color: var(--ink-soft); }
.sh-foot { margin: 12px 0 0; font-size: 12px; color: var(--ink-soft); text-align: center; }

/* loading / failure */
.sh-loading { position: absolute; inset: 0; z-index: 9; display: grid; place-content: center; justify-items: center; gap: 14px; padding: 24px; text-align: center; background: var(--cream); color: #8a7056; font-size: 14px; font-weight: 700; transition: opacity .45s; }
.sh-loading p { margin: 0; max-width: 22em; line-height: 1.6; }
.sh-loading.gone { opacity: 0; pointer-events: none; }

@media (max-width: 759px) {
  .sh-cam { bottom: calc(var(--safe-b) + 100px); right: max(10px, env(safe-area-inset-right)); grid-template-columns: 40px; gap: 4px; padding: 5px; border-radius: 20px; }
  .sh-cam button { width: 40px; height: 40px; border-radius: 14px; }
  .sh-cam svg { width: 20px; height: 20px; }
  .sh-dock { left: 12px; right: 12px; width: auto; transform: none; padding: 8px 8px 8px 14px; gap: 8px; border-radius: 22px; min-height: 60px; }
  .sh-line { font-size: 13px; }
  .sh-btn { padding: 0 14px; font-size: 14px; }
  .sh-timer > b { font-size: 21px; }
}
@media (max-width: 759px) and (max-height: 560px) {
  .sh-cam { bottom: auto; top: calc(var(--bar-h) + 8px); grid-template-columns: repeat(5, 40px); }
}
@media (max-width: 360px) {
  .sh-line { font-size: 12.5px; }
  .sh-btn { padding: 0 12px; }
  .sh-today { padding: 0 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .sh-mark.on { animation: none; }
}

/* Sound shares the existing camera chip treatment, clear of the room title. */
.sh-sound { position: absolute; z-index: 5; right: max(14px, env(safe-area-inset-right)); top: calc(env(safe-area-inset-top) + 72px); width: 44px; height: 44px; border-radius: 16px; background: #fff9ebe6; border: 1px solid #fffbe4; box-shadow: var(--chip-shadow); color: var(--ink); font-size: 25px; }
.sh-sound.muted { opacity: .7; text-decoration: line-through; }
