/* Doodle'n Guess / Sudokix — High-Contrast Hand-Drawn Doodle Design System (see DESIGN.md) */

:root {
  --paper: #f7f3e8;
  --paper-grid: #ded6c1;
  --card: #fffef9;
  --ink: #111116;
  --ink-muted: #3d3c47;
  --border: 3px solid #111116;
  --border-thin: 2.5px solid #111116;
  --shadow: 5px 5px 0 #111116;
  --shadow-sm: 3px 3px 0 #111116;

  --coral: #e63946;
  --cobalt: #1d4ed8;
  --yellow: #ffd60a;
  --green: #15803d;
  --green-soft: #dcfce7;
  --amber-soft: #fef3c7;
  --blue-soft: #dbeafe;
  /* Slightly organic hand-drawn corner radii */
  --radius: 18px 14px 19px 15px / 15px 19px 14px 18px;
  --radius-sm: 11px 9px 12px 10px / 9px 12px 10px 11px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  touch-action: manipulation;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background-color: var(--paper);
  background-image:
    radial-gradient(var(--paper-grid) 1.5px, transparent 1.5px);
  background-size: 22px 22px;
  color: var(--ink);
  font-family: "Comic Neue", "Trebuchet MS", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
  touch-action: manipulation;
}

button,
.avatar-customizer,
.console-shell {
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

input, textarea, .invite-box code {
  user-select: text;
  -webkit-user-select: text;
}

/* --- 2-Frame Flipbook Line-Boil Animation --- */

.doodle-svg {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

.doodle-anim .frame-a {
  animation: doodle-frame-a 0.52s steps(1, end) infinite;
}

.doodle-anim .frame-b {
  animation: doodle-frame-b 0.52s steps(1, end) infinite;
}

@keyframes doodle-frame-a {
  0%, 49.99% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

@keyframes doodle-frame-b {
  0%, 49.99% { opacity: 0; }
  50%, 100% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .doodle-anim .frame-a { animation: none; opacity: 1; }
  .doodle-anim .frame-b { animation: none; opacity: 0; }
}

/* --- Cards & Buttons --- */

.card {
  background: var(--card);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  font-weight: 800;
  cursor: pointer;
  background: var(--card);
  transition: transform 80ms ease, box-shadow 80ms ease;
}

.btn:hover:not(:disabled) {
  transform: translate(-2px, -2px) rotate(-0.5deg);
  box-shadow: 5px 5px 0 var(--ink);
}

.btn:active:not(:disabled) {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ink);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--coral);
  color: #fffef9;
}

.btn-secondary {
  background: var(--cobalt);
  color: #fffef9;
}

.btn-ink {
  background: var(--ink);
  color: #fffef9;
}

.btn-outline {
  background: var(--card);
}

.btn-ghost {
  background: var(--yellow);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.88rem;
}

.btn-lg {
  padding: 14px 20px;
  font-size: 1.06rem;
  flex-direction: column;
  gap: 2px;
}

.btn-lg small {
  font-size: 0.8rem;
  font-weight: 600;
  opacity: 0.95;
}

.btn-play-big {
  width: 100%;
  padding: 13px 18px;
  font-size: 1.4rem;
  font-weight: 900;
  letter-spacing: -0.01em;
  background: #22c55e;
  color: #111116;
  flex-wrap: wrap;
}

.play-game-chip {
  font-size: 0.78rem;
  font-weight: 900;
  padding: 2px 10px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: var(--yellow);
  color: var(--ink);
  letter-spacing: 0.01em;
}

.btn-private-big {
  width: 100%;
  padding: 12px 18px;
  font-size: 1.04rem;
  font-weight: 900;
}

.btn-lobby-start {
  width: auto;
  min-width: 240px;
}

/* --- Two-Column Landing Arcade Layout (Game Showcase + Player Setup Widget) --- */

.landing-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(350px, 430px);
  gap: 22px;
  align-items: stretch;
}

.game-showcase {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  height: 100%;
}

