:root {
  --gold: #D9A441;
  --gold-hi: #F1D58E;
  --panel: #2A2F28;
  --panel-head: #3B4236;
  --ink: #D8DDD2;
  --muted: #9AA392;
  --dim: #AEB6A6;
  --label: #8E9787;
  --input-bg: #151913;
  --line: #5A6355;
  --green: #7FBF5A;
  --red: #C7553F;
  --btn: #C8912F;
  --btn-ink: #1A1408;
  --err-bg: #4A1E1A;
  --err-line: #B8483C;
  --err-title: #F2B8AE;
  --err-body: #E6CFC9;
  --font-display: "Saira Stencil One", system-ui, sans-serif;
  --font-ui: "Chakra Petch", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: #060806;
  color: var(--ink);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
}

.page {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: linear-gradient(149.8deg, #1B2119 17%, #0C0F0B 56%, #060806 82%);
}

/* ---- nền hành lang ---- */
.bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.bg-img {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 64%;
  background: url("bg.webp") center / cover no-repeat;
  opacity: 0.45;
}

.bg-tint {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 64%;
  background: radial-gradient(ellipse 45% 45% at 62% 42%, #3A3320 0%, #141912 45%, #090B08 100%);
}

.bg-rails {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 64%;
  background: repeating-linear-gradient(
    90deg,
    transparent 0,
    transparent 124px,
    rgba(0, 0, 0, 0.33) 124px,
    rgba(0, 0, 0, 0.33) 126px,
    rgba(255, 255, 255, 0.05) 126px,
    rgba(255, 255, 255, 0.05) 127px
  );
}

.bg-glow {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 64%;
  background: radial-gradient(ellipse 14% 4% at 55% 41%, rgba(240, 178, 74, 0.7), transparent 70%);
  filter: blur(9px);
}

.bg-img,
.bg-tint,
.bg-rails,
.bg-glow {
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 28%);
  mask-image: linear-gradient(to right, transparent 0, #000 28%);
}

.bg-fade {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 42%;
  background: linear-gradient(to right, #0C0F0B 0%, rgba(12, 15, 11, 0) 100%);
}

/* ---- bố cục chính ---- */
.main {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6vw;
  padding: 48px 6vw 32px;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 48px;
  width: min(520px, 40vw);
}

.title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(34px, 3.6vw, 52px);
  font-weight: 400;
  letter-spacing: 2px;
  white-space: nowrap;
  line-height: 1.1;
  color: var(--ink);
}

.subtitle {
  margin: 6px 0 0;
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 4px;
  color: var(--gold);
}

/* ---- menu ---- */
.menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.menu-item {
  appearance: none;
  border: 0;
  border-left: 3px solid transparent;
  margin-left: -1.5px;
  padding: 10px 14px;
  width: 100%;
  text-align: left;
  font-family: var(--font-ui);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 3px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.menu-item:hover {
  color: var(--ink);
}

.menu-item.is-active {
  border-left-color: var(--gold);
  background: rgba(217, 164, 65, 0.13);
  color: var(--gold-hi);
  font-weight: 700;
}

.lbl-sm {
  display: none;
}

/* ---- cửa sổ máy chủ ---- */
.panel {
  width: min(440px, 100%);
  background: var(--panel);
  box-shadow:
    inset 1px 1px 0 #5A6355,
    inset -1px -1px 0 #0A0C09,
    0 12px 40px rgba(0, 0, 0, 0.67);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--panel-head);
}

.panel-title {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #E3E7DC;
}

.panel-close {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0 2px;
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
}

.panel-close:hover {
  color: var(--ink);
}

.panel-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px 20px 22px;
}

.server-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lamp {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
}

.lamp.down {
  background: var(--red);
}

.server-text {
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--dim);
}

.alert {
  border-left: 3px solid var(--err-line);
  margin-left: -1.5px;
  padding: 10px 12px;
  background: var(--err-bg);
}

.alert-title {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--err-title);
}

.alert-body {
  margin-top: 4px;
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--err-body);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--label);
}

.field-input {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border: 0;
  background: var(--input-bg);
  box-shadow:
    inset 1px 1px 0 #050605,
    inset -1px -1px 0 #4A5246;
  font-family: var(--font-mono);
  font-size: 14px;
  color: #DDE2D6;
}

.field-input:focus {
  outline: 1px solid var(--gold);
  outline-offset: 1px;
}

.remember {
  display: flex;
  align-items: center;
  gap: 8px;
}

.remember-box {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--gold);
}

.remember-label {
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--dim);
  cursor: pointer;
}

.actions {
  display: flex;
  gap: 10px;
  padding-top: 6px;
}

.btn {
  appearance: none;
  flex: 1 1 0;
  height: 42px;
  border: 0;
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 3px;
  cursor: pointer;
  box-shadow:
    inset 1px 1px 0 rgba(255, 255, 255, 0.2),
    inset -1px -1px 0 rgba(0, 0, 0, 0.53);
  transition: filter 0.15s ease;
}

.btn:hover:not(:disabled) {
  filter: brightness(1.08);
}

.btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.btn-go {
  background: var(--btn);
  color: var(--btn-ink);
}

.btn-wait {
  background: var(--panel-head);
  color: var(--ink);
}

.btn:focus-visible,
.menu-item:focus-visible,
.panel-close:focus-visible,
.remember-box:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* ---- thông báo nhỏ ---- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 64px;
  transform: translateX(-50%);
  z-index: 5;
  max-width: min(90vw, 420px);
  padding: 10px 16px;
  background: var(--panel);
  border-left: 3px solid var(--gold);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--ink);
  text-align: center;
}

/* ---- thanh trạng thái ---- */
.statusbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 96px;
  background: rgba(0, 0, 0, 0.4);
  font-family: var(--font-mono);
  font-size: 12px;
  color: #5E6659;
}

.sb-mobile {
  display: none;
}

/* ---- màn hẹp ---- */
@media (max-width: 767px) {
  .page {
    background: linear-gradient(180deg, #1B2119 0%, #080A07 100%);
  }

  .bg-img {
    left: 0;
    width: 100%;
    opacity: 0.28;
  }

  .bg-tint,
  .bg-rails,
  .bg-glow {
    left: 0;
    width: 100%;
  }

  .bg-fade {
    display: none;
  }

  .bg-img,
  .bg-tint,
  .bg-rails,
  .bg-glow {
    -webkit-mask-image: none;
    mask-image: none;
  }

  .main {
    flex-direction: column;
    align-items: stretch;
    gap: 28px;
    padding: 56px 20px 32px;
  }

  .brand {
    width: 100%;
    gap: 24px;
  }

  .title {
    font-size: 34px;
    letter-spacing: 1px;
  }

  .subtitle {
    font-size: 12px;
    letter-spacing: 3px;
  }

  .menu {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
  }

  .menu-item {
    width: auto;
    border-left: 0;
    margin-left: 0;
    padding: 4px 0;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 2px;
    color: #7E8778;
  }

  .menu-item.is-active {
    border-left: 0;
    background: transparent;
  }

  .menu-item[data-act="focus"],
  .menu-item[data-act="quit"] {
    display: none;
  }

  .lbl {
    display: none;
  }

  .lbl-sm {
    display: inline;
  }

  .panel {
    width: 100%;
  }

  .statusbar {
    justify-content: center;
    padding: 0 20px;
    font-size: 11px;
  }

  .sb-desktop {
    display: none;
  }

  .sb-mobile {
    display: inline;
  }
}

@media (prefers-reduced-motion: reduce) {
  .page *,
  .page *::before,
  .page *::after {
    transition: none !important;
    animation: none !important;
  }
}
