:root {
  color-scheme: dark;
  --black: #000;
  --ink: #f7f7ff;
  --muted: #b7bed5;
  --blue: #244f8e;
  --blue-bright: #8fc7ff;
  --gold: #e5bd4f;
  --gold-dark: #8a6b25;
  --panel: rgba(10, 13, 20, 0.94);
  --panel-border: rgba(244, 217, 122, 0.86);
  --focus: #79d9ff;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background: #000;
  color: var(--ink);
  font-family: Verdana, Geneva, Arial, sans-serif;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.room-shell {
  position: relative;
  height: 100vh;
  min-height: 520px;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 15%, rgba(61, 122, 219, 0.22), transparent 23%),
    radial-gradient(circle at 80% 14%, rgba(248, 199, 83, 0.12), transparent 22%),
    linear-gradient(#000 0%, #030305 100%);
}

.room-title {
  position: absolute;
  z-index: 4;
  left: 30px;
  top: 18px;
  max-width: calc(100vw - 330px);
  pointer-events: none;
}

.room-title h1 {
  margin: 0;
  color: #fff;
  font-family: Impact, Haettenschweiler, "Arial Black", sans-serif;
  font-size: clamp(34px, 4vw, 58px);
  font-weight: 900;
  line-height: 0.95;
  letter-spacing: 0;
  text-shadow:
    0 0 3px #fff,
    0 0 7px #6ab8ff,
    0 0 13px #1a6cff,
    4px 4px 0 #12316f;
}

.top-tools {
  position: absolute;
  z-index: 10;
  top: 25px;
  right: 25px;
  display: flex;
  gap: 34px;
  align-items: flex-start;
}

.icon-button {
  display: grid;
  width: 60px;
  height: 55px;
  place-items: center;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.55);
  border-radius: 9px;
  background: rgba(36, 38, 44, 0.88);
  color: rgba(255, 255, 255, 0.86);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.icon-button:hover,
.icon-button.active {
  border-color: #fff;
  background: #2e3440;
}

.icon-button svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tool-popover,
.nav-menu {
  position: absolute;
  top: 65px;
  right: 0;
  display: none;
  width: 295px;
  padding: 14px;
  border: 1px solid #505762;
  border-radius: 6px;
  background: rgba(22, 24, 29, 0.97);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.48);
}

.tool-popover.open,
.nav-menu.open {
  display: block;
}

#searchPopover {
  right: 158px;
}

#tagsPopover {
  right: 74px;
}

.tool-popover input[type="search"] {
  width: 100%;
  min-width: 0;
  margin-bottom: 10px;
  padding: 8px 10px;
  border: 1px solid #707784;
  border-radius: 4px;
  background: #0b0d10;
  color: #fff;
}

.small-command,
.nav-menu button,
.nav-menu a,
.tag-chip {
  display: block;
  width: 100%;
  min-height: 34px;
  margin: 0 0 8px;
  padding: 7px 10px;
  border: 1px solid #5a6370;
  border-radius: 5px;
  background: #2b3038;
  color: #f8fbff;
  text-align: left;
  text-decoration: none;
}

.small-command,
.tag-chip {
  width: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 5px;
}

.tag-chip.active {
  border-color: var(--gold);
  background: var(--blue);
}

#searchStatus {
  min-height: 18px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.nav-title {
  padding: 2px 4px 10px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  font-weight: 700;
}

.score-wall {
  position: absolute;
  inset: 100px 0 0 0;
  display: flex;
  align-items: stretch;
  gap: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x proximity;
  padding: 0 0 0 110px;
}

.score-wall::-webkit-scrollbar {
  height: 0;
}

.game {
  position: relative;
  flex: 0 0 265px;
  min-width: 265px;
  max-width: 265px;
  height: calc(100vh - 100px);
  min-height: 420px;
  overflow: hidden;
  scroll-snap-align: start;
  background-color: #000;
  background-position: center top;
  background-size: cover;
  background-repeat: no-repeat;
}

.game.empty.hidden-empty {
  display: none;
}

