:root {
  --bg: #180a16;
  --bg-2: #1f0d1c;
  --bg-card: #2b1327;
  --bg-card-hi: #38182f;
  --ink: #f7eef5;
  --ink-soft: #c6a3bb;
  --accent: #ec4899;
  --accent-2: #fb85c4;
  --accent-ink: #3a0a24;
  --kirmizi: #f5384f;
  --kirmizi-deep: #8f1526;
  --mavi: #3b82f6;
  --mavi-deep: #1c3d80;
  --border: #4a2a40;
  --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;
  /* clip, not hidden, where supported: hidden turns body into a scroll
     container, which breaks the turn screen's sticky action bar. */
  overflow-x: clip;
  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(236, 72, 153, 0.12), transparent 60%),
    radial-gradient(ellipse 700px 500px at 100% 20%, rgba(245, 56, 79, 0.1), transparent 60%),
    radial-gradient(ellipse 700px 500px at 0% 60%, rgba(59, 130, 246, 0.06), transparent 60%),
    url("/words-bg.svg"), linear-gradient(180deg, var(--bg-2), var(--bg) 320px);
  background-repeat: no-repeat, no-repeat, no-repeat, repeat, no-repeat;
  background-size: auto, auto, auto, 640px 640px, auto;
  background-attachment: fixed;
  min-height: 100vh;
  min-height: 100dvh;
}

[hidden] {
  display: none !important;
}

/* Bottom padding keeps the last button on any screen clear of the fixed
   help button (and the iPhone home indicator). */
#app {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px calc(88px + env(safe-area-inset-bottom));
  min-height: 100vh;
  min-height: 100dvh;
}

.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(236, 72, 153, 0.25);
}

.screen-title .brand-text {
  background: linear-gradient(135deg, var(--accent-2), var(--accent) 60%);
  -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: #100810;
  color: var(--ink);
  font-size: 16px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.2);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 13px 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  min-height: 44px;
  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(--accent-ink);
  width: 100%;
  border: none;
  box-shadow: 0 8px 22px -8px rgba(236, 72, 153, 0.55);
  font-size: 16px;
}

.btn-danger {
  background: linear-gradient(135deg, #ff6b7d, var(--kirmizi));
  color: #fff;
  width: 100%;
  border: none;
  box-shadow: 0 8px 22px -8px rgba(245, 56, 79, 0.55);
  font-size: 16px;
  margin-top: 10px;
}

.btn-outline-small {
  background: linear-gradient(180deg, var(--bg-card-hi), var(--bg-card));
  border: 1px solid rgba(201, 168, 187, 0.4);
  padding: 10px 12px;
  font-size: 13px;
  box-shadow: 0 4px 14px -6px rgba(0, 0, 0, 0.6);
}

.btn-danger-outline {
  border-color: rgba(245, 56, 79, 0.55);
  color: #ff9aa8;
}

.btn-compact {
  padding: 8px 12px;
  font-size: 14px;
}

.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;
  min-height: 44px;
  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(--accent-ink);
}

.role-choice {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.role-choice-btn {
  flex: 1;
  min-height: 44px;
  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(--accent-ink);
}

.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(245, 56, 79, 0.18), rgba(245, 56, 79, 0.08));
  border: 1px solid var(--kirmizi);
  color: #ffc2ca;
  padding: 11px 14px;
  border-radius: 12px;
  margin-bottom: 12px;
  font-size: 14px;
}

/* ---------- Lobby ---------- */

.team-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.team-col {
  min-width: 0;
  border-radius: var(--radius);
  padding: 14px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.team-col.kirmizi {
  background: linear-gradient(160deg, rgba(245, 56, 79, 0.22), var(--bg-card) 65%);
  border-color: rgba(245, 56, 79, 0.5);
}

.team-col.mavi {
  background: linear-gradient(160deg, rgba(59, 130, 246, 0.22), var(--bg-card) 65%);
  border-color: rgba(59, 130, 246, 0.5);
}

.team-col h3 {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.team-col.kirmizi h3 {
  color: #ff9aa8;
}

.team-col.mavi h3 {
  color: #9dc1ff;
}

.team-player {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  font-size: 14px;
  min-width: 0;
}

.team-player .player-avatar {
  width: 24px;
  height: 24px;
  min-width: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: var(--ink);
}

.team-col.kirmizi .player-avatar {
  background: rgba(245, 56, 79, 0.35);
}

.team-col.mavi .player-avatar {
  background: rgba(59, 130, 246, 0.35);
}

.team-player .player-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-player-block {
  min-width: 0;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.team-player-block:last-child {
  border-bottom: none;
}

.team-player-block .team-player {
  padding: 0;
}

.admin-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 0 32px;
}

.admin-swap-btn {
  min-height: 40px;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink-soft);
  cursor: pointer;
}

.admin-swap-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--ink);
}

