:root {
  --bg1: #ffb347;
  --bg2: #ffcc33;
  --card-bg: #fff8e7;
  --accent: #ff8c00;
  --accent-dark: #cc6e00;
  --text-main: #2b1b00;
  --honey-base: #f4b63f;
  --honey-dark: #e0a72f;
  --bee-yellow: #ffcf33;
  --bee-deep-yellow: #f6a623;
  --bee-dark: #22160b;
  --bee-cream: #fff8e1;
  --bee-outline: #c98515;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background-image:
    url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20width%3D%27160%27%20height%3D%27140%27%20viewBox%3D%270%200%20160%20140%27%3E%0A%3Cg%20fill%3D%27none%27%20stroke%3D%27rgba%28255%2C255%2C255%2C0.22%29%27%20stroke-width%3D%272%27%3E%0A%3Cpath%20d%3D%27M40%2010%20L70%2027%20L70%2063%20L40%2080%20L10%2063%20L10%2027%20Z%27/%3E%0A%3Cpath%20d%3D%27M120%2010%20L150%2027%20L150%2063%20L120%2080%20L90%2063%20L90%2027%20Z%27/%3E%0A%3Cpath%20d%3D%27M80%2045%20L110%2062%20L110%2098%20L80%20115%20L50%2098%20L50%2062%20Z%27/%3E%0A%3Cpath%20d%3D%27M0%2045%20L30%2062%20L30%2098%20L0%20115%20L-30%2098%20L-30%2062%20Z%27/%3E%0A%3Cpath%20d%3D%27M160%2045%20L190%2062%20L190%2098%20L160%20115%20L130%2098%20L130%2062%20Z%27/%3E%0A%3C/g%3E%3C/svg%3E"),
    linear-gradient(135deg, var(--bg1), var(--bg2));
  background-size: 160px 140px, cover;
  background-position: center, center;
  background-attachment: fixed, fixed;
  color: var(--text-main);
  display: block;
  min-height: 100vh;
}

.app {
  max-width: 900px;
  width: 100%;
  padding: 16px;
  margin: 0 auto;
}

h1 {
  text-align: center;
  margin: 8px 0 4px;
  font-size: 2rem;
}

.tagline {
  text-align: center;
  font-size: 0.95rem;
  margin-bottom: 10px;
}

.card {
  background: var(--card-bg);
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.15);
}

.flex-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

input[type="text"],
input[type="number"] {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #d6b87a;
  font-size: 1rem;
}

input[type="text"] {
  flex: 1;
  min-width: 0;
}

input[type="number"] {
  width: 90px;
}

button {
  padding: 12px 16px;
  border-radius: 999px;
  border: none;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.18);
  transition: transform 0.05s ease, box-shadow 0.05s ease, background 0.1s ease;
  min-width: 120px;
}

button:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.22);
}

button:active {
  transform: translateY(0);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
}

button.secondary {
  background: #fff3cf;
  color: var(--text-main);
  border: 1px solid #e0c87a;
  box-shadow: none;
  min-width: 120px;
}

button.secondary:hover {
  background: #ffeaa4;
}

button.danger {
  background: #d7263d;
}

button.danger:hover {
  background: #aa1e30;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  background: rgba(0, 0, 0, 0.05);
  margin-left: 6px;
}

.players-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.player-pill {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  background: #fff;
  border: 1px solid #e5c483;
  display: flex;
  align-items: center;
  gap: 6px;
}

.player-pill.eliminated {
  opacity: 0.4;
  text-decoration: line-through;
  background: #f7d2d7;
  border-color: #f098a4;
}

.status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.status-row span {
  font-size: 0.95rem;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: #fff3cf;
  border: 1px solid #f0c76b;
  font-size: 0.8rem;
  font-weight: 600;
}

.round-label {
  font-weight: 700;
  font-size: 1rem;
}

.word-display {
  margin-top: 8px;
}

.word-display h2 {
  margin: 4px 0 2px;
  font-size: 1.5rem;
}

