/* frontend.css */
*, *:before, *:after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0a0a0a;
  --surface: #111;
  --border: #1c1c1c;
  --text: #ededed;
  --text-dim: #888;
  --text-muted: #444;
  --accent: #d97757;
  --serif: "DM Serif Display", Georgia, serif;
  --sans: "Inter", -apple-system, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", monospace;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
  font-size: 14px;
  line-height: 1.5;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.layout {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.main {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 20px;
}

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

.logo {
  display: inline-flex;
  text-decoration: none;
}

.logo img {
  width: auto;
  height: 20px;
}

.viewer-pill {
  display: inline-flex;
  font-family: var(--mono);
  letter-spacing: .4px;
  text-transform: uppercase;
  color: var(--text-dim);
  border: 1px solid var(--border);
  white-space: nowrap;
  background: #ffffff05;
  border-radius: 999px;
  align-items:  center;
  gap: 8px;
  padding: 6px 10px;
  font-size: 11px;
}

.viewer-pill__dot {
  animation: viewer-pulse 1.8s ease-out infinite;
  background: #22c55e;
  border-radius: 50%;
  width: 7px;
  height: 7px;
  box-shadow: 0 0 #22c55e73;
}

@keyframes viewer-pulse {
  0% {
    box-shadow: 0 0 #22c55e73;
  }

  70% {
    box-shadow: 0 0 0 7px #22c55e00;
  }

  100% {
    box-shadow: 0 0 #22c55e00;
  }
}

.arena {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.arena__meta {
  display: flex;
  flex-shrink: 0;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 24px;
}

.arena__round {
  font-family: var(--mono);
  letter-spacing: .5px;
  text-transform: uppercase;
  font-size: 13px;
  font-weight: 700;
}

.arena__round .dim {
  color: var(--text-muted);
}

.arena__phase {
  font-family: var(--mono);
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-dim);
  font-size: 11px;
}

.vote-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: -10px 0 22px;
}

.vote-panel__label {
  font-family: var(--mono);
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-size: 11px;
}

.vote-panel__buttons {
  display: flex;
  gap: 10px;
}

.vote-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  font-family: var(--sans);
  display: flex;
  border-radius: 8px;
  flex: 1;
  justify-content: center;
  align-items:  center;
  gap: 6px;
  padding: 10px 16px;
  transition: border-color .15s, background .15s;
  font-size: 13px;
}

.vote-btn:hover {
  background: #1a1a1a;
  border-color: #444;
}

.vote-btn--active {
  border-color: var(--accent);
  background: #d977571f;
}

.vote-btn--active:hover {
  background: #d977572e;
}

.prompt {
  flex-shrink: 0;
  margin-bottom: 32px;
}

.prompt__by {
  font-family: var(--mono);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  display: flex;
  flex-wrap: wrap;
  align-items:  center;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 11px;
}

.prompt__text {
  font-family: var(--serif);
  color: var(--text);
  letter-spacing: -.5px;
  border-left: 3px solid var(--accent);
  padding-left: 20px;
  font-size: clamp(28px, 5vw, 52px);
  line-height: 1.15;
}

.prompt__text--loading {
  color: var(--text-muted);
  border-left-color: var(--border);
}

.prompt__text--error {
  color: #ef4444;
  font-family: var(--mono);
  border-left-color: #ef4444;
  font-size: 16px;
}

.showdown {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 16px;
  min-height: 0;
}

.contestant {
  border-left: 3px solid var(--accent);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 20px;
  transition: background .3s;
}

.contestant--winner {
  animation: winner-reveal 1.5s ease-out;
  background: #ffffff08;
  border-left-width: 4px;
}

@keyframes winner-reveal {
  0% {
    background: #fff0;
  }

  30% {
    background: #ffffff0f;
  }

  100% {
    background: #ffffff08;
  }
}

.contestant__head {
  display: flex;
  flex-shrink: 0;
  justify-content: space-between;
  align-items:  center;
}

.win-tag {
  font-family: var(--mono);
  letter-spacing: 1px;
  background: var(--text);
  color: var(--bg);
  border-radius: 3px;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 700;
}

.contestant__body {
  flex: 1;
  min-height: 0;
}