.join-team-btns {
  display: flex;
  gap: 8px;
  margin: 10px 0;
}

.join-team-btns .btn {
  flex: 1;
  font-size: 14px;
}

/* ---------- Turn ---------- */

.scoreboard {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 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);
}

.score-pill {
  font-size: 28px;
  font-weight: 800;
  padding: 8px 20px;
  border-radius: 12px;
  min-width: 56px;
  text-align: center;
}

.score-pill.kirmizi {
  background: linear-gradient(135deg, rgba(245, 56, 79, 0.32), rgba(245, 56, 79, 0.12));
  color: #ff9aa8;
}

.score-pill.mavi {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.32), rgba(59, 130, 246, 0.12));
  color: #9dc1ff;
}

.turn-banner {
  font-weight: 800;
  font-size: 13px;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  line-height: 1.6;
}

.turn-banner.kirmizi {
  color: #ff9aa8;
}

.turn-banner.mavi {
  color: #9dc1ff;
}

.target-note {
  font-size: 12px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink-soft);
}

.timer-bar-wrap {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin-bottom: 4px;
}

/* Shrinks via transform (set from app.js) instead of width — no layout
   work on every tick. */
.timer-bar {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform-origin: left center;
  transition: transform 0.25s linear;
}

.timer-text {
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 700;
  margin: 0;
  text-align: center;
  transition: font-size 0.2s ease, color 0.2s ease;
}

.word-card {
  border-radius: var(--radius);
  padding: 20px 18px;
  border: 1px solid var(--border);
  margin-bottom: 12px;
  background: linear-gradient(180deg, var(--bg-card-hi), var(--bg-card));
  box-shadow: var(--shadow);
}

.controller-badge {
  margin: 0 0 12px;
  padding: 8px 10px;
  border-radius: 10px;
  text-align: center;
  font-size: 13px;
  font-weight: 800;
  color: var(--accent-2);
  background: rgba(236, 72, 153, 0.14);
  border: 1px solid rgba(236, 72, 153, 0.35);
}

