:root {
  --bg0: #050512;
  --bg1: #0b0b22;
  --bg2: #171037;
  --card: rgba(255,255,255,.088);
  --card2: rgba(255,255,255,.13);
  --border: rgba(255,255,255,.14);
  --text: #fff9f0;
  --muted: rgba(255,249,240,.68);
  --pink: #ff2f86;
  --violet: #8f5cff;
  --cyan: #2ff4ff;
  --gold: #ffd166;
  --green: #4dffb8;
  --danger: #ff4d6d;
  --safeBottom: env(safe-area-inset-bottom);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  min-height: 100%;
  background: var(--bg0);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 10% -6%, rgba(255,47,134,.40), transparent 27%),
    radial-gradient(circle at 90% 0%, rgba(47,244,255,.27), transparent 30%),
    radial-gradient(circle at 50% 108%, rgba(143,92,255,.24), transparent 34%),
    linear-gradient(145deg, var(--bg0), var(--bg1) 48%, #05030c);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255,255,255,.026) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.88), transparent 82%);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.appShell {
  width: min(100%, 1080px);
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 14px calc(98px + var(--safeBottom));
}

.topBar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 2px 14px;
  backdrop-filter: blur(18px);
}

.kicker {
  margin: 0 0 2px;
  color: var(--cyan);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: .15em;
}

h1 {
  margin: 0;
  font-size: 31px;
  line-height: .95;
  letter-spacing: -.06em;
}

.livePill {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 13px;
  border-radius: 999px;
  color: #fff;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: .08em;
  background: rgba(255,255,255,.09);
  border: 1px solid var(--border);
}

.livePill span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 16px var(--green);
}

.heroCard {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  padding: 18px;
  border-radius: 30px;
  background:
    linear-gradient(135deg, rgba(255,47,134,.23), rgba(47,244,255,.12)),
    rgba(255,255,255,.075);
  border: 1px solid var(--border);
  box-shadow: 0 24px 70px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.12);
}

.heroCard::after {
  content: "";
  position: absolute;
  right: -80px;
  top: -80px;
  width: 190px;
  height: 190px;
  border-radius: 999px;
  background: rgba(255,255,255,.12);
  filter: blur(6px);
}

.heroLabel {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.heroCard h2 {
  margin: 0;
  max-width: 640px;
  font-size: clamp(31px, 10vw, 58px);
  line-height: .92;
  letter-spacing: -.065em;
}

.heroCard p:not(.heroLabel) {
  max-width: 620px;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.35;
}

.heroStats {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.heroStats div {
  min-height: 96px;
  display: grid;
  place-items: center;
  text-align: center;
  border-radius: 25px;
  background:
    radial-gradient(circle at 50% 20%, rgba(255,255,255,.28), transparent 42%),
    linear-gradient(145deg, rgba(255,255,255,.16), rgba(255,255,255,.055));
  border: 1px solid rgba(255,255,255,.17);
}

.heroStats strong {
  display: block;
  margin-bottom: -18px;
  font-size: 42px;
  line-height: 1;
  font-weight: 1000;
}

.heroStats span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.nameCard,
.adminPanel {
  margin-top: 12px;
  padding: 14px;
  border-radius: 24px;
  background: rgba(255,255,255,.075);
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}

.nameTop {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.nameTop h3 {
  margin: 0;
  font-size: 18px;
}

.nameTop p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.registeredBadge {
  padding: 8px 10px;
  border-radius: 999px;
  color: #052016;
  background: var(--green);
  font-size: 12px;
  font-weight: 1000;
  white-space: nowrap;
}

.hidden {
  display: none !important;
}

.nameRow {
  display: grid;
  grid-template-columns: 1fr 74px;
  gap: 9px;
}

input {
  width: 100%;
  min-height: 52px;
  padding: 0 15px;
  color: var(--text);
  background: rgba(0,0,0,.28);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 18px;
  outline: none;
}

input:focus {
  border-color: rgba(47,244,255,.72);
  box-shadow: 0 0 0 4px rgba(47,244,255,.10);
}

.nameRow button,
.chatDock button,
.adminPanel button {
  min-height: 52px;
  padding: 0 18px;
  border-radius: 18px;
  color: #160713;
  font-weight: 1000;
  background:
    radial-gradient(circle at 30% 20%, rgba(255,255,255,.72), transparent 32%),
    linear-gradient(145deg, var(--pink), var(--cyan));
}

.quickStats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 12px;
}

.statCard {
  padding: 13px;
  border-radius: 22px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.11);
}

.statCard span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.statCard strong {
  display: block;
  margin-top: 3px;
  font-size: 15px;
  line-height: 1.25;
}

.views {
  margin-top: 12px;
}

.view {
  display: none;
}

.view.active {
  display: block;
  animation: popIn .16s ease-out;
}

@keyframes popIn {
  from { opacity: 0; transform: translateY(8px) scale(.99); }
  to { opacity: 1; transform: none; }
}

.sectionHead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 2px 12px;
}