.game.leaders {
  margin-left: auto;
  background:
    linear-gradient(84deg, transparent 0 4%, rgba(47, 104, 174, 0.98) 5% 72%, transparent 73%),
    linear-gradient(84deg, transparent 0 18%, rgba(242, 213, 121, 0.9) 19% 24%, transparent 25%),
    linear-gradient(84deg, transparent 0 48%, rgba(242, 213, 121, 0.9) 49% 54%, transparent 55%),
    linear-gradient(#0d315c, #2c78bd);
}

.game.last {
  margin-right: auto;
}

.game-header {
  display: flex;
  position: relative;
  height: 184px;
  min-height: 184px;
  max-height: 184px;
  align-items: center;
  justify-content: center;
  padding: 0 9px;
}

.leaders .game-header {
  display: block;
  padding-top: 54px;
}

.leaders-title {
  width: 100%;
  padding: 10px 8px;
  border: 1px solid var(--gold);
  border-radius: 0 29px 0 29px;
  background: var(--blue);
  color: #fff;
  font-family: Impact, Haettenschweiler, "Arial Black", sans-serif;
  font-size: 29px;
  line-height: 1.05;
  text-align: center;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.65);
}

.leaders-title span {
  display: block;
  margin-top: 10px;
  font-size: 19px;
}

.game-logo {
  display: block;
  width: min(250px, 94%);
  max-height: 78px;
  object-fit: contain;
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.9));
}

.scores {
  position: absolute;
  left: 0;
  right: 0;
  top: 184px;
  bottom: 0;
  overflow-y: auto;
  padding: 25px 9px 70px;
}

.scores::-webkit-scrollbar {
  width: 0;
}

.scorebox {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "name expand"
    "score score"
    "date date";
  align-items: center;
  min-height: 119px;
  margin: 0 0 24px;
  padding: 14px 16px 8px;
  border: 1px solid var(--panel-border);
  border-radius: 13px;
  background: rgba(0, 0, 0, 0.9);
  color: #fff;
}

