:root {
  --bg: #10151f;
  --bg-2: #141b28;
  --bg-card: #1b2333;
  --bg-card-hi: #232d42;
  --ink: #eef2f8;
  --ink-soft: #9aa7bd;
  --accent: #2dd4bf;
  --accent-2: #5eead4;
  --coral: #fb7185;
  --border: #2a3450;
  --sun: #facc15;
  --violet: #a78bfa;
  /* paper (canvas, notebook pages) and what's written on it */
  --paper: #fdfdf7;
  --paper-ink: #1f2430;
  --paper-ink-soft: #5d5a52;
  --gold-ink: #8a5a00;
  /* text on the teal accent gradient, avatar letters, fields */
  --on-accent: #052623;
  --avatar-ink: #10151f;
  --field-bg: #080b13;
  --danger-ink: #ffb3bd;
  --error-ink: #ffc2ca;
  --overlay: rgba(5, 7, 12, 0.75);
  --banner-top: #0d2e2c;
  --banner-bottom: #08201e;
  --banner-ink: #a8f5eb;
  /* torn top edge of a notebook page (mask) */
  --torn-edge: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 36 10' preserveAspectRatio='none'%3E%3Cpath d='M0 10V5l3-3 4 4 5-5 4 3 4-3 5 5 4-4 3 2 4 1v5z'/%3E%3C/svg%3E");
  --radius: 16px;
  --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.55);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-image: radial-gradient(ellipse 900px 600px at 50% -10%, rgba(45, 212, 191, 0.1), transparent 60%),
    radial-gradient(ellipse 700px 500px at 100% 20%, rgba(251, 113, 133, 0.09), transparent 60%),
    url("/paper-bg.svg"), linear-gradient(180deg, var(--bg-2), var(--bg) 320px);
  background-repeat: no-repeat, no-repeat, repeat, no-repeat;
  background-size: auto, auto, 640px 640px, auto;
  background-attachment: fixed;
  min-height: 100vh;
}

[hidden] {
  display: none !important;
}

#app {
  max-width: 720px;
  margin: 0 auto;
  /* bottom: room for the fixed ❓ button (48px + 16px offset) so it never covers Gönder */
  padding: 20px 16px calc(88px + env(safe-area-inset-bottom));
  min-height: 100vh;
}

.center {
  text-align: center;
}

.screen-title {
  margin: 6px 0 20px;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-shadow: 0 2px 16px rgba(45, 212, 191, 0.25);
}

.screen-title .brand-text {
  background: linear-gradient(135deg, var(--accent-2), var(--coral) 70%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.tagline {
  text-align: center;
  color: var(--ink-soft);
  font-size: 13px;
  margin: -12px 0 20px;
  letter-spacing: 0.4px;
}

.card {
  background: linear-gradient(180deg, var(--bg-card-hi), var(--bg-card));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.field {
  width: 100%;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--field-bg);
  color: var(--ink);
  font-size: 16px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  font-family: inherit;
}

.field:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.2);
}

textarea.field {
  resize: none;
  min-height: 70px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 13px 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  color: var(--ink);
  background: var(--bg-card-hi);
  border-color: var(--border);
  transition: transform 0.08s ease, filter 0.15s ease, box-shadow 0.15s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.btn:not(:disabled):hover {
  filter: brightness(1.12);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: var(--on-accent);
  width: 100%;
  border: none;
  box-shadow: 0 8px 22px -8px rgba(45, 212, 191, 0.55);
  font-size: 16px;
}

.btn-outline-small {
  background: linear-gradient(180deg, var(--bg-card-hi), var(--bg-card));
  border: 1px solid rgba(154, 167, 189, 0.45);
  padding: 10px 12px;
  font-size: 13px;
  box-shadow: 0 4px 14px -6px rgba(0, 0, 0, 0.6);
}

.btn-danger-outline {
  border-color: rgba(251, 113, 133, 0.55);
  color: var(--danger-ink);
}

.footer-note {
  color: var(--ink-soft);
  font-size: 13px;
  margin: 6px 0 0;
}

.mode-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  background: rgba(0, 0, 0, 0.25);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.mode-tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  border-radius: 9px;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  transition: background 0.15s ease, color 0.15s ease;
}

.mode-tab.active {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: var(--on-accent);
}

.room-code {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: 10px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin: 8px 0;
}