.game-cards {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.game-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  width: 100%;
  text-align: left;
  text-decoration: none;
  color: inherit;
  padding: 14px 16px;
  border: var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 80ms ease, box-shadow 80ms ease, background-color 80ms ease;
}

.game-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: var(--shadow);
}

.game-card.active {
  background: var(--yellow);
  box-shadow: var(--shadow);
}

.game-card-icon {
  flex: 0 0 auto;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border: var(--border-thin);
  border-radius: var(--radius-sm);
  background: var(--card);
  box-shadow: 2px 2px 0 var(--ink);
}

.game-card-body {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.game-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.game-card-name {
  font-size: 1.2rem;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.game-card-meta {
  font-size: 0.76rem;
  font-weight: 900;
  padding: 2px 9px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  white-space: nowrap;
}

.game-card-desc {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink-muted);
  line-height: 1.4;
}

.game-card.active .game-card-desc {
  color: var(--ink);
}

.game-card-tags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.game-tag {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 1px 8px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--card);
}

.game-selected-badge {
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 9px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: var(--yellow);
}

.howto-inline-card {
  padding: 16px 18px;
  flex: 1 1 auto;
}

.howto-inline-card .info-card-head {
  margin-bottom: 10px;
  padding-bottom: 8px;
}

.howto-inline-card .howto-steps {
  gap: 6px;
  font-size: 0.9rem;
}

.unified-play-card {
  width: 100%;
  height: 100%;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 13px;
}

.setup-top-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 136px;
  gap: 10px;
}

.avatar-customizer {
  position: relative;
  display: grid;
  grid-template-columns: 44px 136px 44px;
  justify-content: center;
  align-items: center;
  justify-items: center;
  gap: 8px;
  padding: 18px 56px;
  background: var(--paper);
  border: var(--border);
  border-radius: var(--radius);
  min-height: 176px;
}

.avatar-corner-btn {
  position: absolute;
  top: 8px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: var(--border-thin);
  border-radius: 10px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  padding: 0;
  transition: transform 80ms ease;
}

.avatar-corner-btn.left { left: 8px; }
.avatar-corner-btn.right { right: 8px; }

.avatar-corner-btn:hover {
  transform: translate(-1px, -1px) rotate(-4deg);
  background: var(--yellow);
}

.avatar-corner-btn:active {
  transform: translate(1px, 1px);
}

.arrow-col {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}

.doodle-arrow-btn {
  width: 44px;
  height: 38px;
  display: grid;
  place-items: center;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: transform 80ms ease;
}

.doodle-arrow-btn:hover {
  transform: scale(1.16);
}

.doodle-arrow-btn:active {
  transform: scale(0.94);
}

.avatar-center-stage {
  width: 136px;
  height: 136px;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.avatar-center-stage .avatar-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.unified-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.settings-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

/* --- Landing Screen --- */

.landing-shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px 20px 36px;
}

.landing-hero {
  margin-bottom: 18px;
}

.hero-brand-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  text-align: left;
}

.hero-mascot {
  background: var(--card);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 8px;
  transform: rotate(-3deg);
}

.brand-badge {
  display: inline-block;
  background: var(--yellow);
  border: var(--border-thin);
  border-radius: 999px;
  padding: 3px 13px;
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.landing-hero h1 {
  margin: 8px 0 4px;
  font-size: clamp(2.4rem, 5.5vw, 3.6rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1;
}

.hero-tagline {
  margin: 0;
  color: var(--ink-muted);
  font-size: 1.08rem;
  font-weight: 600;
}

.notice-banner {
  margin: 0 0 20px;
  padding: 13px 18px;
  background: var(--amber-soft);
  border: var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  font-weight: 700;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.card-header h2 {
  margin: 0;
  font-size: 1.24rem;
  font-weight: 900;
}

.setting-field label {
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink);
}

input[type="text"], input[type="number"], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: var(--border-thin);
  border-radius: var(--radius-sm);
  background: #ffffff;
  font-weight: 600;
}

input:focus, select:focus, textarea:focus {
  outline: 3px solid var(--yellow);
  outline-offset: 2px;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 14px;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 3px;
  background: var(--ink);
  border-radius: 3px;
  opacity: 0.25;
}

.join-form {
  display: flex;
  gap: 10px;
}

.join-form input {
  text-transform: uppercase;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 800;
  letter-spacing: 0.08em;
}

/* --- About, News & How to Play Cards --- */

.info-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 22px;
}

