@import url("https://fonts.googleapis.com/css2?family=Figtree:wght@400;500;600;700&family=Syne:wght@600;700;800&display=swap");

:root {
  --bg: #06080a;
  --bg-overlay: rgba(6, 8, 10, 0.78);
  --surface: rgba(255, 255, 255, 0.06);
  --surface-strong: rgba(255, 255, 255, 0.1);
  --line: rgba(191, 192, 192, 0.18);
  --text: #e8e9e9;
  --muted: rgba(191, 192, 192, 0.78);
  --silver: #bfc0c0;
  --teal: #3d6b7c;
  --teal-deep: #1a3a4d;
  --teal-soft: rgba(61, 107, 124, 0.35);
  --green: #2f9e7a;
  --green-soft: rgba(47, 158, 122, 0.2);
  --blue: #3d7eb8;
  --blue-soft: rgba(61, 126, 184, 0.22);
  --red: #c4564a;
  --red-soft: rgba(196, 86, 74, 0.22);
  --info: rgba(61, 107, 124, 0.55);
  --error: rgba(196, 86, 74, 0.55);
  --radius: 10px;
  --radius-sm: 7px;
  --font-display: "Syne", system-ui, sans-serif;
  --font-body: "Figtree", system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --footer-h: 52px;
  --shadow-soft: 0 18px 50px rgba(0, 0, 0, 0.35);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(61, 107, 124, 0.28), transparent 55%),
    linear-gradient(var(--bg-overlay), var(--bg-overlay)),
    url("../img/bg2.png");
  background-size: auto, auto, cover;
  background-repeat: no-repeat;
  background-position: center top, center, center;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: inherit;
}

button,
input,
textarea {
  font: inherit;
}

#wrap {
  min-height: 100%;
  margin: 0 auto;
  padding: 28px 20px calc(var(--footer-h) + 28px);
  max-width: 1120px;
  animation: pageIn 0.55s var(--ease) both;
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes alertIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

#footer {
  height: var(--footer-h);
  position: fixed;
  bottom: 0;
  width: 100%;
  left: 0;
  pointer-events: none;
  background: linear-gradient(to top, rgba(6, 8, 10, 0.92), transparent);
}

.credit {
  margin: 0 22px 10px;
  position: absolute;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  pointer-events: auto;
}

.logo {
  height: 28px;
  width: auto;
  vertical-align: middle;
  opacity: 0.92;
}

.brand {
  text-align: center;
  margin: 8px 0 28px;
  width: 100%;
}

.brand-compact {
  text-align: left;
  margin: 0 0 20px;
}

.brand-compact .brand-mark {
  display: inline-block;
  width: auto;
  font-size: clamp(1.35rem, 3vw, 1.8rem);
  letter-spacing: 0.02em;
}

.brand-mark {
  display: block;
  width: 100%;
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  /* Conservative start size; fitBrandMark() grows/shrinks to the shell width after fonts load */
  font-size: clamp(1.25rem, 7cqi, 2.2rem);
  letter-spacing: -0.02em;
  line-height: 1.3;
  padding: 0.05em 0 0.12em;
  overflow: visible;
  white-space: nowrap;
  color: #eef1f2;
}

.brand-sub {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.98rem;
  font-weight: 500;
}

.alert {
  display: none;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  text-align: center;
  margin: 0 0 16px;
  font-weight: 500;
  backdrop-filter: blur(8px);
}

.alert.visible {
  display: block;
  animation: alertIn 0.35s var(--ease) both;
}

.alert-info {
  background: var(--info);
  border: 1px solid rgba(142, 176, 188, 0.25);
}

