:root {
  color-scheme: dark;
  --bg: #0b1220;
  --surface: #111c2e;
  --surface-raised: #16243a;
  --surface-soft: rgba(20, 34, 54, .72);
  --line: rgba(155, 179, 211, .15);
  --line-strong: rgba(155, 179, 211, .26);
  --text: #edf4ff;
  --muted: #94a7c0;
  --subtle: #6d829f;
  --mint: #61e2bd;
  --mint-dark: #1ca987;
  --blue: #80aaff;
  --amber: #ffce7b;
  --red: #ff828b;
  --shadow: 0 28px 80px rgba(0, 0, 0, .28);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(ellipse at 78% 0%, rgba(48, 105, 144, .22), transparent 34rem),
    radial-gradient(ellipse at 3% 31%, rgba(22, 104, 94, .12), transparent 31rem),
    var(--bg);
}

button, a { font: inherit; }
button { color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }

.app-shell { width: min(1120px, calc(100% - 48px)); margin: 0 auto; }
.topbar { height: 82px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; gap: 11px; align-items: center; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 31px; height: 31px; border: 1px solid rgba(97, 226, 189, .54); border-radius: 9px; color: var(--mint); font-weight: 750; font-size: 17px; box-shadow: inset 0 0 18px rgba(97, 226, 189, .09); }
.brand-name { color: #dbe8fa; font-weight: 680; letter-spacing: -.03em; font-size: 15px; }
.brand-divider { margin: 0 8px; color: #50637e; font-weight: 400; }
.brand-product { color: #8295ae; font-size: 10px; font-weight: 700; letter-spacing: .19em; }
.topbar-status { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; }

.hero { padding: 65px 0 40px; max-width: 690px; }
.eyebrow, .card-kicker { color: var(--mint); font-size: 10px; font-weight: 760; letter-spacing: .17em; margin: 0 0 13px; }
.eyebrow { display: flex; align-items: center; gap: 10px; }
.eyebrow-line { width: 22px; height: 1px; background: var(--mint); }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 15px; font-size: clamp(39px, 6vw, 66px); line-height: 1.04; font-weight: 620; letter-spacing: -.055em; }
h1 span { color: #87a5c8; }
.hero-copy { max-width: 490px; margin: 0; color: var(--muted); font-size: 15px; line-height: 1.7; }

.tabs { display: flex; gap: 7px; border-bottom: 1px solid var(--line-strong); }
.tab { position: relative; display: inline-flex; gap: 11px; align-items: center; padding: 14px 18px 15px; border: 0; background: transparent; color: #8193aa; cursor: pointer; font-size: 13px; font-weight: 640; transition: color .18s ease; }
.tab::after { position: absolute; right: 0; bottom: -1px; left: 0; height: 2px; background: transparent; content: ""; }
.tab:hover, .tab:focus-visible { color: var(--text); }
.tab.is-active { color: var(--text); }
.tab.is-active::after { background: var(--mint); box-shadow: 0 0 13px rgba(97, 226, 189, .45); }
.tab-index { color: #5e7794; font-size: 10px; font-weight: 750; letter-spacing: .08em; }
.tab:focus-visible, .button:focus-visible, .text-button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--mint); outline-offset: 3px; }

.tab-panel { padding: 36px 0 56px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.section-heading .eyebrow { margin-bottom: 7px; }
h2 { margin: 0; font-size: 25px; font-weight: 620; letter-spacing: -.035em; }
.pill { display: inline-flex; align-items: center; gap: 7px; min-height: 27px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 999px; color: var(--muted); font-size: 10px; font-weight: 680; letter-spacing: .03em; white-space: nowrap; }
.pill::before { width: 6px; height: 6px; border-radius: 50%; background: currentColor; content: ""; }
.pill--online { color: var(--mint); border-color: rgba(97, 226, 189, .24); background: rgba(97, 226, 189, .06); }
.pill--offline { color: var(--amber); border-color: rgba(255, 206, 123, .24); background: rgba(255, 206, 123, .06); }
.pill--error { color: var(--red); border-color: rgba(255, 130, 139, .24); background: rgba(255, 130, 139, .06); }
.pill--neutral { color: var(--muted); }

.wake-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(255px, .8fr); gap: 16px; }
.wake-card, .info-card, .webhook-card, .settings-card, .offline-card, .fallback-card, .viewer-state { border: 1px solid var(--line); border-radius: 17px; background: linear-gradient(145deg, rgba(22, 36, 58, .95), rgba(15, 26, 43, .94)); box-shadow: var(--shadow); }
.wake-card { position: relative; min-height: 300px; overflow: hidden; }
.wake-card::before { position: absolute; top: -120px; right: -20px; width: 390px; height: 390px; border: 1px solid rgba(97, 226, 189, .08); border-radius: 50%; content: ""; }
.wake-card::after { position: absolute; top: -75px; right: 25px; width: 300px; height: 300px; border: 1px solid rgba(97, 226, 189, .07); border-radius: 50%; content: ""; }
.wake-card-orbit { position: absolute; right: 23px; bottom: 18px; width: 235px; height: 235px; border: 1px solid rgba(97, 226, 189, .06); border-radius: 50%; }
.wake-card-orbit span { position: absolute; width: 6px; height: 6px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 13px var(--mint); }
.wake-card-orbit span:first-child { top: 43px; left: 22px; }
.wake-card-orbit span:nth-child(2) { top: 12px; right: 73px; width: 4px; height: 4px; background: var(--blue); box-shadow: 0 0 12px var(--blue); }
.wake-card-orbit span:nth-child(3) { right: 6px; bottom: 72px; width: 3px; height: 3px; }
.wake-card-content { position: relative; z-index: 1; max-width: 440px; padding: 30px 34px; }
.power-symbol { display: grid; place-items: center; width: 40px; height: 40px; margin-bottom: 20px; border: 1px solid rgba(97, 226, 189, .28); border-radius: 12px; color: var(--mint); background: rgba(97, 226, 189, .065); }
.power-symbol svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.wake-card h3, .offline-card h3, .fallback-card h3 { margin: 0 0 8px; font-size: 19px; font-weight: 610; letter-spacing: -.025em; }
.muted { color: var(--muted); }
.wake-card .muted { max-width: 330px; margin-bottom: 21px; font-size: 12px; line-height: 1.55; }
.small { font-size: 11px; line-height: 1.5; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 12px; min-height: 42px; padding: 0 15px; border: 1px solid transparent; border-radius: 9px; text-decoration: none; cursor: pointer; font-size: 12px; font-weight: 700; transition: transform .18s ease, background .18s ease, border-color .18s ease, opacity .18s ease; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { opacity: .48; cursor: not-allowed; }
.button-primary { color: #08241d; background: var(--mint); box-shadow: 0 8px 24px rgba(39, 198, 155, .13); }
.button-primary:hover:not(:disabled) { background: #7af0ce; }
.button-primary svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.button-secondary { border-color: var(--line-strong); color: #dbe8fa; background: rgba(255, 255, 255, .035); }
.button-secondary:hover:not(:disabled) { border-color: rgba(97, 226, 189, .42); background: rgba(97, 226, 189, .07); }
.action-message { min-height: 18px; margin: 11px 0 0; color: var(--muted); font-size: 11px; }
.action-message.is-success { color: var(--mint); }
.action-message.is-error { color: var(--red); }

.info-card { padding: 27px 25px 20px; box-shadow: none; }
.info-card .card-kicker { margin-bottom: 23px; }
.pc-status-row { display: flex; align-items: start; gap: 12px; }
.pc-status-row strong, .pc-status-row .muted { display: block; }
.pc-status-row strong { margin: -2px 0 5px; font-size: 13px; font-weight: 670; }
.status-dot { position: relative; display: inline-block; flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: #6e829b; }
.status-dot--unknown { background: #71839a; }
.status-dot--online { background: var(--mint); box-shadow: 0 0 0 4px rgba(97, 226, 189, .08), 0 0 12px rgba(97, 226, 189, .35); }
.status-dot--offline { background: var(--amber); box-shadow: 0 0 0 4px rgba(255, 206, 123, .07); }
.status-dot--error { background: var(--red); }
.info-divider { height: 1px; margin: 23px 0 18px; background: var(--line); }
.metrics { display: grid; gap: 13px; margin: 0; }
.metrics div { display: flex; justify-content: space-between; gap: 12px; }
.metrics dt { color: var(--subtle); font-size: 11px; }
.metrics dd { margin: 0; color: #d9e5f4; font-size: 11px; font-variant-numeric: tabular-nums; }
.text-button { margin-top: 19px; padding: 0; border: 0; color: var(--mint); background: transparent; cursor: pointer; font-size: 11px; font-weight: 670; }
.text-button span { margin-left: 4px; font-size: 14px; }

.webhook-card { margin-top: 16px; box-shadow: none; }
.webhook-card summary { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 17px 20px; cursor: pointer; list-style: none; color: #d7e3f2; font-size: 12px; font-weight: 640; }
.webhook-card summary::-webkit-details-marker { display: none; }
.webhook-card summary::after { width: 7px; height: 7px; margin-left: auto; border-right: 1px solid var(--muted); border-bottom: 1px solid var(--muted); content: ""; transform: rotate(45deg) translateY(-2px); transition: transform .2s ease; }
.webhook-card[open] summary::after { transform: rotate(225deg) translate(-2px, -1px); }
.webhook-icon { margin-right: 9px; color: var(--mint); font-size: 15px; }
.summary-hint { margin-left: auto; color: var(--subtle); font-size: 10px; font-weight: 500; }
.webhook-content { padding: 0 20px 19px; }
.webhook-content p { margin: 0 0 12px; font-size: 11px; line-height: 1.5; }
.copy-row { display: flex; align-items: stretch; gap: 8px; }
.copy-row code { display: block; flex: 1; min-width: 0; overflow: auto; padding: 12px; border: 1px solid var(--line); border-radius: 8px; color: #a8c4df; background: rgba(2, 8, 16, .4); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 10px; white-space: nowrap; }
.copy-row .button { min-width: 68px; }
#copy-message { min-height: 14px; margin: 8px 0 0; }

.settings-card { margin-top: 16px; box-shadow: none; }
.settings-card summary { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 17px 20px; cursor: pointer; list-style: none; color: #d7e3f2; font-size: 12px; font-weight: 640; }
.settings-card summary::-webkit-details-marker { display: none; }
.settings-card summary::after { width: 7px; height: 7px; margin-left: auto; border-right: 1px solid var(--muted); border-bottom: 1px solid var(--muted); content: ""; transform: rotate(45deg) translateY(-2px); transition: transform .2s ease; }
.settings-card[open] summary::after { transform: rotate(225deg) translate(-2px, -1px); }
.settings-icon { margin-right: 9px; color: var(--mint); font-size: 14px; }
.settings-content { padding: 0 20px 19px; }
.settings-content > p { margin: 0 0 16px; font-size: 11px; line-height: 1.5; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field { display: block; }
.field-label { display: block; margin-bottom: 7px; color: var(--subtle); font-size: 10px; font-weight: 670; letter-spacing: .06em; text-transform: uppercase; }
.field input { width: 100%; min-height: 40px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 9px; color: var(--text); background: rgba(2, 8, 16, .42); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }
.field input::placeholder { color: #53657f; }
.field input:focus { outline: none; border-color: rgba(97, 226, 189, .52); box-shadow: 0 0 0 3px rgba(97, 226, 189, .09); }
.settings-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 17px; }
.settings-actions .button { min-height: 38px; }
#settings-message { flex: 1 0 100%; min-height: 16px; margin: 0; }

.manager-card { margin-top: 16px; padding: 20px; border: 1px solid var(--line); border-radius: 17px; background: linear-gradient(145deg, rgba(22, 36, 58, .95), rgba(15, 26, 43, .94)); box-shadow: none; }
.manager-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.manager-head .eyebrow { margin-bottom: 6px; }
.manager-head h3 { margin: 0; font-size: 16px; font-weight: 640; letter-spacing: -.02em; }
.manager-head .button { min-height: 34px; }
.manager-hint { margin: 0 0 12px; display: block; }
.machine-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.machine-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: rgba(2, 8, 16, .25); }
.machine-ident { display: grid; flex: 1; gap: 3px; min-width: 0; }
.machine-ident strong { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 650; }
.machine-ident .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.machine-status { color: var(--subtle); }
.machine-tag { padding: 2px 7px; border: 1px solid rgba(97, 226, 189, .28); border-radius: 999px; color: var(--mint); font-size: 9px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.machine-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.row-button { min-height: 30px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 8px; color: #cfe0f5; background: rgba(255, 255, 255, .03); cursor: pointer; font-size: 10px; font-weight: 670; transition: border-color .18s ease, background .18s ease; }
.row-button:hover:not(:disabled) { border-color: rgba(97, 226, 189, .42); background: rgba(97, 226, 189, .07); }
.row-button:disabled { opacity: .45; cursor: not-allowed; }
.machine-form { margin-top: 16px; padding-top: 18px; border-top: 1px solid var(--line); }
.form-title { margin: 0 0 13px; font-size: 13px; font-weight: 660; }
.input-row { display: flex; align-items: stretch; gap: 8px; }
.input-row input { flex: 1; min-width: 0; }
.input-row .button { min-height: 40px; white-space: nowrap; }

.code-heading { margin-bottom: 18px; }
.code-heading .button { min-height: 37px; }
.viewer-state { display: flex; align-items: center; gap: 14px; min-height: 130px; padding: 24px; box-shadow: none; }
.viewer-state strong { display: block; margin-bottom: 5px; font-size: 13px; }
.viewer-state p { margin: 0; font-size: 11px; }
.loader { width: 24px; height: 24px; border: 2px solid rgba(97, 226, 189, .15); border-top-color: var(--mint); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.offline-card, .fallback-card { display: flex; align-items: center; gap: 20px; padding: 26px; box-shadow: none; }
.offline-icon { display: grid; place-items: center; flex: 0 0 auto; width: 44px; height: 44px; border: 1px solid rgba(255, 206, 123, .22); border-radius: 14px; color: var(--amber); background: rgba(255, 206, 123, .07); font-size: 21px; font-weight: 700; }
.offline-card .card-kicker, .fallback-card .card-kicker { margin-bottom: 8px; color: var(--amber); }
.offline-card p:not(.card-kicker), .fallback-card p:not(.card-kicker) { max-width: 540px; margin-bottom: 17px; font-size: 12px; line-height: 1.6; }
.offline-card .button, .fallback-card .button { min-height: 37px; }
.fallback-card { justify-content: space-between; }
.fallback-card .card-kicker { color: var(--blue); }
.fallback-card .button { flex: 0 0 auto; }
.frame-wrap { overflow: hidden; border: 1px solid var(--line-strong); border-radius: 13px; background: #0a111c; box-shadow: var(--shadow); }
.frame-toolbar { display: flex; align-items: center; gap: 8px; min-height: 39px; padding: 0 13px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.frame-live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 8px rgba(97, 226, 189, .65); }
.frame-toolbar a { margin-left: auto; color: var(--blue); text-decoration: none; }
.frame-toolbar a:hover { text-decoration: underline; }
#opencode-frame, #jellyfin-frame { display: block; width: 100%; height: min(72vh, 760px); min-height: 460px; border: 0; background: #fff; }

.footer { display: flex; justify-content: space-between; gap: 12px; padding: 18px 0 27px; border-top: 1px solid var(--line); color: #5e718a; font-size: 9px; font-weight: 670; letter-spacing: .12em; }
.error-page { padding-top: 18vh; }
.footer-dot { margin: 0 5px; color: var(--mint); }
#footer-updated { font-size: 10px; font-weight: 450; letter-spacing: 0; }

@media (max-width: 720px) {
  .app-shell { width: min(100% - 32px, 560px); }
  .topbar { height: 68px; }
  .hero { padding: 49px 0 32px; }
  h1 { font-size: clamp(38px, 10vw, 54px); }
  .wake-layout { grid-template-columns: 1fr; }
  .wake-card { min-height: 285px; }
  .info-card { padding: 23px; }
  .section-heading { align-items: center; }
  .code-heading { align-items: start; }
  .code-heading .button { padding: 0 10px; font-size: 10px; }
  .footer { flex-direction: column; }
  #opencode-frame, #jellyfin-frame { min-height: 380px; height: 65vh; }
}

@media (max-width: 460px) {
  .app-shell { width: calc(100% - 28px); }
  .topbar-status { font-size: 10px; }
  .brand-product { letter-spacing: .12em; }
  .tab { flex: 1; justify-content: center; padding-right: 8px; padding-left: 8px; }
  .tab-panel { padding-top: 28px; }
  .wake-card-content { padding: 25px 22px; }
  .wake-card-orbit { right: -95px; }
  .section-heading h2 { font-size: 22px; }
  .webhook-card summary { flex-wrap: wrap; padding: 15px; }
  .summary-hint { flex: 1 0 100%; order: 3; margin: 0 0 0 24px; }
  .webhook-card summary::after { position: absolute; right: 30px; }
  .webhook-content { padding-right: 14px; padding-left: 14px; }
  .copy-row { flex-direction: column; }
  .copy-row code { max-width: 100%; }
  .copy-row .button { align-self: flex-start; }
  .settings-card summary { flex-wrap: wrap; padding: 15px; }
  .settings-card summary::after { position: absolute; right: 30px; }
  .settings-content { padding-right: 14px; padding-left: 14px; }
  .field-grid { grid-template-columns: 1fr; }
  .manager-card { padding: 16px; }
  .manager-head { align-items: start; }
  .machine-row { flex-wrap: wrap; }
  .machine-actions { width: 100%; justify-content: flex-start; }
  .offline-card, .fallback-card { align-items: flex-start; padding: 20px; }
  .fallback-card { flex-direction: column; }
  .offline-icon { width: 38px; height: 38px; }
}

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