.info-strip-2 {
  grid-template-columns: repeat(2, 1fr);
}

.faq-card {
  margin-top: 18px;
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.faq-item {
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  background: var(--paper);
  padding: 10px 14px;
}

.faq-item summary {
  font-weight: 900;
  font-size: 0.96rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: '+';
  font-size: 1.2rem;
  font-weight: 900;
  flex-shrink: 0;
}

.faq-item[open] summary::after {
  content: '−';
}

.faq-item p {
  margin: 8px 0 0;
  font-size: 0.92rem;
  color: var(--ink-muted);
}

.info-card {
  padding: 20px;
}

.info-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 2.5px dashed var(--ink);
}

.info-card h3 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 900;
}

.info-card p {
  margin: 0 0 10px;
  font-size: 0.95rem;
}

.info-card p:last-child {
  margin-bottom: 0;
}

.news-list, .howto-steps {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 0.94rem;
}

.news-list {
  list-style: none;
  padding-left: 0;
}

.news-badge {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 6px;
  font-size: 0.7rem;
  font-weight: 900;
  background: var(--yellow);
  border: 2px solid var(--ink);
  border-radius: 6px;
}

/* --- Bottom Footer Links --- */

.site-footer {
  margin-top: 30px;
  padding: 18px 20px;
  background: var(--card);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 18px;
  margin-bottom: 10px;
}

.footer-link {
  background: none;
  border: none;
  padding: 4px 6px;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 2.5px;
  text-underline-offset: 4px;
  cursor: pointer;
}

.footer-link:hover {
  background: var(--yellow);
  border-radius: 6px;
}

.footer-note {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink-muted);
}

.playing-now-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 10px;
  padding: 4px 12px;
  background: var(--green-soft);
  border: 2px solid var(--ink);
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--ink);
}

.playing-now-pill.hidden {
  display: none;
}

.live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid var(--ink);
  flex-shrink: 0;
}

/* --- Info Modal --- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(17, 17, 22, 0.58);
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop.hidden {
  display: none;
}

.modal-card {
  max-width: 480px;
  width: 100%;
  padding: 22px;
}

.modal-body p {
  margin: 0 0 10px;
}

.modal-list {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* --- Main Party Game Console (Single-Screen 100dvh, Zero Page Scroll) --- */

.console-shell {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 10px 14px 12px;
  gap: 10px;
  max-width: 1480px;
  margin: 0 auto;
}

.console-topbar {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 56px;
  padding: 8px 14px;
  background: var(--card);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.console-logo {
  font-weight: 900;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
  padding-right: 4px;
}

.room-code-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 8px 0 11px;
  border: var(--border-thin);
  border-radius: var(--radius-sm);
  box-shadow: 2px 2px 0 var(--ink);
  background: var(--paper);
  cursor: pointer;
  font-size: 0.85rem;
  white-space: nowrap;
  transition: transform 80ms ease, box-shadow 80ms ease;
}

.room-code-chip:hover {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--ink);
}

.room-code-chip strong {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.08em;
}

.chip-label {
  font-size: 0.68rem;
  font-weight: 900;
  color: var(--ink-muted);
}

.chip-copy {
  background: var(--yellow);
  border: 2px solid var(--ink);
  border-radius: 7px;
  padding: 1px 7px;
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1.3;
}

.topbar-ctrl {
  height: 36px;
  padding: 0 12px;
  border-width: 2.5px;
  box-shadow: 2px 2px 0 var(--ink);
  white-space: nowrap;
}

.topbar-gear-btn {
  display: none;
  width: 36px;
  height: 36px;
  padding: 0;
  border-width: 2.5px;
  box-shadow: 2px 2px 0 var(--ink);
  flex-shrink: 0;
}

.room-menu-card {
  max-width: 340px;
}

