:root {
  --bg-0: #05070b;
  --bg-1: #0e1320;
  --bg-2: #161f33;
  --panel: rgba(10, 15, 24, 0.88);
  --panel-border: rgba(115, 161, 255, 0.18);
  --panel-glow: rgba(72, 164, 255, 0.14);
  --text: #eef5ff;
  --muted: #92a7c7;
  --accent: #79f0ff;
  --accent-strong: #29c7ff;
  --success: #9eff8a;
  --warning: #ffd778;
  --danger: #ff7d98;
  --locked: rgba(255, 255, 255, 0.08);
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  --radius: 20px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  color: var(--text);
  font-family: "Rajdhani", sans-serif;
  background:
    radial-gradient(circle at 12% 12%, rgba(41, 199, 255, 0.18), transparent 22%),
    radial-gradient(circle at 84% 18%, rgba(255, 125, 152, 0.14), transparent 20%),
    radial-gradient(circle at 62% 82%, rgba(121, 240, 255, 0.12), transparent 18%),
    linear-gradient(135deg, #030406 0%, #0a0f17 40%, #0e1727 100%);
}

button,
input {
  font: inherit;
}

.viewport-shell {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.viewport-scale {
  width: 1920px;
  height: var(--app-height, 940px);
  transform-origin: top left;
}

.aps-app {
  width: 1920px;
  height: var(--app-height, 940px);
  padding: 14px;
  display: grid;
  grid-template-rows: 78px 1fr;
  gap: 14px;
  position: relative;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(255, 255, 255, 0.02);
  border-radius: var(--radius);
  min-height: 0;
}

.eyebrow,
.panel-kicker,
.metric-label,
.subtitle,
.small-label {
  margin: 0;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow,
.panel-kicker,
.metric-label {
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.subtitle,
.small-label {
  color: var(--muted);
  font-size: 14px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 0.95fr) auto 260px;
  align-items: stretch;
  gap: 12px;
  padding: 10px 14px;
}

.topbar h1,
.panel h2,
.section-title {
  margin: 0;
  font-family: "Bebas Neue", sans-serif;
  font-weight: 400;
  letter-spacing: 0.04em;
}

.topbar h1 {
  font-size: 34px;
  line-height: 0.9;
}

.topbar-title-block {
  display: grid;
  gap: 1px;
  align-content: center;
  min-height: 0;
}

.topbar-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-self: stretch;
}

.metric-card {
  min-height: 0;
  padding: 7px 12px 8px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  display: grid;
  gap: 2px;
  align-content: center;
}

.metric-card strong {
  font-size: 22px;
  line-height: 0.95;
}

.timer-card strong {
  font-variant-numeric: tabular-nums;
}

.topbar-actions,
.quick-actions,
.search-actions,
.session-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.topbar-actions {
  justify-content: flex-end;
  align-self: stretch;
  flex-wrap: nowrap;
}

.topbar-actions .btn {
  min-height: 46px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.btn {
  border: 0;
  border-radius: 999px;
  padding: 11px 18px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease, background 0.16s ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(120deg, var(--accent), var(--accent-strong));
  color: #03131b;
  box-shadow: 0 8px 20px rgba(41, 199, 255, 0.22);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-danger {
  background: rgba(255, 125, 152, 0.16);
  color: #ffd8e2;
  border: 1px solid rgba(255, 125, 152, 0.2);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.dashboard {
  min-height: 0;
  display: grid;
  grid-template-columns: 300px 960px 606px;
  gap: 14px;
}

.sidebar {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto auto;
  gap: 14px;
  align-content: start;
}

.session-card,
.summary-card,
.table-card,
.search-panel,
.selection-card,
.perks-panel,
.killer-stage {
  padding: 14px;
}

.session-card {
  display: grid;
  gap: 12px;
}

.topbar-session-card {
  height: 100%;
  min-height: 0;
  padding: 9px 10px 8px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 2px;
  align-content: stretch;
}

.topbar-session-main {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 8px;
  align-items: center;
  min-height: 0;
  min-width: 0;
  height: 100%;
  align-content: center;
}

.topbar-session-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
  align-content: center;
  padding-top: 1px;
}

.topbar-session-card .avatar {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  align-self: center;
}

.topbar-session-name {
  font-size: 14px;
  font-weight: 700;
  line-height: 0.95;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-session-footer,
.topbar-session-links {
  display: flex;
  align-items: center;
  gap: 6px;
}

.topbar-session-footer {
  justify-content: flex-end;
  min-height: 14px;
}

.topbar-session-links {
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: nowrap;
  min-width: 0;
}

.topbar-session-link {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
  text-transform: uppercase;
  cursor: pointer;
}

.topbar-session-link:hover {
  color: var(--text);
}

.session-main {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 12px;
  align-items: center;
}

.avatar {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.05);
}

.session-name {
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.panel-head h2 {
  font-size: 24px;
}

.panel-head-stats {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.mini-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.mini-pill-success {
  color: #d9ffd2;
  background: rgba(158, 255, 138, 0.1);
  border-color: rgba(158, 255, 138, 0.18);
}

.mini-pill-danger {
  color: #ffd5df;
  background: rgba(255, 125, 152, 0.12);
  border-color: rgba(255, 125, 152, 0.18);
}

.mini-pill-warning {
  color: #fff2ce;
  background: rgba(255, 215, 120, 0.12);
  border-color: rgba(255, 215, 120, 0.2);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 6px;
}

.summary-stat {
  padding: 6px 8px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.summary-stat strong {
  display: block;
  font-size: 17px;
  line-height: 1;
}

.summary-card {
  padding: 11px 14px 12px;
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.summary-card .panel-head {
  margin-bottom: 8px;
}

.summary-card .panel-head h2 {
  font-size: 20px;
}

.summary-card .small-label {
  font-size: 10px;
}

.warnings {
  display: grid;
  gap: 5px;
  margin: 4px 0 6px;
}

.warning-row {
  border-radius: 12px;
  padding: 7px 9px;
  font-size: 11px;
  line-height: 1.2;
}

.warning-row.is-warning {
  background: rgba(255, 215, 120, 0.12);
  border: 1px solid rgba(255, 215, 120, 0.18);
  color: #ffeab1;
}

.warning-row.is-danger {
  background: rgba(255, 125, 152, 0.12);
  border: 1px solid rgba(255, 125, 152, 0.18);
  color: #ffd1dc;
}

.legend {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 10px 0 14px;
}

.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
}

.legend-dot.available {
  background: rgba(121, 240, 255, 0.55);
}

.legend-dot.assigned {
  background: rgba(255, 215, 120, 0.8);
}

.legend-dot.completed {
  background: rgba(158, 255, 138, 0.8);
}

.legend-dot.locked {
  background: rgba(255, 255, 255, 0.14);
}

.table-card {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
  min-height: 0;
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

#leaderboardCard {
  min-height: 152px;
}

#recentCard {
  min-height: 0;
  max-height: 296px;
}

.table-list {
  display: grid;
  grid-auto-rows: max-content;
  gap: 6px;
  align-content: start;
  align-items: start;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(121, 240, 255, 0.44) rgba(255, 255, 255, 0.04);
}

.table-list::-webkit-scrollbar {
  width: 8px;
}

.table-list::-webkit-scrollbar-track {
  background: rgba(8, 14, 24, 0.7);
  border: 1px solid rgba(121, 240, 255, 0.08);
  border-radius: 999px;
}

.table-list::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(121, 240, 255, 0.5), rgba(121, 240, 255, 0.2));
  border: 1px solid rgba(121, 240, 255, 0.24);
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.table-list::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(121, 240, 255, 0.62), rgba(121, 240, 255, 0.28));
}

#leaderboardCard .table-list {
  max-height: 118px;
}

#recentCard .table-list {
  max-height: 228px;
}

#leaderboardCard .empty-state {
  min-height: 82px;
  padding: 14px;
}

