:root {
  --bg:#eef3f8; --panel:#fff; --ink:#16243a; --muted:#68768a; --line:#d7e0ea;
  --accent:#2874f0; --accent-dark:#185bc8; --danger:#bd3838; --success:#1d7d56;
  --shadow:0 12px 34px rgba(20,34,54,.12);
}
*{box-sizing:border-box} html,body{margin:0;min-height:100%} body{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;background:var(--bg);color:var(--ink);overscroll-behavior:none} button,input,select{font:inherit} button{cursor:pointer}.hidden{display:none!important}
.btn{border:1px solid var(--line);background:#fff;color:var(--ink);border-radius:10px;padding:9px 13px;font-weight:800;text-decoration:none;white-space:nowrap}.btn:hover{background:#f6f8fb}.btn.primary{background:var(--accent);color:#fff;border-color:var(--accent)}.btn.primary:hover{background:var(--accent-dark)}.btn.danger{color:var(--danger)}.btn.small{padding:7px 10px;font-size:14px}.btn:disabled{opacity:.4;cursor:default}
.center-card{width:min(560px,calc(100vw - 32px));margin:8vh auto;background:#fff;border:1px solid var(--line);border-radius:20px;box-shadow:var(--shadow);padding:34px;text-align:center}.center-card h1{margin:12px 0 10px}.center-card p{color:var(--muted);line-height:1.5}.login-logo,.join-logo{display:block;width:min(470px,100%);height:auto;margin:0 auto 26px}.waiting-logo{display:block;width:min(380px,90%);margin:0 auto 16px}.form-row{display:flex;gap:10px;margin-top:20px}.form-row input{flex:1;min-width:0;border:1px solid var(--line);border-radius:10px;padding:11px 12px}
.lobby-page{min-height:100vh}.lobby-sticky{position:sticky;top:0;z-index:20;background:#fff;border-bottom:1px solid var(--line);box-shadow:0 5px 18px rgba(20,34,54,.07);padding:10px 20px 12px}.lobby-logo{display:block;width:min(570px,74vw);max-height:150px;object-fit:contain;margin:0 auto}.lobby-controls{max-width:1080px;margin:2px auto 0;display:flex;align-items:center;justify-content:space-between;gap:12px;font-size:24px}.lobby-control-buttons{display:flex;gap:8px}.lobby-content{max-width:1080px;margin:0 auto;padding:24px 18px 60px}.board-list{display:flex;flex-direction:column;gap:12px}.board-card{display:flex;align-items:center;justify-content:space-between;gap:20px;background:#fff;border:1px solid var(--line);border-radius:15px;padding:18px 20px;box-shadow:0 4px 16px rgba(20,34,54,.05)}.board-card-info{min-width:0}.board-card h3{margin:0 0 5px;font-size:20px}.board-card p{margin:0;color:var(--muted);font-size:14px}.board-card-actions{display:flex;gap:7px;flex:0 0 auto}.empty-state{background:#fff;border:1px dashed #bcc9d7;border-radius:16px;padding:46px;text-align:center;color:var(--muted);display:flex;flex-direction:column;gap:8px}.empty-state strong{font-size:22px;color:var(--ink)}
.board-shell{height:100dvh;display:grid;grid-template-rows:auto auto minmax(0,1fr) 58px;overflow:hidden}.board-header{background:#fff;border-bottom:1px solid var(--line);padding:7px 12px;display:grid;grid-template-columns:minmax(330px,1fr) auto;gap:12px;align-items:center}.board-header-left{display:flex;align-items:center;gap:8px;min-width:0}.board-logo{width:205px;max-height:72px;object-fit:contain;flex:0 0 auto}.board-name{font-size:17px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:230px}.live-pill{background:#e8f8f0;color:var(--success);border:1px solid #c6e9da;border-radius:999px;padding:4px 8px;font-size:12px;font-weight:900;letter-spacing:.04em}.board-header-right{display:flex;flex-direction:column;align-items:flex-end;gap:5px;min-width:0}.connection-row{height:26px;display:flex;align-items:center;justify-content:flex-end;gap:7px;width:100%}.status-text{color:var(--muted);font-size:14px}.board-toolbar,.student-toolbar{display:flex;align-items:center;justify-content:flex-end;gap:5px;white-space:nowrap}.tool-btn{border:1px solid var(--line);background:#fff;border-radius:8px;padding:7px 9px;font-weight:800;font-size:13px}.tool-btn.active{background:#e9f1ff;border-color:#94b7f6;color:#174fae}.color-input{width:34px;height:32px;border:1px solid var(--line);border-radius:8px;padding:2px;background:#fff}.width-select{border:1px solid var(--line);border-radius:8px;padding:6px;background:#fff;font-size:13px}
.waiting-banner{background:#fff5ca;border-bottom:1px solid #e6d17b;padding:7px 12px;display:flex;flex-wrap:wrap;gap:7px;align-items:center}.waiting-person{display:flex;align-items:center;gap:6px;background:#fff;border:1px solid #eadb9a;padding:5px 7px;border-radius:9px}.canvas-wrap{position:relative;min-height:0;background:#dfe6ee;padding:8px}.canvas-card{position:absolute;inset:8px;background:#fff;border:1px solid #cbd5df;box-shadow:0 4px 18px rgba(23,34,52,.08);overflow:hidden}#boardCanvas{width:100%;height:100%;display:block;touch-action:none;cursor:crosshair}.readonly-note{position:absolute;top:8px;left:50%;transform:translateX(-50%);background:rgba(22,36,58,.82);color:#fff;padding:5px 10px;border-radius:999px;font-size:12px;pointer-events:none}.pagebar{background:#fff;border-top:1px solid var(--line);display:flex;align-items:center;gap:7px;padding:8px 11px;overflow-x:auto}.page-buttons{display:flex;gap:5px}.page-btn{min-width:40px;height:36px;border:1px solid var(--line);background:#fff;border-radius:8px;font-weight:900}.page-btn.active{background:var(--ink);color:#fff;border-color:var(--ink)}.page-spacer{flex:1}
.student-board-shell{height:100dvh;display:grid;grid-template-rows:auto minmax(0,1fr);overflow:hidden}.student-header{background:#fff;border-bottom:1px solid var(--line);padding:7px 12px;display:flex;align-items:center;justify-content:space-between;gap:14px}.student-header-left{display:flex;align-items:center;gap:8px;min-width:0}.student-board-logo{width:190px;max-height:68px;object-fit:contain}.student-control-note{margin-right:4px}
.modal{position:fixed;inset:0;z-index:50;background:rgba(14,26,43,.58);display:grid;place-items:center;padding:18px}.modal-card{position:relative;width:min(500px,100%);max-height:calc(100dvh - 36px);overflow:auto;background:#fff;border-radius:20px;padding:26px;text-align:center;box-shadow:0 20px 60px rgba(0,0,0,.26)}.modal-card h2{margin:0 38px 6px;font-size:25px}.modal-close{position:absolute;right:12px;top:10px;border:0;background:transparent;color:var(--muted);font-size:30px;line-height:1}.share-helper{margin:4px auto 10px;color:var(--muted);line-height:1.4}.share-code-line{font-size:14px;color:var(--muted);margin-bottom:8px}.share-code-line strong{color:var(--ink);font-size:17px;letter-spacing:.12em}.share-qr{display:block;width:min(280px,75vw);height:auto;margin:8px auto 14px;border:1px solid var(--line);border-radius:12px}.share-link-row{display:flex;gap:8px;margin-bottom:8px}.share-url{flex:1;min-width:0;border:1px solid var(--line);border-radius:9px;padding:9px 10px;background:#f8fafc;color:var(--ink);font-size:13px}.toast{position:fixed;right:16px;bottom:74px;background:#172234;color:#fff;border-radius:10px;padding:10px 13px;box-shadow:var(--shadow);z-index:70}.error{color:var(--danger)!important}
@media(max-width:1100px){.board-header{grid-template-columns:minmax(300px,1fr) auto}.board-logo{width:165px}.board-name{max-width:150px}.tool-btn{padding:6px 7px;font-size:12px}.width-select{max-width:92px}.student-board-logo{width:150px}.student-toolbar .status-text{display:none}}
@media(max-width:850px){.board-header{grid-template-columns:1fr;gap:4px}.board-header-right{align-items:stretch}.connection-row{justify-content:flex-end}.board-toolbar{justify-content:flex-start;overflow-x:auto}.board-logo{width:150px}.student-header{align-items:flex-start;flex-direction:column;gap:4px}.student-toolbar{width:100%;justify-content:flex-start;overflow-x:auto}.lobby-logo{width:min(500px,92vw)}.lobby-controls{font-size:20px}.board-card{align-items:flex-start;flex-direction:column}.board-card-actions{width:100%}.board-card-actions .btn{flex:1}}
@media(max-width:600px){.center-card{margin:4vh auto;padding:24px 18px}.form-row{flex-direction:column}.lobby-sticky{padding:8px 10px 10px}.lobby-controls{align-items:stretch;flex-direction:column;gap:7px}.lobby-control-buttons .btn{flex:1}.board-logo{width:125px}.board-name{max-width:110px}.share-link-row{flex-direction:column}}

/* ============================================================
   ZoodleBoard canvas layout repair
   Keep header/footer fixed to their content and force the
   whiteboard canvas to consume every remaining viewport pixel.
   ============================================================ */

html,
body {
  width: 100%;
  height: 100%;
}

.board-shell {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.board-header {
  flex: 0 0 auto;
}

.waiting-banner {
  flex: 0 0 auto;
}

.canvas-wrap {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  overflow: hidden;
}

.canvas-card {
  position: absolute;
  inset: 8px;
}

#boardCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  pointer-events: auto;
}

.pagebar {
  flex: 0 0 58px;
  min-height: 58px;
  width: 100%;
}

.student-board-shell {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.student-header {
  flex: 0 0 auto;
}

.student-board-shell .canvas-wrap {
  flex: 1 1 0;
  min-height: 0;
}


/* ============================================================
   Join request footer + Do Not Disturb
   ============================================================ */
.join-request-slot {
  min-width: 0;
  flex: 0 1 380px;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 4px;
  overflow: hidden;
}

.join-request-message {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
}

.join-action {
  flex: 0 0 auto;
  padding: 5px 8px !important;
}

.dnd-btn {
  flex: 0 0 auto;
}

.dnd-btn.active {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.join-message-card {
  width: min(440px, 100%);
}

.join-message-card p {
  color: var(--ink);
  font-size: 18px;
  line-height: 1.45;
  margin: 18px 0 22px;
}

@media (max-width: 900px) {
  .join-request-slot {
    flex: 0 0 auto;
    min-width: 290px;
  }
}


/* ZoodleBug family navigation - integration test */
.zoodlebug-home-link {
  color: #315a88;
  font-weight: 800;
  text-decoration: none;
}

.zoodlebug-home-link:hover,
.zoodlebug-home-link:focus-visible {
  text-decoration: underline;
}

.lobby-home-link {
  display: block;
  width: fit-content;
  margin: -6px auto 6px;
  font-size: 14px;
}

.board-home-link {
  margin-right: 12px;
  font-size: 12px;
  white-space: nowrap;
}

#newBoardBtn,
#logoutBtn {
  min-height: 30px;
  padding: 5px 10px;
  font-size: 12px;
}


/* Preview tune: larger lobby logo + more gap + bug emoji home link */
.lobby-logo {
  width: min(760px, 92vw);
  max-width: 92vw;
  height: auto;
}

.lobby-home-link {
  display: block;
  width: fit-content;
  margin: 16px auto 10px;
  font-size: 16px;
}

.board-home-link {
  font-size: 13px;
}


/* ZoodleBoard iPad selection guard */
.board-shell,
.board-shell *,
.student-board-shell,
.student-board-shell * {
  -webkit-user-select: none !important;
  user-select: none !important;
  -webkit-touch-callout: none !important;
  caret-color: transparent;
}

.board-shell img,
.student-board-shell img {
  -webkit-user-drag: none;
}

.board-shell input,
.board-shell select,
.student-board-shell input,
.student-board-shell select {
  caret-color: auto;
}


/* Lobby recommended stylus link */
.lobby-title-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}

.recommended-stylus-link {
  font-size: 0.5em;
  font-weight: 700;
  color: var(--accent);
  text-decoration: underline;
  white-space: nowrap;
}


/* Public account authentication screens */
.auth-card {
  width: min(560px, calc(100vw - 32px));
  max-width: 560px;
  padding: 34px 38px 36px;
}

.auth-card .login-logo {
  display: block;
  width: min(430px, 92%);
  height: auto;
  margin: 0 auto 18px;
}

.auth-title {
  margin: 2px 0 8px;
  text-align: center;
  font-size: 28px;
  line-height: 1.15;
  color: var(--ink);
}

.auth-subtitle {
  margin: 0 auto 22px;
  text-align: center;
  color: var(--muted);
  line-height: 1.45;
}

.auth-main-btn {
  width: 100%;
  min-height: 46px;
  font-size: 16px;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 22px 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.auth-form {
  display: grid;
  gap: 17px;
}

.auth-field {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}

.auth-field input {
  width: 100%;
  box-sizing: border-box;
  min-height: 46px;
  border: 2px solid #9aa9bd;
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.auth-field input:focus {
  outline: 3px solid rgba(49, 90, 136, 0.18);
  border-color: var(--accent);
}

.auth-navigation {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin-top: 22px;
}

.auth-text-link {
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 5px 2px;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  text-decoration: underline;
  cursor: pointer;
}

.auth-back-link {
  display: block;
  margin: 23px auto 0;
}

.auth-error,
.auth-message {
  min-height: 20px;
  margin: 16px 0 0;
  text-align: center;
  line-height: 1.35;
}

.auth-message {
  color: #166534;
  font-weight: 800;
}

.auth-help-box {
  display: grid;
  gap: 7px;
  margin: 18px 0 24px;
  padding: 15px 17px;
  border-radius: 12px;
  background: #eef5fb;
  color: var(--ink);
  line-height: 1.4;
}

@media (max-width: 600px) {
  .auth-card {
    padding: 26px 22px 30px;
  }

  .auth-title {
    font-size: 24px;
  }
}

/* Live-connection indicator. Visible only while a device is repairing a
   dropped connection, so nobody has to guess why writing stopped appearing. */
.connection-indicator {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9998;
  padding: 7px 14px;
  border-radius: 999px;
  background: #b45309;
  color: #fff;
  font: 600 13px/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .28);
  pointer-events: none;
}

.connection-indicator.is-offline {
  background: #b91c1c;
}

.connection-indicator.hidden {
  display: none;
}