.room-menu-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.room-menu-actions .btn {
  width: 100%;
}

.topbar-center {
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: 0;
}

.header-status-pill {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 16px;
  border: var(--border-thin);
  border-radius: var(--radius-sm);
  font-weight: 900;
  font-size: 0.92rem;
  background: var(--paper);
  white-space: nowrap;
}

.header-status-pill.accent {
  background: var(--yellow);
}

.console-workspace {
  flex: 1 1 0;
  min-height: 0;
  display: grid;
  grid-template-columns: 235px minmax(0, 1fr) 300px;
  gap: 14px;
  padding: 0 5px 6px 0;
  align-items: stretch;
}

.console-roster,
.console-chat {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.console-stage {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.panel-title {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: var(--border);
  font-weight: 900;
  font-size: 0.94rem;
}

.pill-count {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
  font-weight: 900;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--yellow);
  border: 2px solid var(--ink);
}

/* --- Roster --- */

.roster-list {
  flex: 1 1 0;
  min-height: 0;
  list-style: none;
  margin: 0;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  overflow-y: auto;
}

.roster-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  background: var(--paper);
}

.roster-item.is-me {
  border-color: var(--ink);
  background: #ffffff;
}

.roster-item.is-drawer {
  background: var(--amber-soft);
  border-color: var(--ink);
}

.roster-item.is-solved {
  background: var(--green-soft);
  border-color: var(--green);
}

.roster-rank {
  width: 24px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 900;
  font-size: 0.82rem;
}

.roster-info {
  flex: 1;
  min-width: 0;
}

.roster-name {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 800;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.roster-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink-muted);
}

.tag {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 6px;
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  border: 2px solid var(--ink);
}

.tag-host { background: var(--yellow); }
.tag-you { background: var(--blue-soft); }
.tag-drawer { background: var(--coral); color: #fffef9; }
.tag-solved { background: var(--green); color: #fffef9; }
.tag-voted { background: var(--cobalt); color: #fffef9; }
.tag-spy { background: var(--ink); color: var(--yellow); }
.tag-offline { background: var(--paper); color: var(--ink-muted); border-style: dashed; }

.roster-item.is-spy {
  background: #fee2e2;
  border-color: var(--coral);
}

.roster-color-dot,
.inline-color-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  flex-shrink: 0;
  vertical-align: middle;
}

/* --- Reconnecting Banner (fits inside 100dvh without kicking player out) --- */

.connection-banner {
  flex: 0 0 auto;
  background: var(--yellow);
  border: var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  padding: 8px 14px;
}

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

.connection-banner-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  font-weight: 800;
  font-size: 0.94rem;
}

.waiting-dots {
  font-size: 0.8rem;
  font-weight: 900;
  padding: 2px 9px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--card);
}

.btn-kick {
  border: 2px solid var(--ink);
  background: #ffffff;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  font-weight: 900;
  cursor: pointer;
  line-height: 1;
}

.btn-kick:hover {
  background: var(--coral);
  color: #fffef9;
}

/* --- Chat --- */

.chat-feed {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 0.92rem;
}

.chat-msg {
  padding: 7px 10px;
  border-radius: 9px;
  border: 1.5px solid rgba(17, 17, 22, 0.14);
  background: var(--paper);
  word-break: break-word;
}

.chat-msg.tone-info {
  background: var(--blue-soft);
  border-color: var(--ink);
  font-weight: 700;
  font-size: 0.88rem;
}

.chat-msg.tone-success {
  background: var(--green-soft);
  border-color: var(--green);
  color: #14532d;
  font-weight: 800;
}

.chat-msg.tone-warn {
  background: var(--amber-soft);
  border-color: var(--ink);
  color: #713f12;
  font-weight: 800;
}

.chat-msg.channel-solved {
  background: #ecfdf5;
  border: 2px dashed var(--green);
}

.solved-pill {
  display: inline-block;
  font-size: 0.66rem;
  font-weight: 900;
  background: var(--green);
  color: #fffef9;
  padding: 1px 6px;
  border-radius: 5px;
}

