* { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }
:root {
  --bg: #fdf4e1;
  --card: #ffffff;
  --ink: #1b1c22;
  --blue: #2f7ff2;
  --yellow: #ffcf3f;
  --red: #ff5d5d;
  --dim: #8f8878;
  --boardbg: #0e1014;
  --edge: 2.5px solid var(--ink);
  --pop: 0 4px 0 var(--ink);
}
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 600 15px/1.45 "Baloo 2", ui-rounded, system-ui, sans-serif;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
button { font: inherit; }

header {
  position: absolute; top: 0; left: 0; right: 0; z-index: 8;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 18px; background: none; border: 0; pointer-events: none;
}
header > * { pointer-events: auto; }
#logoImg { height: 40px; display: block; filter: drop-shadow(0 3px 0 rgba(27,28,34,0.9)); }
#tagline {
  color: #fff; opacity: 0.75; font-size: 13px; flex: 1;
  text-shadow: 0 1px 3px rgba(0,0,0,0.7); pointer-events: none;
}
#counter {
  background: var(--card); border: var(--edge); border-radius: 999px;
  padding: 8px 18px; font-weight: 800; font-size: 16px; font-variant-numeric: tabular-nums;
  box-shadow: var(--pop);
}
#ambientBtn {
  background: var(--blue); color: #fff; border: var(--edge); border-radius: 999px;
  padding: 8px 20px; font-weight: 800; font-size: 16px; cursor: pointer; box-shadow: var(--pop);
}
#ambientBtn:active { transform: translateY(2px); box-shadow: none; }
#name {
  background: var(--card); border: var(--edge); color: var(--ink);
  border-radius: 999px; padding: 8px 16px; width: 150px; font: inherit; font-size: 15px;
  box-shadow: var(--pop);
}
#splat { display: flex; transform: rotate(-8deg); }
#arrow { display: flex; margin: 14px -4px 0 -8px; }

#mainRow { flex: 1; display: flex; min-height: 0; position: relative; }
body { position: relative; }
#viewport {
  flex: 1; position: relative; overflow: hidden;
  touch-action: none; cursor: grab; background: var(--boardbg);
}
#viewport:active { cursor: grabbing; }
#tileCanvas { position: absolute; inset: 0; }
#board {
  position: absolute; transform-origin: 0 0; pointer-events: none;
}
.poolVid { position: absolute; object-fit: cover; border-radius: 2px; }

#liveBox {
  position: absolute; z-index: 4; border-radius: 4px;
  animation: liveGlow 1.6s infinite;
  background: rgba(255, 207, 63, 0.06);
}
#liveBox img, #liveBox .liveVid, #liveBox .wmaVid { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 4px; }
#liveBox .liveVid, #liveBox .wmaVid { position: absolute; inset: 0; }
#liveBox .wmaVid { transition: opacity 0.25s; }
#audioBtn {
  background: var(--card); color: var(--ink); border: var(--edge);
  border-radius: 999px; padding: 2px 10px; font-size: 14px; cursor: pointer;
}
#audioBtn:active { transform: translateY(1px); }
#liveBox .liveState {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--yellow); font-weight: 800; letter-spacing: 1px;
  font-size: clamp(6px, 18%, 22px); text-shadow: 0 1px 4px rgba(0,0,0,.8); text-align: center;
}
#liveBox::before, #liveBox::after {
  content: "✦"; position: absolute; color: var(--yellow); font-size: 16px;
  text-shadow: 0 0 4px rgba(0, 0, 0, 0.6);
}
#liveBox::before { top: -16px; left: -10px; }
#liveBox::after { bottom: -16px; right: -10px; font-size: 12px; }
@keyframes liveGlow {
  0%, 100% { box-shadow: 0 0 0 3px var(--yellow), 0 0 16px rgba(255, 207, 63, 0.6); }
  50% { box-shadow: 0 0 0 2px rgba(255, 207, 63, 0.45), 0 0 5px rgba(255, 207, 63, 0.2); }
}

