:root {
  --bg: #f5efe2;
  --panel: rgba(255, 250, 242, 0.88);
  --panel-border: rgba(107, 72, 32, 0.12);
  --text: #2b2116;
  --muted: #6e5a42;
  --accent: #a44c1c;
  --accent-strong: #7f3410;
  --shadow: 0 24px 60px rgba(72, 41, 17, 0.14);
  --radius: 28px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.55), transparent 28%),
    radial-gradient(circle at right, rgba(241, 195, 122, 0.35), transparent 25%),
    linear-gradient(135deg, #efe2c4 0%, #f9f4eb 48%, #f2dfc0 100%);
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
}

body[data-page="present"] {
  overflow: hidden;
}

body[data-page="vote"],
body[data-page="control"] {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.screen { min-height: 100vh; }
.stack > * + * { margin-top: 0.9rem; }
.hidden { display: none !important; }

.home-screen {
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.home-shell {
  width: min(980px, 100%);
  padding: 2rem;
}

.home-subtitle {
  max-width: 44rem;
}

.home-link-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.home-link-card {
  display: grid;
  gap: 0.7rem;
  padding: 1.4rem;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(107, 72, 32, 0.12);
  color: inherit;
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.home-link-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 36px rgba(72, 41, 17, 0.1);
}

.home-link-card h2,
.home-link-card p {
  margin: 0;
}

.lang-switcher {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.8rem;
  border-radius: 999px;
  background: rgba(255, 250, 242, 0.94);
  border: 1px solid rgba(107, 72, 32, 0.12);
  box-shadow: 0 12px 30px rgba(72, 41, 17, 0.12);
  backdrop-filter: blur(14px);
}

.lang-switcher-icon {
  font-size: 1rem;
}

.lang-select {
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  outline: none;
}

.panel, .vote-shell, .present-card {
  background: var(--panel);
  backdrop-filter: blur(18px);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.75rem;
  color: var(--accent);
}

.winner-eyebrow {
  margin-bottom: 0;
}

.muted { color: var(--muted); }
.vote-screen, .control-screen { padding: 1.25rem; }
.vote-shell { max-width: 760px; margin: 0 auto; padding: 1.25rem; }

.egg-card {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 130px) minmax(0, 1fr);
  align-items: center;
  margin: 1.2rem 0;
}

.egg-photo {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: contain;
  border-radius: 22px;
  background: #fff7ea;
}

.vote-form { display: grid; gap: 1rem; }

.criterion {
  padding: 1rem;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(107, 72, 32, 0.12);
}

.criterion-header, .slider-labels, .button-row, .present-hero, .present-result-card, .footer-pill, .score-line, .live-metrics, .hero-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.slider-value { font-weight: 700; color: var(--accent-strong); }
input[type="range"] { width: 100%; accent-color: var(--accent); }
.slider-labels { font-size: 0.85rem; color: var(--muted); }

.submit-button, .action-button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: white;
  padding: 0.95rem 1.25rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

.action-button.ghost {
  background: white;
  color: var(--accent-strong);
  border: 1px solid rgba(127, 52, 16, 0.18);
}

.debug-link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.status-panel { margin-top: 1rem; padding: 1rem 1.2rem; }
.status-panel > .action-button {
  align-self: flex-start;
}

.voter-results-panel {
  text-align: center;
}

.voter-results-title {
  margin: 0;
}

.voter-results-middle {
  display: grid;
  justify-items: center;
  gap: 0.75rem;
}

.comment-prompt {
  margin: 0;
  font-weight: 600;
  color: var(--text);
}

.comment-input {
  width: 100%;
  padding: 0.9rem 1rem;
  border-radius: 18px;
  border: 1px solid rgba(107, 72, 32, 0.18);
  font: inherit;
  background: rgba(255, 255, 255, 0.92);
}

.present-screen {
  padding: 2rem;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 1.5rem;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  box-sizing: border-box;
}

.present-card {
  height: 100%;
  padding: 2rem;
  display: grid;
  gap: 1.6rem;
  overflow: hidden;
}

.fixed-stage-layout {
  grid-template-rows: 8.5rem minmax(0, 1fr) 8.5rem;
  min-height: 0;
}

.stage-header {
  display: grid;
  gap: 0.6rem;
  min-height: 0;
  align-content: start;
  overflow: hidden;
}

.stage-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.8fr) minmax(0, 1fr);
  gap: 2rem;
  min-height: 0;
  overflow: hidden;
  align-items: stretch;
}

