:root {
  --bg: #1f3134;
  --panel: #2e3e45;
  --panel-alt: #40565c;
  --panel-soft: #40565c;
  --panel-muted: #40565c;
  --text: #edf6f3;
  --muted: #b2c5c4;
  --accent: #f3c126;
  --success: #57ddb0;
  --warning: #f3c126;
  --danger: #eb736e;
  --info: #8cbfd3;
  --shadow: 0 18px 40px rgba(12, 24, 27, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  height: 100%;
  color: var(--text);
  font-family: "Segoe UI", "Trebuchet MS", sans-serif;
  background: var(--bg);
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(rgba(255, 255, 255, 0.01), rgba(255, 255, 255, 0.01)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220' viewBox='0 0 220 220'%3E%3Cg fill='none' stroke='rgba(255,255,255,0.02)' stroke-width='1'%3E%3Cpath d='M0 70 L80 0'/%3E%3Cpath d='M30 220 L220 30'/%3E%3Cpath d='M120 220 L220 120'/%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.28;
  pointer-events: none;
}

a {
  color: inherit;
  text-decoration: none;
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
  height: calc(100vh - 32px);
  padding: 16px 0;
}

.page {
  display: grid;
  gap: 14px;
  height: 100%;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
}

.session-logout {
  position: fixed;
  top: 20px;
  right: 24px;
  z-index: 50;
}

.session-logout__button {
  border: 0;
  border-radius: 6px;
  background: rgba(64, 86, 92, 0.96);
  color: rgba(255, 255, 255, 0.86);
  padding: 10px 14px;
  font: inherit;
  cursor: pointer;
}

.session-logout__button:hover {
  background: rgba(64, 86, 92, 1);
}

.pin-login-shell {
  min-height: 100%;
  display: grid;
  place-items: center;
}

.pin-login-card {
  width: min(420px, 100%);
  background: var(--panel);
  border-radius: 24px;
  padding: 32px;
  box-shadow: 0 24px 60px rgba(10, 18, 20, 0.18);
}

.pin-login-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}

.pin-login-brand__logo {
  width: 52px;
  height: 52px;
  object-fit: contain;
  flex-shrink: 0;
}

.pin-login-brand__eyebrow {
  margin: 0 0 4px;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(204, 218, 220, 0.62);
}

.pin-login-brand h1 {
  margin: 0;
  font-size: 1.9rem;
}

.pin-login-copy {
  margin-bottom: 24px;
}

.pin-login-copy h2 {
  margin: 0 0 8px;
  font-size: 1.3rem;
}

.pin-login-copy p {
  margin: 0;
  color: rgba(226, 236, 238, 0.72);
}

.pin-login-form {
  display: grid;
  gap: 14px;
}

.pin-login-input {
  width: 100%;
  border: 0;
  border-radius: 12px;
  background: var(--panel-alt);
  color: #f5f8f8;
  padding: 16px 18px;
  font-size: 1.4rem;
  letter-spacing: 0.28em;
  text-align: center;
}

.pin-login-input::placeholder {
  color: rgba(245, 248, 248, 0.34);
  letter-spacing: 0.18em;
}

.pin-login-error {
  margin: 0;
  color: #f4a3a3;
  font-size: 0.92rem;
}

.pin-login-button {
  width: 100%;
  justify-content: center;
}

.dashboard-intro,
.flash,
.rail,
.server-header,
.terminal-panel,
.server-detail-empty {
  background: var(--panel);
  border-radius: 22px;
  box-shadow: none;
}

.dashboard-intro {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 22px 28px;
  background: var(--panel);
}

.dashboard-intro h1 {
  margin: 0;
  font-size: clamp(1.35rem, 3vw, 1.8rem);
  line-height: 1;
}

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

.server-pill--access {
  margin-left: 6px;
}

.dashboard-brand__logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
  flex-shrink: 0;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #c6d5d2;
}

.dashboard-stats {
  display: flex;
  gap: 0;
  align-items: stretch;
}

.stat-chip {
  width: 168px;
  min-width: 168px;
  padding: 10px 30px;
  background: transparent;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  text-align: center;
}

.stat-chip + .stat-chip::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 1px;
  height: 64%;
  transform: translateY(-50%);
  background: rgba(205, 224, 220, 0.16);
}