.error-banner {
  background: linear-gradient(180deg, rgba(251, 113, 133, 0.18), rgba(251, 113, 133, 0.08));
  border: 1px solid var(--coral);
  color: var(--error-ink);
  padding: 11px 14px;
  border-radius: 12px;
  margin-bottom: 12px;
  font-size: 14px;
}

.open-rooms-list {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.open-room-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: filter 0.15s ease;
}

.open-room-row:hover {
  filter: brightness(1.15);
}

.open-room-row span {
  color: var(--ink-soft);
  font-size: 12px;
}

/* ---------- Top bar ---------- */

.topbar-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
}

/* ---------- Lobby ---------- */

.player-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.player-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.player-row:last-child {
  border-bottom: none;
}

.player-order {
  width: 20px;
  color: var(--ink-soft);
  font-weight: 800;
  font-size: 12px;
  text-align: center;
}

.player-avatar {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-2), var(--coral));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: var(--avatar-ink);
}

.player-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-tag.spectator-tag {
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink-soft);
}

.role-choice {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.role-choice-btn {
  flex: 1;
  padding: 11px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.role-choice-btn.selected {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  border-color: transparent;
  color: var(--on-accent);
}

.player-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(45, 212, 191, 0.18);
  color: var(--accent-2);
  white-space: nowrap;
}

.reorder-btns {
  display: flex;
  gap: 4px;
}

.reorder-btn {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.reorder-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ---------- Chain screen ---------- */

/* Sticky so the timer and the counter stay in view while drawing. */
.status-bar {
  position: sticky;
  top: calc(6px + env(safe-area-inset-top));
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 12px;
  border-radius: var(--radius);
  margin-bottom: 12px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg-card-hi), var(--bg-card));
  box-shadow: var(--shadow);
}

.round-label {
  flex: 1;
  text-align: center;
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
}

.round-label small {
  display: block;
  margin-top: 1px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-soft);
}

/* Timer: a draining ring with the seconds inside; coral + pulse for the last 10 s. */
.timer-ring {
  position: relative;
  flex: none;
  width: 46px;
  height: 46px;
}

.timer-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.timer-track {
  fill: rgba(45, 212, 191, 0.08);
  stroke: var(--border);
  stroke-width: 4;
}

.timer-arc {
  fill: none;
  stroke: var(--accent);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.25s linear, stroke 0.3s ease;
}

.timer-num {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  color: var(--accent-2);
  font-variant-numeric: tabular-nums;
}

.timer-ring.urgent .timer-arc {
  stroke: var(--coral);
}

.timer-ring.urgent .timer-num {
  color: var(--coral);
}

.timer-ring.urgent {
  animation: timer-pulse 1s ease-in-out infinite;
}

@keyframes timer-pulse {
  50% {
    transform: scale(1.08);
    filter: drop-shadow(0 0 8px rgba(251, 113, 133, 0.6));
  }
}

/* Counter: outlined pill with ✅, clearly not a timer. */
.count-pill {
  flex: none;
  font-size: 13px;
  font-weight: 800;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px dashed rgba(154, 167, 189, 0.55);
  color: var(--ink);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Kimler gönderdi: avatars, lit with a ✓ once handed in. */
.submit-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: -2px 0 12px;
}

.submit-avatar,
.ring-node {
  position: relative;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-soft);
  background: var(--bg-card);
  border: 2px solid var(--border);
  transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}

.submit-avatar.done,
.ring-node.done {
  background: linear-gradient(135deg, var(--accent-2), var(--coral));
  border-color: var(--accent-2);
  color: var(--avatar-ink);
}

.avatar-check {
  position: absolute;
  right: -5px;
  bottom: -5px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 9px;
  font-style: normal;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 2px var(--bg);
  transform: scale(0);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.done > .avatar-check {
  transform: scale(1);
}

.step-banner {
  text-align: center;
  padding: 14px 16px;
  border-radius: var(--radius);
  margin-bottom: 12px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg-card-hi), var(--bg-card));
  box-shadow: var(--shadow);
}

.step-banner .step-kicker {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--accent-2);
  margin-bottom: 6px;
}

.step-banner .step-prompt {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.35;
}

.step-banner.compact {
  padding: 10px 14px;
  margin-bottom: 10px;
}

.step-banner.compact .step-prompt {
  font-size: 18px;
}

.idea-inline {
  margin-top: 8px;
}

