:root {
  --ink: var(--platform-text, #e8eaef);
  --ink-soft: var(--platform-text-muted, #94a3b8);
  --muted: var(--platform-text-muted, #94a3b8);
  --line: var(--platform-border, #2a3140);
  --paper: var(--platform-bg, #0b0d12);
  --panel: var(--platform-surface, #161a22);
  --accent: #0f5c4c;
  --accent-soft: rgba(15, 92, 76, 0.2);
  --warn: #d4a574;
  --shadow: none;
  --font: "DM Sans", system-ui, sans-serif;
  --serif: "Libre Baskerville", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --radius: 12px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(ellipse 70% 45% at 100% 0%, rgba(15, 92, 76, 0.18), transparent 55%),
    radial-gradient(ellipse 50% 40% at 0% 100%, rgba(212, 165, 116, 0.08), transparent 50%),
    linear-gradient(165deg, #0c1010 0%, var(--paper) 50%, #0e1412 100%);
  background-attachment: fixed;
}

a {
  color: var(--accent);
}

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  margin-bottom: 1.25rem;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.brand-link {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.brand-sep {
  color: var(--muted);
}

.quiet-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
}

.quiet-link:hover {
  text-decoration: underline;
}

.tagline {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 3rem;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: none;
  padding: 1.1rem 1.15rem 1.2rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.form-grid label,
.stack-label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.form-grid .full,
.stack-label.full {
  grid-column: 1 / -1;
}

input,
select,
textarea {
  font: inherit;
  font-size: 0.95rem;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
  background: #fff;
  width: 100%;
}

textarea {
  min-height: 88px;
  resize: vertical;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.9rem;
}

.btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.55rem 0.9rem;
  border-radius: 8px;
  cursor: pointer;
  min-height: 2.5rem;
}

.btn:hover {
  border-color: #b7c7bc;
  color: var(--ink);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #f4faf8;
}

.btn-primary:hover {
  background: #0c4a3d;
  color: #fff;
}

.btn-danger {
  color: #8b2e2e;
  border-color: #e2c4c4;
  background: #fff8f8;
  padding: 0.35rem 0.55rem;
  font-size: 0.8rem;
}

.card-head h2 {
  margin: 0 0 0.35rem;
  font-family: var(--serif);
  font-size: 1.2rem;
}

.hint {
  margin: 0 0 0.85rem;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.preview-panel {
  background: #1e2421;
  border-color: #2c3530;
  color: #e8efe9;
}

.preview-panel .card-head h2,
.preview-panel .hint {
  color: #9aaba0;
}

.preview {
  margin: 0;
  white-space: pre-wrap;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.55;
  color: #e8efe9;
  overflow-x: auto;
  max-height: 70vh;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.9rem;
}

.tab {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
}

.tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #f4faf8;
}

.line-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin: 0.75rem 0;
}

.line-row {
  display: grid;
  grid-template-columns: 1.4fr 0.5fr 0.7fr 0.7fr auto;
  gap: 0.4rem;
  align-items: center;
}

.hub-hero h1 {
  margin: 0.25rem 0 0.75rem;
  font-family: var(--serif);
  font-size: clamp(2rem, 4vw, 2.8rem);
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.eyebrow {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.lede {
  margin: 0 0 1.75rem;
  max-width: 38rem;
  color: var(--ink-soft);
  font-size: 1.05rem;
  line-height: 1.55;
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.app-card {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 1.2rem 1.25rem 1.3rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: none;
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
  min-height: 8.5rem;
}

.app-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  background: color-mix(in srgb, var(--accent) 8%, var(--panel));
}

.app-card h2 {
  margin: 0;
  font-family: var(--font);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
}

.app-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.45;
  flex: 1;
}

.app-card .go {
  display: none;
}

.app-card.ref {
  background: color-mix(in srgb, var(--accent) 10%, var(--panel));
}

@media (max-width: 900px) {
  .grid-2,
  .form-grid,
  .line-row {
    grid-template-columns: 1fr;
  }

  body.has-platform-topbar .actions {
    position: sticky;
    bottom: 0;
    z-index: 5;
    margin: 1rem -0.25rem 0;
    padding: 0.75rem 0.25rem calc(0.75rem + env(safe-area-inset-bottom, 0));
    background: color-mix(in srgb, var(--paper) 92%, transparent);
    backdrop-filter: blur(8px);
    border-top: 1px solid var(--line);
  }

  body.has-platform-topbar .actions .btn-primary {
    flex: 1 1 auto;
  }
}
