:root {
  color-scheme: dark;
  --ink: #f2f0e7;
  --muted: #9daaa1;
  --faint: #6d7971;
  --bg: #0a100d;
  --line: rgba(224, 235, 227, 0.12);
  --green: #72e39a;
  --green-deep: #35b766;
  --amber: #f1c75b;
  --red: #ff7369;
  --blue: #75b8ff;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.4);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 18%, rgba(57, 124, 77, 0.18), transparent 28rem),
    radial-gradient(circle at 90% 82%, rgba(99, 78, 42, 0.12), transparent 24rem),
    linear-gradient(145deg, #0a100d 0%, #0d1511 48%, #09100c 100%);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(114, 227, 154, 0.55);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.ambient-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.28;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, black, transparent 85%);
}

.page-shell {
  width: min(1180px, calc(100% - 40px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.site-header {
  min-height: 94px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  width: 35px;
  height: 35px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 3px;
  transform: rotate(2deg);
}

.brand-mark span {
  border-radius: 2px;
  background: var(--green-deep);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.16);
}

.brand-mark span:nth-child(2),
.brand-mark span:nth-child(3) {
  background: #5b8f54;
}

.brand-copy {
  display: grid;
  gap: 1px;
}

.brand-copy strong {
  font-size: 0.94rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.brand-copy small {
  color: var(--muted);
  font-size: 0.75rem;
}

.mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  color: #c4d1c8;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.025);
  font-size: 0.73rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mode-badge span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 12px rgba(241, 199, 91, 0.75);
}

main {
  display: grid;
  place-items: center;
  padding: 64px 0;
}

.auth-layout {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.7fr);
  align-items: center;
  gap: clamp(56px, 9vw, 128px);
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.intro-copy h1,
.dashboard-heading h1 {
  margin: 0;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: clamp(2.65rem, 6vw, 5.6rem);
  line-height: 0.98;
  letter-spacing: -0.07em;
}

.intro-copy h1 {
  max-width: 760px;
}

.intro-text {
  max-width: 560px;
  margin: 27px 0 0;
  color: var(--muted);
  font-size: 1.04rem;
  line-height: 1.75;
}

.safety-note {
  width: fit-content;
  margin-top: 35px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #c5d1c9;
}

.safety-note p {
  margin: 0;
  font-size: 0.84rem;
}

.shield {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  color: var(--green);
  border: 1px solid rgba(114, 227, 154, 0.25);
  border-radius: 9px;
  background: rgba(114, 227, 154, 0.08);
  font-size: 0.75rem;
}

.login-card,
.server-card {
  border: 1px solid var(--line);
  background: linear-gradient(150deg, rgba(25, 41, 31, 0.96), rgba(13, 23, 17, 0.95));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.login-card {
  padding: 38px;
  border-radius: 24px;
}

.card-heading {
  margin-bottom: 29px;
}

.card-heading h2 {
  margin: 0 0 8px;
  font-size: 1.5rem;
  letter-spacing: -0.03em;
}

.card-heading > p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.login-card label {
  display: block;
  margin: 18px 0 8px;
  color: #ccd5cf;
  font-size: 0.78rem;
  font-weight: 650;
}

.login-card input {
  width: 100%;
  height: 49px;
  padding: 0 15px;
  color: var(--ink);
  border: 1px solid rgba(224, 235, 227, 0.16);
  border-radius: 11px;
  background: rgba(4, 9, 6, 0.55);
  transition: border-color 160ms ease, background 160ms ease;
}

.login-card input::placeholder {
  color: #657068;
}

.login-card input:focus {
  border-color: rgba(114, 227, 154, 0.52);
  background: rgba(5, 12, 8, 0.72);
}

.primary-button,
.start-button {
  border: 0;
  cursor: pointer;
  transition: transform 160ms ease, filter 160ms ease, opacity 160ms ease;
}

.primary-button:hover:not(:disabled),
.start-button:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.primary-button:active:not(:disabled),
.start-button:active:not(:disabled) {
  transform: translateY(1px);
}

.primary-button {
  width: 100%;
  height: 50px;
  margin-top: 22px;
  padding: 0 17px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #07130b;
  border-radius: 11px;
  background: var(--green);
  font-weight: 800;
}

.primary-button:disabled,
.start-button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.button-arrow {
  font-size: 1.25rem;
}

.mock-disclaimer,
.form-error {
  margin: 16px 0 0;
  font-size: 0.72rem;
  line-height: 1.5;
  text-align: center;
}

.mock-disclaimer {
  color: var(--faint);
}

.form-error {
  color: #ffaaa4;
}

.dashboard {
  width: min(760px, 100%);
}

.dashboard-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 30px;
}

.dashboard-heading h1 {
  font-size: clamp(2.2rem, 7vw, 4rem);
}

.user-menu {
  display: grid;
  justify-items: end;
  gap: 6px;
  color: var(--muted);
  font-size: 0.76rem;
}

.user-menu strong {
  color: var(--ink);
}

.user-menu em {
  margin-left: 6px;
  padding: 3px 6px;
  color: var(--green);
  border: 1px solid rgba(114, 227, 154, 0.25);
  border-radius: 999px;
  font-size: 0.6rem;
  font-style: normal;
  letter-spacing: 0.08em;
}

.text-button,
.refresh-button {
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.text-button {
  color: var(--green);
  font-size: 0.74rem;
}

.connection-alert {
  margin-bottom: 14px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 11px;
  color: #ffd0cc;
  border: 1px solid rgba(255, 115, 105, 0.28);
  border-radius: 12px;
  background: rgba(102, 28, 22, 0.24);
}

.connection-alert > span {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 115, 105, 0.5);
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 800;
}

.connection-alert p {
  margin: 0;
  font-size: 0.78rem;
}

.server-card {
  overflow: hidden;
  border-radius: 27px;
}

.card-topline {
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  color: var(--faint);
  border-bottom: 1px solid var(--line);
  font-size: 0.67rem;
  font-weight: 750;
  letter-spacing: 0.14em;
}

.safe-control-label {
  color: #8ca895;
}

.status-stage {
  min-height: 280px;
  padding: 45px 24px 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.status-orb {
  position: relative;
  width: 76px;
  height: 76px;
  margin-bottom: 25px;
  display: grid;
  place-items: center;
}

.orb-core {
  width: 28px;
  height: 28px;
  z-index: 1;
  border-radius: 8px;
  background: currentColor;
  box-shadow: 0 0 30px currentColor;
  transform: rotate(45deg);
}

.orb-ring {
  position: absolute;
  inset: 0;
  border: 1px solid currentColor;
  border-radius: 50%;
  opacity: 0.22;
}

.tone-offline {
  color: var(--red);
}

.tone-starting {
  color: var(--amber);
}

.tone-online {
  color: var(--green);
}

.tone-error {
  color: var(--red);
}

.tone-unknown {
  color: var(--blue);
}

.tone-starting .orb-ring,
.tone-unknown .orb-ring {
  animation: pulse-ring 1.6s ease-out infinite;
}

.state-label {
  margin: 0;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: clamp(1.7rem, 6vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  text-transform: uppercase;
}

.state-message {
  min-height: 24px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.start-button {
  width: calc(100% - 48px);
  min-height: 56px;
  margin: 0 24px 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #07130b;
  border-radius: 13px;
  background: var(--green);
  font-size: 0.84rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.play-mark {
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 9px solid currentColor;
}

.motd-value {
  margin: -5px 24px 24px;
  padding: 12px 14px;
  color: #b8c8bd;
  border: 1px solid rgba(224, 235, 227, 0.08);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.14);
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.76rem;
  line-height: 1.5;
  text-align: center;
  white-space: pre-line;
}

.server-metrics {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.server-metrics div {
  padding: 21px 24px;
  text-align: center;
}

.server-metrics div + div {
  border-left: 1px solid var(--line);
}

.server-metrics dt {
  margin-bottom: 7px;
  color: var(--faint);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.server-metrics dd {
  margin: 0;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 1rem;
  font-weight: 750;
}

.card-footer {
  min-height: 70px;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.card-footer > div {
  display: grid;
  gap: 4px;
}

.card-footer span,
.card-footer small {
  color: var(--faint);
  font-size: 0.7rem;
}

.card-footer span {
  color: #aebbb2;
}

.refresh-button {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--green);
  font-size: 0.75rem;
}

.refresh-button:disabled {
  cursor: wait;
  opacity: 0.5;
}

.connection-hint {
  max-width: 570px;
  margin: 22px auto 0;
  color: var(--faint);
  font-size: 0.74rem;
  line-height: 1.65;
  text-align: center;
}

.user-management {
  margin-top: 26px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(15, 25, 19, 0.76);
}

.management-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 24px;
}

.management-heading h2 {
  margin: 0;
  font-size: 1.35rem;
}

.management-heading > p {
  max-width: 310px;
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.55;
  text-align: right;
}

.create-user-form {
  display: grid;
  grid-template-columns: 1fr 1.25fr 0.75fr auto;
  align-items: end;
  gap: 10px;
}

.create-user-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.68rem;
}

.create-user-form input,
.create-user-form select {
  width: 100%;
  height: 42px;
  padding: 0 11px;
  color: var(--ink);
  border: 1px solid rgba(224, 235, 227, 0.16);
  border-radius: 9px;
  background: rgba(4, 9, 6, 0.55);
}

.secondary-button {
  height: 42px;
  padding: 0 16px;
  color: #07130b;
  border: 0;
  border-radius: 9px;
  background: var(--green);
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 800;
}

.secondary-button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.management-message {
  min-height: 18px;
  margin: 13px 0 0;
  color: var(--green);
  font-size: 0.72rem;
}

.management-message.is-error {
  color: #ffaaa4;
}

.shutdown-control {
  width: min(100%, 820px);
  margin: 22px auto 0;
  padding: 22px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 18px;
  border: 1px solid rgba(255, 121, 112, 0.22);
  border-radius: 14px;
  background: rgba(68, 19, 16, 0.18);
}

.shutdown-control[hidden] {
  display: none;
}

.shutdown-control h2,
.shutdown-dialog h2 {
  margin: 3px 0 7px;
  font-size: 1.05rem;
}

.shutdown-control p,
.shutdown-dialog p {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.55;
}

.danger-button {
  min-height: 42px;
  padding: 0 16px;
  color: #fff4f2;
  border: 1px solid rgba(255, 139, 130, 0.46);
  border-radius: 9px;
  background: #7f2d27;
  cursor: pointer;
  font-size: 0.74rem;
  font-weight: 800;
}

.danger-button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.shutdown-message {
  min-height: 18px;
  margin: 0;
  grid-column: 1 / -1;
  color: #f3c6c1;
}

.shutdown-message.is-error {
  color: #ffaaa4;
}

.shutdown-dialog {
  width: min(calc(100% - 32px), 460px);
  padding: 0;
  color: var(--ink);
  border: 1px solid rgba(255, 139, 130, 0.28);
  border-radius: 16px;
  background: #101712;
}

.shutdown-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
}

.dialog-content {
  padding: 25px;
}

.dialog-actions {
  margin-top: 22px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.authorized-user-list {
  margin: 13px 0 0;
  padding: 0;
  display: grid;
  gap: 7px;
  list-style: none;
}

.authorized-user-list li {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #ccd5cf;
  border: 1px solid rgba(224, 235, 227, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  font-size: 0.76rem;
}

.authorized-user-list small {
  color: var(--faint);
  letter-spacing: 0.08em;
}

.site-footer {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 13px;
  color: #66726a;
  border-top: 1px solid var(--line);
  font-size: 0.7rem;
}

.footer-separator {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #536058;
}

.noscript-message {
  position: fixed;
  inset: auto 20px 20px;
  padding: 14px;
  color: white;
  border-radius: 10px;
  background: #9b2f27;
  text-align: center;
}

@keyframes pulse-ring {
  0% {
    opacity: 0.35;
    transform: scale(0.76);
  }
  75%,
  100% {
    opacity: 0;
    transform: scale(1.15);
  }
}

@media (max-width: 820px) {
  .auth-layout {
    grid-template-columns: 1fr;
    gap: 48px;
  }

  .intro-copy {
    text-align: center;
  }

  .intro-text,
  .safety-note {
    margin-right: auto;
    margin-left: auto;
  }
}

@media (max-width: 580px) {
  .page-shell {
    width: min(100% - 24px, 480px);
  }

  .site-header {
    min-height: 76px;
  }

  .brand-copy small {
    display: none;
  }

  .mode-badge {
    padding: 7px 9px;
    font-size: 0.62rem;
  }

  main {
    padding: 42px 0;
  }

  .auth-layout {
    gap: 36px;
  }

  .intro-copy h1 {
    font-size: clamp(2.35rem, 14vw, 3.6rem);
  }

  .intro-text {
    font-size: 0.92rem;
  }

  .login-card {
    padding: 27px 22px;
    border-radius: 19px;
  }

  .dashboard-heading {
    align-items: start;
    flex-direction: column;
    gap: 16px;
  }

  .user-menu {
    width: 100%;
    display: flex;
    justify-content: space-between;
  }

  .management-heading {
    align-items: start;
    flex-direction: column;
    gap: 8px;
  }

  .shutdown-control {
    grid-template-columns: 1fr;
  }

  .shutdown-control .danger-button {
    width: 100%;
  }

  .management-heading > p {
    text-align: left;
  }

  .create-user-form {
    grid-template-columns: 1fr;
  }

  .server-card {
    border-radius: 20px;
  }

  .status-stage {
    min-height: 245px;
  }

  .server-metrics div {
    padding: 18px 10px;
  }

  .card-footer {
    padding: 14px 18px;
  }

  .site-footer {
    flex-wrap: wrap;
    gap: 8px;
    padding: 16px 0;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
