:root {
  --bg: #0a0516;
  --bg2: #120a28;
  --panel: #1a1033;
  --panel2: #241647;
  --line: #3a2766;
  --txt: #f1ecff;
  --mut: #a396c9;
  --purple: #8b5cf6;
  --purple2: #6d28d9;
  --neon: #22d3ee;
  --gold: #fbbf24;
  --gold2: #f59e0b;
  --ok: #22c55e;
  --bad: #ef4444;
}
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html,
body {
  margin: 0;
}
body {
  background:
    radial-gradient(1100px 560px at 50% -10%, #2b1262 0, transparent 62%),
    var(--bg);
  color: var(--txt);
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.5;
}
[hidden] {
  display: none !important;
}
a {
  color: var(--neon);
  text-decoration: none;
}
h1,
h2,
h3 {
  margin: 0;
}
.wrap {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px 40px;
}
.center {
  text-align: center;
}
.mut {
  color: var(--mut);
}
.gold {
  color: var(--gold);
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: 16px;
}
button {
  cursor: pointer;
  border: 0;
  color: inherit;
}
.btn {
  display: inline-block;
  text-align: center;
  text-decoration: none;
  padding: 14px 18px;
  border-radius: 14px;
  font-weight: 700;
  background: var(--panel2);
  border: 1px solid var(--line);
  color: var(--txt);
  transition:
    transform 0.08s,
    filter 0.15s;
}
.btn:active {
  transform: scale(0.97);
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn-gold {
  background: linear-gradient(135deg, var(--gold), var(--gold2));
  color: #2a1700;
  border: 0;
  box-shadow: 0 6px 22px rgba(251, 191, 36, 0.28);
}
.btn-purple {
  background: linear-gradient(135deg, var(--purple), var(--purple2));
  border: 0;
  box-shadow: 0 6px 22px rgba(139, 92, 246, 0.35);
}
.btn-bad {
  background: #7f1d1d;
  border-color: #b91c1c;
}
.btn-ok {
  background: #14532d;
  border-color: #16a34a;
}
.btn-big {
  width: 100%;
  padding: 20px;
  font-size: 22px;
  border-radius: 18px;
}
.btn-sm {
  padding: 8px 12px;
  font-size: 14px;
  border-radius: 10px;
}
.input,
select.input,
textarea.input {
  width: 100%;
  padding: 15px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #0f0824;
  color: var(--txt);
  outline: 0;
}
.input:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.25);
}
.input.code {
  text-align: center;
  letter-spacing: 6px;
  font-size: 26px;
  font-weight: 800;
  text-transform: uppercase;
}
label.lbl {
  display: block;
  margin: 0 0 6px;
  color: var(--mut);
  font-size: 14px;
}
.err {
  color: #fca5a5;
  text-align: center;
  min-height: 22px;
  font-size: 14px;
}

.card {
  background: linear-gradient(180deg, var(--panel), var(--bg2));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
}
.card h2 {
  font-size: 17px;
  color: var(--gold);
  margin-bottom: 10px;
}