#tools {
  position: absolute; top: 74px; left: 16px; z-index: 6;
  display: flex; flex-direction: column; gap: 10px;
}
#tools button {
  width: 46px; height: 46px; background: var(--card); border: var(--edge);
  border-radius: 13px; font-size: 20px; font-weight: 800; color: var(--ink);
  cursor: pointer; box-shadow: var(--pop);
}
#tools button:active { transform: translateY(2px); box-shadow: none; }
#howCard {
  position: absolute; left: 20px; bottom: 186px; z-index: 7; width: 330px;
  background: var(--card); border: var(--edge); border-radius: 16px;
  padding: 14px 16px; font-size: 13.5px; font-weight: 600; box-shadow: 0 5px 0 var(--ink);
}
#howCard b { display: block; letter-spacing: 2px; margin-bottom: 8px; }
.howRow { display: flex; gap: 9px; padding: 5px 0; align-items: flex-start; }
.howNo {
  background: var(--yellow); border: 2px solid var(--ink); border-radius: 999px;
  width: 22px; height: 22px; display: grid; place-items: center;
  font-weight: 800; font-size: 12px; flex-shrink: 0;
}
#howBtn {
  position: absolute; left: 20px; bottom: 118px; z-index: 6;
  background: var(--card); border: 3.5px solid #ff5d8f; border-radius: 16px;
  padding: 8px 16px; transform: rotate(-8deg); cursor: pointer;
  font-weight: 800; font-size: 15px; line-height: 1.1; letter-spacing: 0.5px;
  box-shadow: 0 5px 0 var(--ink); text-align: left;
}
#howBtn span { color: var(--blue); font-size: 17px; }
#howBtn:active { transform: rotate(-8deg) translateY(2px); box-shadow: none; }
#online {
  position: absolute; left: 18px; bottom: 58px; z-index: 6;
  background: var(--blue); color: #fff; border: var(--edge); border-radius: 14px;
  padding: 7px 15px; font-size: 14px; font-weight: 700; box-shadow: var(--pop);
  pointer-events: none;
}
#online b { font-size: 18px; font-variant-numeric: tabular-nums; }
#online i { font-style: normal; opacity: 0.9; text-transform: uppercase; letter-spacing: 1px; font-size: 11px; }
#falBadge, #askBadge {
  position: absolute; bottom: 14px; z-index: 6;
  font-size: 13px; font-weight: 700; color: var(--ink);
  background: var(--card); border: var(--edge); border-radius: 999px;
  padding: 6px 13px; box-shadow: var(--pop);
}
#falBadge { left: 18px; }
#askBadge { right: 436px; }
.redlink { color: var(--red); text-decoration: underline; font-weight: 800; }
.redlink:hover { color: #c23a2e; }

/* floating dock */
#dockHandle { display: none; }
#dock {
  position: absolute; right: 18px; top: 66px; bottom: 18px;
  width: 400px; z-index: 7;
  display: flex; flex-direction: column; min-height: 0;
  background: var(--bg); border: var(--edge); border-radius: 22px;
  box-shadow: 0 6px 0 var(--ink);
  padding: 14px; gap: 12px;
}
/* two halves: DIRECT on top, WHAT'S NEXT below */
#directPane {
  flex: 1 1 42%; min-height: 0; display: flex; flex-direction: column;
}
#nextPane {
  flex: 1 1 46%; min-height: 0; display: flex; flex-direction: column; gap: 10px;
}
#paneSplit { border-top: 2.5px dashed rgba(27, 28, 34, 0.25); margin: 2px 6px; flex-shrink: 0; }
#liveCard {
  background: var(--card); border: var(--edge); border-radius: 18px;
  box-shadow: var(--pop); padding: 12px;
  flex: 1; min-height: 0; display: flex; flex-direction: column;
}
#liveHead {
  display: flex; align-items: center; gap: 10px;
  background: var(--blue); color: #fff; border: var(--edge);
  border-radius: 14px; padding: 9px 13px; margin-bottom: 10px;
  font-weight: 800; font-size: 16px; letter-spacing: 1px;
}
#liveHead span:first-child { flex: 1; }
#sizeBadge {
  background: var(--yellow); color: var(--ink); border: var(--edge);
  border-radius: 999px; padding: 1px 10px; font-size: 13px; font-weight: 800;
}
#gotoBtn {
  background: var(--card); color: var(--ink); border: var(--edge);
  border-radius: 999px; padding: 2px 12px; font-size: 14px; font-weight: 800; cursor: pointer;
}
#gotoBtn:active { transform: translateY(1px); }
#timerCard {
  display: flex; align-items: center; gap: 10px;
  background: var(--yellow); border: var(--edge); border-radius: 14px;
  padding: 8px 13px; margin-bottom: 10px; font-size: 12px; font-weight: 700;
}
#timerCard b { font-size: 22px; font-variant-numeric: tabular-nums; line-height: 1; }
/* PiP: floats when the live region is out of view; click jumps to it */
#pip {
  position: absolute; top: 74px; left: 78px; z-index: 7;
  width: 300px; aspect-ratio: 16 / 9; cursor: pointer;
  border: 3px solid var(--yellow); border-radius: 12px; overflow: hidden;
  background: var(--boardbg); box-shadow: 0 0 18px rgba(255, 207, 63, 0.5), 0 5px 0 var(--ink);
}
#pip video, #pip img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pipLive {
  position: absolute; left: 8px; top: 8px;
  background: var(--yellow); border: 2px solid var(--ink); border-radius: 999px;
  padding: 1px 10px; font-size: 11px; font-weight: 800; letter-spacing: 1px; color: var(--ink);
}
.pipLive::first-letter { color: var(--red); }
.pipHint {
  position: absolute; right: 8px; bottom: 8px;
  background: rgba(27, 28, 34, 0.8); color: #fff; border-radius: 999px;
  padding: 2px 10px; font-size: 11px; font-weight: 700;
}
#logHead { font-size: 11px; font-weight: 800; letter-spacing: 2px; color: var(--dim); margin: 10px 2px 2px; flex-shrink: 0; }
#dirLog { flex: 1; min-height: 40px; overflow-y: auto; margin: 2px 0 0; }
.logRow { font-size: 13px; color: var(--ink); padding: 2px 0; }
.logRow b { color: var(--blue); }
.seedRowLog { background: rgba(255, 207, 63, 0.25); border-radius: 8px; padding: 3px 7px; }
.inputRow { display: flex; gap: 8px; align-items: stretch; }
.inputRow input {
  flex: 1; background: var(--card); border: var(--edge); color: var(--ink);
  border-radius: 12px; padding: 9px 13px; font: inherit; font-size: 16px; min-width: 0;
}
.inputRow button {
  background: var(--yellow); color: var(--ink); border: var(--edge); border-radius: 12px;
  padding: 0 14px; font-size: 14px; font-weight: 800; cursor: pointer;
  box-shadow: 0 3px 0 var(--ink); white-space: nowrap; font-variant-numeric: tabular-nums;
}
#seedsCard .inputRow { margin-top: 8px; }
#seedsCard .inputRow button { background: var(--blue); color: #fff; }
.inputRow button:active { transform: translateY(2px); box-shadow: none; }
.inputRow button:disabled {
  background: #e7e0d0; color: var(--dim); cursor: not-allowed; box-shadow: none; transform: none;
}

