:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1d2129;
  --line: #2a2f39;
  --text: #e9ecf1;
  --muted: #9aa3b2;
  --accent: #e8483f;
  --accent-2: #ff6b5e;
  --ok: #3ccf7a;
  --warn: #f0b429;
  --bad: #ef5350;
  --steam: #1b2838;
  --steam-2: #2a475e;
  --radius: 10px;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
}

body {
  min-height: 100vh;
}

h1,
h2 {
  margin: 0;
  font-weight: 650;
}

h1 {
  font-size: 1.6rem;
}

h2 {
  font-size: .95rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: .75rem;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: .85rem;
}

.boot {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.boot-spinner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  animation: spin .9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 8px;
  padding: .55rem 1rem;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  transition: background .15s, border-color .15s, opacity .15s;
}

.btn:hover:not(:disabled) {
  border-color: #3a4150;
  background: #232833;
}

.btn:disabled {
  opacity: .5;
  cursor: default;
}

.btn:focus-visible,
.region:focus-visible,
.user:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-2);
  border-color: var(--accent-2);
}

.btn-steam {
  background: linear-gradient(180deg, var(--steam-2), var(--steam));
  border-color: #3d6c8d;
}

.btn-ghost {
  background: transparent;
}

.btn-small {
  padding: .3rem .7rem;
  font-size: .85rem;
}

.btn-big {
  padding: .85rem 1.6rem;
  font-size: 1.05rem;
}

.lang {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .35rem .5rem;
  font: inherit;
  font-size: .85rem;
}

.landing,
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.landing-card,
.login-card {
  max-width: 32rem;
  text-align: center;
  display: grid;
  gap: 1rem;
  justify-items: center;
}

.landing-card p,
.login-card p {
  margin: 0;
  color: var(--muted);
}

.landing-logo {
  width: 72px;
  height: 72px;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: #12151b;
}

.brand {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-weight: 650;
}

.brand img {
  width: 26px;
  height: 26px;
}

.spacer {
  flex: 1;
}

.update {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .85rem;
  color: var(--warn);
}

.user {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: transparent;
  border: 0;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  padding: .25rem .5rem;
  border-radius: 8px;
}

.user:hover {
  background: var(--panel-2);
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  object-fit: cover;
  flex: none;
}

.avatar-empty {
  display: inline-block;
  background: var(--line);
}

.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 220px minmax(0, 1.6fr) minmax(260px, 1fr);
  gap: 1.25rem;
  padding: 1.25rem;
  align-items: start;
}

.col-main,
.col-side {
  display: grid;
  gap: 1.25rem;
}

.col-catalog {
  position: sticky;
  top: 1.25rem;
}

.catalog ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .4rem;
}

.catalog-search {
  width: 100%;
  margin-bottom: .6rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  font-size: .9rem;
  padding: .45rem .65rem;
}

.catalog-search:focus {
  outline: none;
  border-color: var(--accent);
}

.catalog-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .4rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.catalog-item:hover:not(:disabled) {
  background: var(--panel);
  border-color: var(--line);
}

.catalog-item.active {
  background: var(--panel-2);
  border-color: var(--accent);
}

.catalog-item:disabled {
  opacity: .45;
  cursor: default;
}

.catalog-item:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

.catalog-thumb {
  width: 64px;
  height: 36px;
  border-radius: 5px;
  object-fit: cover;
  flex: none;
  background: var(--line);
}

.catalog-text {
  display: grid;
  min-width: 0;
}

.catalog-name {
  font-weight: 600;
  font-size: .92rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.catalog-meta {
  font-size: .78rem;
  color: var(--muted);
}

.catalog-meta.soon {
  color: var(--warn);
}

.hero-info {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

.hero-text {
  min-width: 0;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .4rem;
}

.btn-glass {
  background: rgba(15, 17, 21, .55);
  border-color: rgba(255, 255, 255, .18);
}

.btn-glass:hover:not(:disabled) {
  background: rgba(15, 17, 21, .8);
}

.description {
  white-space: pre-wrap;
  color: var(--muted);
}

.landing-games {
  width: 100%;
  margin-top: 1rem;
}

.landing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: .75rem;
  width: min(44rem, 90vw);
}

.landing-game {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  text-align: left;
}

.landing-game img,
.landing-game-empty {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--line);
}