.word-card-label {
  margin: 0;
  font-size: 12px;
  color: var(--ink-soft);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.word-card-word {
  font-size: 34px;
  font-weight: 800;
  text-align: center;
  margin: 6px 0;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.forbidden-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* A plain, strong red chip rather than a strike-through, which made the
   banned words hard to read at a glance. */
.forbidden-list li {
  text-align: center;
  font-size: 17px;
  font-weight: 800;
  color: #ffe3e7;
  background: rgba(245, 56, 79, 0.24);
  border: 1px solid rgba(245, 56, 79, 0.75);
  border-left: 5px solid var(--kirmizi);
  border-radius: 10px;
  padding: 9px 8px;
}

/* Doğru/Pas (describer) and TABU (opponents): pinned to the bottom of the
   viewport while the turn screen scrolls, so they're reachable on short
   phones without scrolling past the card. */
.action-bar {
  position: sticky;
  /* (sticky is positioned: the undo chip anchors to it) */
  bottom: 0;
  z-index: 20;
  display: flex;
  gap: 8px;
  margin: 0 -16px 12px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(24, 10, 22, 0), var(--bg) 30%);
}

.action-bar .btn {
  flex: 1;
  min-height: 54px;
  margin-top: 0;
  font-size: 17px;
}

.turnend-card {
  border-radius: var(--radius);
  padding: 24px 18px;
  border: 1px solid var(--border);
  margin-bottom: 12px;
  text-align: center;
  background: linear-gradient(180deg, var(--bg-card-hi), var(--bg-card));
  box-shadow: var(--shadow);
}

.turnend-describer {
  margin: 0 0 16px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

.turnend-stats {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 20px;
}

.turnend-stat {
  flex: 1;
  max-width: 110px;
  border-radius: 14px;
  padding: 14px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  opacity: 0;
  transform: scale(0.4) translateY(10px);
  animation: turnend-stat-pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.turnend-stat-icon {
  font-size: 22px;
}

.turnend-stat-num {
  font-size: 28px;
  font-weight: 800;
}

.turnend-stat-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--ink-soft);
}

.turnend-correct {
  background: rgba(52, 211, 153, 0.14);
  border: 1px solid rgba(52, 211, 153, 0.35);
}

.turnend-correct .turnend-stat-num {
  color: #34d399;
}

.turnend-pass {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
}

.turnend-pass .turnend-stat-num {
  color: var(--ink-soft);
}

.turnend-tabu {
  background: rgba(245, 56, 79, 0.14);
  border: 1px solid rgba(245, 56, 79, 0.35);
}

.turnend-tabu .turnend-stat-num {
  color: #ff9aa8;
}

@keyframes turnend-stat-pop {
  0% {
    opacity: 0;
    transform: scale(0.4) translateY(10px);
  }
  60% {
    opacity: 1;
    transform: scale(1.12) translateY(0);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.turnend-countdown {
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.turnend-countdown-num {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  margin: 0 auto 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 800;
  color: var(--accent-2);
  border: 3px solid var(--accent);
  background: rgba(236, 72, 153, 0.12);
}

.turnend-countdown-num.tick {
  animation: turnend-countdown-pulse 0.4s ease;
}

@keyframes turnend-countdown-pulse {
  0% {
    transform: scale(1.3);
    opacity: 0.4;
  }
  60% {
    transform: scale(1);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.log-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 160px;
  overflow-y: auto;
  font-size: 13px;
}

.log-list li {
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  color: var(--ink-soft);
}

.log-list li:last-child {
  border-bottom: none;
}

.log-list li.team-kirmizi {
  color: #ff9aa8;
}

.log-list li.team-mavi {
  color: #9dc1ff;
}

.log-icon {
  margin-right: 6px;
}

.gameover-banner {
  text-align: center;
  padding: 22px 18px;
  border-radius: var(--radius);
  margin-bottom: 14px;
  font-size: 20px;
  font-weight: 800;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.gameover-banner.kirmizi {
  background: linear-gradient(160deg, rgba(245, 56, 79, 0.3), var(--bg-card));
  color: #ff9aa8;
  border-color: rgba(245, 56, 79, 0.5);
}

.gameover-banner.mavi {
  background: linear-gradient(160deg, rgba(59, 130, 246, 0.3), var(--bg-card));
  color: #9dc1ff;
  border-color: rgba(59, 130, 246, 0.5);
}

.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;
  min-height: 44px;
  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;
}

.howto-fab {
  position: fixed;
  right: calc(16px + env(safe-area-inset-right));
  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(--accent-ink);
  font-size: 20px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 22px -6px rgba(236, 72, 153, 0.6);
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
}

.howto-fab:active {
  transform: scale(0.95);
}

/* During a turn the bottom belongs to Doğru/Pas/TABU and the top to the
   scores, so the help button steps aside until the turn is over. */
body.has-action-bar .howto-fab {
  display: none;
}

.howto-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 3, 6, 0.75);
  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;
  max-height: 80dvh;
  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: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 15px;
  cursor: pointer;
}

.howto-body {
  padding: 4px 18px 20px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
}

.howto-body ul {
  margin: 6px 0;
  padding-left: 20px;
}

.howto-body li {
  margin: 6px 0;
}

.inapp-banner {
  background: linear-gradient(180deg, #3a260d, #241708);
  color: #ffdf8a;
  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: 16px;
  overflow: hidden;
  background: radial-gradient(ellipse 700px 500px at 20% 30%, rgba(245, 56, 79, 0.18), transparent 60%),
    radial-gradient(ellipse 700px 500px at 80% 70%, rgba(236, 72, 153, 0.18), transparent 60%), var(--bg);
  cursor: pointer;
  opacity: 1;
  transition: opacity 0.35s ease;
}

.intro-screen.intro-out {
  opacity: 0;
}

.intro-flash {
  position: absolute;
  inset: 0;
  background: var(--kirmizi);
  opacity: 0;
  pointer-events: none;
  animation: tabu-flash 0.35s ease 0.95s;
}

@keyframes tabu-flash {
  0% {
    opacity: 0;
  }
  20% {
    opacity: 0.45;
  }
  100% {
    opacity: 0;
  }
}

.intro-title-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.intro-title {
  margin: 0;
  font-size: 52px;
  font-weight: 800;
  letter-spacing: 8px;
  font-family: "Courier New", Consolas, monospace;
  color: var(--ink);
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
  opacity: 0;
  animation: tabu-title-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s forwards;
}

@keyframes tabu-title-pop {
  0% {
    transform: scale(0.5);
    opacity: 0;
  }
  70% {
    transform: scale(1.07);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.intro-stamp {
  position: absolute;
  top: 50%;
  left: 50%;
  padding: 9px 20px;
  border: 4px solid var(--kirmizi);
  border-radius: 8px;
  color: var(--kirmizi);
  font-weight: 800;
  font-size: 20px;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-family: "Courier New", Consolas, monospace;
  background: rgba(245, 56, 79, 0.1);
  box-shadow: 0 0 0 2px rgba(245, 56, 79, 0.22) inset, 0 6px 18px -6px rgba(0, 0, 0, 0.6);
  transform: translate(-50%, -50%) rotate(-12deg) scale(3);
  opacity: 0;
  animation: tabu-stamp-slam 0.4s cubic-bezier(0.2, 0.9, 0.4, 1) 0.7s forwards;
  white-space: nowrap;
}

@keyframes tabu-stamp-slam {
  0% {
    transform: translate(-50%, -50%) rotate(-12deg) scale(3);
    opacity: 0;
  }
  55% {
    transform: translate(-50%, -50%) rotate(-12deg) scale(0.92);
    opacity: 1;
  }
  75% {
    transform: translate(-50%, -50%) rotate(-12deg) scale(1.06);
  }
  100% {
    transform: translate(-50%, -50%) rotate(-12deg) scale(1);
    opacity: 1;
  }
}

.intro-subtitle {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
  opacity: 0;
  animation: intro-fade-in 0.5s ease 1.35s 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.6s forwards;
}

/* ---------- Lobby: team choice, settings ---------- */

.team-col-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-col-count {
  flex: none;
}

.team-choice-btn {
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink-soft);
  border-width: 2px;
  min-width: 0;
}

.team-choice-btn.kirmizi {
  border-color: rgba(245, 56, 79, 0.45);
}

.team-choice-btn.mavi {
  border-color: rgba(59, 130, 246, 0.45);
}

.team-choice-btn.kirmizi.active {
  background: linear-gradient(135deg, #ff6b7d, var(--kirmizi));
  border-color: #ffc2ca;
  color: #fff;
  box-shadow: 0 8px 22px -8px rgba(245, 56, 79, 0.7);
}

.team-choice-btn.mavi.active {
  background: linear-gradient(135deg, #6aa3ff, var(--mavi));
  border-color: #c9dcff;
  color: #fff;
  box-shadow: 0 8px 22px -8px rgba(59, 130, 246, 0.7);
}

.settings-title {
  margin: 0 0 4px;
  font-size: 16px;
}

.settings-label {
  margin: 14px 0 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
}

.option-btns {
  display: flex;
  gap: 8px;
}

.option-btns .btn {
  flex: 1;
  min-width: 0;
}

.opt-btn.active {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: var(--accent-ink);
  border-color: transparent;
}

.pack-btns {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
}

.pack-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 52px;
  padding: 8px 6px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card-hi);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
}

.pack-btn .pack-name {
  font-size: 14px;
  font-weight: 800;
}

.pack-btn .pack-count {
  font-size: 12px;
  color: var(--ink-soft);
}

.pack-btn.active {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  border-color: transparent;
  color: var(--accent-ink);
}

.pack-btn.active .pack-count {
  color: var(--accent-ink);
  opacity: 0.8;
}

.team-name-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.team-name-field {
  min-width: 0;
  border-left-width: 5px;
}

.team-name-field.kirmizi {
  border-left-color: var(--kirmizi);
}

.team-name-field.mavi {
  border-left-color: var(--mavi);
}

.settings-summary {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 0 0 14px;
}

.settings-chip {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
}

/* ---------- Turn: timer row, sound, last 10 seconds ---------- */

.timer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 2px 0 10px;
  min-height: 40px;
}

.timer-row-side {
  flex: 0 0 40px;
  display: flex;
  justify-content: flex-end;
}

.sound-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  font-size: 17px;
  cursor: pointer;
  color: var(--ink);
}

.sound-btn[aria-pressed="true"] {
  border-color: var(--accent);
  background: rgba(236, 72, 153, 0.18);
}

#turn-screen.urgent .timer-bar {
  background: linear-gradient(90deg, #ff6b7d, var(--kirmizi));
}

#turn-screen.urgent .timer-text {
  font-size: 24px;
  font-weight: 800;
  color: #ff9aa8;
  animation: urgent-pulse 1s ease-in-out infinite;
}

@keyframes urgent-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.14);
  }
}

