:root {
  color-scheme: light;
  --ink: #28222e;
  --muted: #655d6b;
  --line: #39313f;
  --paper: #fff7d9;
  --surface: #fffdf5;
  --forest: #28222e;
  --mint: #51ddd0;
  --mint-strong: #087c78;
  --coral: #f34f7d;
  --yellow: #ffd84d;
  --sky: #73cfff;
  --danger: #b8244c;
  font-family: "Trebuchet MS", "Comic Sans MS", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--paper); }

body {
  min-height: 100vh;
  margin: 0;
  background-color: var(--paper);
  background-image: repeating-linear-gradient(135deg, transparent 0, transparent 34px, rgba(243, 79, 125, .055) 35px, transparent 37px);
}

[hidden] { display: none !important; }

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }

.topbar {
  min-height: 82px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 24px;
  padding: 0 clamp(20px, 5vw, 76px);
  color: var(--ink);
  background: var(--yellow);
  border-bottom: 4px solid var(--ink);
}

.wordmark {
  width: max-content;
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.05;
  text-decoration: none;
}

.wordmark-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 8px;
  color: var(--ink);
  background: var(--coral);
  box-shadow: 3px 3px 0 var(--ink);
  font: 900 16px/1 Impact, "Comic Sans MS", sans-serif;
  transform: rotate(-4deg);
}

