/* ═══════════════════════════════════════════
   LittleScreen — Chat & Canvas page styles
   ═══════════════════════════════════════════ */

body.ls-page-chat {
  height: 100vh;
  overflow: hidden;
  padding-top: 56px; /* topnav */
  padding-bottom: 56px; /* bottombar */
}

.cc-shell {
  height: calc(100vh - 56px - 56px);
  display: flex; flex-direction: column;
  position: relative;
}

/* Identity gate overlay */
.cc-identity-gate {
  position: fixed; inset: 0;
  z-index: 80;
  display: grid; place-items: center;
  background: rgba(20,12,18,.85);
  backdrop-filter: blur(8px);
  padding: 20px;
}
.cc-ig-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px 24px;
  max-width: 460px; width: 100%;
  display: flex; flex-direction: column; gap: 14px;
  box-shadow: 0 30px 80px rgba(0,0,0,.5);
}
.cc-ig-card h2 { font-size: 1.4rem; }
.cc-ig-card .muted { font-size: .88rem; }
.cc-ig-card input {
  background: rgba(255,255,255,.05);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 1.05rem;
  color: var(--text);
}
.cc-ig-icons, .cc-ig-colors { display: flex; flex-wrap: wrap; gap: 6px; }
.cc-ig-icons button {
  font-size: 1.4rem; line-height: 1;
  width: 44px; height: 44px;
  background: rgba(255,255,255,.04);
  border: 2px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  padding: 0;
}
.cc-ig-icons button.active { border-color: var(--accent); background: var(--accent-dim); }
.cc-ig-colors button {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  padding: 0;
}
.cc-ig-colors button.active { border-color: var(--text); }

/* Header strip */
.cc-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,.2);
}
.cc-header-left { display: flex; flex-direction: column; gap: 2px; }
.cc-eyebrow {
  font-size: .65rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--accent);
}
.cc-header h2 { font-size: 1.15rem; font-weight: 800; letter-spacing: -.01em; }
.cc-header-right { display: flex; gap: 8px; align-items: center; }

/* Body split */
.cc-body {
  flex: 1; display: grid;
  grid-template-columns: 1fr 360px;
  min-height: 0;
}

/* Canvas — white paper background so dark ink is visible by default */
.cc-canvas-wrap {
  position: relative;
  background:
    repeating-conic-gradient(rgba(0,0,0,.035) 0% 25%, transparent 0% 50%) 0 0/24px 24px,
    #ffffff;
  overflow: hidden;
  /* VR/touch: kill all native gestures over the wrapper too — fixes Quest 3
     where the controller-laser leaving the inner canvas would scroll the page. */
  touch-action: none;
  overscroll-behavior: contain;
}
#cc-canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  touch-action: none;
  display: block;
  cursor: crosshair;
  background: #ffffff;
}
.cc-canvas-hint { color: #fff; }
.cc-canvas-hint {
  position: absolute;
  top: 14px; left: 50%;
  transform: translateX(-50%);
  font-size: .8rem;
  background: rgba(0,0,0,.55);
  padding: 6px 14px;
  border-radius: 999px;
  pointer-events: none;
  opacity: .8;
  white-space: nowrap;
}
.cc-canvas-hint.fade { opacity: 0; transition: opacity .8s; }

/* Drawing dock — hidden by default, slides up from above the bottombar.
   Toggled by the "✏️ Draw" button in the page bottombar. */
.cc-toolbar {
  position: fixed;
  left: 50%; bottom: 70px;
  transform: translate(-50%, calc(100% + 80px));
  display: flex; gap: 8px; align-items: center;
  background: rgba(20,12,18,.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-hi);
  border-radius: 16px 16px 0 0;
  padding: 10px 14px;
  flex-wrap: wrap;
  max-width: calc(100% - 24px);
  box-shadow: 0 -16px 40px -10px rgba(0,0,0,.55);
  z-index: 64;
  transition: transform .28s cubic-bezier(.2,.9,.25,1), opacity .18s;
  opacity: 0;
  pointer-events: none;
}
.cc-toolbar.open {
  transform: translate(-50%, 0);
  opacity: 1;
  pointer-events: auto;
}
/* Force open class via body.draw-dock-open as well, so room.js doesn't need to know */
body.draw-dock-open .cc-toolbar {
  transform: translate(-50%, 0);
  opacity: 1;
  pointer-events: auto;
}
/* Active state on the bottombar Draw button */
#bb-draw-btn.active {
  color: var(--accent);
}
#bb-draw-btn.active .bb-ic { filter: drop-shadow(0 0 10px var(--accent)); }
.cc-tool {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 1.5rem;
  padding: 10px 12px;
  cursor: pointer;
  min-width: 52px; min-height: 52px;
  color: var(--text);
}
.cc-tool:hover { background: rgba(255,255,255,.06); }
.cc-tool.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }
.cc-tool-sep { width: 1px; height: 24px; background: var(--border); margin: 0 4px; }
.cc-color-row { display: flex; gap: 4px; }
.cc-color {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
}
.cc-color.active { border-color: var(--text); transform: scale(1.1); }
.cc-size-row {
  display: flex; align-items: center; gap: 6px;
  font-size: .75rem; color: var(--muted);
}
.cc-size-row input[type="range"] { width: 100px; min-height: auto; padding: 0; }

