:root {
  color-scheme: dark;
  --bg: #050611;
  --panel: rgba(16, 18, 38, .82);
  --panel-strong: rgba(24, 26, 54, .96);
  --line: rgba(255, 255, 255, .14);
  --text: #f7f7ff;
  --muted: #b9bed8;
  --pink: #ff2bd6;
  --cyan: #6cf6ff;
  --gold: #ffe66d;
  --green: #45f5a1;
  --red: #ff5572;
  --radius: 8px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(circle at 16% 10%, rgba(255,43,214,.28), transparent 30%),
    radial-gradient(circle at 82% 16%, rgba(108,246,255,.24), transparent 28%),
    linear-gradient(145deg, #050611 0%, #11122a 45%, #090713 100%);
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: .18;
  background-image: linear-gradient(rgba(255,255,255,.12) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.1) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, transparent, #000 18%, #000 86%, transparent);
}

a { color: inherit; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled, input:disabled, textarea:disabled, select:disabled { cursor: not-allowed; opacity: .58; }
.app { width: min(1180px, 100%); margin: 0 auto; padding: 18px 14px 56px; }
.screen { width: 100vw; min-height: 100vh; padding: 3.5vw; overflow: hidden; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mark { width: 40px; height: 40px; border-radius: 8px; background: linear-gradient(135deg, var(--pink), var(--cyan) 55%, var(--gold)); box-shadow: 0 0 28px rgba(255,43,214,.35); flex: none; }
.brand h1 { margin: 0; font-size: clamp(1.3rem, 4vw, 2.4rem); line-height: 1; letter-spacing: 0; }
.brand p { margin: 4px 0 0; color: var(--muted); font-size: .9rem; }
.pill { border: 1px solid var(--line); background: rgba(255,255,255,.08); border-radius: 999px; padding: 8px 11px; color: var(--muted); white-space: nowrap; }
.pill.open { color: #07130d; background: var(--green); border-color: transparent; font-weight: 800; }
.pill.closed { color: #fff; background: var(--red); border-color: transparent; font-weight: 800; }
.country-badge { display: inline-flex; align-items: center; gap: .38em; vertical-align: middle; }
.flag-icon {
  width: 1.25em;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(255,255,255,.22);
  flex: none;
}
.live-country .flag-icon { width: 1.35em; }
.live-portrait-label .flag-icon, .wall-act .flag-icon { width: 1.15em; }

.grid { display: grid; gap: 14px; }
.two { grid-template-columns: 1fr; }
.three { grid-template-columns: 1fr; }
.panel, .act-card, .wall-card, .result-card {
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(18px);
  border-radius: var(--radius);
  box-shadow: 0 18px 60px rgba(0,0,0,.26);
}
.panel { padding: 16px; }
.panel h2, .panel h3 { margin: 0 0 12px; }
.muted { color: var(--muted); }
.danger { color: var(--red); }
.ok { color: var(--green); }
.gold { color: var(--gold); }
.hidden { display: none !important; }
.warning { border-color: rgba(255, 230, 109, .55); background: rgba(255, 230, 109, .12); }
.warning strong { color: var(--gold); }
.warning p { margin: 8px 0 0; color: var(--text); }

.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field label { color: var(--muted); font-size: .88rem; }
.field-help { color: var(--muted); font-size: .78rem; line-height: 1.3; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.08);
  color: var(--text);
  border-radius: 8px;
  padding: 11px 12px;
  outline: none;
}
textarea { min-height: 86px; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(108,246,255,.16); }
.button-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.btn {
  border: 0;
  border-radius: 8px;
  padding: 11px 14px;
  color: #050611;
  font-weight: 850;
  background: linear-gradient(135deg, var(--cyan), var(--gold));
  min-height: 42px;
}
.btn.secondary { color: var(--text); background: rgba(255,255,255,.1); border: 1px solid var(--line); }
.btn.danger { color: #fff; background: var(--red); }
.btn.small { min-height: 34px; padding: 7px 10px; font-size: .88rem; }
.btn.touch { min-height: 58px; padding: 14px 16px; font-size: 1rem; }

.act-card { overflow: hidden; }
.act-media { display: grid; grid-template-columns: 92px 1fr; gap: 12px; padding: 12px; align-items: center; }
.act-media img { width: 92px; aspect-ratio: 1; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.act-kicker { color: var(--cyan); font-weight: 800; font-size: .83rem; text-transform: uppercase; }
.act-title { margin: 3px 0 2px; font-size: 1.2rem; line-height: 1.1; }
.act-sub { color: var(--muted); }
.rating-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 0 12px 12px; align-items: end; }
.rating-grid .field { margin: 0; }
.placement-control {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  gap: 6px;
}
.placement-control button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.1);
  color: var(--text);
  font-size: 1.35rem;
  font-weight: 900;
}
.placement-control input { text-align: center; font-weight: 900; }
.placement-readout {
  grid-column: 1 / -1;
  border: 1px solid rgba(108,246,255,.28);
  background: rgba(108,246,255,.09);
  border-radius: 8px;
  padding: 7px 10px;
  color: var(--cyan);
  font-weight: 850;
  text-align: center;
}
.private { border-top: 1px solid var(--line); padding: 12px; }
.favorite-heart {
  display: grid;
  place-items: center;
  gap: 2px;
  min-height: 66px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 8px;
  background: rgba(255,255,255,.07);
  color: var(--muted);
  font-weight: 850;
}
.favorite-heart span { color: var(--gold); font-size: 2rem; line-height: .9; }
.favorite-heart small { color: inherit; font-weight: 850; }
.favorite-heart.active { color: #050611; background: linear-gradient(135deg, var(--gold), var(--pink)); border-color: transparent; box-shadow: 0 0 26px rgba(255,43,214,.25); }
.favorite-heart.active span { color: #050611; }
.progress-panel { display: grid; gap: 10px; }
.progress-top { display: flex; justify-content: space-between; gap: 14px; align-items: center; }
.progress-top h2, .progress-top p { margin: 0; }
.progress-top strong { color: var(--gold); font-size: 1.9rem; }
.progress-track { height: 12px; border-radius: 999px; background: rgba(255,255,255,.1); overflow: hidden; }
.progress-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--cyan), var(--gold), var(--pink)); transition: width .25s ease; }
.join-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 16px;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 14px;
}
.join-hero h2 { margin: 4px 0; font-size: clamp(2rem, 8vw, 4.2rem); line-height: .95; }
.join-hero img { width: 112px; aspect-ratio: 1; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.join-actions { display: grid; gap: 10px; margin-bottom: 14px; }
.favorite-award {
  border: 1px solid rgba(255,230,109,.42);
  background: linear-gradient(135deg, rgba(255,230,109,.18), rgba(255,43,214,.14));
  border-radius: 8px;
  padding: 14px 16px;
  margin: 0 0 14px;
}
.favorite-award span, .favorite-award small { display: block; color: var(--muted); font-weight: 850; }
.favorite-award strong { display: block; color: var(--gold); font-size: clamp(1.4rem, 3vw, 3rem); line-height: 1; margin: 6px 0; }
.screen-award { margin-bottom: 2vw; padding: 1.2vw 1.5vw; }
.rank-editor { display: grid; gap: 8px; margin: 14px 0; }
.rank-row {
  display: grid;
  grid-template-columns: 34px 44px 58px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.05);
  border-radius: 8px;
  padding: 9px;
}
.rank-row.dragging { opacity: .45; border-color: var(--gold); }
.rank-row.drop-target { border-color: var(--cyan); box-shadow: 0 0 0 2px rgba(108,246,255,.18); }
.drag-handle { color: var(--muted); font-size: 1.25rem; text-align: center; cursor: grab; touch-action: none; user-select: none; }
.drag-active { overscroll-behavior: contain; }
.rank-place { color: var(--gold); font-weight: 950; font-size: 1.35rem; text-align: center; }
.rank-row img { width: 58px; aspect-ratio: 1; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.rank-main { min-width: 0; }
.rank-main strong, .rank-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-main small { color: var(--muted); margin-top: 2px; }
.rank-buttons { display: flex; gap: 6px; }
.savebar { position: sticky; bottom: 0; z-index: 10; margin: 18px -14px -56px; padding: 12px 14px; background: rgba(5,6,17,.9); border-top: 1px solid var(--line); backdrop-filter: blur(16px); }
.status { min-height: 22px; color: var(--muted); }

.live-control { display: grid; grid-template-columns: 1fr; gap: 14px; margin-bottom: 14px; }
.live-now { border: 1px solid var(--line); background: rgba(255,255,255,.06); border-radius: 8px; padding: 16px; }
.live-now h3 { font-size: clamp(1.6rem, 4vw, 3.2rem); line-height: 1; margin: 8px 0 6px; }
.live-admin-title { color: var(--cyan); font-weight: 900; margin-top: 12px; text-transform: uppercase; }
.live-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-content: start; }
.act-button-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 12px; }
.act-button {
  min-height: 86px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.07);
  color: var(--text);
  text-align: left;
  padding: 12px;
}
.act-button.active { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(255,230,109,.18), 0 0 30px rgba(255,230,109,.18); }
.act-button span, .act-button small { display: block; color: var(--muted); }
.act-button strong { display: block; margin: 5px 0; font-size: 1rem; line-height: 1.1; }