.chat-form {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  padding: 9px 10px;
  border-top: var(--border);
  background: var(--card);
}

/* --- Lobby & Podium --- */

.lobby-panel, .podium-panel {
  padding: 20px 22px;
  height: 100%;
  min-height: 0;
  overflow-y: auto;
}

.eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--coral);
}

.lobby-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.lobby-header h2, .podium-panel h2 {
  margin: 4px 0 0;
  font-size: 1.55rem;
  font-weight: 900;
}

.invite-box {
  background: var(--yellow);
  border: var(--border-thin);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.invite-label {
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.invite-box code {
  font-size: 0.84rem;
  font-weight: 800;
  word-break: break-all;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}

.setting-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.setting-field.full-width {
  margin-top: 8px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 0.9rem;
  text-transform: none !important;
  letter-spacing: 0 !important;
  font-weight: 700 !important;
}

.checkbox-row input {
  width: auto;
}

.lobby-footer {
  margin-top: 22px;
  display: flex;
  justify-content: center;
}

.waiting-banner {
  padding: 12px 18px;
  background: var(--paper);
  border: var(--border-thin);
  border-radius: var(--radius-sm);
  font-weight: 800;
}

/* --- Podium --- */

.podium-panel {
  text-align: center;
}

.podium-trophy {
  margin-bottom: 6px;
}

.podium-blocks {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 16px;
  margin: 26px 0;
}

.podium-col {
  width: 145px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.podium-name {
  font-weight: 900;
}

.podium-score {
  font-size: 0.88rem;
  color: var(--ink-muted);
  font-weight: 800;
}

.podium-step {
  width: 100%;
  border: var(--border);
  border-radius: 12px 12px 0 0;
  font-weight: 900;
  font-size: 1.5rem;
  display: grid;
  place-items: center;
}

.place-1 .podium-step { height: 112px; background: var(--yellow); }
.place-2 .podium-step { height: 82px; background: #e5e7eb; }
.place-3 .podium-step { height: 64px; background: #fdba74; }

.standings-list {
  max-width: 420px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.standings-row {
  display: flex;
  justify-content: space-between;
  padding: 9px 13px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 9px;
  font-weight: 700;
}

/* --- Doodle'n Guess Header & Stage --- */

.doodle-header {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  justify-content: space-between;
  max-width: 740px;
}

.header-clock-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.round-badge {
  font-size: 0.84rem;
  font-weight: 900;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--paper);
  border: var(--border-thin);
  white-space: nowrap;
}

.word-center {
  flex: 1;
  text-align: center;
}

.word-status {
  font-weight: 800;
  color: var(--ink-muted);
}

.word-status.accent {
  color: var(--coral);
  font-weight: 900;
}

.word-display {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.word-role {
  font-size: 0.7rem;
  font-weight: 900;
  padding: 2px 8px;
  border-radius: 6px;
  border: 2px solid var(--ink);
  background: var(--yellow);
  align-self: center;
}

.word-letters {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.38rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.word-space {
  display: inline-block;
  width: 16px;
}

.word-lengths {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  font-weight: 900;
  color: var(--ink);
}

.timer-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 68px;
  text-align: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 900;
  font-size: 1.05rem;
  padding: 4px 10px 4px 7px;
  border: var(--border-thin);
  border-radius: 999px;
  background: var(--yellow);
}

.timer-pill.urgent {
  background: var(--coral);
  color: #fffef9;
  animation: pulse 0.6s infinite alternate;
}

@keyframes pulse {
  from { transform: scale(1); }
  to { transform: scale(1.08); }
}

.doodle-stage {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.canvas-frame {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  container-type: size;
  display: grid;
  place-items: center;
  background: var(--paper);
  border-bottom: var(--border);
  overflow: hidden;
}

#dng-canvas,
#spy-canvas {
  display: block;
  width: min(100cqw, calc(100cqh * 4 / 3));
  height: min(100cqh, calc(100cqw * 3 / 4));
  background: #ffffff;
  box-shadow: 0 0 0 2px var(--ink);
  touch-action: none;
  cursor: default;
}

#dng-canvas.is-drawable,
#spy-canvas.is-drawable {
  cursor: crosshair;
}

.canvas-overlay {
  position: absolute;
  inset: 0;
  background: rgba(17, 17, 22, 0.56);
  backdrop-filter: blur(2px);
  display: grid;
  place-items: center;
  padding: 20px;
}

.canvas-overlay.hidden {
  display: none;
}

.overlay-card {
  background: var(--card);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px 28px;
  text-align: center;
  max-width: 500px;
  max-height: 92%;
  overflow-y: auto;
  width: 100%;
}

.overlay-doodle {
  margin-bottom: 6px;
}

.overlay-card h3 {
  margin: 6px 0 16px;
  font-size: 1.38rem;
  font-weight: 900;
}

.word-choice-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.btn-choice {
  background: var(--yellow);
  font-size: 1.08rem;
  padding: 11px 18px;
}

.reveal-highlight {
  color: var(--coral);
  text-decoration: underline;
  text-decoration-thickness: 3px;
  text-underline-offset: 4px;
}

.delta-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.delta-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 9px;
  font-weight: 700;
}

.delta-plus {
  color: var(--green);
}

.delta-empty {
  color: var(--ink-muted);
  font-size: 0.94rem;
  font-weight: 700;
}

/* --- Drawing Toolbar --- */

.doodle-toolbar {
  flex: 0 0 auto;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--paper);
}

.toolbar-palette {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 5px;
}

.pal-swatch {
  height: 22px;
  border-radius: 6px;
  border: 2.5px solid var(--ink);
  cursor: pointer;
}

.pal-swatch.active {
  outline: 3px solid var(--coral);
  outline-offset: 1px;
  transform: scale(1.1);
}

.toolbar-tools {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.tool-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tool-btn, .size-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: var(--border-thin);
  border-radius: 9px;
  background: var(--card);
  padding: 6px 10px;
  font-weight: 800;
  font-size: 0.85rem;
  cursor: pointer;
}

.tool-btn.active, .size-btn.active {
  background: var(--yellow);
  box-shadow: var(--shadow-sm);
}

.tool-btn.danger:hover {
  background: var(--coral);
  color: #fffef9;
}

.size-btn {
  width: 38px;
  height: 36px;
  padding: 0;
}

.size-btn span {
  display: block;
  border-radius: 50%;
  background: var(--ink);
}

.guesser-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.guesser-hint {
  font-size: 0.94rem;
  font-weight: 700;
}

.reaction-btns {
  display: flex;
  gap: 8px;
}

.react-btn {
  gap: 6px;
}

/* --- Spy Canvas Header, Overlays & Bottom Bar --- */

.spy-cat-badge {
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 9px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: var(--blue-soft);
  align-self: center;
}

.word-role.spy-badge {
  background: var(--ink);
  color: var(--yellow);
  font-size: 0.84rem;
  padding: 3px 11px;
}

.overlay-sub {
  margin: 0 0 12px;
  color: var(--ink-muted);
  font-weight: 700;
  font-size: 0.96rem;
}

.pen-preview-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  border: var(--border-thin);
  border-radius: 999px;
  background: var(--paper);
  font-weight: 800;
  font-size: 0.88rem;
}

.pen-swatch {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2.5px solid var(--ink);
  flex-shrink: 0;
}

.spy-toolbar {
  padding: 8px 12px;
}

.spy-draw-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.spy-bar-left,
.spy-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pen-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border: var(--border-thin);
  border-radius: 999px;
  background: var(--card);
  font-weight: 900;
  font-size: 0.86rem;
}

.stroke-status-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--card);
  font-weight: 800;
  font-size: 0.82rem;
}