.answer {
  font-family: var(--serif);
  color: var(--text-dim);
  letter-spacing: -.3px;
  font-size: clamp(20px, 3.5vw, 28px);
  line-height: 1.3;
}

.contestant--winner .answer {
  color: var(--text);
}

.answer--loading {
  color: var(--text-muted);
}

.answer--error {
  color: #ef4444;
  font-family: var(--mono);
  font-size: 13px;
}

.contestant__foot {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  gap: 8px;
}

.vote-bar {
  background: var(--border);
  overflow: hidden;
  border-radius: 2px;
  height: 3px;
}

.vote-bar__fill {
  border-radius: 2px;
  height: 100%;
  transition: width .6s cubic-bezier(.22,1,.36,1);
}

.vote-meta {
  display: flex;
  font-family: var(--mono);
  align-items:  center;
  gap: 6px;
  font-size: 12px;
}

.vote-meta__count {
  font-size: 16px;
  font-weight: 700;
}

.vote-meta__label {
  color: var(--text-muted);
}

.vote-meta__dots {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.voter-dot {
  object-fit: contain;
  opacity: .7;
  border-radius: 50%;
  width: 16px;
  height: 16px;
}

.voter-dot--letter {
  display: inline-flex;
  justify-content: center;
  align-items:  center;
  font-size: 10px;
  font-weight: 700;
}

.contestant--votable {
  cursor: pointer;
  transition: background .2s, border-color .2s;
}

.contestant--votable:hover {
  background: #ffffff0a;
  box-shadow: inset 0 0 0 1px #ffffff14;
}

.contestant--votable:active {
  background: #ffffff0f;
}

.contestant--my-vote {
  background: #ffffff08;
  box-shadow: inset 0 0 0 1px #ffffff14;
}

.my-vote-tag {
  font-family: var(--mono);
  letter-spacing: 1px;
  border: 1px solid var(--text-muted);
  color: var(--text-dim);
  border-radius: 3px;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 700;
}

.viewer-vote-bar {
  margin-top: 4px;
}

.viewer-vote-bar__fill {
  background: #666 !important;
}

.viewer-vote-meta {
  color: var(--text-muted);
}

.viewer-vote-meta__count {
  color: #999 !important;
}

.viewer-vote-meta__icon {
  margin-left: auto;
  font-size: 14px;
}

.vote-countdown {
  color: var(--text);
  margin-left: 8px;
  font-weight: 700;
}

.tie-label {
  text-align: center;
  font-family: var(--mono);
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 16px 0;
  font-size: 13px;
  font-weight: 700;
}

.standings {
  border-top: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  overflow-y: auto;
  flex-direction: column;
  flex-shrink: 0;
  gap: 20px;
  max-height: 50vh;
  padding: 16px 20px;
}

.standings__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.standings__links {
  display: flex;
  gap: 10px;
}

.standings__title {
  font-family: var(--mono);
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 700;
}

.standings__link {
  font-family: var(--mono);
  color: var(--text-muted);
  text-decoration: none;
  transition: color .2s;
  font-size: 11px;
}

.standings__link:hover {
  color: var(--text);
}

.lb-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lb-section__head {
  border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
  padding-bottom: 6px;
}

.lb-section__label {
  font-family: var(--mono);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
}

.lb-section__list {
  display: flex;
  flex-direction: column;
}

.lb-entry {
  opacity: .55;
  padding: 6px 0 4px;
  transition: opacity .3s;
}

.lb-entry--active, .lb-entry:hover {
  opacity: 1;
}

.lb-entry__top {
  display: flex;
  align-items:  center;
  gap: 6px;
  margin-bottom: 5px;
}

.lb-entry__rank {
  text-align: center;
  font-family: var(--mono);
  color: var(--text-muted);
  flex-shrink: 0;
  width: 20px;
  font-size: 11px;
}

.lb-entry__score {
  font-family: var(--mono);
  color: var(--text-dim);
  text-align: right;
  min-width: 14px;
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
}

.lb-entry__bar {
  background: var(--border);
  overflow: hidden;
  border-radius: 2px;
  height: 3px;
  margin-left: 26px;
}

.lb-entry__fill {
  border-radius: 2px;
  height: 100%;
  transition: width .6s cubic-bezier(.22,1,.36,1);
}

.connecting {
  height: 100vh;
  display: flex;
  background: var(--bg);
  flex-direction: column;
  justify-content: center;
  align-items:  center;
  gap: 16px;
  height: 100dvh;
}

.connecting__logo {
  display: flex;
}

.connecting__logo img {
  width: auto;
  height: 64px;
}

.connecting__sub {
  font-family: var(--mono);
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  font-size: 13px;
}

.waiting {
  display: flex;
  font-family: var(--serif);
  color: var(--text-muted);
  flex: 1;
  justify-content: center;
  align-items:  center;
  font-size: 28px;
}

.game-over {
  display: flex;
  text-align: center;
  flex-direction: column;
  flex: 1;
  justify-content: center;
  align-items:  center;
  gap: 28px;
  padding: 48px 0;
}

.game-over__label {
  font-family: var(--mono);
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 700;
}

.game-over__winner {
  display: flex;
  flex-direction: column;
  align-items:  center;
  gap: 16px;
}

.game-over__crown {
  font-size: 40px;
}

.game-over__name {
  font-family: var(--serif);
  display: flex;
  align-items:  center;
  gap: 16px;
  font-size: clamp(32px, 7vw, 56px);
  line-height: 1.1;
}

.game-over__name img {
  width: 40px;
  height: 40px;
}

.game-over__sub {
  color: var(--text-dim);
  font-size: 14px;
}

.next-toast {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--border);
  font-family: var(--mono);
  color: var(--text-dim);
  display: flex;
  z-index: 100;
  animation: toast-in .3s cubic-bezier(.22, 1, .36, 1);
  white-space: nowrap;
  border-radius: 20px;
  align-items:  center;
  gap: 6px;
  max-width: calc(100vw - 40px);
  padding: 10px 20px;
  font-size: 12px;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  box-shadow: 0 8px 24px #0009;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 12px);
  }

  to {
    opacity: 1;
    transform: translate(-50%);
  }
}