#directRow { flex-shrink: 0; }
#seedsCard {
  background: var(--card); border: var(--edge); border-radius: 18px;
  box-shadow: var(--pop); padding: 10px 12px; flex-shrink: 0;
}
#proposeRow { flex-shrink: 0; }
#seedsHead { font-size: 12px; font-weight: 800; letter-spacing: 2px; color: var(--dim); margin-bottom: 6px; }
.seedRow { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 14px; }
.seedRow .txt { flex: 1; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seedRow i { color: var(--dim); font-style: normal; font-size: 12px; }
.seedOrd {
  background: var(--ink); color: #fff; border-radius: 6px; padding: 0 7px;
  font-size: 11px; font-weight: 800; flex-shrink: 0;
}
.seedRow:first-child .seedOrd { background: var(--blue); }
.voteBtn {
  background: var(--yellow); border: var(--edge); color: var(--ink);
  border-radius: 12px; padding: 3px 12px; font-size: 13px; font-weight: 800;
  cursor: pointer; font-variant-numeric: tabular-nums; box-shadow: 0 3px 0 var(--ink);
  flex-shrink: 0;
}
.voteBtn:active { transform: translateY(2px); box-shadow: none; }

#feed {
  flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 2px;
}
.line {
  font-size: 14px; word-wrap: break-word;
  display: flex; gap: 9px; align-items: flex-start;
  background: var(--card); border: var(--edge); border-radius: 14px;
  padding: 7px 10px; box-shadow: var(--pop);
}
.line b { color: var(--blue); font-weight: 800; }
.line.dirline { border-color: var(--blue); }
.line .txt { flex: 1; font-weight: 600; }
.avatar {
  width: 28px; height: 28px; border: var(--edge); border-radius: 999px;
  display: grid; place-items: center; font-size: 15px; flex-shrink: 0;
}
.line.sys {
  background: none; border: 0; box-shadow: none; padding: 0 5px;
  color: var(--dim); font-size: 13px; display: block;
}
input:disabled { opacity: 0.55; }