/* Red edge vignette for the last seconds; never takes a tap. */
body.turn-urgent::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;
  box-shadow: inset 0 0 70px 10px rgba(245, 56, 79, 0.45);
  animation: vignette-pulse 1s ease-in-out infinite;
}

@keyframes vignette-pulse {
  0%,
  100% {
    opacity: 0.65;
  }
  50% {
    opacity: 1;
  }
}

/* ---------- Turn: guessers' countdown ring ---------- */

.guess-panel {
  text-align: center;
  padding-top: 18px;
}

.ring-wrap {
  position: relative;
  width: min(200px, 56vw);
  aspect-ratio: 1;
  margin: 0 auto 10px;
}

.countdown-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  display: block;
}

.ring-track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 9;
}

.ring-progress {
  fill: none;
  stroke: var(--accent);
  stroke-width: 9;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.25s linear, stroke 0.3s ease;
}

.ring-progress.kirmizi {
  stroke: var(--kirmizi);
}

.ring-progress.mavi {
  stroke: var(--mavi);
}

#turn-screen.urgent .ring-progress {
  stroke: var(--kirmizi);
}

.ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.ring-seconds {
  font-size: 54px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

#turn-screen.urgent .ring-seconds {
  color: #ff9aa8;
  animation: urgent-pulse 1s ease-in-out infinite;
}