.model-tag {
  display: inline-flex;
  white-space: nowrap;
  align-items:  center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
}

.model-tag--sm {
  gap: 4px;
  font-size: 12px;
}

.model-tag__logo {
  object-fit: contain;
  width: 18px;
  height: 18px;
}

.model-tag--sm .model-tag__logo {
  width: 14px;
  height: 14px;
}

.dots span {
  animation: blink 1.4s infinite;
}

.dots span:nth-child(2) {
  animation-delay: .2s;
}

.dots span:nth-child(3) {
  animation-delay: .4s;
}

@keyframes blink {
  0%, 80%, 100% {
    opacity: .15;
  }

  40% {
    opacity: 1;
  }
}

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: none;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.site-footer {
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  flex-shrink: 0;
  margin-top: 32px;
  padding: 16px 0 4px;
  font-size: 11px;
  line-height: 1.9;
}

.site-footer a {
  color: var(--text-dim);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--text);
  text-decoration: underline;
}

.lb-entry__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  font-size: 12px;
  font-weight: 500;
}

.user-answers {
  border-top: 1px solid var(--border);
  margin-top: 20px;
  padding-top: 16px;
}

.user-answers__label {
  font-family: var(--mono);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-size: 10px;
  font-weight: 700;
}

.user-answers__list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.user-answer {
  display: flex;
  justify-content: space-between;
  align-items:  center;
  gap: 8px;
  font-size: 13px;
  line-height: 1.4;
}

.user-answer__main {
  flex: 1;
  min-width: 0;
}

.user-answer__vote {
  display: flex;
  flex-shrink: 0;
  align-items:  center;
  gap: 5px;
}

.user-vote-btn {
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  background: none;
  border-radius: 4px;
  padding: 2px 7px;
  transition: border-color .15s, color .15s;
  font-size: 10px;
  line-height: 1.4;
}

.user-vote-btn:hover {
  color: var(--text-dim);
  border-color: #444;
}

.user-vote-btn--active {
  border-color: var(--accent);
  color: var(--accent);
}

.user-vote-count {
  font-family: var(--mono);
  color: var(--text-muted);
  text-align: right;
  min-width: 14px;
  font-size: 11px;
  font-weight: 700;
}

