:root {
  --bg: #1a1035;
  --bg-card: #2a1b52;
  --primary: #ff5da2;
  --primary-dark: #d94489;
  --accent: #ffd23f;
  --text: #f5f0ff;
  --text-dim: #b8a9d9;
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(160deg, #1a1035, #2a1b52 60%, #3a1f5e);
  color: var(--text);
  min-height: 100vh;
}

#app {
  min-height: 100vh;
  display: flex;
  justify-content: center;
}

.room-page {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.display-page {
  max-width: 1100px;
}

.display-header {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px 20px 0;
}

.display-header-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--accent);
}

.display-leaderboard {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  width: 100%;
}

.display-score-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.07);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 14px;
}

.display-score-top {
  background: rgba(255, 210, 63, 0.16);
  border: 1px solid var(--accent);
}

.display-rank {
  font-weight: 700;
  color: var(--accent);
  min-width: 16px;
  text-align: center;
}

.display-points {
  font-weight: 700;
  color: var(--accent);
}

.me-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.08);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  margin-top: 14px;
}

.screen {
  width: 100%;
  max-width: 480px;
  padding: 24px 20px 60px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
}

.center-screen {
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 80vh;
}

.logo {
  text-align: center;
  font-size: 28px;
  margin: 10px 0 0;
}

.tagline {
  text-align: center;
  color: var(--text-dim);
  margin: 0;
  font-size: 15px;
}

.account-corner {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
}

.account-email {
  font-size: 12px;
  color: var(--text-dim);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.account-btn:active:not(:disabled) {
  background: var(--primary);
  border-color: var(--primary);
}

.account-btn:disabled {
  opacity: 0.5;
}

.game-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 10px 0;
}

.game-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 2px solid transparent;
  border-radius: var(--radius);
  padding: 24px 20px;
  cursor: pointer;
  text-align: center;
  color: var(--text);
}

.game-card:active {
  border-color: var(--primary);
}

.game-card-emoji {
  font-size: 40px;
}

.game-card-title {
  font-size: 18px;
  font-weight: 700;
}

.game-card-desc {
  font-size: 13px;
  color: var(--text-dim);
}

.game-card-players {
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
}

.tabs {
  display: flex;
  gap: 8px;
  background: rgba(255, 255, 255, 0.06);
  padding: 4px;
  border-radius: 999px;
}

.tab {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-dim);
  padding: 10px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.tab.active {
  background: var(--primary);
  color: white;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  margin: 4px 0 -6px;
}

.radio-group,
.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 10px 14px;
}

.radio-option,
.checkbox-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 400;
  color: var(--text);
  cursor: pointer;
}

.radio-option input,
.checkbox-option input {
  accent-color: var(--primary);
  width: 18px;
  height: 18px;
}

.option-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.option-row-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.option-row-main .radio-option,
.option-row-main .checkbox-option {
  flex: 1;
}

.hint-toggle {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 6px;
}

.hint-text {
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 8px 10px;
}

.text-input,
.answer-input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 16px;
}

.text-input:focus,
.answer-input:focus {
  outline: none;
  border-color: var(--primary);
}

.code-input {
  text-align: center;
  letter-spacing: 4px;
  font-weight: 700;
  text-transform: uppercase;
}

.password-field {
  position: relative;
}

.password-field .text-input {
  padding-right: 46px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 17px;
  line-height: 1;
  padding: 8px;
  cursor: pointer;
  color: var(--text-dim);
}

.answer-input {
  min-height: 100px;
  resize: vertical;
  font-family: inherit;
}

.btn {
  padding: 14px 20px;
  border-radius: 12px;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  display: block;
}

.btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:active:not(:disabled) {
  background: var(--primary-dark);
}

.btn.danger {
  background: rgba(255, 138, 138, 0.12);
  color: #ff8a8a;
  border: 1px solid #ff8a8a;
}

.btn.danger:active:not(:disabled) {
  background: #ff8a8a;
  color: #1a1035;
}

.row-actions {
  display: flex;
  gap: 10px;
}

.row-actions .btn {
  flex: 1;
}

.error-msg {
  color: #ff8a8a;
  font-size: 14px;
  text-align: center;
  min-height: 18px;
}

.success-msg {
  color: #7ee787;
  font-size: 14px;
  text-align: center;
  min-height: 18px;
}

.avatar-picker {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.avatar-preview {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  overflow: hidden;
}

.avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  width: 100%;
}

.emoji-btn {
  border: none;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  font-size: 20px;
  padding: 8px 0;
  cursor: pointer;
}

.emoji-btn:active {
  background: var(--primary);
}

.emoji-taken {
  opacity: 0.25;
  cursor: not-allowed;
  filter: grayscale(1);
}

.upload-label {
  color: var(--accent);
  font-size: 14px;
  cursor: pointer;
  text-align: center;
}

.link-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
  padding: 8px;
  margin: 0 auto;
}

.player-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.player-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.07);
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 14px;
}

.avatar-emoji {
  font-size: 18px;
}