.hero {
  padding-top: 9vh;
  text-align: center;
}
.logo {
  font-size: 64px;
  filter: drop-shadow(0 0 18px rgba(139, 92, 246, 0.8));
}
.title {
  font-size: 40px;
  font-weight: 900;
  margin: 6px 0;
  background: linear-gradient(90deg, var(--gold), var(--neon), var(--purple));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.tag {
  color: var(--mut);
  margin: 0 0 28px;
}
dialog {
  background: var(--panel);
  color: var(--txt);
  border: 1px solid var(--line);
  border-radius: 18px;
  max-width: 440px;
  width: 92%;
  padding: 20px;
}
dialog::backdrop {
  background: rgba(5, 2, 15, 0.8);
}
dialog ol {
  padding-left: 20px;
  line-height: 1.9;
  margin: 10px 0 16px;
}

.hud {
  position: sticky;
  top: 0;
  z-index: 5;
  background: linear-gradient(var(--bg) 82%, transparent);
  padding: 10px 0 12px;
}
.hud-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.hud .nm {
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 48%;
}
.hud .sc {
  color: var(--gold);
  font-weight: 900;
  font-size: 20px;
}
.hearts {
  font-size: 24px;
  letter-spacing: 2px;
  margin-top: 4px;
  min-height: 34px;
}
.streak {
  color: var(--neon);
  font-size: 13px;
  font-weight: 700;
}
.tbar {
  height: 14px;
  border-radius: 99px;
  background: #1b1138;
  border: 1px solid var(--line);
  overflow: hidden;
  margin-top: 6px;
}
.tbar i {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--neon), var(--purple));
  transform-origin: left;
  will-change: width;
}
.tbar.low i {
  background: linear-gradient(90deg, #f97316, var(--bad));
}
.qno {
  text-align: center;
  color: var(--mut);
  font-size: 13px;
}
.qtext {
  font-size: 23px;
  font-weight: 800;
  text-align: center;
  line-height: 1.55;
  padding: 14px 6px;
}
.opts {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.opt {
  min-height: 70px;
  padding: 14px 16px;
  border-radius: 18px;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  border: 2px solid transparent;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 12px;
  transition:
    transform 0.08s,
    filter 0.2s,
    opacity 0.2s;
}
.opt b {
  display: inline-grid;
  place-items: center;
  min-width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.28);
}
.opt:nth-child(1) {
  background: linear-gradient(135deg, #7c3aed, #5b21b6);
}
.opt:nth-child(2) {
  background: linear-gradient(135deg, #0891b2, #155e75);
}
.opt:nth-child(3) {
  background: linear-gradient(135deg, #d97706, #92400e);
}
.opt:active:not(:disabled) {
  transform: scale(0.98);
}
.opt:disabled {
  filter: saturate(0.35) brightness(0.7);
  cursor: default;
}
.opt.correct {
  filter: none !important;
  background: linear-gradient(135deg, #16a34a, #15803d) !important;
  border-color: #86efac;
  box-shadow: 0 0 24px rgba(34, 197, 94, 0.55);
}
.opt.wrong {
  filter: none !important;
  background: linear-gradient(135deg, #dc2626, #991b1b) !important;
  border-color: #fca5a5;
  box-shadow: 0 0 24px rgba(239, 68, 68, 0.5);
}
.opt.picked {
  outline: 3px solid var(--gold);
}
.msg {
  text-align: center;
  min-height: 54px;
  font-size: 18px;
  font-weight: 700;
  margin-top: 10px;
}
.msg small {
  display: block;
  color: var(--mut);
  font-weight: 400;
  font-size: 14px;
  margin-top: 2px;
}
.explain {
  background: #0f0824;
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  color: var(--mut);
  font-size: 15px;
  margin-top: 8px;
}
.banner {
  background: #2b1262;
  border: 1px solid var(--purple);
  border-radius: 14px;
  padding: 10px;
  text-align: center;
  font-weight: 700;
}

.chars {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.char {
  position: relative;
  padding: 0;
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: 3/4;
}
.char img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  display: block;
}
.char span {
  position: absolute;
  inset: auto 0 0 0;
  padding: 6px;
  background: linear-gradient(transparent, rgba(5, 2, 15, 0.92));
  font-weight: 700;
  font-size: 14px;
  text-align: center;
}
.char.taken {
  filter: grayscale(1) brightness(0.45);
  pointer-events: none;
}
.char.taken::after {
  content: "Taken";
  position: absolute;
  top: 8px;
  right: 8px;
  background: #000a;
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 12px;
}
.char.mine {
  border-color: var(--gold);
  box-shadow: 0 0 22px rgba(251, 191, 36, 0.5);
}
.avatar {
  width: 10px; 
  height: 10px;
  border-radius: 50%; 
  object-fit: cover; 
  object-position: top;
  border: 3px solid var(--gold);
  box-shadow: 0 0 20px rgba(251,191,36,.4);
  margin: 0 auto;
}
.chip img, .lb img, .tavatar { 
  width: 40px; 
  height: 40px; 
  border-radius: 50%; 
  object-fit: cover; 
  object-position: top; 
  border: 2px solid var(--purple); 
}
.spin {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 4px solid var(--line);
  border-top-color: var(--purple);
  animation: sp 1s linear infinite;
  margin: 0 auto;
}
@keyframes sp {
  to {
    transform: rotate(360deg);
  }
}

.lb {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.lb li {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #0f0824;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
}
.lb img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  object-position: top;
  border: 2px solid var(--purple);
}
.lb .n {
  flex: 1;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lb .l {
  font-size: 13px;
}
.lb .s {
  color: var(--gold);
  font-weight: 900;
}
.lb li.out {
  opacity: 0.45;
}

.shake {
  animation: shake 0.45s;
}
@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-9px);
  }
  40% {
    transform: translateX(9px);
  }
  60% {
    transform: translateX(-6px);
  }
  80% {
    transform: translateX(6px);
  }
}
#flash {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle, transparent 30%, rgba(239, 68, 68, 0.55));
  opacity: 0;
  z-index: 50;
}
#flash.on {
  animation: flash 0.6s;
}
@keyframes flash {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}
.pop {
  animation: pop 0.4s;
}
@keyframes pop {
  0% {
    transform: scale(0.7);
    opacity: 0;
  }
  60% {
    transform: scale(1.12);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}
#conn {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: #3a1a1e;
  color: #fecaca;
  border: 1px solid #7f1d1d;
  padding: 8px 14px;
  border-radius: 99px;
  font-size: 13px;
  z-index: 60;
}
#toast {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: #241647;
  border: 1px solid var(--purple);
  padding: 10px 18px;
  border-radius: 99px;
  z-index: 60;
  font-weight: 700;
}

.arena-body {
  background:
    linear-gradient(rgba(10, 5, 22, 0.55), rgba(10, 5, 22, 0.75)),
    url(../images/backgrounds/arena_bg.jpg) center/cover fixed,
    var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
}
.lobby-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 24px;
  text-align: center;
}
.room-code {
  font-size: clamp(64px, 14vw, 160px);
  font-weight: 900;
  letter-spacing: 0.12em;
  color: var(--gold);
  text-shadow: 0 0 30px rgba(251, 191, 36, 0.6);
}
.join-url {
  font-size: clamp(18px, 2.6vw, 32px);
  color: var(--neon);
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  max-width: 1200px;
}
.chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 6px 14px 6px 8px;
  font-weight: 700;
  animation: pop 0.35s;
}
.chip img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  object-position: top;
}
.arena {
  display: grid;
  grid-template-columns: minmax(260px, 24vw) 1fr;
  gap: 20px;
  padding: 20px;
  min-height: 100vh;
}
.side {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.side .card {
  background: rgba(26, 16, 51, 0.82);
  backdrop-filter: blur(4px);
}
.main {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  justify-content: center;
}
.sq-head {
  display: flex;
  gap: 24px;
  font-size: clamp(16px, 1.8vw, 24px);
  color: var(--mut);
}
.sq-text {
  font-size: clamp(28px, 4.2vw, 64px);
  font-weight: 900;
  text-align: center;
  line-height: 1.4;
  max-width: 1100px;
  text-shadow: 0 4px 24px #000;
}
.ring {
  position: relative;
  width: clamp(120px, 15vw, 210px);
  aspect-ratio: 1;
}
.ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.ring circle {
  fill: none;
  stroke-width: 10;
}
.ring .bg {
  stroke: #2a1a52;
}
.ring .fg {
  stroke: var(--neon);
  stroke-linecap: round;
  stroke-dasharray: 339.292;
  stroke-dashoffset: 0;
  filter: drop-shadow(0 0 8px var(--neon));
}
.ring.low .fg {
  stroke: var(--bad);
  filter: drop-shadow(0 0 8px var(--bad));
}
.ring .num {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: clamp(40px, 6vw, 84px);
  font-weight: 900;
}
.ring.low .num {
  color: var(--bad);
  animation: pulse 0.5s infinite alternate;
}
@keyframes pulse {
  to {
    transform: scale(1.12);
  }
}
.sopts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  width: 100%;
  max-width: 1200px;
}
.sopt {
  padding: 22px 16px;
  border-radius: 20px;
  font-size: clamp(20px, 2.6vw, 38px);
  font-weight: 800;
  text-align: center;
  border: 3px solid transparent;
  transition: all 0.3s;
}
.sopt:nth-child(1) {
  background: linear-gradient(135deg, #7c3aed, #5b21b6);
}
.sopt:nth-child(2) {
  background: linear-gradient(135deg, #0891b2, #155e75);
}
.sopt:nth-child(3) {
  background: linear-gradient(135deg, #d97706, #92400e);
}
.sopt.dim {
  opacity: 0.3;
  filter: grayscale(0.6);
}
.sopt.correct {
  background: linear-gradient(135deg, #16a34a, #15803d) !important;
  border-color: #86efac;
  box-shadow: 0 0 40px rgba(34, 197, 94, 0.7);
  transform: scale(1.04);
}
.s-explain {
  font-size: clamp(16px, 1.8vw, 26px);
  color: #d9ccff;
  background: rgba(15, 8, 36, 0.8);
  border-radius: 16px;
  padding: 12px 20px;
  max-width: 1000px;
  text-align: center;
}
.feed {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 120px;
}
.feed div {
  background: #3a1a1e;
  border: 1px solid #7f1d1d;
  color: #fecaca;
  border-radius: 12px;
  padding: 8px 12px;
  font-weight: 700;
  animation: slidein 0.5s;
}
@keyframes slidein {
  from {
    transform: translateX(-30px);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
.alive {
  font-size: clamp(14px, 1.5vw, 20px);
  color: var(--mut);
}
.alive b {
  color: var(--ok);
}

.podium-wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px 14px 50px;
}
.podium {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  gap: 10px;
  align-items: end;
  margin: 26px 0;
}
.pod {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  opacity: 0;
  animation: rise 0.9s forwards;
}
.pod .av {
  width: clamp(70px, 16vw, 130px);
  aspect-ratio: 3/4;
  border-radius: 16px;
  object-fit: cover;
  object-position: top;
  border: 3px solid var(--purple);
  background: var(--panel);
}
.pod .nm {
  font-weight: 900;
  font-size: clamp(15px, 2.6vw, 24px);
  text-align: center;
  overflow-wrap: anywhere;
}
.pod .pt {
  color: var(--gold);
  font-weight: 900;
}
.pod .base {
  width: 100%;
  border-radius: 14px 14px 0 0;
  display: grid;
  place-items: center;
  font-size: clamp(30px, 6vw, 56px);
  font-weight: 900;
  color: #1a0f00;
}
.pod.p1 .base {
  height: 200px;
  background: linear-gradient(var(--gold), var(--gold2));
}
.pod.p1 .av {
  border-color: var(--gold);
  box-shadow: 0 0 40px rgba(251, 191, 36, 0.7);
}
.pod.p2 .base {
  height: 140px;
  background: linear-gradient(#e5e7eb, #9ca3af);
}
.pod.p3 .base {
  height: 100px;
  background: linear-gradient(#d6935a, #92562c);
}
.pod.p3 {
  animation-delay: 0.3s;
}
.pod.p2 {
  animation-delay: 1.4s;
}
.pod.p1 {
  animation-delay: 2.6s;
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(60px) scale(0.8);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.confetti {
  position: fixed;
  top: -20px;
  width: 10px;
  height: 16px;
  z-index: 40;
  animation: fall linear forwards;
  pointer-events: none;
}
@keyframes fall {
  to {
    transform: translateY(110vh) rotate(720deg);
  }
}
.rank-table {
  width: 100%;
  border-collapse: collapse;
}
.rank-table td,
.rank-table th {
  padding: 9px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.rank-table th {
  color: var(--mut);
  font-weight: 600;
  font-size: 14px;
}
.rank-table tr.me {
  background: rgba(251, 191, 36, 0.12);
}
.rev {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 12px;
  background: var(--panel);
}
.rev h3 {
  font-size: 17px;
  margin-bottom: 8px;
}
.rev .o {
  padding: 6px 10px;
  border-radius: 10px;
  margin: 4px 0;
  background: #0f0824;
}
.rev .o.ok {
  background: #14532d;
  border: 1px solid #16a34a;
}
.rev .o.mine-bad {
  background: #7f1d1d;
  border: 1px solid #b91c1c;
}
.rev .ex {
  color: var(--neon);
  font-size: 14px;
  margin-top: 6px;
}
.admin-wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 14px 14px 50px;
}
.admin-nav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  align-items: center;
}
.admin-nav a {
  padding: 9px 14px;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  font-weight: 700;
  color: var(--mut);
}
.admin-nav a.on {
  background: var(--purple2);
  color: #fff;
  border-color: var(--purple);
}
.admin-nav a.out {
  margin-left: auto;
  color: #fca5a5;
}
.grid3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.grid2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (max-width: 640px) {
  .grid3,
  .grid2 {
    grid-template-columns: 1fr;
  }
}
.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.tile {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 6px;
  text-align: center;
}
.tile b {
  display: block;
  font-size: 22px;
  color: var(--gold);
}
.tile span {
  font-size: 12px;
  color: var(--mut);
}
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
  background: #2a1a52;
  color: var(--purple);
}
table.t {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
table.t th,
table.t td {
  padding: 8px 6px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
table.t th {
  color: var(--mut);
  font-weight: 600;
}
@media (max-width: 768px) {
  .arena {
    grid-template-columns: 1fr;
  }
  .side {
    order: 2;
  }
  .main {
    order: 1;
  }
}