/* Chat panel */
.cc-chat {
  display: flex; flex-direction: column;
  border-left: 1px solid var(--border);
  background: rgba(0,0,0,.2);
  min-height: 0;
}
.cc-chat-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 2px;
}
.cc-chat-head h3 { font-size: 1.05rem; }
.cc-chat-log {
  flex: 1; min-height: 0; overflow-y: auto;
  list-style: none; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 8px;
}
.cc-msg {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(255,255,255,.03);
  border-radius: 12px;
  border: 1px solid var(--border);
}
.cc-msg-icon { font-size: 1.2rem; line-height: 1.5; }
.cc-msg-body { min-width: 0; }
.cc-msg-meta { display: flex; gap: 8px; align-items: baseline; }
.cc-msg-name { font-weight: 700; font-size: .85rem; }
.cc-msg-time { font-size: .68rem; color: var(--muted); }
.cc-msg-text {
  font-size: .95rem; line-height: 1.45;
  word-break: break-word;
}
.cc-msg.system .cc-msg-text { color: var(--accent); font-style: italic; font-size: .82rem; }

.cc-chat-form {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
}
.cc-chat-icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 44px; height: 44px;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0;
  display: grid; place-items: center;
}
#cc-id-pip {
  display: inline-block;
  width: 18px; height: 18px;
  border-radius: 50%;
  font-size: 0;
}
.cc-chat-form input { min-height: 44px; padding: 12px 14px; }

/* VR mode — bigger everything for headset legibility */
body.vr-mode .cc-toolbar { padding: 16px 20px; gap: 12px; bottom: 88px; border-radius: 20px 20px 0 0; }
body.vr-mode .cc-tool { min-width: 72px; min-height: 72px; font-size: 2rem; padding: 14px 16px; }
body.vr-mode .cc-color { width: 52px; height: 52px; }
body.vr-mode .cc-size-row input[type="range"] { width: 180px; height: 12px; }
body.vr-mode .cc-size-row span { font-size: 1.05rem; }
body.vr-mode .cc-msg-text { font-size: 1.1rem; }
body.vr-mode .cc-chat-form input { min-height: 56px; font-size: 1.1rem; }
body.vr-mode .cc-header h2 { font-size: 1.5rem; }

/* ── Drawing v2: stylus chip + settings popover (REFRESH/DRAW pattern) ── */
.cc-stylus-chip {
  position: absolute;
  top: 10px; right: 10px;
  z-index: 4;
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(20,12,18,.78);
  color: #d8c8b0;
  border: 1px solid rgba(255,255,255,.08);
  pointer-events: none;
  font-variant-numeric: tabular-nums;
  backdrop-filter: blur(8px);
}
.cc-stylus-chip.pen   { color: #7ce0a0; border-color: rgba(124,224,160,.4); }
.cc-stylus-chip.touch { color: #ffd070; border-color: rgba(255,208,112,.4); }
.cc-stylus-chip.vr    { color: #c8a2ff; border-color: rgba(200,162,255,.4); }
.cc-stylus-chip.mouse { opacity: .8; }

/* Settings (gear) popover — opens above the toolbar */
.cc-settings-pop {
  position: absolute;
  bottom: calc(100% + 8px); right: 0;
  z-index: 65;
  min-width: 240px;
  padding: 12px 14px;
  background: rgba(20,12,18,.96);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-hi);
  border-radius: 12px;
  box-shadow: 0 -8px 30px rgba(0,0,0,.45);
  display: none;
}
.cc-settings-pop.open { display: block; }
.cc-settings-pop h4 {
  margin: 0 0 6px;
  font-size: 11px; text-transform: uppercase; letter-spacing: .14em;
  color: var(--muted);
}
.cc-segmented {
  display: flex; gap: 0;
  border: 1px solid var(--border);
  border-radius: 8px; overflow: hidden;
  margin-bottom: 12px;
}
.cc-segmented button {
  flex: 1;
  background: transparent;
  border: 0;
  color: var(--text);
  padding: 6px 8px;
  cursor: pointer;
  font-size: 12px;
  min-height: 36px;
}
.cc-segmented button.active {
  background: var(--accent-dim);
  color: var(--accent);
}
.cc-toggle-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 8px;
  cursor: pointer;
  user-select: none;
}
.cc-toggle-row input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; }
.cc-opacity-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--muted);
  margin-bottom: 4px;
}
.cc-opacity-row input[type="range"] { flex: 1; min-height: 28px; }

/* Gear button styling — uses .cc-tool */
.cc-tool[data-action="settings"].active {
  background: var(--accent-dim); border-color: var(--accent); color: var(--accent);
}

/* VR mode tweaks for new pieces */
body.vr-mode .cc-stylus-chip { font-size: 14px; padding: 6px 14px; }
body.vr-mode .cc-settings-pop { min-width: 320px; padding: 16px 18px; }
body.vr-mode .cc-segmented button { font-size: 14px; min-height: 52px; padding: 10px 12px; }

/* 6-column bottombar on canvas pages so the Draw button fits */
body.ls-page-chat .ls-bottombar,
body.ls-page-room .ls-bottombar {
  grid-template-columns: repeat(6, 1fr);
}

/* Mobile */
@media (max-width: 760px) {
  .cc-body { grid-template-columns: 1fr; grid-template-rows: 1fr 240px; }
  .cc-chat { border-left: none; border-top: 1px solid var(--border); }
  .cc-toolbar { padding: 8px 10px; gap: 6px; }
  .cc-tool { min-width: 44px; min-height: 44px; font-size: 1.15rem; padding: 8px 10px; }
  .cc-color { width: 28px; height: 28px; }
  .cc-size-row input[type="range"] { width: 80px; }
  .cc-size-row span { display: none; }
}