.alert-error {
  background: var(--error);
  border: 1px solid rgba(255, 180, 170, 0.2);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 11px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  color: #fff;
  line-height: 1.25;
  transition:
    transform 0.18s var(--ease),
    background-color 0.18s var(--ease),
    opacity 0.18s var(--ease),
    box-shadow 0.18s var(--ease);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0) scale(0.98);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn-success {
  background: linear-gradient(180deg, #38b089, var(--green));
}

.btn-danger {
  background: linear-gradient(180deg, #d46659, var(--red));
}

.btn-primary {
  background: linear-gradient(180deg, #4f8496, var(--teal));
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--silver);
}

textarea,
input[type="text"],
input[type="password"],
input[type="datetime-local"] {
  width: 100%;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.88);
  color: #121417;
  resize: vertical;
  transition:
    border-color 0.18s var(--ease),
    box-shadow 0.18s var(--ease),
    background-color 0.18s var(--ease);
}

textarea:focus,
input[type="text"]:focus,
input[type="password"]:focus,
input[type="datetime-local"]:focus {
  outline: none;
  border-color: rgba(61, 107, 124, 0.65);
  box-shadow: 0 0 0 3px rgba(61, 107, 124, 0.22);
  background: #fff;
}

textarea.placeholder-active,
input.placeholder-active {
  color: rgba(18, 20, 23, 0.45);
  font-style: italic;
}

h4,
.section-title {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  line-height: 1.35;
  color: var(--silver);
  overflow: visible;
}

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

.col-main {
  flex: 1 1 58%;
  min-width: 280px;
}

.col-side {
  flex: 1 1 30%;
  min-width: 260px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hidden {
  display: none !important;
}

.panel {
  margin-bottom: 28px;
  padding: 18px 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  backdrop-filter: blur(10px);
  animation: riseIn 0.45s var(--ease) both;
}

.panel:nth-child(2) {
  animation-delay: 0.05s;
}

.panel:nth-child(3) {
  animation-delay: 0.1s;
}

.poll-actions {
  display: flex;
  gap: 12px;
  align-items: stretch;
}

.poll-actions .btn {
  flex: 1;
  min-height: 48px;
}

.poll-question {
  text-align: center;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: clamp(1.05rem, 2.6vw, 1.35rem);
  color: #fff;
  line-height: 1.45;
  overflow: visible;
  padding-bottom: 0.1em;
}

.poll-question-left {
  text-align: left;
}

/* Audience is mobile-first: one centered column, no horizontal drift */
body.audience {
  /* Fade out the baked-in "Gondolat BONBONOK" strip at the bottom of bg2.png */
  background-image:
    linear-gradient(to bottom, transparent 58%, var(--bg) 82%),
    radial-gradient(ellipse 90% 55% at 50% 18%, rgba(61, 107, 124, 0.22), transparent 60%),
    linear-gradient(rgba(6, 8, 10, 0.72), rgba(6, 8, 10, 0.78)),
    url("../img/bg2.png");
  background-size: auto, auto, auto, cover;
  background-position: center, center, center, center 12%;
  background-attachment: scroll;
}

body.audience #wrap {
  max-width: 440px;
  width: 100%;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top))
    max(18px, env(safe-area-inset-right))
    calc(var(--footer-h) + max(20px, env(safe-area-inset-bottom)))
    max(18px, env(safe-area-inset-left));
  box-sizing: border-box;
}

body.audience #footer {
  background: linear-gradient(to top, rgba(6, 8, 10, 0.96) 40%, transparent);
}

body.audience .credit {
  left: 0;
  right: 0;
  margin: 0;
  bottom: max(10px, env(safe-area-inset-bottom));
  justify-content: center;
}

.audience-shell {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  min-height: calc(100dvh - var(--footer-h) - 56px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  container-type: inline-size;
  container-name: shell;
}

.audience-shell > * {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.audience-shell .brand {
  margin: 0 0 22px;
  overflow: visible;
}

.audience-shell .brand-mark {
  text-align: center;
  max-width: 100%;
}

.audience-shell .brand-sub {
  text-align: center;
  padding: 0 4px;
}

.audience-shell .alert {
  width: 100%;
  margin-left: 0;
  margin-right: 0;
}

.audience-shell .panel {
  border: none;
  background: transparent;
  padding: 0;
  backdrop-filter: none;
  width: 100%;
}

.audience-shell .compose {
  padding: 18px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-soft);
  width: 100%;
  box-sizing: border-box;
}

.login-shell {
  max-width: 400px;
  margin: 0 auto;
  min-height: calc(100vh - var(--footer-h) - 56px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  container-type: inline-size;
  container-name: shell;
}

.login-card {
  padding: 28px 24px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-soft);
  animation: riseIn 0.5s var(--ease) both;
}

.login-card legend {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 700;
  margin: 0 0 4px;
  letter-spacing: 0.02em;
}

.login-card .stack {
  gap: 14px;
}

.question-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 14px 15px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  color: #fff;
  border: 1px solid transparent;
  animation: riseIn 0.3s var(--ease) both;
  transition: transform 0.18s var(--ease), opacity 0.18s var(--ease);
}