.nav { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 12px; }
.nav button { flex: none; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { border-bottom: 1px solid var(--line); padding: 10px 8px; text-align: left; vertical-align: top; }
.table th { color: var(--muted); font-weight: 700; }

.wall-header { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2vw; align-items: start; margin-bottom: 1.4vw; }
.wall-qr { display: flex; gap: .8vw; align-items: start; }
.wall-qr > div { display: grid; justify-items: center; gap: .35vw; color: var(--text); font-weight: 850; }
.wall-qr img { width: clamp(82px, 8vw, 145px); background: #fff; border-radius: 8px; padding: 7px; }
.wall-feed { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.2vw; align-items: start; }
.wall-card { padding: 1.2vw; animation: pop .45s ease both; }
.wall-card strong { font-size: clamp(1.1rem, 1.8vw, 2rem); }
.wall-card p { font-size: clamp(1.4rem, 2.4vw, 3.2rem); line-height: 1.12; margin: .7vw 0; overflow-wrap: anywhere; }
.wall-act { display: grid; grid-template-columns: clamp(54px, 6vw, 92px) 1fr; gap: .8vw; align-items: center; margin-bottom: .6vw; }
.wall-act img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.wall-act small { display: block; color: var(--cyan); font-weight: 850; text-transform: uppercase; margin-bottom: .25vw; }
.wall-act strong { display: block; }
.emoji { font-size: clamp(2rem, 4vw, 5rem); float: right; line-height: 1; }
.screen-title { font-size: clamp(2.8rem, 6vw, 7rem); line-height: .95; margin: 0 0 2vw; text-wrap: balance; }
.qr-row { display: grid; grid-template-columns: repeat(2, minmax(120px, 1fr)); gap: 1.4vw; align-items: start; }
.qr { width: min(100%, 180px); background: #fff; padding: 10px; border-radius: 8px; }
.qr img { width: 100%; display: block; }
.live-fusion { min-height: 88vh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(360px, .85fr); gap: 2vw; align-items: stretch; }
.live-stage { display: grid; grid-template-columns: minmax(0, 1fr) minmax(210px, .55fr); gap: 2vw; align-items: center; min-width: 0; }
.live-copy { min-width: 0; }
.live-act { font-size: clamp(3rem, 6.5vw, 8rem); line-height: .92; margin: 0; }
.live-country { color: var(--cyan); font-size: clamp(1rem, 2vw, 2rem); font-weight: 900; text-transform: uppercase; }
.live-portrait { position: relative; align-self: stretch; min-height: 56vh; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); box-shadow: 0 24px 80px rgba(0,0,0,.35); }
.live-portrait img { width: 100%; height: 100%; object-fit: cover; display: block; }
.live-portrait::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(5,6,17,.82), transparent 45%); }
.live-portrait-label { position: absolute; left: 1vw; right: 1vw; bottom: 1vw; z-index: 1; color: var(--text); font-weight: 900; text-transform: uppercase; font-size: clamp(.85rem, 1.2vw, 1.4rem); }
.live-join { align-self: center; }
.live-wall-panel { border: 1px solid var(--line); background: rgba(16,18,38,.78); border-radius: 8px; padding: 1.1vw; overflow: hidden; }
.live-wall-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1vw; align-items: start; margin-bottom: 1vw; }
.live-wall-top h2 { margin: 0; font-size: clamp(1.6rem, 2.8vw, 3rem); }
.wall-qr.compact img { width: clamp(68px, 5.7vw, 108px); padding: 5px; }
.wall-qr.compact span { font-size: .78rem; }
.live-wall-feed { display: grid; gap: .8vw; max-height: 72vh; overflow: hidden; }
.live-wall-empty {
  min-height: 22vh;
  display: grid;
  place-content: center;
  gap: .6vw;
  padding: 1.2vw;
  border: 1px dashed rgba(108,246,255,.36);
  border-radius: 8px;
  background: rgba(108,246,255,.08);
  color: var(--muted);
  text-align: center;
}
.live-wall-empty strong { color: var(--text); font-size: clamp(1.1rem, 1.8vw, 2.2rem); }
.live-wall-card { padding: .9vw; }
.live-wall-card p { font-size: clamp(1.05rem, 1.65vw, 2.2rem); }
.live-wall-card .emoji { font-size: clamp(1.6rem, 2.6vw, 3.4rem); }
.result-list { display: grid; gap: .8vw; }
.result-card { display: grid; grid-template-columns: 90px 1fr 190px; gap: 18px; align-items: center; padding: 1vw; }
.rank { font-size: clamp(2rem, 4vw, 5rem); font-weight: 950; color: var(--gold); }
.score { text-align: right; font-size: clamp(1.2rem, 2.7vw, 3rem); font-weight: 950; }
.winner { outline: 3px solid var(--gold); box-shadow: 0 0 70px rgba(255,230,109,.3); }