.ring-unit {
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 4px;
}

.guess-describer {
  margin: 4px 0 6px;
  font-size: 16px;
}

.guess-score {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.guess-score-num {
  font-size: 30px;
  font-weight: 800;
}

.guess-panel.kirmizi .guess-score-num {
  color: #ff9aa8;
}

.guess-panel.mavi .guess-score-num {
  color: #9dc1ff;
}

.guess-score-label {
  font-size: 13px;
  color: var(--ink-soft);
}

@media (max-height: 640px) {
  .ring-wrap {
    width: min(150px, 44vw);
  }
  .ring-seconds {
    font-size: 42px;
  }
}

/* ---------- Turn: card flip, undo chip, score bump ---------- */

.word-card.flip-in {
  animation: card-flip-in 0.35s ease-out;
}

@keyframes card-flip-in {
  0% {
    transform: perspective(900px) rotateY(-90deg);
    opacity: 0.4;
  }
  100% {
    transform: perspective(900px) rotateY(0);
    opacity: 1;
  }
}

.undo-chip {
  position: absolute;
  left: 50%;
  top: -30px;
  transform: translateX(-50%);
  z-index: 1;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: var(--bg-card-hi);
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 6px 18px -6px rgba(0, 0, 0, 0.7);
  animation: chip-in 0.2s ease-out;
}

.undo-chip-what {
  color: var(--ink-soft);
  font-weight: 600;
}

.undo-row {
  display: flex;
  justify-content: center;
  margin-bottom: 10px;
}

.undo-row .undo-chip {
  position: static;
  transform: none;
}

@keyframes chip-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.score-pill {
  transition: transform 0.2s ease;
}

.score-pill.bump {
  animation: score-bump 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes score-bump {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.35);
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.18);
  }
  100% {
    transform: scale(1);
  }
}

/* ---------- Result effects (fixed layer, never takes a tap) ---------- */

.fx-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 150;
  overflow: hidden;
}

.fx-layer > * {
  pointer-events: none;
}

.fx-flash {
  position: absolute;
  inset: 0;
  background: var(--kirmizi);
  opacity: 0;
  animation: tabu-flash 0.45s ease;
}

.fx-stamp-wrap {
  position: absolute;
  inset: 0;
  animation: fx-fade-out 0.3s ease 0.85s forwards;
}