.word-meta {
  font-size: 0.9rem;
  margin-top: 4px;
}

.word-meta p {
  margin: 2px 0;
}

.controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.note {
  font-size: 0.8rem;
  opacity: 0.8;
  margin-top: 4px;
}

.prompt {
  margin-top: 8px;
  font-size: 0.95rem;
  font-weight: 600;
}

.hidden {
  display: none !important;
}

.winner-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.winner-card {
  background: #fffdf4;
  border-radius: 24px;
  padding: 24px 18px;
  max-width: 420px;
  width: 90%;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.winner-card h2 {
  margin: 6px 0;
  font-size: 1.7rem;
}

.winner-name {
  font-size: 1.8rem;
  font-weight: 800;
  margin: 4px 0 10px;
}

.winner-sub {
  font-size: 0.95rem;
  margin-bottom: 14px;
}

.confetti {
  position: absolute;
  width: 8px;
  height: 12px;
  top: -20px;
  background: #ffcc33;
  opacity: 0.9;
  animation: fall linear forwards;
}

@keyframes fall {
  to {
    transform: translateY(420px) rotate(360deg);
    opacity: 0.2;
  }
}

@media (min-width: 700px) {
  .flex-desktop {
    display: block;
  }

  .flex-desktop>.card {
    flex: 1;
  }
}

.remove-btn {
  min-width: auto;
  padding: 1px 6px;
  font-size: 0.95rem;
  line-height: 1;
  border-radius: 999px;
  background: transparent;
  color: #d7263d;
  box-shadow: none;
  border: none;
  cursor: pointer;
}

.player-pill .remove-btn:hover {
  background: rgba(215, 38, 61, 0.1);
  color: #aa1e30;
  transform: none;
  box-shadow: none;
}

.pack-status {
  font-size: 0.8rem;
  opacity: 0.9;
}

.pack-status.success {
  color: #006400;
  font-weight: 600;
}

.pack-status.error {
  color: #b00020;
  font-weight: 600;
}

.logo-header {
  text-align: center;
  padding: 16px 8px 10px;
  margin-bottom: 10px;
}

.logo-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
}

.logo-text {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 1px;
}

.logo-bee {
  font-size: 2.2rem;
}

.logo-tagline {
  margin-top: 6px;
  font-size: 0.9rem;
  opacity: 0.85;
  font-weight: 600;
}

.logo-img {
  width: 100%;
  max-width: 620px;
  max-height: 165px;
  height: auto;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .14);
}

@media (min-width: 700px) {
  .logo-img {
    max-height: 190px;
  }
}

/* PT Badges */

.pt-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: .2px;
  background: rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.10);
  white-space: nowrap;
}

.pt-badge .icon {
  font-size: 0.9rem;
}

.pt-badge.zero {
  opacity: .45;
  font-weight: 700;
}

#nextWordBtn {
  font-weight: 900;
  letter-spacing: .2px;
  border: 2px solid rgba(0, 0, 0, 0.25);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
  transform: translateY(0);
}

#nextWordBtn:active {
  transform: translateY(1px);
}

button:disabled,
.btn-disabled {
  opacity: .45 !important;
  cursor: not-allowed !important;
  filter: grayscale(0.15);
  box-shadow: none !important;
  transform: none !important;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.9rem;
  background: rgba(0, 0, 0, 0.85);
  color: white;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.25);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(-2px);
}

.top-right-control {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 999;
}

.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.btn-row .right-btn {
  margin-left: auto;
}

.spelling-controls {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.spelling-controls .btn-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.spelling-controls .btn-row button {
  flex: 1;
  min-width: 0;
}

.spelling-controls .btn-row .spacer {
  flex: 1;
}

/* --- Auth Overlay --- */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.auth-overlay.hidden {
  display: none !important;
}

.auth-card {
  background: var(--card-bg, #fff8e7);
  border-radius: 24px;
  padding: 32px 24px;
  max-width: 380px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  border: 3px solid var(--bee-yellow, #ffcf33);
}