#recentCard .empty-state {
  min-height: 96px;
  padding: 16px;
}

.summary-card .quick-actions {
  gap: 8px;
  margin-top: 6px;
}

.summary-card .btn {
  padding: 8px 12px;
  font-size: 11px;
}

.table-row {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  gap: 8px;
  align-items: center;
  min-height: 38px;
  padding: 7px 9px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

#recentCard .table-row {
  min-height: 34px;
  padding: 6px 8px;
}

#recentCard .table-name {
  font-size: 14px;
}

#recentCard .table-meta {
  font-size: 11px;
}

#recentCard .table-time {
  font-size: 15px;
}

.table-rank {
  font-family: "Bebas Neue", sans-serif;
  font-size: 20px;
  color: var(--accent);
}

.table-main {
  min-width: 0;
}

.table-name {
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
}

.table-meta {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
}

.table-side {
  display: grid;
  justify-items: end;
  gap: 4px;
}

.table-time {
  font-variant-numeric: tabular-nums;
  font-size: 16px;
  font-weight: 700;
}

.killer-stage {
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  padding: 9px 10px 8px;
}

.killer-stage .panel-head {
  margin-bottom: 6px;
}

.killer-grid {
  min-height: 0;
  display: grid;
  grid-template-rows: repeat(8, minmax(0, 1fr));
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 5px;
  align-content: stretch;
  align-items: stretch;
}