.question-row .text {
  flex: 1;
  word-break: break-word;
  font-weight: 500;
}

.question-row .actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.question-row .icon-btn {
  background: rgba(0, 0, 0, 0.08);
  border: none;
  border-radius: 8px;
  color: inherit;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s var(--ease), transform 0.15s var(--ease);
}

.question-row .icon-btn:hover {
  background: rgba(0, 0, 0, 0.16);
  transform: translateY(-1px);
}

.question-row.undecided {
  background: rgba(255, 255, 255, 0.94);
  color: #15181c;
}

.question-row.undecided .okay {
  color: var(--green);
}

.question-row.undecided .later {
  color: var(--blue);
}

.question-row.undecided .trash {
  color: var(--red);
}

.question-row.asked {
  background: linear-gradient(135deg, #35a882, var(--green));
}

.question-row.asked .okay {
  display: none;
}

.question-row.asked .later,
.question-row.asked .trash {
  background: rgba(0, 0, 0, 0.18);
  color: #fff;
}

.question-row.to-be-asked {
  background: linear-gradient(135deg, #4a8ec4, var(--blue));
}

.question-row.to-be-asked .later {
  display: none;
}

.question-row.deleted {
  background: linear-gradient(135deg, #d06a5e, var(--red));
  opacity: 0.82;
}

.question-row.deleted .trash {
  display: none;
}

.show-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 4px;
}

.show-controls input {
  max-width: 240px;
}

#showRunningText {
  color: var(--muted);
}

#showRunningText strong {
  color: #fff;
  font-weight: 600;
}

#download {
  cursor: pointer;
  margin-top: 12px;
  color: var(--silver);
  font-size: 0.92rem;
  text-decoration: none;
  border-bottom: 1px solid rgba(191, 192, 192, 0.35);
  width: fit-content;
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease);
}

#download:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.55);
}

.field-label {
  display: block;
  margin: 4px 0 0;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.poll-stat {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--teal-soft);
  border: 1px solid rgba(142, 176, 188, 0.2);
  font-weight: 600;
}

.offline-banner {
  display: none;
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 10px 14px;
  text-align: center;
  background: rgba(196, 86, 74, 0.92);
  color: #fff;
  font-weight: 600;
}

.offline-banner.visible {
  display: block;
}

.staff-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.muted-line {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

.qr-wrap {
  display: flex;
  justify-content: center;
  padding: 12px;
  background: #fff;
  border-radius: var(--radius-sm);
  width: fit-content;
  margin: 0 auto 12px;
}

.qr-image {
  width: min(220px, 70vw);
  height: auto;
  display: block;
}

.audience-url {
  text-align: center;
  font-size: 0.85rem;
  color: var(--silver);
  word-break: break-all;
  margin: 0;
}

.poll-live-label {
  margin: 0;
  text-align: center;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--silver);
}

.poll-actions-lg {
  flex-direction: column;
}

.btn-poll {
  min-height: 56px;
  width: 100%;
  font-size: 1.05rem;
}

/* Speaker */
body.showman {
  background:
    radial-gradient(ellipse 70% 45% at 50% 0%, rgba(61, 107, 124, 0.22), transparent 60%),
    #101316 !important;
  background-image: none;
}

body.showman #wrap,
.showman-wrap {
  max-width: 920px;
  padding-top: 24px;
}

.showman-toolbar {
  margin-bottom: 24px;
}

