@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Outfit:wght@400;500;600;700;800;900&display=swap');

:root {
  --bg: #090b12;
  --panel: #111522;
  --panel2: #171d2d;
  --text: #f5f6ff;
  --muted: #7e879e;
  --accent: #a78bfa;
  --cyan: #58d9e8;
  --border: rgba(255,255,255,.075);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(ellipse at 35% 0%, #202044 0%, transparent 48%),
    radial-gradient(ellipse at 100% 100%, #142a35 0%, transparent 40%),
    var(--bg);
  color: var(--text);
  font-family: 'Outfit', sans-serif;
  min-height: 100vh;
  overflow: hidden;
}

.screen {
  width: 100%;
  max-width: 1920px;
  aspect-ratio: 16 / 9;
  min-height: 100vh;
  margin: auto;
  padding: 2.3% 3.2% 1.3%;
  display: flex;
  flex-direction: column;
  position: relative;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 2%;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 24px;
  color: #10111c;
  background: linear-gradient(135deg, var(--cyan), var(--accent));
  box-shadow: 0 0 28px #a78bfa44;
}

.brand-name {
  font-size: clamp(19px, 2vw, 30px);
  font-weight: 900;
  letter-spacing: -.8px;
}

.brand-name span {
  color: var(--accent);
}

.brand-sub {
  color: var(--muted);
  font: 10px 'DM Mono', monospace;
  letter-spacing: 2px;
  margin-top: 3px;
}

.live-status {
  display: flex;
  align-items: center;
  gap: 9px;
  font: 11px 'DM Mono', monospace;
  color: #a6b3c7;
  letter-spacing: 1px;
}

.live-dot {
  width: 8px;
  height: 8px;
  background: #ff526e;
  border-radius: 50%;
  box-shadow: 0 0 12px #ff526e;
}

.live-dot.online {
  background: #45e5a0;
  box-shadow: 0 0 12px #45e5a0;
}

.game-layout {
  display: grid;
  grid-template-columns: 1.65fr .85fr;
  gap: 2.5%;
  flex: 1;
  min-height: 0;
  padding-top: 2.2%;
}

.main-panel {
  background: linear-gradient(145deg, #151a2aee, #101421ee);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 3% 4%;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

.main-panel::before {
  content: "";
  position: absolute;
  width: 350px;
  height: 350px;
  border-radius: 50%;
  background: #8c70ff0b;
  filter: blur(35px);
  top: -180px;
  left: 20%;
  pointer-events: none;
}

.round-line {
  width: 100%;
  display: flex;
  justify-content: space-between;
  color: #b6bdd0;
  font: 11px 'DM Mono', monospace;
  letter-spacing: 1.5px;
}

.round-line b {
  color: var(--cyan);
  margin-left: 5px;
}

.round-label {
  color: var(--accent);
}

.timer-wrap {
  text-align: center;
  margin: 2.5% 0 1.5%;
}

.timer {
  font-size: clamp(48px, 6.5vw, 92px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -4px;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 30px #a78bfa30;
}

.timer-caption {
  margin-top: 7px;
  font: 10px 'DM Mono', monospace;
  color: var(--muted);
  letter-spacing: 3px;
}

.letters-heading {
  color: #aab3c8;
  font: 10px 'DM Mono', monospace;
  letter-spacing: 2px;
  margin: 2% 0 2%;
}

.letters {
  display: flex;
  gap: clamp(6px, 1.1vw, 15px);
  justify-content: center;
  width: 100%;
}

.letter {
  width: clamp(43px, 6vw, 76px);
  height: clamp(50px, 6.5vw, 83px);
  display: grid;
  place-items: center;
  border-radius: 13px;
  font-size: clamp(23px, 3.2vw, 43px);
  font-weight: 900;
  color: #f5f2ff;
  background: linear-gradient(145deg, #292b4c, #191d32);
  border: 1px solid #a78bfa55;
  box-shadow: 0 7px 22px #0004, inset 0 1px #ffffff15;
  animation: letterIn .3s ease both;
}

@keyframes letterIn {
  from { opacity: .3; transform: translateY(8px) scale(.94); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.rules {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 4%;
}

.rules div {
  background: #ffffff07;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.rules b {
  font: 9px 'DM Mono', monospace;
  color: #a9b2c9;
}

.rules span {
  font-size: 17px;
  font-weight: 800;
  color: var(--cyan);
}

.chat-hint {
  margin-top: 3.5%;
  background: #a78bfa16;
  border: 1px solid #a78bfa35;
  color: #d2c5ff;
  border-radius: 30px;
  padding: 10px 18px;
  font: 10px 'DM Mono', monospace;
  letter-spacing: 1px;
}

.chat-icon {
  color: var(--cyan);
  margin-right: 8px;
}

.accepted-title {
  width: 100%;
  margin-top: auto;
  padding-top: 3%;
  color: var(--muted);
  font: 10px 'DM Mono', monospace;
  letter-spacing: 1.5px;
}

.accepted-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 8px;
}

.accepted-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 9px;
  background: #ffffff07;
  border: 1px solid var(--border);
  animation: popIn .3s ease both;
}

.accepted-name {
  color: #c0c9da;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 35%;
}

.accepted-word {
  font-weight: 900;
  color: var(--cyan);
  letter-spacing: 1px;
}

.accepted-points {
  font: 11px 'DM Mono', monospace;
  color: #a78bfa;
}

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

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 3%;
  min-height: 0;
}

.leader-card {
  flex: 1;
  min-height: 0;
  background: linear-gradient(145deg, #151a2a, #101421);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 5%;
  overflow: hidden;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font: 11px 'DM Mono', monospace;
  letter-spacing: 1px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.small-tag {
  font-size: 8px;
  color: var(--accent);
  background: #a78bfa16;
  padding: 5px 7px;
  border-radius: 5px;
}

.leader-list {
  padding-top: 9px;
}

.leader-row {
  display: grid;
  grid-template-columns: 25px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 8px 3px;
  border-bottom: 1px solid #ffffff08;
}

.rank {
  font: 11px 'DM Mono', monospace;
  color: #737e96;
}

.rank.first {
  color: #f2ce72;
}

.player-name {
  font-size: 12px;
  font-weight: 600;
  color: #dce2f0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-points {
  font: 11px 'DM Mono', monospace;
  color: var(--cyan);
}

.empty {
  padding: 14px 3px;
  color: #778198;
  font-size: 11px;
}

footer {
  padding-top: 1.5%;
  display: flex;
  justify-content: space-between;
  color: #626d83;
  font: 9px 'DM Mono', monospace;
  letter-spacing: 2px;
}

footer span:last-child {
  color: #a78bfa;
}

.result-overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: none;
  place-items: center;
  background: #080a12ed;
  backdrop-filter: blur(14px);
}

.result-overlay.show {
  display: grid;
  animation: popIn .4s ease;
}

.result-card {
  width: min(620px, 90vw);
  max-height: 90vh;
  overflow: auto;
  text-align: center;
  padding: 35px;
  border: 1px solid #a78bfa55;
  border-radius: 24px;
  background: linear-gradient(145deg, #1c2038, #101421);
  box-shadow: 0 20px 100px #0008;
}

.result-kicker {
  font: 11px 'DM Mono', monospace;
  letter-spacing: 3px;
  color: var(--cyan);
}

.trophy {
  font-size: 50px;
  color: #f5d37a;
  margin: 15px 0 5px;
  text-shadow: 0 0 30px #f5d37a55;
}

.result-title {
  color: #9da8c0;
  font: 11px 'DM Mono', monospace;
  letter-spacing: 3px;
}

.winner-name {
  font-size: clamp(27px, 5vw, 48px);
  font-weight: 900;
  margin-top: 10px;
  overflow-wrap: anywhere;
}

.winner-points {
  color: var(--cyan);
  font: 14px 'DM Mono', monospace;
  margin-top: 6px;
}

.result-ranking {
  text-align: left;
  margin-top: 22px;
}

.result-ranking .leader-row {
  padding: 9px 5px;
}

.next-round {
  margin-top: 24px;
  color: var(--accent);
  font: 10px 'DM Mono', monospace;
  letter-spacing: 2px;
}

@media (max-aspect-ratio: 4/3) {
  body {
    overflow: auto;
  }

  .screen {
    aspect-ratio: auto;
    min-height: 100vh;
    padding: 18px;
  }

  .game-layout {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .main-panel {
    min-height: 600px;
  }

  .side-panel {
    min-height: 500px;
  }
}