.killer-card {
  min-height: 0;
  height: 100%;
  border-radius: 16px;
  padding: 6px 6px 7px;
  background: linear-gradient(180deg, rgba(19, 28, 45, 0.96), rgba(11, 17, 27, 0.96));
  border: 1px solid rgba(255, 255, 255, 0.06);
  display: grid;
  grid-template-rows: auto auto;
  gap: 4px;
  align-content: start;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.killer-card.is-completed {
  border-color: rgba(158, 255, 138, 0.28);
  background: radial-gradient(circle at top left, rgba(158, 255, 138, 0.14), transparent 54%), linear-gradient(180deg, rgba(27, 59, 42, 0.98), rgba(11, 28, 20, 0.98));
  box-shadow: inset 0 0 0 1px rgba(158, 255, 138, 0.12), 0 0 0 1px rgba(59, 116, 75, 0.12);
}

.killer-card.is-completed .killer-name {
  color: #f3fff0;
}

.killer-card.is-highlighted {
  border-color: rgba(121, 240, 255, 0.4);
  box-shadow: 0 0 0 1px rgba(121, 240, 255, 0.18);
}

.killer-head {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  min-height: 30px;
}

.killer-head > div {
  min-width: 0;
  display: grid;
  align-content: center;
}

.killer-head img {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  object-fit: contain;
  padding: 1px;
  background: rgba(255, 255, 255, 0.05);
}

.killer-name {
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.killer-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 3px;
}

.killer-slots {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 3px;
  align-self: start;
}

.slot {
  aspect-ratio: 1;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
  transition: border-color 0.16s ease, transform 0.16s ease, background 0.16s ease;
}

.slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 7px;
}

.slot:hover {
  transform: translateY(-1px);
}

.slot.is-filled {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

.slot.is-completed {
  border-color: rgba(158, 255, 138, 0.3);
  background: rgba(158, 255, 138, 0.14);
}

.slot.is-selected-target {
  border-color: rgba(121, 240, 255, 0.44);
  background: rgba(121, 240, 255, 0.12);
}

.slot.is-locked {
  background: var(--locked);
  border-style: dashed;
  cursor: not-allowed;
}

.slot-empty-mark {
  color: rgba(255, 255, 255, 0.22);
  font-size: 16px;
  font-weight: 700;
}

.slot-locked-mark {
  color: rgba(255, 255, 255, 0.18);
  font-size: 12px;
  font-weight: 700;
}

.perk-stage {
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 236px) 64px minmax(0, 1fr);
  gap: 14px;
}

.search-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 64px;
  padding: 10px 14px;
}

.search-wrap {
  min-height: 100%;
  display: flex;
  align-items: center;
}

.search-wrap input {
  width: 100%;
  min-height: 40px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  padding: 0 14px;
}

.perks-panel {
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}

.perk-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(13, minmax(0, 1fr));
  gap: 6px;
  align-content: start;
}