.showman-label {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.showman-settings summary {
  cursor: pointer;
  color: var(--silver);
  list-style: none;
}

.showman-settings summary::-webkit-details-marker {
  display: none;
}

.showman-settings-panel {
  margin-top: 12px;
  max-width: 360px;
}

.showman-alert {
  position: fixed;
  inset: 10% 10%;
  z-index: 10000;
  background: linear-gradient(160deg, #d46659, var(--red));
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow-soft);
}

.showman-alert.visible {
  display: flex;
  animation: riseIn 0.4s var(--ease) both;
}

.showman-alert h1 {
  font-family: var(--font-display);
  font-size: clamp(28px, 6vw, 55px);
  font-weight: 800;
  margin: 0;
  line-height: 1.25;
}

.showman-current {
  margin: 8vh 0 40px;
  animation: riseIn 0.45s var(--ease) both;
}

.showman-kicker,
.queue-kicker {
  margin: 0 0 10px;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--teal);
  font-weight: 700;
}

.showman-current h2 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 5.5vw, 3rem);
  font-weight: 800;
  margin: 0;
  line-height: 1.25;
}

.showman-queue {
  border-top: 1px solid var(--line);
  padding-top: 24px;
}

.queue-item {
  margin-bottom: 22px;
  opacity: 0.72;
  animation: riseIn 0.45s var(--ease) both;
}

.queue-item h3 {
  font-family: var(--font-body);
  font-size: clamp(1.05rem, 2.8vw, 1.35rem);
  font-weight: 600;
  margin: 0;
  line-height: 1.35;
  color: var(--silver);
}

.showman-empty {
  text-align: center;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 1.1rem;
  margin-top: 18vh;
  letter-spacing: 0.04em;
}

.asked-list .asked-item {
  animation: riseIn 0.45s var(--ease) both;
}

/* Projector / room screen */
body.screen {
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(61, 107, 124, 0.28), transparent 55%),
    #070a0c !important;
  background-image: none;
  overflow: hidden;
}

.screen-wrap {
  max-width: 1100px;
  min-height: calc(100dvh - var(--footer-h) - 40px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: 24px;
}

.screen-view {
  animation: riseIn 0.4s var(--ease) both;
}

.screen-kicker {
  margin: 0 0 16px;
  text-align: center;
  font-size: clamp(0.85rem, 1.6vw, 1.05rem);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--teal);
  font-weight: 700;
}

.screen-title {
  margin: 0;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2rem, 5.8vw, 3.6rem);
  line-height: 1.2;
  color: #fff;
}

.screen-brand {
  margin: 0 0 12px;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2rem, 6vw, 3.4rem);
  color: #eef1f2;
}

.screen-idle {
  margin: 0;
  text-align: center;
  color: var(--muted);
  font-size: clamp(1.1rem, 2.5vw, 1.5rem);
}

.screen-bars {
  margin-top: 48px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.screen-bar-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 10px;
}

.screen-bar-label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.2rem, 3vw, 1.8rem);
}

.screen-bar-pct {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.4rem, 3.4vw, 2.1rem);
  color: var(--silver);
}

.screen-bar-track {
  height: clamp(28px, 4vw, 42px);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  border: 1px solid var(--line);
}

.screen-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  transition: width 0.6s var(--ease);
}

.screen-bar-a {
  background: linear-gradient(90deg, #2f9e7a, #4ec79a);
}

.screen-bar-b {
  background: linear-gradient(90deg, #c4564a, #e07a6e);
}

.screen-votes {
  margin: 28px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 1.05rem;
  letter-spacing: 0.04em;
}

@media (max-width: 640px) {
  #wrap {
    padding: 20px 14px calc(var(--footer-h) + 20px);
  }

  body.audience #wrap {
    padding: max(16px, env(safe-area-inset-top))
      max(16px, env(safe-area-inset-right))
      calc(var(--footer-h) + max(16px, env(safe-area-inset-bottom)))
      max(16px, env(safe-area-inset-left));
  }

  .panel {
    padding: 14px;
  }

  .question-row {
    flex-direction: column;
  }

  .question-row .actions {
    align-self: flex-end;
  }

  .logo {
    height: 20px;
  }

  body.audience .brand-sub {
    font-size: 0.92rem;
  }

  body.audience .btn {
    min-height: 48px;
    font-size: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
