:root {
  color-scheme: dark;
  --ink: #f4f6ee;
  --muted: #aeb8aa;
  --panel: rgba(18, 27, 23, 0.9);
  --line: rgba(207, 230, 203, 0.16);
  --green: #8fe388;
  --green-deep: #183c25;
  --amber: #f5c76b;
  --red: #ff8d87;
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 5%, rgba(89, 145, 86, 0.2), transparent 34rem),
    radial-gradient(circle at 90% 90%, rgba(56, 103, 87, 0.2), transparent 32rem),
    #09110d;
  font: 16px/1.55 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.06;
  background-image: linear-gradient(90deg, #fff 1px, transparent 1px), linear-gradient(#fff 1px, transparent 1px);
  background-size: 32px 32px;
}

.shell { width: min(760px, calc(100% - 32px)); margin: 0 auto; padding: 10vh 0 40px; }
.hero { margin-bottom: 32px; }
.eyebrow, .label { margin: 0 0 8px; color: var(--green); font-size: 0.75rem; font-weight: 750; letter-spacing: 0.16em; text-transform: uppercase; }
h1 { max-width: 680px; margin: 0; font-size: clamp(2.6rem, 9vw, 5.2rem); line-height: 0.95; letter-spacing: -0.055em; }
.lede { max-width: 610px; margin: 24px 0 0; color: var(--muted); font-size: 1.08rem; }

.panel { padding: clamp(22px, 5vw, 38px); border: 1px solid var(--line); border-radius: 24px; background: var(--panel); box-shadow: 0 28px 80px rgba(0, 0, 0, 0.32); backdrop-filter: blur(18px); }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
h2 { margin: 0; font-size: clamp(1.55rem, 4vw, 2.15rem); letter-spacing: -0.025em; }
.state { flex: none; padding: 7px 11px; border: 1px solid currentColor; border-radius: 999px; color: var(--muted); font: 700 0.72rem/1 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: 0.08em; }
.state[data-state="READY"] { color: var(--green); }
.state[data-state="ERROR"] { color: var(--red); }
.state[data-state="CREATING_VM"], .state[data-state="RESTORING_WORLD"], .state[data-state="STARTING_MINECRAFT"], .state[data-state="CHECKPOINTING"] { color: var(--amber); }
.status-message { min-height: 1.6em; margin: 28px 0 22px; color: var(--muted); }

.button { min-height: 48px; border: 0; border-radius: 12px; padding: 0 18px; font: inherit; font-weight: 750; cursor: pointer; transition: transform 120ms ease, opacity 120ms ease, background 120ms ease; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:focus-visible, a:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; }
.button:disabled { cursor: not-allowed; opacity: 0.42; }
.primary { width: 100%; color: #071009; background: var(--green); }
.secondary { color: var(--ink); background: var(--green-deep); }
.connection { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: center; margin: 0 0 18px; padding: 15px; border: 1px solid rgba(143, 227, 136, 0.32); border-radius: 14px; background: rgba(31, 77, 43, 0.25); }
.connection-label { grid-column: 1 / -1; color: var(--muted); font-size: 0.78rem; }
.connection code { overflow-wrap: anywhere; color: var(--green); font-size: clamp(0.9rem, 3vw, 1.15rem); }
.retry { margin: 12px 0 0; color: var(--amber); font-size: 0.85rem; text-align: center; }
.timeline { display: grid; gap: 9px; margin: 24px 0 0; padding: 20px 0 0; border-top: 1px solid var(--line); list-style: none; }
.timeline li { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 0.86rem; }
.timeline li::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 12px rgba(143, 227, 136, 0.5); }
footer { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 22px; color: #768178; font-size: 0.82rem; }
footer a { color: var(--muted); }
.owner-panel { margin-top: 20px; }
.owner-login { display: grid; gap: 8px; margin-top: 24px; }
.owner-login label { color: var(--muted); font-size: 0.82rem; }
.form-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
input { min-width: 0; border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; color: var(--ink); background: rgba(0, 0, 0, 0.24); font: inherit; }
input:focus { border-color: var(--green); outline: 2px solid rgba(143, 227, 136, 0.2); }
.owner-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 24px; }
.text-button { border: 0; padding: 8px; color: var(--muted); background: transparent; text-decoration: underline; cursor: pointer; }
.owner-help { color: var(--muted); font-size: 0.84rem; }
.backup-list { display: grid; gap: 10px; margin: 18px 0 0; padding: 0; list-style: none; }
.backup-list li { display: grid; grid-template-columns: 1fr auto; gap: 4px 14px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; }
.backup-title { overflow-wrap: anywhere; font: 700 0.84rem/1.4 ui-monospace, SFMono-Regular, Consolas, monospace; }
.backup-meta { color: var(--muted); font-size: 0.76rem; }
.backup-actions { grid-row: 1 / 3; grid-column: 2; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.backup-actions button { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; color: var(--ink); background: transparent; cursor: pointer; }

@media (max-width: 520px) {
  .shell { padding-top: 48px; }
  .panel-heading { align-items: center; }
  .connection { grid-template-columns: 1fr; }
  .connection-label { grid-column: auto; }
  .form-row { grid-template-columns: 1fr; }
  .owner-actions { align-items: stretch; flex-direction: column; }
  .backup-list li { grid-template-columns: 1fr; }
  .backup-actions { grid-row: auto; grid-column: auto; margin-top: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .button { transition: none; }
}
