:root {
  --bg: #070b0f;
  --panel: rgba(15, 22, 29, .86);
  --panel-2: rgba(22, 31, 39, .78);
  --line: rgba(255,255,255,.085);
  --text: #f4f7f8;
  --muted: #8f9ca6;
  --accent: #80e2b7;
  --accent-2: #68b9ff;
  --danger: #ff7f8b;
  --warn: #ffd27b;
  --shadow: 0 24px 80px rgba(0,0,0,.34);
}
* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 0%, rgba(48, 118, 94, .18), transparent 32%),
    radial-gradient(circle at 100% 20%, rgba(54, 105, 153, .14), transparent 27%),
    var(--bg);
}
button { font: inherit; }
.bg-orb { position: fixed; width: 28rem; height: 28rem; border-radius: 50%; filter: blur(100px); opacity: .09; pointer-events: none; }
.bg-orb-a { background: #55e0aa; left: -12rem; top: 20rem; }
.bg-orb-b { background: #4ba2ff; right: -14rem; top: 4rem; }
.shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 54px 0 36px; position: relative; }
.hero { display: flex; justify-content: space-between; gap: 34px; align-items: end; margin-bottom: 40px; }
.eyebrow { font-size: 12px; letter-spacing: .28em; font-weight: 800; color: var(--accent); margin-bottom: 9px; }
h1 { font-size: clamp(38px, 6vw, 72px); letter-spacing: -.055em; line-height: .95; margin: 0; }
.hero-copy { max-width: 700px; margin: 20px 0 0; color: var(--muted); line-height: 1.65; font-size: 16px; }
.summary { display: grid; grid-template-columns: repeat(3, 1fr); min-width: 340px; border: 1px solid var(--line); border-radius: 20px; overflow: hidden; background: rgba(255,255,255,.025); backdrop-filter: blur(18px); }
.summary > div { padding: 18px 20px; text-align: center; border-right: 1px solid var(--line); }
.summary > div:last-child { border-right: 0; }
.summary strong { display: block; font-size: 26px; }
.summary span { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.live-dot { color: var(--muted); font-size: 13px; display: flex; gap: 8px; align-items: center; }
.live-dot span { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 18px rgba(128,226,183,.8); }
.ghost-button { border: 1px solid var(--line); background: rgba(255,255,255,.03); color: var(--text); padding: 9px 14px; border-radius: 12px; cursor: pointer; }
.ghost-button:hover { background: rgba(255,255,255,.06); }
.server-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 18px; align-items: start; }
.server-card { position: relative; padding: 22px; min-height: 285px; align-self: start; border: 1px solid var(--line); border-radius: 22px; background: linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.018)), var(--panel); box-shadow: var(--shadow); overflow: hidden; }
.server-card::after { content: ""; position: absolute; inset: auto -50px -80px auto; width: 170px; height: 170px; border-radius: 50%; filter: blur(20px); opacity: .08; }
.server-card.online::after { background: var(--accent); }
.server-card.offline::after { background: var(--danger); }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.root-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .13em; }
h2 { margin: 7px 0 5px; font-size: 23px; letter-spacing: -.025em; }
.instance-name { color: #67737d; font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; }
.status-pill { display: inline-flex; align-items: center; gap: 7px; padding: 7px 9px; font-size: 10px; letter-spacing: .08em; font-weight: 800; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; }
.status-pill span { width: 7px; height: 7px; border-radius: 50%; }
.status-pill.online { color: #aaf3d2; background: rgba(85,224,170,.08); }
.status-pill.online span { background: var(--accent); box-shadow: 0 0 10px rgba(128,226,183,.7); }
.status-pill.offline { color: #ffabb3; background: rgba(255,127,139,.07); }
.status-pill.offline span { background: var(--danger); }
.status-pill.starting, .status-pill.stopping { color: #ffe1a7; background: rgba(255,210,123,.08); }
.status-pill.starting span, .status-pill.stopping span { background: var(--warn); animation: pulse 1.1s infinite; }
@keyframes pulse { 50% { opacity: .3; transform: scale(.75); } }
.stats-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 26px; }
.stat { padding: 13px 14px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.025); }
.stat span, .idle span { display: block; color: var(--muted); font-size: 11px; margin-bottom: 3px; }
.stat strong { font-size: 18px; }
.idle { margin-top: 10px; padding: 12px 14px; border-radius: 14px; background: rgba(128,226,183,.045); border: 1px solid rgba(128,226,183,.11); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.idle span { margin: 0; }
.idle strong { font-size: 12px; text-align: right; }
.idle.muted { background: rgba(255,255,255,.025); border-color: var(--line); }
.server-error { margin-top: 9px; color: #e9bd76; font-size: 11px; }
.card-actions { margin-top: 22px; }
.start-button { width: 100%; border: 0; border-radius: 14px; padding: 13px 16px; cursor: pointer; color: #07120e; background: linear-gradient(135deg, #9ef0cd, #6fd6a8); font-weight: 850; box-shadow: 0 10px 30px rgba(87,220,164,.15); }
.start-button:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.04); }
.start-button:disabled { cursor: wait; opacity: .65; }
.notice { margin: 0 0 18px; padding: 13px 15px; border-radius: 13px; border: 1px solid var(--line); background: rgba(255,255,255,.035); }
.notice.success { border-color: rgba(128,226,183,.25); color: #bdf5dc; }
.notice.warn { border-color: rgba(255,210,123,.25); color: #ffe0a3; }
.notice.error { border-color: rgba(255,127,139,.3); color: #ffb1b9; }
.notice.hidden { display: none; }
.empty { grid-column: 1 / -1; padding: 50px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 18px; }
.skeleton-card { min-height: 285px; border-radius: 22px; background: linear-gradient(90deg, rgba(255,255,255,.025), rgba(255,255,255,.055), rgba(255,255,255,.025)); background-size: 220% 100%; animation: shimmer 1.3s infinite; border: 1px solid var(--line); }
@keyframes shimmer { to { background-position: -220% 0; } }
footer { display: flex; justify-content: space-between; color: #68737c; font-size: 12px; margin-top: 26px; padding: 0 3px; }
@media (max-width: 900px) {
  .hero { align-items: stretch; flex-direction: column; }
  .summary { min-width: 0; width: 100%; }
  .server-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 620px) {
  .shell { width: min(100% - 22px, 1180px); padding-top: 30px; }
  .server-grid { grid-template-columns: 1fr; }
  .summary > div { padding: 14px 10px; }
  .summary strong { font-size: 22px; }
  .server-card { min-height: 0; }
  footer { gap: 10px; flex-direction: column; }
}

/* v3: editable server information, no image/photo feature */
.hidden { display: none !important; }
.toolbar-actions { display: flex; gap: 10px; align-items: center; }
.ghost-button.admin-active { border-color: rgba(128,226,183,.32); color: #bdf5dc; background: rgba(128,226,183,.08); }
.password-stat strong { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 16px; overflow-wrap: anywhere; }
.description-dropdown { margin-top: 10px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.022); overflow: hidden; }
.description-dropdown summary { cursor: pointer; list-style: none; padding: 12px 14px; color: var(--muted); font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.description-dropdown summary::-webkit-details-marker { display: none; }
.description-dropdown summary::after { content: "⌄"; color: var(--text); font-size: 16px; transition: transform .18s ease; }
.description-dropdown[open] summary::after { transform: rotate(180deg); }
.description-body { border-top: 1px solid var(--line); padding: 13px 14px 15px; color: #c8d0d6; font-size: 13px; line-height: 1.6; }
.card-actions.with-admin { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; align-items: stretch; }
.card-actions.with-admin .start-button { min-width: 0; }
.edit-button { border: 1px solid var(--line); border-radius: 14px; padding: 12px 15px; cursor: pointer; color: var(--text); background: rgba(255,255,255,.035); font-weight: 750; }
.edit-button:hover { background: rgba(255,255,255,.07); }
.modal-open { overflow: hidden; }
.modal-backdrop { position: fixed; inset: 0; z-index: 1000; padding: 22px; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.72); backdrop-filter: blur(8px); }
.modal { width: min(440px, 100%); padding: 22px; border-radius: 22px; border: 1px solid var(--line); background: #111820; box-shadow: 0 30px 100px rgba(0,0,0,.55); }
.modal-wide { width: min(620px, 100%); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.modal-head h3 { margin: 3px 0 0; font-size: 24px; }
.modal-close { width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--line); color: var(--text); background: rgba(255,255,255,.035); cursor: pointer; font-size: 24px; line-height: 1; }
.field-label { display: block; margin: 16px 0 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
.field-input { width: 100%; border: 1px solid var(--line); border-radius: 13px; padding: 12px 13px; color: var(--text); background: rgba(255,255,255,.035); outline: none; font: inherit; }
.field-input:focus { border-color: rgba(128,226,183,.4); box-shadow: 0 0 0 3px rgba(128,226,183,.07); }
.field-textarea { resize: vertical; min-height: 140px; line-height: 1.5; }
.primary-button { margin-top: 18px; width: 100%; border: 0; border-radius: 13px; padding: 12px 15px; cursor: pointer; color: #07120e; background: linear-gradient(135deg, #9ef0cd, #6fd6a8); font-weight: 850; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.modal-actions .ghost-button, .modal-actions .primary-button { width: auto; margin: 0; }

@media (max-width: 620px) {
  .toolbar { align-items: flex-start; gap: 12px; }
  .toolbar-actions { flex-wrap: wrap; justify-content: flex-end; }
  .card-actions.with-admin { grid-template-columns: 1fr; }
  .edit-button { width: 100%; }
  .modal-backdrop { padding: 12px; }
  .modal { padding: 18px; border-radius: 18px; }
}

/* v3.4: editable server name/address + safe lightweight Markdown rendering */
.connection-panel {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(255,255,255,.026);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.connection-panel > div {
  min-width: 0;
  display: grid;
  gap: 4px;
}
.connection-panel span {
  color: var(--muted);
  font-size: 12px;
}
.connection-panel strong {
  color: var(--text);
  font-size: 14px;
  overflow-wrap: anywhere;
}
.copy-address {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  background: rgba(255,255,255,.04);
  color: var(--text);
  font-weight: 700;
  font-size: 12px;
}
.copy-address:hover { background: rgba(255,255,255,.08); }
.markdown-body { white-space: normal; }
.markdown-body strong { color: #f3f7fa; font-weight: 800; }
.markdown-body em { color: #d9e2e7; }
.markdown-body code,
.field-help code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .92em;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 6px;
  padding: 1px 5px;
  background: rgba(255,255,255,.045);
}
.md-line { min-height: 1.25em; }
.md-spacer { height: .8em; }
.md-list {
  margin: 6px 0 6px 20px;
  padding: 0;
  display: grid;
  gap: 3px;
}
.md-heading {
  margin: 10px 0 6px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.35;
}
.muted-text { color: var(--muted); }
.field-help {
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}


/* v3.5: cards no longer stretch to the height of an opened description */
.server-grid { align-items: start; }
.server-card { align-self: start; }
.status-pill.starting { color: #ffe4a3; background: rgba(255,210,123,.08); border-color: rgba(255,210,123,.2); }
.status-pill.starting span { background: var(--warn); box-shadow: 0 0 12px rgba(255,210,123,.55); animation: pulse-starting 1.15s ease-in-out infinite; }
.server-card.starting::after { background: var(--warn); }
@keyframes pulse-starting { 0%,100% { opacity: .45; transform: scale(.85); } 50% { opacity: 1; transform: scale(1.12); } }

/* v3.9: configurable Auto-Off */
.autooff-editor {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(128,226,183,.035);
}
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  cursor: pointer;
}
.switch-row > span {
  display: grid;
  gap: 3px;
}
.switch-row strong {
  color: var(--text);
  font-size: 14px;
}
.switch-row small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}
.switch-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: #80e2b7;
  flex: 0 0 auto;
}
.autooff-test-button {
  width: 100%;
  margin-top: 12px;
}
.autooff-test-button:disabled {
  opacity: .45;
  cursor: not-allowed;
}