.wordmark-copy { display: grid; gap: 4px; }
.wordmark-copy strong { font: 900 14px/1 Impact, "Trebuchet MS", sans-serif; }
.wordmark-copy small { font-size: 10px; font-weight: 750; }
.wordmark-copy b { color: #b8244c; }

.primary-nav { height: 100%; display: flex; align-items: stretch; gap: 6px; }

.nav-tab {
  min-width: 88px;
  padding: 0 16px;
  border: 0;
  border-bottom: 3px solid transparent;
  color: #6c6270;
  background: transparent;
  font-size: 13px;
  font-weight: 700;
}

.nav-tab:hover, .nav-tab.is-active { color: var(--ink); }
.nav-tab.is-active { border-bottom-color: var(--coral); }

.connection-state {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
}

.state-dot { width: 10px; height: 10px; border: 2px solid var(--ink); border-radius: 50%; background: var(--coral); }
.state-dot.is-online { background: var(--mint); box-shadow: 2px 2px 0 var(--ink); }

main { width: min(1420px, calc(100% - 64px)); min-height: calc(100vh - 132px); margin: 0 auto; }

.screen { padding: 45px 0 48px; }

.page-heading {
  min-height: 120px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 0 0 25px;
  border-bottom: 2px dashed var(--line);
}

.eyebrow {
  margin: 0 0 10px;
  color: #bf315f;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.3;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; color: var(--ink); font: 48px/1.02 Impact, "Comic Sans MS", sans-serif; text-shadow: 2px 2px 0 var(--yellow); }
h2 { margin-bottom: 0; color: var(--ink); font-size: 19px; font-weight: 700; }
h3 { margin-bottom: 0; font-size: 13px; font-weight: 750; }
.heading-note { margin: 0 0 5px; color: var(--muted); font: italic 15px "Comic Sans MS", "Trebuchet MS", sans-serif; }

.watch-layout { display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); align-items: start; }
.access-panel { padding: 27px 28px 26px 0; border-right: 2px dashed var(--line); }
.player-panel { min-width: 0; padding: 27px 0 27px 30px; }

.panel-heading, .section-title-row, .player-meta, .subsection-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.panel-heading { margin-bottom: 24px; }
.panel-index { color: var(--coral); font: 900 16px Impact, sans-serif; transform: rotate(5deg); }
.panel-heading-small { margin: 25px 0 13px; }
.small-title { font-size: 15px; }
.status-copy { min-height: 42px; margin-bottom: 20px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.button { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 17px; border: 2px solid var(--ink); border-radius: 6px; font-size: 12px; font-weight: 900; box-shadow: 3px 3px 0 var(--ink); transition: transform .12s ease, box-shadow .12s ease, background-color .12s ease; }
.button:hover { transform: translate(1px, 1px); box-shadow: 2px 2px 0 var(--ink); }
.button-primary { color: var(--ink); background: var(--coral); }
.button-primary:hover { background: #ff7d9f; }
.button-secondary { color: var(--ink); border-color: var(--ink); background: var(--mint); }
.button-secondary:hover { background: #83eee3; }
.button-quiet { color: var(--ink); border-color: var(--ink); background: var(--sky); }
.button-quiet:hover { background: #a3e0ff; }

.pair-code { display: grid; gap: 5px; margin: 20px 0 4px; padding: 16px; border: 2px dashed var(--ink); border-radius: 6px; background: var(--sky); }
.pair-code output { color: var(--coral); font: 36px/1.1 Georgia, serif; letter-spacing: 3px; }
.muted, .field-note { color: var(--muted); font-size: 12px; line-height: 1.5; }
.divider { height: 1px; margin-top: 22px; background: var(--line); }
.count { min-width: 28px; height: 28px; display: inline-grid; place-items: center; border: 2px solid var(--ink); border-radius: 50%; color: var(--ink); background: var(--yellow); font-size: 11px; font-weight: 900; }
.count-large { min-width: 38px; height: 38px; font: 17px Georgia, serif; }

.session-list, .list-rows { display: grid; }
.session-row, .list-row { min-height: 55px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.session-row-title, .row-title { min-width: 0; overflow: hidden; color: var(--ink); font-size: 13px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.row-meta { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; font-weight: 500; }
.row-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; }
.text-button { padding: 6px 0; border: 0; color: var(--mint-strong); background: transparent; font-size: 11px; font-weight: 900; }
.text-button:hover { color: var(--forest); text-decoration: underline; }
.text-button.danger { color: var(--danger); }
.empty-row { padding: 14px 0; color: var(--muted); font-size: 12px; }

.player-stage { position: relative; min-height: 240px; overflow: hidden; border: 3px solid var(--ink); border-radius: 6px; background: #17131c; aspect-ratio: 16 / 8.7; box-shadow: 5px 5px 0 var(--ink); }
.player-stage video { width: 100%; height: 100%; display: block; background: #0b1512; object-fit: contain; }
.player-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: #afc0b8; }
.player-empty p { margin: 0; font: italic 15px Georgia, serif; }
.screen-mark { width: 54px; height: 54px; display: grid; place-items: center; border: 2px solid var(--yellow); border-radius: 8px; color: var(--yellow); font: 900 19px Impact, sans-serif; transform: rotate(-4deg); }
.player-meta { min-height: 82px; padding: 15px 0 12px; border-bottom: 1px solid var(--line); }
.player-meta .eyebrow { margin-bottom: 6px; }
.player-meta h2 { font: 21px Georgia, serif; }
.room-presence { flex: 0 0 auto; color: var(--muted); font-size: 11px; }
.key-form { max-width: 600px; padding-top: 18px; }
label { display: block; margin-bottom: 7px; color: var(--ink); font-size: 12px; font-weight: 750; }
.key-entry { display: flex; gap: 9px; }
input, select, textarea { width: 100%; min-width: 0; border: 2px solid var(--ink); border-radius: 5px; outline: none; color: var(--ink); background: var(--surface); }
input, select { min-height: 42px; padding: 0 12px; }
textarea { padding: 11px 12px; resize: vertical; font: 12px/1.5 Consolas, "Courier New", monospace; }
input:focus, select:focus, textarea:focus { border-color: var(--ink); box-shadow: 3px 3px 0 var(--mint); }
input::placeholder { color: #99a69e; }
.field-note { margin: 8px 0 0; }

.login-panel { width: min(100%, 480px); padding: 26px 0 34px; }
.login-panel .panel-heading { padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.owner-dashboard { padding-top: 1px; }
.owner-section { padding: 30px 0 35px; border-bottom: 1px solid var(--line); }
.section-title-row { align-items: flex-start; margin-bottom: 24px; }
.section-title-row .eyebrow { margin-bottom: 7px; }
.lookup-form { max-width: 560px; margin-bottom: 15px; }
.verified-request { width: min(100%, 560px); margin: 15px 0 25px; padding: 15px; border-left: 3px solid var(--mint-strong); background: #e9f3ed; }
.verified-request .row-actions { margin-top: 12px; }
.subsection-heading { justify-content: flex-start; margin-top: 24px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.subsection-heading h3 { margin-right: 4px; }
.upload-form { max-width: 900px; padding: 22px; border: 2px solid var(--ink); border-radius: 6px; background: var(--surface); box-shadow: 5px 5px 0 var(--ink); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.field-wide { grid-column: 1 / -1; }
.field input[type="file"] { padding: 8px 10px; }
.form-actions { display: flex; align-items: center; gap: 15px; margin-top: 18px; }
.upload-progress { color: var(--mint-strong); font-size: 12px; }
.key-result { max-width: 640px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.library-section > .list-rows { max-width: 900px; margin-top: 18px; }
.create-session-form { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto; align-items: end; gap: 14px; max-width: 950px; }
.sessions-section > .list-rows { max-width: 950px; margin-top: 19px; }
.toast { min-height: 22px; margin: 16px 0 0; color: var(--coral); font-size: 12px; font-weight: 700; }
.toast.is-success { color: var(--mint-strong); }

.site-footer { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 clamp(20px, 5vw, 76px); border-top: 3px solid var(--ink); color: var(--ink); background: var(--mint); font-size: 10px; font-weight: 900; }

@media (max-width: 820px) {
  main { width: min(100% - 36px, 720px); }
  .topbar { padding: 0 18px; }
  .watch-layout { grid-template-columns: minmax(230px, .8fr) minmax(0, 1.4fr); }
  .access-panel { padding-right: 18px; }
  .player-panel { padding-left: 18px; }
  h1 { font-size: 40px; }
  .heading-note { max-width: 150px; text-align: right; }
}

@media (max-width: 620px) {
  .topbar { min-height: 68px; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 6px 16px; }
  .wordmark { font-size: 9px; }
  .wordmark-mark { width: 36px; height: 36px; font-size: 14px; }
  .wordmark-copy strong { font-size: 11px; }
  .wordmark-copy small { font-size: 9px; }
  .primary-nav { grid-column: 2; grid-row: 1; }
  .nav-tab { min-width: 65px; padding: 0 10px; font-size: 12px; }
  .connection-state { display: none; }
  main { width: calc(100% - 32px); min-height: calc(100vh - 124px); }
  .screen { padding: 32px 0; }
  .page-heading { min-height: 105px; align-items: flex-end; padding-bottom: 18px; }
  h1 { font-size: 34px; }
  .heading-note { display: none; }
  .watch-layout { grid-template-columns: 1fr; }
  .access-panel { padding: 22px 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .player-panel { padding: 22px 0; }
  .player-stage { min-height: 190px; aspect-ratio: 16 / 10; }
  .player-meta { align-items: flex-start; }
  .player-meta h2 { font-size: 18px; }
  .room-presence { max-width: 105px; text-align: right; }
  .key-entry { align-items: stretch; }
  .key-entry .button { flex: 0 0 auto; padding: 0 12px; }
  .form-grid, .create-session-form { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .upload-form { padding: 15px; }
  .form-actions { align-items: flex-start; flex-direction: column; }
  .site-footer { align-items: flex-start; flex-direction: column; justify-content: center; gap: 5px; padding: 12px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
/* ---- Cartoon image additions ---- */
#watch-title { max-width: 820px; font-size: 38px; }
#watch-title sup { font-size: .4em; }
.poster-wall {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-template-rows: repeat(2, 150px);
  gap: 18px;
  padding: 30px 6px 34px;
  border-bottom: 2px dashed var(--line);
}

.poster {
  position: relative;
  margin: 0;
  overflow: hidden;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: var(--ink);
  box-shadow: 5px 5px 0 var(--ink);
  transition: transform .15s ease, box-shadow .15s ease;
}

.poster img { width: 100%; height: 100%; display: block; object-fit: cover; }
.poster:hover { z-index: 2; transform: rotate(0) scale(1.04) !important; box-shadow: 7px 7px 0 var(--coral); }

.poster figcaption {
  position: absolute;
  left: 0;
  bottom: 0;
  padding: 4px 10px;
  border-top: 2px solid var(--ink);
  border-right: 2px solid var(--ink);
  border-radius: 0 8px 0 0;
  color: var(--ink);
  background: var(--yellow);
  font: 14px/1.2 Impact, "Comic Sans MS", sans-serif;
  letter-spacing: .5px;
}

.poster-main { grid-column: 1 / 4; grid-row: 1 / 3; transform: rotate(-1deg); }
.poster-main figcaption { padding: 7px 14px; font-size: 20px; background: var(--mint); }
.poster-a { grid-column: 4 / 6; transform: rotate(1.5deg); }
.poster-b { grid-column: 6; transform: rotate(-2deg); }
.poster-c { grid-column: 4 / 6; grid-row: 2; transform: rotate(-1deg); }
.poster-d { grid-column: 6; grid-row: 2; transform: rotate(2deg); }

.burst {
  display: inline-block;
  margin-right: 8px;
  padding: 2px 8px;
  border: 2px solid var(--ink);
  border-radius: 20px;
  color: #fff;
  background: var(--coral);
  font-size: 14px;
  transform: rotate(-6deg);
}

.mascot {
  display: block;
  width: 100%;
  max-width: 280px;
  margin: 30px auto 0;
  border: 3px solid var(--ink);
  border-radius: 50% 50% 8px 8px / 40% 40% 8px 8px;
  box-shadow: 4px 4px 0 var(--ink);
  transform: rotate(-2deg);
}

.player-empty { z-index: 1; }
.player-bg { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; object-fit: cover; opacity: .35; filter: saturate(1.2); }
.player-empty .screen-mark { background: rgba(23, 19, 28, .75); }
.player-empty p { color: #fff; text-shadow: 2px 2px 0 var(--ink); }
.player-empty .player-hint { margin-top: -4px; padding: 4px 12px; border: 2px solid var(--ink); border-radius: 20px; color: var(--ink); background: var(--yellow); text-shadow: none; font: 700 13px "Trebuchet MS", sans-serif; font-style: normal; }
.player-stage video { position: relative; z-index: 2; }

.heading-sticker {
  width: 150px;
  height: 100px;
  margin-left: auto;
  border: 3px solid var(--ink);
  border-radius: 8px;
  box-shadow: 4px 4px 0 var(--ink);
  object-fit: cover;
  transform: rotate(3deg);
}

.login-panel { position: relative; }
.login-sticker {
  position: absolute;
  left: calc(100% + 40px);
  top: 20px;
  width: 220px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  box-shadow: 5px 5px 0 var(--ink);
  transform: rotate(3deg);
}

.film-strip {
  display: flex;
  gap: 8px;
  padding: 14px 12px;
  overflow: hidden;
  border-top: 3px solid var(--ink);
  background: var(--ink);
}
.film-strip img {
  flex: 1 1 0;
  min-width: 0;
  height: 90px;
  border: 2px solid #5a4f63;
  border-radius: 3px;
  object-fit: cover;
}

@media (max-width: 820px) {
  .poster-wall { grid-template-rows: repeat(2, 120px); gap: 12px; }
  .login-sticker { position: static; display: block; margin-top: 24px; width: 100%; max-width: 260px; }
}

@media (max-width: 620px) {
  .poster-wall { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: none; grid-auto-rows: 110px; }
  .poster-main { grid-column: 1 / 3; grid-row: auto; height: 170px; }
  .poster-a, .poster-b, .poster-c, .poster-d { grid-column: auto; grid-row: auto; }
  .heading-sticker { display: none; }
  .film-strip img:nth-child(n+4) { display: none; }
}
