:root {
  color-scheme: dark;
  --bg: #070707;
  --panel: #111111;
  --panel-2: #191919;
  --line: #2b2b2b;
  --text: #f7f2ee;
  --muted: #a9a19b;
  --lava: #ff1f0f;
  --amber: #ffc247;
  --green: #39d98a;
  --blue: #4db3ff;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.42);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    linear-gradient(145deg, rgba(255, 31, 15, 0.16), transparent 36%),
    radial-gradient(circle at 100% 0%, rgba(255, 194, 71, 0.14), transparent 30%),
    var(--bg);
  color: var(--text);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

a {
  color: inherit;
}

.participant-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 18px;
}

.phone-shell,
.host-shell {
  width: min(100%, 520px);
  margin: 0 auto;
}

.phone-shell {
  display: grid;
  gap: 16px;
}

.brand-header,
.host-topbar,
.pin-panel,
.host-controls,
.scoreboard,
.answer-form,
.meme-panel,
.buis-panel,
.team-login,
.team-panel,
.question-strip,
.status-bar {
  background: rgba(17, 17, 17, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.brand-header {
  display: grid;
  grid-template-columns: 74px 1fr;
  align-items: center;
  gap: 14px;
  min-height: 94px;
  padding: 12px;
}

.brand-mark {
  width: 74px;
  height: 74px;
  object-fit: contain;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--lava);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(1.8rem, 8vw, 3rem);
  line-height: 0.95;
}

.question-strip {
  padding: 14px 16px;
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 760;
}

.answer-form {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.play-area {
  display: grid;
  gap: 16px;
}

.team-login {
  padding: 16px;
}

.team-login form {
  display: grid;
  gap: 12px;
}

.team-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 10px 12px;
}

.team-panel span {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

.team-panel strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 1.05rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-panel button {
  min-height: 38px;
  border-radius: 8px;
  background: #262626;
  color: var(--text);
  font-weight: 850;
  padding: 0 12px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #3a3a3a;
  border-radius: 8px;
  background: #050505;
  color: var(--text);
  outline: none;
}

input {
  min-height: 48px;
  padding: 0 13px;
}

select {
  min-height: 48px;
  padding: 0 13px;
}

textarea {
  min-height: 132px;
  padding: 12px 13px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--lava);
  box-shadow: 0 0 0 3px rgba(255, 31, 15, 0.18);
}

.primary-action,
.secondary-action,
.next-action {
  min-height: 48px;
  border-radius: 8px;
  padding: 0 14px;
  color: var(--text);
  font-weight: 850;
}

.primary-action {
  background: var(--lava);
}

.secondary-action {
  background: #262626;
}

.next-action {
  background: var(--blue);
  color: #04111d;
}

.status-bar {
  min-height: 46px;
  padding: 12px 14px;
  color: var(--muted);
  text-align: center;
}

.status-bar.ok {
  color: var(--green);
}

.status-bar.warn {
  color: var(--amber);
}

.status-bar.error {
  color: #ff8b8b;
}

.meme-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.meme-toggle {
  min-height: 46px;
  border-radius: 8px;
  background: #f7f2ee;
  color: #080808;
  font-weight: 900;
}

.meme-scores {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.meme-scores[hidden] {
  display: none;
}

.meme-scores button {
  aspect-ratio: 1;
  border-radius: 8px;
  background: #262626;
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 900;
}

.meme-scores button:active {
  background: var(--lava);
}

.buis-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.buis-toggle,
.buis-send {
  min-height: 46px;
  border-radius: 8px;
  background: var(--amber);
  color: #120b00;
  font-weight: 900;
}

.buis-form {
  display: grid;
  gap: 10px;
}

.buis-form[hidden] {
  display: none;
}

.buis-form textarea {
  min-height: 86px;
}

.host-page {
  min-height: 100vh;
  padding: 10px;
}

.host-shell {
  display: grid;
  gap: 10px;
}

.host-topbar {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 10px;
  align-items: center;
  min-height: 68px;
  padding: 9px;
  position: relative;
}

.host-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.host-title h1 {
  font-size: 1.55rem;
}

.phone-link {
  grid-column: 1 / -1;
  display: block;
  min-height: 34px;
  border-radius: 8px;
  background: #050505;
  border: 1px solid var(--line);
  color: var(--amber);
  font-size: 0.95rem;
  font-weight: 850;
  line-height: 34px;
  overflow: hidden;
  padding: 0 10px;
  text-align: center;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.alternate-links {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.alternate-links:empty {
  display: none;
}

.alternate-links a {
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 750;
  line-height: 28px;
  overflow: hidden;
  padding: 0 8px;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pin-panel,
.host-controls {
  display: grid;
  gap: 10px;
  padding: 10px;
}

.button-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.scoreboard {
  min-height: 360px;
  overflow: hidden;
}

.scoreboard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 70px;
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
}

.scoreboard h2 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1;
}

.reveal-pill {
  flex: 0 0 auto;
  min-width: 88px;
  border: 1px solid #474747;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  line-height: 30px;
  text-align: center;
}

.reveal-pill.live {
  border-color: rgba(57, 217, 138, 0.52);
  color: var(--green);
}

.answers-list {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 0;
  max-height: calc(100vh - 284px);
  min-height: 260px;
  overflow: auto;
  padding: 10px;
}

.answer-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  padding: 10px;
}

.answer-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.answer-number {
  display: inline-grid;
  place-items: center;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--lava);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 900;
}

.team-name {
  min-width: 0;
  font-weight: 850;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.answer-text {
  min-height: 42px;
  border-radius: 8px;
  background: #060606;
  color: var(--text);
  font-size: 1rem;
  font-weight: 720;
  line-height: 1.25;
  padding: 10px;
  overflow-wrap: anywhere;
}

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

.empty-state {
  display: grid;
  min-height: 220px;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.meme-overlay {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 20;
  overflow: hidden;
}

.buis-overlay {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 30;
  overflow: hidden;
}

.meme-flyer {
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  width: min(88vw, 460px);
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  border: 2px solid rgba(255, 194, 71, 0.9);
  border-radius: 8px;
  background: rgba(5, 5, 5, 0.92);
  box-shadow: 0 0 34px rgba(255, 31, 15, 0.52);
  padding: 12px 14px;
  transform: translate(-50%, -50%) rotate(var(--meme-rotate, -4deg));
  animation: meme-pop 5s ease-in-out forwards;
}

.meme-flyer strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meme-flyer span {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 8px;
  background: var(--lava);
  color: var(--text);
  font-size: 1.65rem;
  font-weight: 950;
}

.buis-burst {
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  gap: 8px;
  width: min(92vw, 510px);
  border: 3px solid var(--text);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 31, 15, 0.96), rgba(255, 194, 71, 0.96)),
    #ff1f0f;
  box-shadow: 0 0 0 8px rgba(255, 31, 15, 0.25), 0 28px 90px rgba(0, 0, 0, 0.75);
  color: #080808;
  padding: 18px;
  text-align: center;
  transform: translate(-50%, -50%) rotate(-2deg);
  animation: buis-pop 4.2s cubic-bezier(0.2, 0.9, 0.2, 1) forwards;
}

.buis-kicker {
  color: #080808;
  font-size: 0.82rem;
  font-weight: 950;
  text-transform: uppercase;
}

.buis-main {
  font-size: clamp(1.55rem, 7vw, 3rem);
  font-weight: 950;
  line-height: 0.96;
  overflow-wrap: anywhere;
}

.buis-reason {
  border-radius: 8px;
  background: rgba(8, 8, 8, 0.82);
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 780;
  line-height: 1.25;
  padding: 10px;
  overflow-wrap: anywhere;
}

@keyframes meme-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(var(--meme-rotate, -4deg)) scale(0.84);
  }
  10% {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(var(--meme-rotate, -4deg)) scale(1.04);
  }
  82% {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(var(--meme-rotate, -4deg)) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(var(--meme-rotate, -4deg)) scale(0.96);
  }
}

@keyframes buis-pop {
  0% {
    opacity: 0;
    scale: 0.28;
    transform: translate(-50%, -50%) rotate(-18deg);
  }
  10% {
    opacity: 1;
    scale: 1.12;
  }
  18% {
    scale: 0.97;
    transform: translate(-50%, -50%) rotate(2deg);
  }
  76% {
    opacity: 1;
    scale: 1;
  }
  100% {
    opacity: 0;
    scale: 1.24;
    transform: translate(-50%, -50%) rotate(8deg);
  }
}

@media (min-width: 700px) {
  .host-page {
    padding: 14px;
  }

  .host-shell {
    width: min(100%, 560px);
  }
}

@media (max-width: 360px) {
  .button-grid {
    grid-template-columns: 1fr;
  }
}