.landing-game-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .5rem .6rem;
  font-size: .9rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
}

.hero {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--panel);
  aspect-ratio: 16 / 7;
}

.hero-cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-empty {
  background: linear-gradient(135deg, #1d2129, #2a1a1d);
}

.hero-info {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 1.25rem 1.25rem 1rem;
  background: linear-gradient(180deg, transparent, rgba(10, 12, 16, .92));
}

.hero-info p {
  margin: .25rem 0 0;
}

.checks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .55rem;
}

.check {
  display: grid;
  grid-template-columns: 12px 90px 1fr auto;
  align-items: center;
  gap: .65rem;
}

.check .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--warn);
}

.check.ok .dot {
  background: var(--ok);
}

.check.bad .dot {
  background: var(--bad);
}

.check-label {
  font-weight: 600;
}

.check-hint {
  padding-left: calc(12px + .65rem);
}

.play {
  display: grid;
  gap: .5rem;
  justify-items: stretch;
}

.btn-play {
  background: var(--accent);
  border-color: var(--accent);
  font-size: 1.25rem;
  font-weight: 700;
  padding: 1rem;
  letter-spacing: .03em;
}

.btn-play:hover:not(:disabled) {
  background: var(--accent-2);
  border-color: var(--accent-2);
}

.btn-play.btn-cancel {
  background: var(--panel-2);
  border-color: var(--line);
}

.play-status {
  margin: 0;
  text-align: center;
  color: var(--muted);
}

.play-status.ok {
  color: var(--ok);
}

.play-status.error {
  color: var(--bad);
}

.regions {
  display: grid;
  gap: .45rem;
}

.region {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  padding: .55rem .8rem;
  cursor: pointer;
  text-align: left;
}

.region.active {
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.region:disabled {
  opacity: .6;
  cursor: default;
}

.region-meta {
  color: var(--muted);
  font-size: .85rem;
}

.party-actions {
  display: grid;
  gap: .6rem;
}

.join {
  display: flex;
  gap: .5rem;
}

.code-input {
  flex: 1;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  padding: .5rem .7rem;
  text-transform: uppercase;
  letter-spacing: .15em;
}

.code-input:focus {
  outline: none;
  border-color: var(--accent);
}

.party-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  margin-bottom: .75rem;
}

.party-head h2 {
  margin: 0;
}

.party-code {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.party-code strong {
  letter-spacing: .15em;
  font-size: 1.05rem;
}

.members {
  list-style: none;
  margin: 0 0 .75rem;
  padding: 0;
  display: grid;
  gap: .45rem;
}

.member {
  display: flex;
  align-items: center;
  gap: .55rem;
}

.member-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag {
  font-size: .75rem;
  padding: .1rem .45rem;
  border-radius: 999px;
  background: var(--line);
  color: var(--muted);
  white-space: nowrap;
}

.tag-ok {
  background: rgba(60, 207, 122, .15);
  color: var(--ok);
}

.tag-warn {
  background: rgba(240, 180, 41, .15);
  color: var(--warn);
}

.tag-off {
  background: rgba(154, 163, 178, .12);
}

.party-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%);
  max-width: min(90vw, 36rem);
  background: #232833;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .65rem 1rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
  z-index: 20;
}

.toast-error {
  border-color: rgba(239, 83, 80, .6);
}

.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(5, 6, 9, .6);
  display: grid;
  place-items: center;
  z-index: 10;
  padding: 16px;
}

.modal {
  width: min(32rem, 100%);
  max-height: 80vh;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem;
}

.devices {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .6rem;
}

.devices li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  padding: .6rem .7rem;
  background: var(--panel-2);
  border-radius: 8px;
}

.devices .tag {
  margin-left: .5rem;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 1rem;
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr);
  }

  .col-catalog {
    grid-column: 1 / -1;
    position: static;
  }

  .catalog ul {
    grid-auto-flow: column;
    grid-auto-columns: minmax(180px, 220px);
    overflow-x: auto;
    padding-bottom: .25rem;
  }
}

@media (max-width: 860px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .check {
    grid-template-columns: 12px 70px 1fr;
  }

  .check .btn {
    grid-column: 2 / -1;
    justify-self: start;
  }
}