.avatar-img {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
}

.host-badge {
  background: var(--accent);
  color: #3a1f5e;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
}

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

.player-progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.06);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 15px;
}

.player-progress-row .progress-count {
  margin-left: auto;
  font-weight: 700;
  color: var(--accent);
}

.player-progress-done {
  opacity: 0.6;
}

.player-progress-done .progress-count {
  color: #7ee787;
}

.qr-code {
  align-self: center;
  border-radius: 12px;
  background: white;
  padding: 8px;
}

.players-count {
  text-align: center;
  color: var(--text-dim);
  font-size: 14px;
  margin: 0;
}

.round-label {
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.prompt-text {
  text-align: center;
  font-size: 22px;
  line-height: 1.4;
  background: var(--bg-card);
  padding: 24px;
  border-radius: var(--radius);
  margin: 0;
}

.big-progress {
  text-align: center;
  font-size: 48px;
  font-weight: 800;
  color: var(--accent);
}

.big-timer {
  text-align: center;
  font-size: 56px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

.big-timer-stop {
  color: var(--primary);
  animation: stopPulse 0.6s ease-in-out infinite;
}

@keyframes stopPulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.08);
  }
}

@media (prefers-reduced-motion: reduce) {
  .big-timer-stop {
    animation: none;
  }
}

.spinner {
  align-self: center;
  width: 30px;
  height: 30px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-card {
  background: var(--bg-card);
  border: none;
  border-radius: 12px;
  padding: 16px;
  font-size: 16px;
  color: var(--text);
  text-align: left;
}

.option-btn {
  cursor: pointer;
}

.option-btn:active:not(:disabled) {
  background: var(--primary);
}

.option-btn:disabled {
  opacity: 0.6;
}

.option-with-count {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.vote-count {
  flex-shrink: 0;
  font-weight: 700;
  color: var(--accent);
  font-size: 14px;
}

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

.score-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.06);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 15px;
}

.score-row .rank {
  font-weight: 700;
  color: var(--accent);
  min-width: 20px;
  font-size: 15px;
}

.score-row-top {
  border: 2px solid transparent;
  font-size: 16px;
}

.score-row-top .rank {
  font-size: 22px;
}

.score-row.rank-1 {
  background: rgba(255, 210, 63, 0.18);
  border-color: var(--accent);
}

.score-row.rank-2 {
  background: rgba(200, 210, 230, 0.14);
  border-color: #c8d2e6;
}

.score-row.rank-3 {
  background: rgba(205, 127, 50, 0.16);
  border-color: #cd7f32;
}

.score-row span:last-child {
  margin-left: auto;
}

.score-points {
  font-weight: 700;
  color: var(--accent);
}

.winner-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 20px;
  background: var(--bg-card);
  padding: 16px;
  border-radius: var(--radius);
}

.winner-banner .avatar-emoji {
  font-size: 32px;
}

.display-mode .prompt-text {
  font-size: 28px;
}

.display-only .option-card {
  cursor: default;
}

h2, h3 {
  text-align: center;
}

/* Фанты */

.bottle-circle {
  position: relative;
  width: 100%;
  max-width: 340px;
  aspect-ratio: 1 / 1;
  margin: 10px auto;
}

.circle-seat {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  text-align: center;
  max-width: 70px;
}

.seat-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.seat-avatar .avatar-emoji {
  font-size: 24px;
  line-height: 1;
}

.seat-avatar .avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.circle-seat-picked .seat-avatar {
  box-shadow: 0 0 0 3px var(--accent), 0 0 18px 5px rgba(255, 210, 63, 0.45);
  animation: pickedGlow 1.8s ease-in-out infinite;
}

.circle-seat-partner .seat-avatar {
  box-shadow: 0 0 0 3px var(--primary), 0 0 18px 5px rgba(255, 93, 162, 0.45);
  animation: partnerGlow 1.8s ease-in-out infinite;
}

@keyframes pickedGlow {
  0%, 100% { box-shadow: 0 0 0 3px var(--accent), 0 0 18px 5px rgba(255, 210, 63, 0.45); }
  50% { box-shadow: 0 0 0 3px var(--accent), 0 0 30px 10px rgba(255, 210, 63, 0.75); }
}

@keyframes partnerGlow {
  0%, 100% { box-shadow: 0 0 0 3px var(--primary), 0 0 18px 5px rgba(255, 93, 162, 0.45); }
  50% { box-shadow: 0 0 0 3px var(--primary), 0 0 30px 10px rgba(255, 93, 162, 0.75); }
}

@media (prefers-reduced-motion: reduce) {
  .circle-seat-picked .seat-avatar,
  .circle-seat-partner .seat-avatar {
    animation: none;
  }
}

.bottle {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  transform-origin: center;
}

.bottle-img {
  display: block;
  height: 132px;
  width: auto;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.45));
  pointer-events: none;
  user-select: none;
}

.fanty-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
}

.card-inline {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
}

.fanty-summary-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

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

.summary-photo {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
}