.stage-left,
.stage-center,
.stage-right {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.stage-left {
  display: grid;
  justify-items: stretch;
  align-content: stretch;
}

.stage-right {
  display: grid;
  place-items: center;
  height: 100%;
  padding: 0.5rem;
}

.stage-center {
  display: grid;
  place-items: center;
  align-content: center;
}

.egg-meta {
  margin-top: 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1.35;
}

.egg-meta p {
  margin: 0.5rem 0;
}

.present-image-frame {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: 100%;
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.6);
  overflow: hidden;
}

.stage-bottom {
  align-self: end;
}

.stage-status {
  align-self: end;
  margin: 0;
}

.category-winner-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr);
  gap: 2rem;
  min-height: 0;
  overflow: hidden;
  align-items: stretch;
}

.category-winner-copy {
  align-self: center;
  min-width: 0;
  text-align: center;
}

.category-winner-top {
  margin: 0 0 1.5rem;
  font-size: 2rem;
  font-weight: 700;
}

.category-winner-rest {
  margin: 0.55rem 0;
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--muted);
}

.present-hero {
  display: grid;
  grid-template-columns: 2fr 1fr;
  align-items: start;
  gap: 2rem;
}

.practice-layout {
  grid-template-columns: 1fr 1fr;
  align-items: start;
}

.practice-copy {
  align-self: start;
  min-width: 0;
}

.practice-bottom {
  min-height: 8.5rem;
  display: grid;
  align-content: end;
}

.lobby-layout {
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  align-items: center;
}
.present-title { font-size: clamp(2.4rem, 5vw, 5rem); line-height: 0.96; margin: 0; }
.present-subtitle { font-size: 1.25rem; max-width: 36rem; }
.winner-name { margin-top: 0.75rem; }

.qr-card {
  padding: 1.5rem;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.92);
  justify-self: center;
  text-align: center;
}

.qr-card img { width: min(24vw, 240px); border-radius: 18px; }
.voting-layout { grid-template-columns: 2fr 1fr; align-items: start; gap: 2rem; }

.hero-text {
  min-width: 0;
}

.hero-media {
  min-width: 0;
  display: grid;
  place-items: center;
  justify-items: center;
  align-content: center;
  width: 100%;
  justify-self: stretch;
}

.spider-slot {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  justify-items: center;
  align-items: center;
  margin-top: 0;
}

.hidden-slot {
  visibility: hidden;
}

.vote-count-line.hidden-slot {
  min-height: 1.5rem;
}

.present-image {
  position: absolute;
  inset: 1rem;
  width: calc(100% - 2rem);
  height: calc(100% - 2rem);
  object-fit: contain;
  object-position: center center;
}

.present-result-grid, .scoreboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.comment-wall {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  height: 100%;
  max-height: none;
  overflow-y: auto;
  padding-right: 0.35rem;
  align-content: flex-start;
}

.comment-pill {
  padding: 0.85rem 1rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(107, 72, 32, 0.1);
  display: inline-block;
  width: fit-content;
  max-width: min(100%, 28rem);
  align-self: flex-start;
}

.comment-panel {
  min-height: 0;
  height: 100%;
}

.podium-layout {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  align-items: end;
  padding-top: 10rem;
}

.summary-table-wrap {
  overflow: auto;
  border-radius: 24px;
  border: 1px solid rgba(107, 72, 32, 0.1);
  background: rgba(255, 255, 255, 0.68);
  width: 100%;
  max-height: 100%;
}