.fx-stamp {
  position: absolute;
  top: 45%;
  left: 50%;
  padding: 10px 26px;
  border: 5px solid var(--kirmizi);
  border-radius: 10px;
  color: var(--kirmizi);
  background: rgba(24, 10, 22, 0.88);
  font-family: "Courier New", Consolas, monospace;
  font-weight: 800;
  font-size: 46px;
  letter-spacing: 4px;
  white-space: nowrap;
  box-shadow: 0 0 0 3px rgba(245, 56, 79, 0.25) inset, 0 12px 30px -8px rgba(0, 0, 0, 0.7);
  transform: translate(-50%, -50%) rotate(-12deg) scale(3);
  opacity: 0;
  animation: tabu-stamp-slam 0.4s cubic-bezier(0.2, 0.9, 0.4, 1) forwards;
}

@keyframes fx-fade-out {
  to {
    opacity: 0;
  }
}

.fx-fly {
  position: absolute;
  top: 50%;
  left: 50%;
  font-size: 40px;
  font-weight: 800;
  text-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
  opacity: 0;
}

.fx-fly.kirmizi {
  color: #ff9aa8;
}

.fx-fly.mavi {
  color: #9dc1ff;
}

.fx-plus {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 48px;
  font-weight: 800;
  color: #34d399;
  text-shadow: 0 4px 18px rgba(52, 211, 153, 0.45);
  animation: plus-float 1s ease-out forwards;
}

@keyframes plus-float {
  0% {
    transform: translate(-50%, -20%) scale(0.6);
    opacity: 0;
  }
  25% {
    transform: translate(-50%, -50%) scale(1.15);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -190%) scale(1);
    opacity: 0;
  }
}

.fx-card-out {
  position: fixed;
  margin: 0;
  animation: card-slide-out 0.55s ease-in forwards;
}

@keyframes card-slide-out {
  to {
    transform: translateX(-115vw) rotate(-10deg);
    opacity: 0;
  }
}

.fx-sweep {
  position: absolute;
  left: 0;
  right: 0;
  top: 38%;
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  transform: translateX(-100%);
  animation: sweep-across 1.3s cubic-bezier(0.65, 0, 0.35, 1) forwards;
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.7);
}

.fx-sweep.kirmizi {
  background: linear-gradient(90deg, var(--kirmizi-deep), var(--kirmizi), var(--kirmizi-deep));
}

.fx-sweep.mavi {
  background: linear-gradient(90deg, var(--mavi-deep), var(--mavi), var(--mavi-deep));
}

.fx-sweep-text {
  color: #fff;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-align: center;
  text-shadow: 0 3px 12px rgba(0, 0, 0, 0.35);
}

@keyframes sweep-across {
  0% {
    transform: translateX(-100%);
  }
  25%,
  72% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(100%);
  }
}

/* Reduced-motion stand-in for every effect: a still label. */
.fx-toast {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: calc(100% - 32px);
  padding: 12px 22px;
  border-radius: 14px;
  background: var(--bg-card-hi);
  border: 2px solid var(--border);
  font-size: 26px;
  font-weight: 800;
  text-align: center;
  box-shadow: var(--shadow);
}

.fx-toast.tabu {
  border-color: var(--kirmizi);
  color: #ff9aa8;
}

.fx-toast.correct {
  border-color: #34d399;
  color: #34d399;
}

.fx-toast.turn.kirmizi {
  border-color: var(--kirmizi);
}

.fx-toast.turn.mavi {
  border-color: var(--mavi);
}

.fx-toast.undo,
.fx-toast.pass {
  font-size: 20px;
}

.fx-toast.slide {
  animation: toast-slide-out 0.7s ease-in 0.2s forwards;
}

@keyframes toast-slide-out {
  to {
    transform: translate(-180%, -50%);
    opacity: 0;
  }
}

/* ---------- Turn end: summary, ready box ---------- */

.turn-banner.kirmizi,
.team-text.kirmizi {
  color: #ff9aa8;
}

.turn-banner.mavi,
.team-text.mavi {
  color: #9dc1ff;
}

.turn-summary {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.summary-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  border: 1px solid var(--border);
  max-width: 100%;
}

.summary-word {
  overflow-wrap: anywhere;
}

.summary-item.correct {
  background: rgba(52, 211, 153, 0.16);
  border-color: rgba(52, 211, 153, 0.5);
  color: #a7f3d0;
}

.summary-item.pass {
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink-soft);
}

.summary-item.pass .summary-word {
  text-decoration: line-through;
  text-decoration-color: rgba(198, 163, 187, 0.6);
}

.summary-item.tabu {
  background: rgba(245, 56, 79, 0.18);
  border-color: rgba(245, 56, 79, 0.6);
  color: #ffc2ca;
}