.scorebox.leader-score {
  grid-template-columns: 68px 1fr;
  grid-template-areas:
    "rank name"
    "rank score";
  min-height: 80px;
  max-height: 80px;
  height: 80px;
  margin-left: 7px;
  margin-right: 7px;
  padding: 0 12px 0 0;
  border: 0;
  border-radius: 0 30px 0 30px;
  background:
    radial-gradient(at right bottom, #fedb37 0%, #fdb931 8%, #9f7928 30%, #b79037 40%, transparent 80%),
    radial-gradient(at left top, #fff 0%, #ffffac 8%, #d1b464 25%, #eacd8a 62.5%, #e1e1e1 100%);
}

.player {
  grid-area: name;
  min-width: 0;
  color: #9ba3ff;
  font-family: Impact, Haettenschweiler, "Arial Black", sans-serif;
  font-size: 35px;
  line-height: 1;
  text-align: center;
  text-shadow: 0 2px 0 #16165d;
  overflow-wrap: anywhere;
}

.scorebox.leader-score .player {
  color: #244f8e;
  font-size: 31px;
}

.score-value {
  grid-area: score;
  margin-top: 12px;
  font-size: 29px;
  font-weight: 900;
  line-height: 1.05;
  text-align: center;
  text-shadow: 0 2px 0 #000;
}

.leader-score .score-value {
  margin-top: 2px;
  font-size: 31px;
}

.score-date {
  grid-area: date;
  align-self: end;
  margin-top: 5px;
  color: #fff;
  font-size: 11px;
  text-align: right;
}

.rank {
  grid-area: rank;
  align-self: stretch;
  display: grid;
  width: 44px;
  place-items: center;
  background: var(--blue);
  color: #fff;
  font-family: Impact, Haettenschweiler, "Arial Black", sans-serif;
  font-size: 31px;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.5);
}

.expand {
  grid-area: expand;
  width: 27px;
  height: 27px;
  margin-top: -5px;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 5px;
  background: rgba(55, 55, 55, 0.9);
  color: #ddd;
  font-size: 23px;
  line-height: 21px;
  text-align: center;
}

.extra-scores {
  grid-column: 1 / -1;
  display: none;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  color: #d7def8;
  font-size: 14px;
}

.scorebox.expanded .extra-scores {
  display: block;
}

.empty-message {
  margin-top: 28px;
  color: rgba(255, 255, 255, 0.7);
  font-family: Impact, Haettenschweiler, "Arial Black", sans-serif;
  font-size: 25px;
  text-align: center;
  text-shadow: 0 2px 0 #000;
}

.post-score {
  position: absolute;
  z-index: 3;
  right: 9px;
  bottom: 17px;
  left: 9px;
  min-height: 42px;
  border: 1px solid #81d68f;
  border-radius: 6px;
  background: #19662c;
  color: #fff;
  font-weight: 700;
  text-align: center;
}

.game.readonly .post-score {
  opacity: 0.75;
}

.highlight {
  outline: 3px solid var(--focus);
  outline-offset: -3px;
}

.clock-wrap {
  position: absolute;
  right: 24px;
  bottom: 16px;
  color: rgba(255, 255, 255, 0.72);
  font-family: "Arial Black", Verdana, sans-serif;
  font-size: 22px;
  text-shadow: 0 2px 0 #000;
}

.brand-mark {
  position: absolute;
  left: 22px;
  bottom: 17px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 14px;
  font-weight: 700;
}

dialog {
  border: 0;
  padding: 0;
  color: #fff;
  background: transparent;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
}

.score-dialog form,
.news-dialog form {
  position: relative;
  width: min(92vw, 420px);
  padding: 30px 24px 26px;
  border: 1px solid var(--gold);
  border-radius: 8px;
  background: #020202;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.72);
  font-family: Verdana, Geneva, Arial, sans-serif;
}

.score-dialog h2,
.news-dialog h2 {
  margin: 0 36px 24px 0;
  font-family: Impact, Haettenschweiler, "Arial Black", sans-serif;
  font-size: 34px;
  line-height: 1;
  letter-spacing: 0;
}

.score-dialog label {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
  font-size: 20px;
  font-weight: 700;
}

.score-dialog input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #a7a7a7;
  border-radius: 4px;
  background: #111;
  color: #fff;
  font-size: 26px;
  font-weight: 900;
  text-align: center;
}

.post-button {
  width: 100%;
  min-height: 46px;
  border: 1px solid #9ae99b;
  border-radius: 6px;
  background: #19803a;
  color: #fff;
  font-size: 20px;
  font-weight: 900;
}

.dialog-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: 1px solid #ff9797;
  border-radius: 5px;
  background: #8f1515;
  color: #fff;
  font-weight: 900;
}

@media (max-width: 820px) {
  body {
    overflow: auto;
  }

  .room-shell {
    height: 100svh;
    min-height: 620px;
  }

  .room-title {
    left: 14px;
    right: 14px;
    max-width: none;
  }

  .room-title h1 {
    font-size: 36px;
  }

  .top-tools {
    top: 74px;
    right: 12px;
    gap: 8px;
  }

  .icon-button {
    width: 48px;
    height: 44px;
  }

  .icon-button svg {
    width: 25px;
    height: 25px;
  }

  .score-wall {
    inset: 132px 0 0 0;
    padding-left: 12px;
  }

  .game {
    flex-basis: 250px;
    min-width: 250px;
    max-width: 250px;
    height: calc(100svh - 132px);
  }

  .game.leaders {
    margin-left: 0;
  }

  .game.last {
    margin-right: 12px;
  }

  .tool-popover,
  .nav-menu,
  #searchPopover,
  #tagsPopover {
    right: 0;
    top: 52px;
    width: min(300px, calc(100vw - 24px));
  }
}

@media (max-width: 430px) {
  .room-title h1 {
    font-size: 31px;
  }

  .top-tools {
    top: 68px;
  }

  .clock-wrap,
  .brand-mark {
    display: none;
  }
}