.write-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.write-actions .btn-primary {
  flex: 1;
  width: auto;
}

/* The current round's "sheet": unfolds from its top edge when it arrives,
   and slides off to the right ("passing it on") when submitted. */
.paper-stage {
  position: relative;
  transform-origin: top center;
}

.paper-stage.unfold {
  animation: paper-unfold 0.62s cubic-bezier(0.2, 0.75, 0.25, 1) backwards;
}

.paper-stage.unfold::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 55%;
  border-radius: var(--radius) var(--radius) 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.3);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.42), transparent);
  pointer-events: none;
  animation: fold-shadow 0.62s ease-out forwards;
}

@keyframes paper-unfold {
  0% {
    transform: perspective(1000px) rotateX(-90deg);
    opacity: 0;
  }
  15% {
    opacity: 1;
  }
  70% {
    transform: perspective(1000px) rotateX(7deg);
  }
  100% {
    transform: perspective(1000px) rotateX(0);
  }
}

@keyframes fold-shadow {
  to {
    opacity: 0;
  }
}

.paper-stage.handoff-out {
  pointer-events: none;
  animation: handoff-out 0.45s cubic-bezier(0.5, 0, 0.75, 0) forwards;
}

@keyframes handoff-out {
  25% {
    transform: translateX(-8px) rotate(-2deg);
  }
  100% {
    transform: translateX(115%) rotate(14deg);
    opacity: 0;
  }
}

.prev-drawing-wrap {
  background: var(--paper);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
  aspect-ratio: 10 / 7;
  display: flex;
  align-items: center;
  justify-content: center;
}

.prev-drawing-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Any note printed on paper (light) background. */
.paper-note,
.prev-drawing-loading {
  color: var(--paper-ink-soft);
  font-size: 13px;
  margin: 0;
}

.canvas-wrap {
  background: var(--paper);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 10px;
  touch-action: none;
}

.canvas-wrap canvas {
  width: 100%;
  aspect-ratio: 10 / 7;
  display: block;
  touch-action: none;
}

/* One compact row: tools · colour · size (scrolls if a phone is very narrow),
   undo/clear pinned right; palette and sizes open as popovers above it. */
.toolbar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 6px;
  border-radius: 14px;
  background: linear-gradient(180deg, var(--bg-card-hi), var(--bg-card));
  border: 1px solid var(--border);
  margin-bottom: 10px;
}

.toolbar-scroll {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 4px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}

.toolbar-scroll::-webkit-scrollbar {
  display: none;
}

.toolbar-sep {
  flex: none;
  width: 1px;
  height: 26px;
  background: var(--border);
}

/* Geri Al · Temizle · Çizimi Gönder on one row under the toolbar */
.draw-actions {
  display: flex;
  gap: 8px;
}

.draw-actions .icon-btn {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  font-size: 19px;
}

.draw-actions .btn-primary {
  flex: 1;
  width: auto;
}

.tool-btn,
.icon-btn,
.size-btn {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  font-size: 17px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.tool-btn.active,
.size-btn.active {
  border-color: var(--accent-2);
  background: rgba(45, 212, 191, 0.2);
  box-shadow: 0 0 0 1px var(--accent-2) inset;
}

.icon-btn:active,
.tool-btn:active {
  transform: scale(0.94);
}

.size-dot {
  border-radius: 50%;
  background: var(--ink);
}

.pop-btn.open {
  border-color: var(--accent-2);
  background: rgba(45, 212, 191, 0.2);
}

.color-chip {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(238, 242, 248, 0.55);
}

.toolbar-pop {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg-card-hi), var(--bg-card));
  box-shadow: var(--shadow);
  animation: pop-in 0.16s ease-out;
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

.toolbar-pop .size-btn {
  width: 44px;
  height: 44px;
}