/* socials next to names */
a.soc {
  text-decoration: none; font-size: 10px; font-weight: 800; color: var(--ink);
  background: var(--bg); border: 1.5px solid var(--ink); border-radius: 999px;
  padding: 0 6px; margin-left: 4px; vertical-align: 1px; white-space: nowrap;
}
a.soc:hover { background: var(--yellow); }
#storyLink { color: var(--blue); font-weight: 800; }

/* onboarding */
#onboard {
  position: fixed; inset: 0; background: rgba(14, 16, 20, 0.82); z-index: 90;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
#onboardCard {
  width: min(460px, 100%); background: var(--bg); border: var(--edge);
  border-radius: 22px; box-shadow: 0 8px 0 var(--ink); padding: 22px;
  display: flex; flex-direction: column; gap: 10px;
}
.obLogo { font-weight: 800; font-size: 22px; letter-spacing: 0.5px; }
.obLogo span { color: var(--yellow); -webkit-text-stroke: 1.2px var(--ink); }
.obLogo i { font-style: normal; color: var(--blue); }
.obIntro { color: var(--dim); font-size: 14px; }
.obLabel { font-size: 12px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; margin-top: 4px; }
.obLabel i { color: var(--dim); font-style: normal; text-transform: none; letter-spacing: 0; font-weight: 600; }
#onboardCard input[type="text"], #onboardCard input:not([type]) {
  background: var(--card); border: var(--edge); color: var(--ink);
  border-radius: 12px; padding: 10px 13px; font: inherit; font-size: 16px; width: 100%;
}
.obRow { display: flex; gap: 8px; }
.obRow input { min-width: 0; }
.obAgree {
  display: flex; gap: 10px; align-items: flex-start; font-size: 12.5px; font-weight: 600;
  color: var(--ink); background: var(--card); border: var(--edge); border-radius: 12px; padding: 10px;
}
.obAgree input { width: 18px; height: 18px; margin-top: 2px; flex-shrink: 0; accent-color: var(--blue); }
#obGo {
  background: var(--yellow); color: var(--ink); border: var(--edge); border-radius: 14px;
  padding: 12px; font-weight: 800; font-size: 16px; cursor: pointer; box-shadow: var(--pop);
}
#obGo:active { transform: translateY(2px); box-shadow: none; }
#obGo:disabled { background: #e7e0d0; color: var(--dim); cursor: not-allowed; box-shadow: none; }