.perk-tile {
  aspect-ratio: 1;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  display: grid;
  place-items: center;
  padding: 1px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.perk-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
}

.perk-tile:hover {
  transform: translateY(-1px);
}

.perk-tile.is-assigned {
  border-color: rgba(168, 178, 194, 0.26);
  background: rgba(121, 130, 145, 0.12);
  box-shadow: inset 0 0 0 1px rgba(168, 178, 194, 0.1);
}

.perk-tile.is-assigned:not(.is-completed) img {
  filter: grayscale(1) saturate(0.18) brightness(0.86);
}

.perk-tile.is-completed {
  border-color: rgba(158, 255, 138, 0.34);
  box-shadow: inset 0 0 0 1px rgba(158, 255, 138, 0.16);
}

.perk-tile.is-selected {
  border-color: rgba(121, 240, 255, 0.5);
  box-shadow: 0 0 0 2px rgba(121, 240, 255, 0.2);
}

.perk-tile.is-busy {
  opacity: 0.5;
}

.perk-ribbon {
  position: absolute;
  inset: auto 0 0 0;
  height: 4px;
}

.perk-ribbon.available {
  background: rgba(121, 240, 255, 0.55);
}

.perk-ribbon.assigned {
  background: rgba(166, 176, 194, 0.88);
}

.perk-ribbon.completed {
  background: rgba(158, 255, 138, 0.9);
}

.selection-card {
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 8px;
  min-height: 0;
}

.selection-card h2 {
  font-size: 24px;
}

.selection-preview {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 12px;
  align-items: center;
  min-height: 74px;
  padding: 8px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
  overflow: visible;
}

.selection-preview img {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  object-fit: contain;
  padding: 1px;
  align-self: center;
}

.selection-preview-killer {
  grid-template-columns: 60px minmax(0, 1fr) auto;
  align-items: center;
}

.selection-preview-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
  align-content: center;
  align-self: center;
}

.selection-preview-copy .session-name {
  font-size: 22px;
  line-height: 1;
}

.selection-preview-side {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  align-self: center;
  min-width: 0;
}

.selection-killer-panel {
  display: grid;
  gap: 7px;
  padding-top: 0;
  align-content: start;
}

.selection-loadout {
  display: grid;
  grid-template-columns: repeat(4, 58px);
  gap: 8px;
}

.selection-loadout-copy {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
  min-height: 16px;
  padding-bottom: 2px;
}

.selection-loadout-copy strong {
  color: var(--text);
}

.selection-loadout-slot {
  aspect-ratio: 1;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.selection-loadout-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.selection-loadout-slot.is-filled {
  border-color: rgba(255, 215, 120, 0.26);
  background: rgba(255, 215, 120, 0.12);
}

.selection-loadout-slot.is-completed {
  border-color: rgba(158, 255, 138, 0.3);
  background: rgba(158, 255, 138, 0.14);
}

.selection-loadout-slot.is-locked {
  background: var(--locked);
  border-style: dashed;
}

.selection-match-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 136px));
  gap: 8px;
}

.selection-match-actions-compact {
  grid-template-columns: repeat(2, minmax(0, 92px));
  align-items: center;
}

.selection-match-actions-compact .btn {
  min-height: 34px;
  padding: 0 10px;
  font-size: 12px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.selection-help {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}

.selection-help strong {
  color: var(--text);
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 120px;
  color: var(--muted);
  border-radius: 16px;
  border: 1px dashed rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.02);
  text-align: center;
  padding: 20px;
}

.notice-card {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(121, 240, 255, 0.08);
  border: 1px solid rgba(121, 240, 255, 0.14);
  color: #dbfbff;
  font-size: 14px;
  line-height: 1.2;
}

.notice-card.is-danger {
  background: rgba(255, 125, 152, 0.12);
  border-color: rgba(255, 125, 152, 0.18);
  color: #ffd7e0;
}

.notice-card.is-warning {
  background: rgba(255, 215, 120, 0.12);
  border-color: rgba(255, 215, 120, 0.2);
  color: #ffefc7;
}

.mono {
  font-variant-numeric: tabular-nums;
}