/* Every swatch gets a light ring so dark colours (#1a1a1a) show on the dark card. */
.color-swatch,
.custom-color-input {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  padding: 0;
  cursor: pointer;
  box-shadow: 0 0 0 2px rgba(238, 242, 248, 0.4);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.color-swatch.active,
.custom-color-input.active {
  transform: scale(1.12);
  box-shadow: 0 0 0 2px var(--bg-card), 0 0 0 4.5px var(--accent-2), 0 0 12px rgba(94, 234, 212, 0.55);
}

.custom-color-input {
  background: conic-gradient(var(--coral), var(--sun), var(--accent), var(--violet), var(--coral));
  overflow: hidden;
}

.custom-color-input::-webkit-color-swatch-wrapper {
  padding: 3px;
}

.custom-color-input::-webkit-color-swatch {
  border: none;
  border-radius: 50%;
}

.custom-color-input::-moz-color-swatch {
  border: none;
  border-radius: 50%;
}

.waiting-card {
  text-align: center;
  padding: 30px 16px;
}

.waiting-card .waiting-icon,
.ring-icon {
  font-size: 34px;
  display: block;
  margin-bottom: 10px;
  animation: waiting-bob 1.6s ease-in-out infinite;
}

@keyframes waiting-bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

/* Waiting / spectator ring: avatars around the table, a sheet travelling between them. */
.pass-ring {
  position: relative;
  width: min(280px, 80vw);
  aspect-ratio: 1;
  margin: 14px auto 10px;
}

.ring-line {
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  border: 2px dashed var(--border);
}

.ring-orbit {
  position: absolute;
  inset: 21%;
  pointer-events: none;
}

.ring-paper {
  position: absolute;
  left: 50%;
  top: 0;
  width: 22px;
  height: 26px;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.5));
}

.ring-paper .paper-sheet {
  fill: var(--paper);
  stroke: var(--accent);
  stroke-width: 1.5;
}

.ring-paper .paper-fold {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
}

.ring-paper .paper-lines {
  stroke: var(--ink-soft);
  stroke-width: 1.4;
  stroke-linecap: round;
}

.ring-node {
  position: absolute;
  width: 36px;
  height: 36px;
  font-size: 14px;
  transform: translate(-50%, -50%);
}

.ring-node.done {
  box-shadow: 0 0 14px 2px rgba(94, 234, 212, 0.45);
}

.ring-center {
  position: absolute;
  inset: 29%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-align: center;
}

.ring-center .ring-icon {
  font-size: 26px;
  margin-bottom: 2px;
}

.ring-center strong {
  font-size: 15px;
  line-height: 1.2;
}

.ring-count {
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.ring-sub {
  font-size: 11px;
  color: var(--ink-soft);
  line-height: 1.25;
}

.who-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-bottom: 12px;
}

.who-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

.who-chip i {
  display: none;
  font-style: normal;
  color: var(--accent-2);
}

.who-chip.done {
  color: var(--ink);
  border-color: rgba(94, 234, 212, 0.6);
}

.who-chip.done i {
  display: inline;
}

/* ---------- Lobby settings ---------- */

.settings-card h3 {
  margin: 0 0 10px;
}

.settings-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.settings-label span,
.settings-summary span {
  font-weight: 600;
  color: var(--ink-soft);
}

.settings-summary {
  margin: 4px 0;
  font-size: 14px;
}

.segmented {
  display: flex;
  gap: 6px;
  padding: 4px;
  margin-bottom: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
}

.speed-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.speed-btn small {
  font-size: 11px;
  font-weight: 600;
}

.speed-btn.selected {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: var(--on-accent);
}

.switch-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.switch-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 14px;
}

.switch-text small {
  font-size: 12px;
  color: var(--ink-soft);
}

.switch {
  position: relative;
  flex: none;
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: var(--border);
  transition: background 0.2s ease;
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--ink);
  transition: transform 0.2s ease;
}

.switch.on {
  background: var(--accent);
}

.switch.on::after {
  transform: translateX(18px);
}

/* ---------- Reveal ---------- */

.present-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin: -8px 0 12px;
}

.present-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 12px;
  color: var(--accent-2);
  background: rgba(45, 212, 191, 0.12);
  border: 1px solid rgba(45, 212, 191, 0.35);
}

.present-badge.free {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border);
}

.present-badge small {
  display: block;
  font-weight: 600;
  color: var(--ink-soft);
}

.present-badge small:empty {
  display: none;
}

.present-meta {
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  margin: 0 0 16px;
}

.present-stage {
  min-height: 280px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.present-controls {
  display: flex;
  gap: 10px;
  margin: 18px 0 10px;
}

.present-controls .btn {
  flex: 1;
}

.present-controls .btn-primary {
  flex: 1.6;
  width: auto;
}

.reveal-feed {
  display: flex;
  flex-direction: column;
}

.reveal-feed-item {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg-card-hi), var(--bg-card));
  box-shadow: var(--shadow);
  padding: 18px;
}