.stroke-status-pill.done {
  background: var(--green-soft);
}

.btn-play-done {
  background: #22c55e;
  color: var(--ink);
}

.spy-vote-bar {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.spy-vote-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.spy-vote-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 900;
  font-size: 0.94rem;
}

.vote-chip-row {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  max-height: 76px;
  overflow-y: auto;
}

.vote-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border: var(--border-thin);
  border-radius: 999px;
  background: var(--card);
  font-weight: 800;
  font-size: 0.86rem;
  cursor: pointer;
}

.vote-chip:hover:not(:disabled) {
  background: var(--yellow);
}

.vote-chip.selected {
  background: var(--coral);
  color: #fffef9;
  box-shadow: var(--shadow-sm);
}

.vote-check {
  font-weight: 900;
}

.spy-guess-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.spy-guess-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 900;
  font-size: 0.9rem;
  white-space: nowrap;
}

.spy-guess-form input {
  flex: 1 1 180px;
  min-width: 120px;
  padding: 7px 10px;
}

/* --- Toasts --- */

.toast-region {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 70;
  pointer-events: none;
  max-width: min(92vw, 540px);
}

.toast {
  padding: 11px 18px;
  border: var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  font-weight: 800;
  font-size: 0.94rem;
  background: var(--card);
  text-align: center;
}