.sectionHead h3 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -.035em;
}

.sectionHead p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.miniBtn,
.filterBtn {
  min-height: 40px;
  padding: 0 13px;
  border-radius: 999px;
  color: var(--text);
  font-weight: 950;
  background: rgba(255,255,255,.10);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.filterBar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 12px;
}

.filterBtn.active {
  color: #130714;
  background: linear-gradient(145deg, var(--gold), #fff2ad);
}

.songList,
.resultList,
.pulseList {
  display: grid;
  gap: 10px;
}

.songCard {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  align-items: center;
  padding: 13px;
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(255,255,255,.105), rgba(255,255,255,.055));
  border: 1px solid rgba(255,255,255,.115);
  box-shadow: 0 12px 35px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.08);
}

.songCard.sweden {
  background:
    linear-gradient(145deg, rgba(77,255,184,.18), rgba(47,244,255,.08)),
    rgba(255,255,255,.08);
  border-color: rgba(77,255,184,.55);
}

.songCard.sweden::before {
  content: "SVERIGE";
  position: absolute;
  top: 10px;
  right: 12px;
  color: var(--green);
  font-size: 10px;
  font-weight: 1000;
  letter-spacing: .13em;
}

.orderBubble {
  width: 44px;
  height: 44px;
  border-radius: 17px;
  display: grid;
  place-items: center;
  color: var(--gold);
  font-weight: 1000;
  background: rgba(0,0,0,.28);
  border: 1px solid rgba(255,255,255,.10);
}

.songInfo {
  min-width: 0;
  padding-right: 58px;
}

.countryLine {
  color: var(--gold);
  font-size: 13px;
  font-weight: 1000;
}

.songTitle {
  margin-top: 3px;
  font-size: 17px;
  font-weight: 1000;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.artist {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ratingRow {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
  margin-top: 4px;
}

.ratingBtn {
  min-height: 45px;
  border-radius: 16px;
  color: rgba(255,249,240,.8);
  font-size: 20px;
  font-weight: 1000;
  background: rgba(255,255,255,.075);
  border: 1px solid rgba(255,255,255,.10);
}

.ratingBtn.active {
  color: #241308;
  background:
    radial-gradient(circle at 30% 20%, rgba(255,255,255,.72), transparent 32%),
    linear-gradient(145deg, var(--gold), var(--pink));
  box-shadow: 0 12px 28px rgba(255,209,102,.18);
}

.songMeta {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}

.metaPill {
  padding: 7px 9px;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(0,0,0,.20);
  border: 1px solid rgba(255,255,255,.08);
  font-size: 12px;
  font-weight: 850;
}

.metaPill.mine {
  color: #071d17;
  background: var(--green);
}

.resultCard,
.pulseCard {
  padding: 14px;
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(255,255,255,.105), rgba(255,255,255,.055));
  border: 1px solid rgba(255,255,255,.115);
  box-shadow: 0 12px 35px rgba(0,0,0,.20);
}

.resultTop {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  gap: 10px;
  align-items: center;
}

.place {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  color: #180b13;
  background: linear-gradient(145deg, var(--gold), #fff0a8);
  font-weight: 1000;
}

.resultTitle {
  min-width: 0;
}

.resultCountry {
  color: var(--gold);
  font-weight: 1000;
}

.resultSong {
  margin-top: 2px;
  color: var(--text);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.resultScore {
  color: var(--cyan);
  font-weight: 1000;
  white-space: nowrap;
  text-align: right;
}

.resultSub {
  color: var(--muted);
  font-size: 12px;
}

.bar {
  height: 11px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,.12);
}

.barFill {
  height: 100%;
  min-width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--pink), var(--violet), var(--cyan));
  box-shadow: 0 0 18px rgba(47,244,255,.26);
}