.reveal-feed-arrow {
  font-size: 20px;
  color: var(--ink-soft);
  margin: 10px 0 12px;
}

/* A page of the notebook: paper colour, grain, faint ruling, torn top edge,
   slightly crooked. The shadow lives on the wrapper because the mask clips it. */
.reveal-page {
  position: relative;
  filter: drop-shadow(0 10px 16px rgba(0, 0, 0, 0.45));
}

.reveal-page.tilt-l {
  transform: rotate(-0.6deg);
}

.reveal-page.tilt-r {
  transform: rotate(0.6deg);
}

.paper-card {
  position: relative;
  padding: 24px 16px 16px;
  border-radius: 3px 3px 12px 12px;
  color: var(--paper-ink);
  background-color: var(--paper);
  background-image: radial-gradient(circle at 30% 40%, rgba(120, 100, 60, 0.07) 0 0.8px, transparent 1.3px),
    radial-gradient(circle at 70% 70%, rgba(120, 100, 60, 0.05) 0 0.8px, transparent 1.3px),
    repeating-linear-gradient(180deg, transparent 0 27px, rgba(45, 120, 160, 0.07) 27px 28px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.65), rgba(234, 226, 204, 0.6));
  background-size: 9px 9px, 13px 13px, 100% 28px, 100% 100%;
  -webkit-mask: var(--torn-edge) top left / 36px 10px repeat-x, linear-gradient(#000 0 0) 0 9px / 100% calc(100% - 9px) no-repeat;
  mask: var(--torn-edge) top left / 36px 10px repeat-x, linear-gradient(#000 0 0) 0 9px / 100% calc(100% - 9px) no-repeat;
}

.reveal-page-author {
  font-size: 12px;
  font-weight: 600;
  color: var(--paper-ink-soft);
  margin-bottom: 10px;
  text-align: center;
}

.auto-tag {
  font-size: 11px;
  white-space: nowrap;
}

.paper-body {
  transition: filter 0.45s ease, opacity 0.45s ease;
}

.reveal-text {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.4;
  padding: 10px;
  color: var(--paper-ink);
  overflow-wrap: anywhere;
}

.reveal-text.typing::after {
  content: "▍";
  margin-left: 2px;
  color: var(--accent);
  animation: caret-blink 0.7s steps(1) infinite;
}

@keyframes caret-blink {
  50% {
    opacity: 0;
  }
}

.reveal-image-wrap {
  background: var(--paper);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 10 / 7;
}

.reveal-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Folded: blurred, creased, "tap to open". */
.fold-cover {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.05) 49.5%, rgba(0, 0, 0, 0.2) 50%, rgba(255, 255, 255, 0.4) 50.6%, transparent 100%);
}

.fold-cover span {
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--paper);
  color: var(--paper-ink);
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.reveal-page.folded {
  cursor: pointer;
}

.reveal-page.folded .fold-cover {
  display: flex;
}

.reveal-page.folded .paper-card {
  transform: perspective(900px) rotateX(16deg);
  transform-origin: top center;
}

.reveal-page.folded .paper-body {
  filter: blur(9px) saturate(0.6);
  opacity: 0.55;
}

.reveal-page.folded .reveal-text::before {
  content: "";
  display: block;
  width: 70%;
  height: 14px;
  border-radius: 7px;
  background: currentColor;
  opacity: 0.25;
  box-shadow: 0 24px 0 currentColor;
}

.reveal-page.folded .react-bar {
  visibility: hidden;
}

.reveal-page.opening .paper-card {
  transform-origin: top center;
  animation: page-open 0.6s cubic-bezier(0.2, 0.75, 0.25, 1);
}

@keyframes page-open {
  0% {
    transform: perspective(900px) rotateX(-70deg);
  }
  70% {
    transform: perspective(900px) rotateX(6deg);
  }
  100% {
    transform: none;
  }
}

/* Reactions */
.react-bar {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
}

.react-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 58px;
  height: 40px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
}

.react-btn .react-emoji {
  font-size: 18px;
}

.react-btn.mine {
  background: rgba(45, 212, 191, 0.2);
  border-color: var(--accent-2);
}

.react-btn:active {
  transform: scale(0.92);
}

.react-count:empty {
  display: none;
}