.summary-icon {
  font-size: 13px;
}

.turn-summary-empty {
  margin: 0 0 16px;
}

.ready-box {
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.ready-next {
  margin: 0 0 8px;
  font-size: 15px;
}

.ready-you {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 800;
  color: var(--accent-2);
}

.ready-btn {
  font-size: 17px;
  min-height: 54px;
  animation: ready-glow 1.6s ease-in-out infinite;
}

.ready-btn-admin {
  width: 100%;
}

@keyframes ready-glow {
  0%,
  100% {
    box-shadow: 0 8px 22px -8px rgba(236, 72, 153, 0.55);
  }
  50% {
    box-shadow: 0 8px 30px -4px rgba(236, 72, 153, 0.9);
  }
}

.ready-box .turnend-countdown {
  border-top: none;
  padding-top: 12px;
}

.ready-box .turnend-countdown-num {
  width: 44px;
  height: 44px;
  font-size: 19px;
  margin-bottom: 4px;
}

/* ---------- Game over ---------- */

.gameover-banner {
  position: relative;
  overflow: hidden;
}

.gameover-trophy {
  font-size: 40px;
  line-height: 1;
}

.gameover-team {
  margin-top: 6px;
  font-size: 26px;
  overflow-wrap: anywhere;
}

.gameover-stamp-wrap {
  position: relative;
  height: 64px;
}

.gameover-stamp {
  position: absolute;
  top: 50%;
  left: 50%;
  padding: 6px 18px;
  border: 4px solid currentColor;
  border-radius: 8px;
  font-family: "Courier New", Consolas, monospace;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 4px;
  white-space: nowrap;
  background: rgba(0, 0, 0, 0.18);
  transform: translate(-50%, -50%) rotate(-12deg) scale(3);
  opacity: 0;
  animation: tabu-stamp-slam 0.4s cubic-bezier(0.2, 0.9, 0.4, 1) 0.35s forwards;
}

.gameover-stamp.kirmizi {
  color: var(--kirmizi);
}

.gameover-stamp.mavi {
  color: var(--mavi);
}

.gameover-score {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 34px;
  font-variant-numeric: tabular-nums;
}

.gameover-score-num.kirmizi {
  color: #ff9aa8;
}

.gameover-score-num.mavi {
  color: #9dc1ff;
}

.gameover-score-sep {
  color: var(--ink-soft);
  font-size: 22px;
}

.confetti {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.confetti i {
  position: absolute;
  top: -24px;
  border-radius: 2px;
  opacity: 0.95;
  animation-name: confetti-fall;
  animation-timing-function: cubic-bezier(0.3, 0.4, 0.6, 1);
  animation-fill-mode: both;
}

@keyframes confetti-fall {
  0% {
    transform: translate(0, 0) rotate(0);
  }
  100% {
    transform: translate(var(--drift), 110vh) rotate(var(--rot));
    opacity: 0.8;
  }
}

.stat-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.stat-row:last-child {
  border-bottom: none;
}

.stat-icon {
  font-size: 26px;
  line-height: 1.2;
}

.stat-body {
  min-width: 0;
}

.stat-title {
  margin: 0;
  font-size: 13px;
  color: var(--ink-soft);
  font-weight: 700;
}

.stat-name {
  margin: 2px 0 0;
  font-size: 18px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.stat-name.kirmizi {
  color: #ff9aa8;
}

.stat-name.mavi {
  color: #9dc1ff;
}

.stat-count {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
}

.stat-rest,
.stat-empty {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--ink-soft);
}

/* ---------- Reduced motion ---------- */
/* Animations off; anything that only became visible through an animation is
   shown in its final state instead. The JS swaps the result effects for
   still labels and skips confetti / the flying +1. */
@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;
  }
  .intro-title,
  .intro-subtitle,
  .intro-skip-hint,
  .turnend-stat {
    animation: none !important;
    opacity: 1;
    transform: none;
  }
  .intro-stamp,
  .gameover-stamp {
    animation: none !important;
    opacity: 1;
    transform: translate(-50%, -50%) rotate(-12deg);
  }
  .intro-flash,
  body.turn-urgent::after,
  .confetti {
    animation: none !important;
  }
  #turn-screen.urgent .timer-text,
  #turn-screen.urgent .ring-seconds,
  .ready-btn {
    animation: none !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);
  }
}