.pulseCard {
  display: grid;
  gap: 5px;
}

.pulseTop {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.pulseTop strong {
  color: var(--cyan);
}

.pulseStars {
  color: var(--gold);
  letter-spacing: .05em;
}

.chatMessages {
  height: calc(100vh - 330px);
  min-height: 360px;
  max-height: 620px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 2px 2px 94px;
  overscroll-behavior: contain;
}

.chatMsg {
  width: fit-content;
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 18px 18px 18px 7px;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.10);
  line-height: 1.35;
}

.chatMsg.system {
  width: 100%;
  max-width: 100%;
  border-radius: 18px;
  background: rgba(255,209,102,.12);
  border-color: rgba(255,209,102,.32);
}

.chatName {
  display: block;
  margin-bottom: 2px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 1000;
}

.chatMsg.system .chatName {
  color: var(--gold);
}

.chatDock {
  position: fixed;
  left: 14px;
  right: 14px;
  bottom: calc(78px + var(--safeBottom));
  z-index: 25;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px;
  width: min(calc(100% - 28px), 1052px);
  margin: 0 auto;
  padding: 10px;
  border-radius: 24px;
  background: rgba(10,10,28,.84);
  border: 1px solid var(--border);
  backdrop-filter: blur(20px);
  box-shadow: 0 18px 55px rgba(0,0,0,.35);
}

.adminPanel {
  display: grid;
  gap: 12px;
}

.adminPanel p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.dangerBtn {
  background: linear-gradient(145deg, var(--danger), var(--pink)) !important;
}

code {
  color: var(--cyan);
  font-size: 12px;
  word-break: break-all;
}

.bottomNav {
  position: fixed;
  left: 10px;
  right: 10px;
  bottom: calc(10px + var(--safeBottom));
  z-index: 30;
  width: min(calc(100% - 20px), 1060px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
  padding: 8px;
  border-radius: 26px;
  background: rgba(9,9,25,.86);
  border: 1px solid var(--border);
  backdrop-filter: blur(22px);
  box-shadow: 0 18px 60px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.10);
}

.navBtn {
  min-height: 56px;
  border-radius: 20px;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
  font-weight: 1000;
}

.navBtn span {
  display: block;
  font-size: 18px;
  margin-bottom: 2px;
}

.navBtn.active {
  color: var(--text);
  background:
    radial-gradient(circle at 50% 0%, rgba(255,255,255,.22), transparent 42%),
    linear-gradient(145deg, rgba(255,47,134,.30), rgba(47,244,255,.18));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.11);
}

.toast {
  position: fixed;
  left: 50%;
  top: max(16px, env(safe-area-inset-top));
  z-index: 100;
  transform: translateX(-50%);
  width: min(calc(100% - 28px), 430px);
  padding: 13px 15px;
  border-radius: 999px;
  text-align: center;
  color: #071712;
  background: linear-gradient(145deg, var(--green), var(--cyan));
  font-weight: 1000;
  box-shadow: 0 18px 50px rgba(0,0,0,.35);
}

@media (min-width: 760px) {
  .appShell {
    padding-left: 22px;
    padding-right: 22px;
  }

  .heroCard {
    grid-template-columns: 1fr 290px;
    padding: 24px;
  }

  .quickStats {
    grid-template-columns: repeat(3, 1fr);
  }

  .songList {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .resultList,
  .pulseList {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1080px) {
  .songList {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