.float-emoji {
  position: fixed;
  z-index: 150;
  font-size: 30px;
  pointer-events: none;
  transform: translate(-50%, 0);
  animation: float-up 1.6s cubic-bezier(0.2, 0.6, 0.3, 1) forwards;
}

@keyframes float-up {
  0% {
    opacity: 0;
    transform: translate(-50%, 0) scale(0.6);
  }
  15% {
    opacity: 1;
    transform: translate(-50%, -20px) scale(1.15);
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--drift, 0px)), -170px) scale(1);
  }
}

.confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 160;
}

/* Başlangıç → Son */
.summary-title {
  text-align: center;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.3px;
  margin-bottom: 12px;
}

.summary-cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.summary-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--paper-ink-soft);
  text-align: center;
  margin-bottom: 6px;
}

.summary-slot {
  min-height: 90px;
  padding: 6px;
  border-radius: 8px;
  border: 1px dashed rgba(0, 0, 0, 0.2);
  background: rgba(255, 255, 255, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
}

.summary-slot.summary-drawing {
  min-height: 0;
  padding: 0;
  aspect-ratio: 10 / 7;
  overflow: hidden;
}

.summary-slot img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.summary-text {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.35;
  text-align: center;
  overflow-wrap: anywhere;
}

.summary-author {
  margin-top: 6px;
  font-size: 11px;
  color: var(--paper-ink-soft);
  text-align: center;
}

.summary-arrow {
  align-self: center;
  font-size: 20px;
  color: var(--coral);
}

/* Ödül töreni */
.awards {
  display: flex;
  flex-direction: column;
  gap: 18px;
  filter: drop-shadow(0 10px 16px rgba(0, 0, 0, 0.45));
}

.award-card {
  text-align: center;
  animation: award-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}

.award-card:nth-child(2) {
  animation-delay: 0.12s;
}

@keyframes award-pop {
  from {
    opacity: 0;
    transform: scale(0.85) rotate(-2deg);
  }
}

.award-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--gold-ink);
}

.award-sub {
  margin: 2px 0 10px;
  font-size: 12px;
  color: var(--paper-ink-soft);
}

.award-author {
  margin-top: 8px;
  font-weight: 700;
  color: var(--paper-ink-soft);
}

.award-text {
  min-height: 0;
}

.awards-empty {
  padding: 30px 10px;
}

.share-btn {
  width: 100%;
  margin: 8px 0 10px;
}

.book-picker {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 10px;
}

.book-picker-btn {
  flex: none;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.book-picker-btn:disabled {
  cursor: default;
}

.book-picker-btn.active {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: var(--on-accent);
  border-color: transparent;
}


/* ---------- How to play ---------- */

.howto-fab {
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: var(--on-accent);
  font-size: 20px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 22px -6px rgba(45, 212, 191, 0.6);
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
}

.howto-fab:active {
  transform: scale(0.95);
}

.howto-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 95;
  padding: 20px;
}

.howto-card {
  background: linear-gradient(180deg, var(--bg-card-hi), var(--bg-card));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 480px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
}

.howto-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 10px;
  position: sticky;
  top: 0;
  background: var(--bg-card-hi);
  border-radius: var(--radius) var(--radius) 0 0;
}

.howto-header h2 {
  margin: 0;
  font-size: 19px;
}

.howto-close {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--ink);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 15px;
  cursor: pointer;
}

.howto-body {
  padding: 4px 18px 20px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
}

.inapp-banner {
  background: linear-gradient(180deg, var(--banner-top), var(--banner-bottom));
  color: var(--banner-ink);
  font-size: 13px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
}

.inapp-banner button {
  background: none;
  border: none;
  color: inherit;
  font-size: 16px;
  cursor: pointer;
}

/* ---------- Intro / splash animation ---------- */

.intro-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: radial-gradient(ellipse 900px 600px at 50% 20%, rgba(45, 212, 191, 0.14), transparent 60%),
    radial-gradient(ellipse 700px 500px at 50% 90%, rgba(251, 113, 133, 0.14), transparent 60%), var(--bg);
  cursor: pointer;
  opacity: 1;
  transition: opacity 0.35s ease;
}

.intro-screen.intro-out {
  opacity: 0;
}

.intro-chain-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0 10px;
}

.intro-chain-row::before {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  top: 50%;
  height: 2px;
  background: var(--border);
  transform: translateY(-50%);
  z-index: 0;
}