.toast-success { background: var(--green-soft); }
.toast-warn { background: var(--amber-soft); }

.roster-list,
.chat-feed,
.lobby-panel,
.podium-panel,
.vote-chip-row {
  touch-action: pan-y;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* --- Responsive Layout --- */

@media (max-width: 1120px) {
  .console-workspace {
    grid-template-columns: 205px minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) 210px;
  }
  .console-chat {
    grid-column: 1 / -1;
  }
}

@media (max-width: 860px) {
  .landing-main-grid, .info-strip, .info-strip-2, .settings-grid-3 {
    grid-template-columns: 1fr;
  }
  .hero-brand-row {
    justify-content: center;
    text-align: center;
  }
  .avatar-customizer {
    grid-template-columns: 38px 116px 38px;
    gap: 4px;
    padding: 16px 46px;
  }
  .avatar-center-stage {
    width: 116px;
    height: 116px;
  }
  .doodle-arrow-btn {
    width: 38px;
    height: 34px;
  }

  /* Skribbl-style mobile console: single-row clean topbar + gear menu, top ~50% full-width stage, bottom ~50% split roster | chat, full-width bottom input */
  .console-shell {
    padding: 6px 8px 8px;
    gap: 6px;
  }
  .console-topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    min-height: 46px;
    padding: 5px 8px;
    border-width: 2.5px;
    border-radius: var(--radius-sm);
  }
  .topbar-left,
  .topbar-right {
    display: none;
  }
  .topbar-center {
    grid-column: 1;
    justify-content: flex-start;
    width: 100%;
    min-width: 0;
  }
  .topbar-gear-btn {
    display: inline-flex;
  }
  .doodle-header {
    gap: 6px;
    max-width: none;
    align-items: center;
  }
  .header-clock-group {
    gap: 4px;
  }
  .round-badge,
  .word-role:not(.spy-badge) {
    display: none;
  }
  .word-center {
    min-width: 0;
  }
  .word-display {
    flex-wrap: nowrap;
    gap: 6px;
    max-width: 100%;
    overflow: hidden;
  }
  .timer-pill {
    min-width: 52px;
    height: 32px;
    padding: 0 8px 0 5px;
    font-size: 0.88rem;
    gap: 3px;
  }
  .timer-pill .doodle-svg {
    width: 18px;
    height: 18px;
  }
  .word-letters {
    font-size: 0.98rem;
    letter-spacing: 0.04em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .word-role.spy-badge, .spy-cat-badge {
    font-size: 0.68rem;
    padding: 2px 7px;
    white-space: nowrap;
  }
  .header-status-pill {
    height: 32px;
    padding: 0 11px;
    font-size: 0.8rem;
  }

  .console-workspace {
    grid-template-columns: 43% minmax(0, 1fr);
    grid-template-rows: minmax(0, 1.15fr) minmax(0, 0.85fr) auto;
    gap: 6px;
    padding: 0 3px 3px 0;
  }
  .console-stage {
    grid-column: 1 / -1;
    grid-row: 1;
  }
  .doodle-stage {
    border-width: 2.5px;
    box-shadow: var(--shadow-sm);
  }
  .console-roster {
    grid-column: 1;
    grid-row: 2;
    border-width: 2.5px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
  }
  .console-roster .panel-title {
    padding: 5px 8px;
    font-size: 0.78rem;
    border-bottom-width: 2px;
  }
  .console-roster .pill-count {
    font-size: 0.72rem;
    padding: 1px 6px;
  }
  .roster-list {
    padding: 4px;
    gap: 4px;
  }
  .roster-item {
    padding: 4px 5px;
    gap: 5px;
    border-radius: 8px;
  }
  .roster-rank {
    width: 17px;
    font-size: 0.7rem;
  }
  .roster-avatar svg {
    width: 26px;
    height: 26px;
  }
  .roster-name {
    font-size: 0.78rem;
    gap: 3px;
  }
  .roster-sub {
    font-size: 0.7rem;
    gap: 4px;
  }
  .tag {
    font-size: 0.58rem;
    padding: 0 4px;
    border-width: 1.5px;
  }

  .console-chat {
    display: contents;
  }
  .console-chat > .panel-title {
    display: none;
  }
  .console-chat > .chat-feed {
    grid-column: 2;
    grid-row: 2;
    height: 100%;
    min-height: 0;
    background: var(--card);
    border: var(--border-thin);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    padding: 6px 8px;
    gap: 5px;
    font-size: 0.82rem;
  }
  .console-chat > .chat-form {
    grid-column: 1 / -1;
    grid-row: 3;
    background: var(--card);
    border: var(--border-thin);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    padding: 5px 6px;
    gap: 6px;
  }
  .console-chat > .chat-form input {
    padding: 6px 10px;
    font-size: 0.9rem;
  }

  /* Compact mobile drawing & spy toolbars so canvas gets maximum room */
  .doodle-toolbar {
    padding: 5px 6px;
    gap: 5px;
  }
  .toolbar-palette {
    gap: 3px;
  }
  .pal-swatch {
    height: 18px;
    border-width: 2px;
    border-radius: 4px;
  }
  .toolbar-tools {
    gap: 4px;
  }
  .tool-group {
    gap: 3px;
  }
  .tool-btn {
    padding: 4px 6px;
    font-size: 0.76rem;
    border-width: 2px;
  }
  .tool-btn span {
    display: none;
  }
  .size-btn {
    width: 28px;
    height: 28px;
    border-width: 2px;
  }
  .guesser-bar {
    gap: 6px;
  }
  .guesser-hint {
    font-size: 0.8rem;
  }
  .spy-draw-bar {
    gap: 5px;
  }
  .spy-bar-left, .spy-bar-right {
    gap: 5px;
  }
  .pen-chip {
    padding: 3px 8px;
    font-size: 0.76rem;
  }
  .pen-swatch {
    width: 14px;
    height: 14px;
  }
  .stroke-status-pill {
    padding: 2px 7px;
    font-size: 0.72rem;
  }
  .spy-vote-bar {
    gap: 4px;
  }
  .spy-vote-title {
    font-size: 0.82rem;
  }
  .vote-chip-row {
    max-height: 52px;
    gap: 4px;
  }
  .vote-chip {
    padding: 3px 8px;
    font-size: 0.76rem;
    border-width: 2px;
  }

  .lobby-panel, .podium-panel {
    padding: 12px 12px;
    border-width: 2.5px;
    box-shadow: var(--shadow-sm);
  }
  .lobby-header {
    gap: 8px;
    margin-bottom: 10px;
  }
  .lobby-header h2, .podium-panel h2 {
    font-size: 1.15rem;
  }
  .settings-grid {
    gap: 8px;
    margin-bottom: 8px;
  }
  .lobby-footer {
    margin-top: 12px;
  }
  .btn-lobby-start {
    min-width: 0;
    width: 100%;
    padding: 10px 14px;
    font-size: 1.12rem;
  }
  .overlay-card {
    padding: 14px 16px;
  }
  .overlay-card h3 {
    font-size: 1.12rem;
    margin: 4px 0 10px;
  }
}