.check-progress progress {
  width: 100%;
  height: 6px;
  appearance: none;
  border: 0;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.check-progress progress::-webkit-progress-bar {
  background: var(--line);
}

.check-progress progress::-webkit-progress-value {
  background: var(--accent);
  border-radius: 999px;
}

.gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(6, 7, 10, .82);
  backdrop-filter: blur(6px);
}

.gate-card {
  width: min(30rem, 100%);
  display: grid;
  gap: .9rem;
  justify-items: center;
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.75rem 1.5rem;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .55);
}

.gate-card h2 {
  margin: 0;
  font-size: 1.35rem;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
}

.gate-card p {
  margin: 0;
  color: var(--muted);
}

.gate-logo {
  width: 56px;
  height: 56px;
}

.gate-notes {
  width: 100%;
  white-space: pre-wrap;
  background: var(--panel-2);
  border-radius: 8px;
  padding: .6rem .8rem;
  font-size: .9rem;
}

.gate-progress {
  width: 100%;
  display: grid;
  gap: .5rem;
}

.gate-progress progress {
  width: 100%;
  height: 8px;
  appearance: none;
  border: 0;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.gate-progress progress::-webkit-progress-bar {
  background: var(--line);
}

.gate-progress progress::-webkit-progress-value {
  background: var(--accent);
  border-radius: 999px;
}

.gate-error {
  display: grid;
  gap: .5rem;
  justify-items: center;
}

.gate-error p {
  color: var(--bad);
}

.friends {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .45rem;
  max-height: 320px;
  overflow-y: auto;
}

.friend {
  display: flex;
  align-items: center;
  gap: .55rem;
}

.friend-text {
  flex: 1;
  min-width: 0;
  display: grid;
}

.friend-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.friend-status {
  font-size: .78rem;
  color: var(--muted);
}

.friend-online .friend-status,
.friend-in_party .friend-status {
  color: var(--ok);
}

.friend-searching .friend-status,
.friend-in_game .friend-status {
  color: #5aa9ff;
}

.friend-offline {
  opacity: .55;
}

.friends-empty {
  display: grid;
  gap: .5rem;
  justify-items: start;
}

.friends-empty p {
  margin: 0;
}

.invites {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 30;
  display: grid;
  gap: .6rem;
  width: min(24rem, calc(100vw - 2.5rem));
}

.invite {
  display: flex;
  align-items: center;
  gap: .7rem;
  background: var(--panel-2);
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: .7rem .8rem;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .5);
}

.invite-text {
  flex: 1;
  min-width: 0;
  display: grid;
}

.invite-actions {
  display: grid;
  gap: .35rem;
}

.modal-small {
  width: min(26rem, 100%);
}

.modal-text {
  color: var(--muted);
  margin: 0;
}

.modal-foot {
  gap: .5rem;
}

.notice {
  margin: 1rem 1.25rem 0;
  padding: .7rem 1rem;
  border-radius: 8px;
  border: 1px solid rgba(240, 180, 41, .45);
  background: rgba(240, 180, 41, .1);
  color: #f3d58a;
  font-size: .92rem;
}

.login-alt {
  display: grid;
  gap: .35rem;
  justify-items: center;
}

.catalog-tabs {
  display: flex;
  gap: .25rem;
  margin-bottom: .75rem;
  border-bottom: 1px solid var(--line);
}

.catalog-tab {
  flex: 1;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font: inherit;
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: .45rem .25rem;
  cursor: pointer;
}

.catalog-tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.catalog-group {
  margin: .75rem 0 .4rem;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  font-weight: 600;
}

.catalog-row {
  position: relative;
}

.catalog-row .catalog-item {
  padding-right: 2rem;
}

.catalog-fav {
  position: absolute;
  top: 50%;
  right: .35rem;
  transform: translateY(-50%);
  width: 1.6rem;
  height: 1.6rem;
  display: grid;
  place-items: center;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
  opacity: .55;
}

.catalog-row:hover .catalog-fav,
.catalog-fav.on,
.catalog-fav:focus-visible {
  opacity: 1;
}

.catalog-fav.on {
  color: var(--warn);
}

.catalog-fav:hover {
  background: var(--panel-2);
}