.user-answer__name {
  font-family: var(--mono);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
}

.user-answer__sep {
  color: var(--text-muted);
}

.user-answer__text {
  color: var(--text-dim);
  font-family: var(--serif);
  font-size: 15px;
}

.propose {
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  gap: 8px;
  padding: 14px 0 10px;
}

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

.propose__title {
  font-family: var(--mono);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
}

.propose__badge {
  color: #4caf7d;
  white-space: nowrap;
  background: #4caf7d1f;
  border: 1px solid #4caf7d40;
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 600;
}

.propose__badge--empty {
  color: var(--text-muted);
  border-color: var(--border);
  background: #ffffff08;
}

.propose__tiers {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.propose__tier {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  font-family: var(--sans);
  color: var(--text);
  border-radius: 7px;
  flex-direction: column;
  align-items:  center;
  gap: 2px;
  padding: 8px 6px;
  transition: border-color .15s, background .15s;
}

.propose__tier:hover {
  border-color: #444;
}

.propose__tier--selected {
  border-color: var(--accent);
  background: #d9775714;
}

.propose__tier__price {
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
}

.propose__tier__label {
  color: var(--text-dim);
  font-size: 10px;
}

.propose__row {
  display: flex;
  align-items:  flex-start;
  gap: 6px;
}

.propose__row--mt {
  margin-top: 2px;
}

.propose__input {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--sans);
  border-radius: 6px;
  flex: 1;
  min-width: 0;
  padding: 7px 10px;
  font-size: 13px;
}

.propose__input:focus {
  outline: none;
  border-color: #444;
}

.propose__input::placeholder {
  color: var(--text-muted);
}

.propose__textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--sans);
  resize: none;
  border-radius: 6px;
  flex: 1;
  min-width: 0;
  padding: 7px 10px;
  font-size: 13px;
  line-height: 1.4;
}

.propose__textarea:focus {
  outline: none;
  border-color: #444;
}

.propose__textarea::placeholder {
  color: var(--text-muted);
}

.propose__btn {
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--sans);
  white-space: nowrap;
  border: none;
  border-radius: 6px;
  flex-shrink: 0;
  padding: 7px 14px;
  transition: opacity .15s;
}

.propose__btn:hover:not(:disabled) {
  opacity: .85;
}

.propose__btn:disabled {
  opacity: .35;
  cursor: not-allowed;
}

.propose__hint {
  color: var(--text-muted);
  font-size: 11px;
  font-family: var(--mono);
}

.propose__msg {
  margin: 0;
  font-size: 12px;
}

.propose__msg--ok {
  color: #4caf7d;
}

.propose__msg--error {
  color: #ff6b6b;
}

.propose__spinner {
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  animation: propose-spin .8s linear infinite;
  border-radius: 50%;
  flex-shrink: 0;
  width: 14px;
  height: 14px;
}

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

.propose__link-btn {
  color: var(--text-muted);
  font-size: 11px;
  font-family: var(--mono);
  cursor: pointer;
  text-decoration: underline;
  background: none;
  border: none;
  padding: 0;
}

.propose__link-btn:hover {
  color: var(--text-dim);
}

@media (width >= 1024px) {
  body {
    overflow: hidden;
    height: 100vh;
  }

  .app {
    height: 100vh;
  }

  .layout {
    overflow: hidden;
    flex-direction: row;
  }

  .main {
    position: relative;
    align-items:  center;
    padding: 88px 48px 32px;
  }

  .header {
    position: absolute;
    margin-bottom: 0;
    top: 32px;
    left: 48px;
    right: 48px;
  }

  .arena {
    width: 100%;
    max-width: 900px;
    margin: auto 0;
  }

  .prompt {
    margin-bottom: 40px;
  }

  .prompt__text {
    padding-left: 24px;
  }

  .showdown {
    flex-direction: row;
    align-items:  flex-start;
    gap: 32px;
  }

  .contestant {
    flex: 1;
  }

  .standings {
    border-top: none;
    border-left: 1px solid var(--border);
    overflow-y: auto;
    gap: 24px;
    width: 280px;
    max-height: none;
    padding: 24px;
  }
}