.summary-layout {
  grid-template-rows: auto minmax(0, 1fr);
}

.summary-table-stage {
  display: grid;
  align-items: center;
  min-height: 0;
}

.summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
}

.summary-table th,
.summary-table td {
  padding: 0.95rem 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(107, 72, 32, 0.08);
  white-space: nowrap;
}

.summary-table th {
  position: sticky;
  top: 0;
  background: rgba(245, 239, 226, 0.96);
  z-index: 1;
}

.summary-table tbody tr:last-child td {
  border-bottom: 0;
}

.podium-slot {
  padding: 1.25rem;
  border-radius: 24px 24px 0 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(229,212,184,0.95));
  border: 1px solid rgba(107, 72, 32, 0.12);
  text-align: center;
  transition: opacity 0.4s ease, transform 0.4s ease;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 0.75rem;
  position: relative;
}

.podium-first { min-height: 440px; }
.podium-second { min-height: 300px; }
.podium-third { min-height: 230px; }

.podium-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  font-weight: 700;
  font-size: 1.2rem;
}

.hidden-podium {
  opacity: 0.28;
  transform: translateY(10px);
}

.podium-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  position: absolute;
  inset: 0;
}

.podium-image-frame {
  position: absolute;
  bottom: calc(100% - 1.5rem);
  left: 50%;
  transform: translateX(-50%);
  overflow: hidden;
  display: grid;
  place-items: center;
}

.podium-third .podium-image-frame,
.podium-second .podium-image-frame {
  width: min(100%, 346px);
  height: 293px;
}

.podium-first .podium-image-frame {
  width: min(100%, 505px);
  height: 426px;
}

.present-result-card {
  padding: 1rem 1.1rem;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 22px;
  border: 1px solid rgba(107, 72, 32, 0.1);
}

.result-placeholder {
  visibility: hidden;
}

.meter { height: 12px; border-radius: 999px; background: rgba(164, 76, 28, 0.12); overflow: hidden; }
.meter-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, #d97b2a, #a44c1c); }
.radar { width: 220px; aspect-ratio: 1; display: block; margin: 0 auto; }
.radar-large { width: min(100%, 420px); }
.radar-xlarge { width: min(100%, 504px); }
.egg-photo-contain { object-fit: contain; background: rgba(255, 255, 255, 0.9); }

.present-footer { display: flex; justify-content: flex-end; gap: 1rem; align-items: center; }

.footer-status {
  margin-right: auto;
  max-width: min(60vw, 720px);
  justify-content: flex-start;
}

.footer-pill {
  padding: 0.85rem 1.2rem;
  background: rgba(43, 33, 22, 0.82);
  color: white;
  border-radius: 999px;
}

.control-grid {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 1.25rem;
}

.control-side {
  display: grid;
  gap: 1.25rem;
  align-content: start;
}

.control-login {
  max-width: 420px;
  margin: 5rem auto 0;
}

.panel { padding: 1.4rem; }
.link-list { display: grid; gap: 0.75rem; }
.link-list a { color: var(--accent-strong); text-decoration: none; font-weight: 700; }
.live-metrics { padding: 0.9rem 1rem; border-radius: 20px; background: rgba(255, 255, 255, 0.7); }

.debug-panel {
  padding: 1rem;
  border-radius: 20px;
  background: rgba(43, 33, 22, 0.06);
  border: 1px dashed rgba(107, 72, 32, 0.22);
}

.censored-image {
  filter: blur(34px) grayscale(1) saturate(0);
}

.mystery-teaser-image {
  filter: blur(24px);
}


@media (max-width: 900px) {
  .lobby-layout, .voting-layout, .control-grid, .egg-card, .podium-layout, .stage-main, .category-winner-main { grid-template-columns: 1fr; }
  .qr-card { justify-self: start; }
  .present-footer { justify-content: center; flex-wrap: wrap; }
  .footer-status { margin-right: 0; max-width: 100%; }
}