/* inspect modal */
#inspect {
  position: fixed; inset: 0; background: rgba(14, 16, 20, 0.8); z-index: 50;
  display: flex; align-items: center; justify-content: center;
}
#inspectCard {
  width: min(720px, calc(100vw - 40px)); max-height: calc(100vh - 60px); overflow-y: auto;
  background: var(--bg); border: var(--edge); border-radius: 20px;
  box-shadow: 0 8px 0 var(--ink); padding: 16px; position: relative;
}
#inspectHead { font-weight: 800; letter-spacing: 3px; font-size: 13px; color: var(--dim); margin-bottom: 8px; }
#inspectClose {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  background: var(--red); color: #fff; border: var(--edge); border-radius: 999px;
  width: 34px; height: 34px; font-weight: 800; cursor: pointer;
}
#inspectVid {
  width: 100%; aspect-ratio: 16 / 9; object-fit: cover;
  border-radius: 14px; border: var(--edge); display: block; background: var(--boardbg);
}
#inspectInfo { margin: 10px 2px 6px; font-size: 15px; font-weight: 700; }
#inspectLog { margin: 0 2px; }
#inspectStills { display: flex; gap: 8px; overflow-x: auto; margin-top: 10px; }
#inspectStills img {
  height: 74px; border-radius: 8px; border: 2px solid var(--ink); flex-shrink: 0;
}

@media (max-width: 760px) {
  #tagline { display: none; }
  #logoImg { height: 26px; }
  header { padding: 10px 12px; gap: 8px; }
  #counter, #ambientBtn { padding: 5px 11px; font-size: 13px; box-shadow: 0 3px 0 var(--ink); }
  #name { width: 92px; padding: 5px 10px; font-size: 13px; }
  #tools { top: 56px; left: 10px; gap: 6px; }
  #tools button { width: 38px; height: 38px; font-size: 16px; border-radius: 11px; }
  #online { top: 56px; right: 10px; left: auto; bottom: auto; padding: 5px 11px; font-size: 12px; }
  #howBtn { left: 12px; bottom: 174px; font-size: 12px; padding: 6px 11px; }
  #howCard { left: 12px; right: 12px; width: auto; bottom: 238px; font-size: 12.5px; }
  #falBadge { left: 10px; bottom: 128px; font-size: 10.5px; padding: 4px 9px; }
  #pip { top: 100px; left: auto; right: 10px; width: 172px; border-width: 2.5px; }
  #askBadge { display: none; }

  /* dock becomes a bottom drawer: collapsed = handle + direct input */
  #dock {
    left: 8px; right: 8px; top: auto; bottom: 0; width: auto;
    max-height: 78vh; border-radius: 18px 18px 0 0; padding: 8px 10px 10px; gap: 8px;
    transform: translateY(calc(100% - 116px));
    transition: transform 0.28s ease;
    box-shadow: 0 -3px 0 var(--ink);
  }
  body.dockOpen #dock { transform: none; height: 78vh; }
  #dockHandle {
    display: flex; align-items: center; gap: 10px; order: -2;
    background: var(--blue); color: #fff; border: var(--edge); border-radius: 12px;
    padding: 8px 12px; font-weight: 800; font-size: 14px; cursor: pointer;
    font-family: inherit;
  }
  #dockHandle b { background: var(--yellow); color: var(--ink); border-radius: 999px; padding: 0 9px; font-variant-numeric: tabular-nums; }
  #dockHandle i { margin-left: auto; font-style: normal; font-size: 12px; opacity: 0.9; }
  #directRow { order: -1; }
  #directPane { flex: 0 1 auto; }
  #nextPane { flex: 1 1 auto; }
  #paneSplit { display: none; }
  #directRow input { padding: 10px 13px; }
  #liveCard { padding: 9px; }
  #liveHead { font-size: 13px; padding: 7px 10px; }
  #timerCard { padding: 6px 10px; }
  #timerCard b { font-size: 18px; }
  #dirLog { max-height: 70px; }
  .line { font-size: 13px; padding: 6px 8px; }
  .avatar { width: 24px; height: 24px; font-size: 13px; }
  #seedsCard { padding: 8px 10px; }
  .seedRow { font-size: 13px; }
}