.stat-chip span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.stat-chip strong {
  font-size: 1.5rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.stat-chip:last-child strong {
  color: #69bfe7;
}

.flash {
  padding: 12px 16px;
}

.flash--success {
  background: rgba(67, 214, 150, 0.16);
}

.flash--error {
  background: rgba(255, 106, 111, 0.16);
}

.control-surface {
  display: grid;
  grid-template-columns: minmax(360px, 392px) minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
  min-height: 0;
  height: 100%;
}

.rail {
  width: 100%;
  min-width: 0;
  padding: 14px;
  position: sticky;
  top: 16px;
  background: var(--panel);
  overflow: hidden;
  min-height: 100%;
  align-self: stretch;
}

.main-stage {
  min-width: 0;
  display: grid;
  gap: 14px;
  align-content: stretch;
  min-height: 100%;
  overflow: hidden;
}

.server-list {
  display: grid;
  gap: 10px;
}

.server-list__item {
  display: block;
  position: relative;
  width: 100%;
  max-width: 100%;
  padding: 16px 18px;
  min-height: 108px;
  border-radius: 14px;
  background: #35474e;
  box-shadow:
    inset 0 0 0 1px rgba(232, 243, 240, 0.08),
    0 6px 12px rgba(12, 24, 27, 0.12);
  transition: transform 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

.server-list__item:hover {
  transform: translateY(-1px);
  background: #40565c;
  box-shadow:
    inset 0 0 0 1px rgba(232, 243, 240, 0.1),
    0 8px 14px rgba(12, 24, 27, 0.14);
}

.server-list__item--selected {
  background: #40565c;
  box-shadow:
    inset 0 0 0 1px rgba(232, 243, 240, 0.12),
    0 8px 16px rgba(12, 24, 27, 0.16);
}

.server-list__item--selected::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -6px;
  width: 6px;
  height: 38%;
  transform: translateY(-50%);
  border-radius: 0 999px 999px 0;
  background: var(--accent);
  box-shadow:
    inset 1px 0 0 rgba(36, 28, 5, 0.28),
    0 0 10px rgba(243, 193, 38, 0.28);
}

.server-list__row,
.server-list__identity {
  display: flex;
  align-items: center;
}

.server-list__row {
  justify-content: space-between;
  gap: 14px;
  min-height: 100%;
}

.server-list__identity {
  gap: 14px;
  min-width: 0;
  min-height: 100%;
}

.server-list__text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.server-list__item[data-has-meta="false"] .server-list__row,
.server-list__item[data-has-meta="false"] .server-list__identity {
  min-height: 100%;
}

.server-list__item[data-has-meta="false"] .server-list__text {
  justify-content: center;
}

.server-list__game {
  margin: 0 0 3px;
  color: rgba(237, 246, 243, 0.52);
  font-size: 0.78rem;
  line-height: 1;
}

.game-icon {
  width: 48px;
  height: 48px;
  border-radius: 0;
  flex-shrink: 0;
  object-fit: cover;
  background: transparent;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #7d849f;
  box-shadow: 0 0 0 6px rgba(87, 221, 176, 0.08);
}

.status-dot--online {
  background: var(--success);
}

.status-dot--transition {
  background: var(--warning);
}

.status-dot--offline {
  background: #eb736e;
  box-shadow: 0 0 0 6px rgba(235, 115, 110, 0.08);
}

.server-list h3 {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.server-list__meta {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  min-height: 30px;
}

.server-pill {
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #e1ece8;
  background: rgba(255, 255, 255, 0.06);
  white-space: nowrap;
  line-height: 1;
  font-size: 0.78rem;
}

.server-pill > span {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.server-pill--status {
  background: rgba(255, 255, 255, 0.04);
}

.server-list__status {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-shrink: 0;
}

.server-list__count {
  min-width: 0;
  min-height: 26px;
  padding: 0 12px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #e1ece8;
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1;
}

.server-list__count::before {
  content: "";
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  opacity: 0.88;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M16 11c1.66 0 2.99-1.34 2.99-3S17.66 5 16 5s-3 1.34-3 3 1.34 3 3 3m-8 0c1.66 0 2.99-1.34 2.99-3S9.66 5 8 5 5 6.34 5 8s1.34 3 3 3m0 2c-2.33 0-7 1.17-7 3.5V19h14v-2.5C15 14.17 10.33 13 8 13m8 0c-.29 0-.62.02-.97.05 1.16.84 1.97 1.95 1.97 3.45V19h6v-2.5c0-2.33-4.67-3.5-7-3.5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M16 11c1.66 0 2.99-1.34 2.99-3S17.66 5 16 5s-3 1.34-3 3 1.34 3 3 3m-8 0c1.66 0 2.99-1.34 2.99-3S9.66 5 8 5 5 6.34 5 8s1.34 3 3 3m0 2c-2.33 0-7 1.17-7 3.5V19h14v-2.5C15 14.17 10.33 13 8 13m8 0c-.29 0-.62.02-.97.05 1.16.84 1.97 1.95 1.97 3.45V19h6v-2.5c0-2.33-4.67-3.5-7-3.5'/%3E%3C/svg%3E") center / contain no-repeat;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.panel-heading h3 {
  margin: 0;
  font-size: 1.05rem;
}

.panel-heading--terminal {
  justify-content: flex-start;
}

.inline-muted {
  margin-left: 8px;
  color: var(--muted);
  font-weight: 400;
}

.server-header,
.terminal-panel,
.server-detail-empty {
  padding: 16px 18px;
  background: var(--panel);
}

.server-shell {
  display: grid;
  gap: 0;
  background: var(--panel);
  border-radius: 22px;
  box-shadow: var(--shadow);
  overflow: hidden;
  min-height: 100%;
  align-self: stretch;
  grid-template-rows: auto minmax(0, 1fr);
}

.server-header__top,
.server-header__identity,
.server-header__actions,
.server-header__meta {
  display: flex;
  align-items: center;
}

.server-header {
  display: grid;
  gap: 24px;
  padding-bottom: 0;
  border-radius: 0;
  box-shadow: none;
}

.server-header__top {
  justify-content: space-between;
  gap: 20px;
  width: 100%;
}

.server-header__identity {
  gap: 16px;
  min-width: 0;
}

.server-header__identity h2 {
  margin: 0;
  font-size: 1.65rem;
  font-weight: 500;
  line-height: 1.1;
}

.server-header__meta {
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.server-header__meta .server-pill {
  min-height: 32px;
  padding: 0 14px;
}

.server-header__actions {
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}

.server-header__actions form {
  display: flex;
}

.server-tabs {
  display: flex;
  align-items: center;
  gap: 34px;
  padding-top: 2px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.server-tab {
  position: relative;
  padding: 0 0 14px;
  border: 0;
  background: transparent;
  color: rgba(237, 246, 243, 0.92);
  font: inherit;
  font-size: 1rem;
  cursor: pointer;
}

.server-tab::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 3px;
  border-radius: 999px 999px 0 0;
  background: transparent;
}

.server-tab--active::after {
  background: var(--accent);
}

.tab-panel--hidden {
  display: none !important;
}

.metric-pill {
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
}

.metric-pill--compact {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
}

.metric-pill--compact strong {
  font-size: 0.78rem;
  font-weight: 500;
}

.metric-pill span {
  color: var(--muted);
  font-size: 0.78rem;
}

.metric-pill strong {
  font-size: 0.98rem;
}

.status-pill {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  border: 1px solid transparent;
}

.status-pill--online {
  color: #eafcf3;
  background: rgba(87, 221, 176, 0.18);
}

.status-pill--transition {
  color: #fff4dd;
  background: rgba(243, 185, 93, 0.18);
}

.status-pill--offline {
  color: #e7ebff;
  background: rgba(255, 255, 255, 0.06);
}

.button {
  min-width: 112px;
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 6px;
  color: white;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 180ms ease, opacity 180ms ease, filter 180ms ease, width 180ms ease, min-width 180ms ease, padding 180ms ease, margin 180ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

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

.button--primary {
  background: var(--accent);
  color: #293638;
}

.button--danger {
  background: var(--danger);
}

.button--neutral {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.button--hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.game-icon--hero {
  width: 44px;
  height: 44px;
  border-radius: 12px;
}

.terminal-panel--full {
  width: 100%;
}

.terminal-panel--merged {
  border-radius: 0;
  box-shadow: none;
  padding-top: 18px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.terminal-screen {
  margin: 0;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: #edf1ff;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.84rem;
  line-height: 1.5;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.24) transparent;
}

.terminal-screen::-webkit-scrollbar {
  width: 10px;
}

.terminal-screen::-webkit-scrollbar-track {
  background: transparent;
}

.terminal-screen::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: padding-box;
}

.terminal-screen::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.28);
  border: 3px solid transparent;
  background-clip: padding-box;
}

.terminal-line {
  padding: 3px 16px;
  white-space: pre-wrap;
  word-break: break-word;
}

.terminal-line:first-child {
  padding-top: 14px;
}

.terminal-line:last-child {
  padding-bottom: 14px;
}

.terminal-line--info {
  color: #dbece8;
}

.terminal-line--system {
  color: #9fd0d8;
  background: transparent;
}

.terminal-line--warning {
  color: #ffe19a;
  background: rgba(243, 193, 38, 0.09);
}

.terminal-line--error {
  color: #ffb9b5;
  background: rgba(235, 115, 110, 0.12);
}

.terminal-line--success {
  color: #95edc8;
}

.terminal-command-form {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: auto;
  padding-top: 14px;
  position: sticky;
  bottom: 0;
  background: var(--panel);
}

.terminal-command-input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font: inherit;
}

.terminal-command-input::placeholder {
  color: var(--muted);
}

.terminal-command-input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.terminal-command-button {
  min-width: 96px;
}

.terminal-command-hint {
  margin: 10px 2px 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.player-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  align-content: flex-start;
}

.player-list__item,
.player-list__empty {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

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

.server-detail-empty {
  text-align: center;
}

@media (max-width: 980px) {
  .control-surface,
  .dashboard-intro,
  .server-header__top {
    flex-direction: column;
  }

  .control-surface {
    display: flex;
    min-height: auto;
    height: auto;
  }

  .rail {
    width: 100%;
    min-width: 0;
    position: static;
    padding: 8px;
  }

  .main-stage {
    flex: 1 1 auto;
    width: 100%;
    min-height: auto;
    overflow: visible;
  }

  .server-tabs {
    gap: 22px;
    overflow-x: auto;
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100% - 20px, 1480px);
  }

  .dashboard-stats {
    width: 100%;
    display: grid;
  }

  .server-header__actions,
  .server-header__actions form {
    width: 100%;
  }
}