@keyframes pop { from { transform: translateY(18px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }

@media (min-width: 760px) {
  .app { padding: 28px 24px 70px; }
  .two { grid-template-columns: 1fr 1fr; }
  .three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .rating-grid { grid-template-columns: 1fr 1fr 1fr; }
  .savebar { margin-left: -24px; margin-right: -24px; padding-left: 24px; padding-right: 24px; }
  .live-control { grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr); }
}

@media (max-width: 760px) {
  .topbar { align-items: flex-start; }
  .act-media { grid-template-columns: 76px 1fr; }
  .act-media img { width: 76px; }
  .rank-row { grid-template-columns: 30px 38px minmax(0, 1fr) auto; }
  .rank-row img { display: none; }
  .rank-buttons { flex-direction: column; }
  .wall-header { grid-template-columns: 1fr; }
  .wall-qr { justify-content: start; }
  .wall-feed { grid-template-columns: 1fr; }
  .live-fusion, .live-stage { grid-template-columns: 1fr; }
  .result-card { grid-template-columns: 56px 1fr; }
  .score { grid-column: 1 / -1; text-align: left; }
}

@media (max-width: 1050px) {
  .live-fusion, .live-stage { grid-template-columns: 1fr; align-items: start; }
  .live-portrait { min-height: 34vh; }
  .live-wall-feed { max-height: none; }
  .screen { overflow: auto; }
}