.intro-chain-node {
  position: relative;
  z-index: 1;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--border);
  animation: intro-chain-pulse 1.6s ease-in-out infinite;
}

@keyframes intro-chain-pulse {
  0%,
  75%,
  100% {
    background: var(--border);
    box-shadow: none;
    transform: scale(1);
  }
  25% {
    background: var(--accent-2);
    box-shadow: 0 0 14px 4px rgba(94, 234, 212, 0.65);
    transform: scale(1.3);
  }
}

.intro-title {
  margin: 0;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0;
  transform: translateY(10px) scale(0.92);
  animation: intro-title-pop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) 1.1s forwards;
}

.intro-title .brand-text {
  background: linear-gradient(135deg, var(--accent-2), var(--coral) 70%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

@keyframes intro-title-pop {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.intro-subtitle {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
  opacity: 0;
  animation: intro-fade-in 0.5s ease 1.4s forwards;
}

@keyframes intro-fade-in {
  to {
    opacity: 1;
  }
}

.intro-skip-hint {
  position: absolute;
  bottom: 26px;
  font-size: 12px;
  color: var(--ink-soft);
  opacity: 0;
  animation: intro-fade-in 0.5s ease 1.65s forwards;
}

/* ---------- Accessibility ---------- */

button:focus-visible,
.field:focus-visible,
input[type="color"]:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

/* No motion for people who asked for none: animations jump to their end state. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- 📺 Sunum ekranı ---------- */

/* Nothing on the shared screen is clickable: no buttons, no help, no top bar. */
body.tv-mode .top-bar,
body.tv-mode .howto-fab,
body.tv-mode #app button,
body.tv-mode .action-bar {
  display: none !important;
}

body.tv-mode #app {
  max-width: 1500px;
  padding-bottom: 60px;
}

/* A laptop shared on Zoom is wide but seen small: scale everything up. */
@media (min-width: 1000px) {
  body.tv-mode #app {
    zoom: 1.25;
  }
}

.tv-link-btn {
  width: 100%;
  margin-top: 8px;
}

.tv-lobby {
  text-align: center;
  padding-top: 2vh;
}

.tv-title {
  font-size: clamp(30px, 5vw, 60px);
  margin: 0 0 3vh;
}

.tv-lobby-grid {
  display: flex;
  gap: 5vw;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 3vh;
}

.tv-qr {
  width: min(40vh, 340px);
  aspect-ratio: 1;
  background: #fff;
  border-radius: 20px;
  padding: 12px;
  box-sizing: border-box;
  animation: tv-pop 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

.tv-qr .qr-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.tv-sub {
  color: var(--ink-soft);
  font-size: clamp(15px, 1.8vw, 22px);
  margin: 6px 0;
}

.tv-code-label {
  margin-top: 3vh;
}

.tv-code {
  font-size: clamp(60px, 10vw, 160px);
  font-weight: 900;
  letter-spacing: 0.12em;
  line-height: 1;
}

.tv-names {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 1.5vh;
}

.tv-names span {
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-weight: 700;
  font-size: clamp(15px, 1.7vw, 22px);
  animation: tv-pop 0.35s ease both;
}

.tv-names span.off {
  opacity: 0.45;
}

.tv-teams {
  text-align: left;
  max-width: 900px;
  margin: 0 auto;
}

.tv-corner {
  position: fixed;
  right: 14px;
  bottom: 10px;
  z-index: 50;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 14px;
  pointer-events: none;
}

.tv-corner strong {
  letter-spacing: 2px;
}

.tv-round-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  align-items: start;
  margin-top: 10px;
}

@media (max-width: 900px) {
  .tv-round-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.tv-landing-card {
  max-width: 420px;
  margin: 0 auto;
}

.tv-go {
  display: flex;
  margin-top: 10px;
  text-decoration: none;
}

@keyframes tv-pop {
  from {
    opacity: 0;
    transform: scale(0.85);
  }
}

/* No typing on the shared screen either. */
body.tv-mode #app input:not(#tv-code-input),
body.tv-mode #app textarea,
body.tv-mode .chat-input-row,
body.tv-mode .reaction-bar,
body.tv-mode .react-bar {
  display: none !important;
}

/* No typing on the shared screen either. */
body.tv-mode #app input:not(#tv-code-input),
body.tv-mode #app textarea,
body.tv-mode .chat-input-row,
body.tv-mode .react-bar {
  display: none !important;
}
