/*
  shadcn/ui — New York, zinc, CSS variables.
  Tokens match sugma-installer/src/index.css (style: new-york, baseColor: zinc).
  Components follow Button, Card, Badge, Alert, and Separator in that app.
  Icons are vendored Lucide strokes (templates/partials/icons.html).
*/

:root {
    --background: oklch(0.145 0 0);
    --foreground: oklch(0.985 0 0);
    --card: oklch(0.205 0 0);
    --card-foreground: oklch(0.985 0 0);
    --popover: oklch(0.205 0 0);
    --popover-foreground: oklch(0.985 0 0);
    --primary: oklch(0.922 0 0);
    --primary-foreground: oklch(0.205 0 0);
    --secondary: oklch(0.269 0 0);
    --secondary-foreground: oklch(0.985 0 0);
    --muted: oklch(0.269 0 0);
    --muted-foreground: oklch(0.708 0 0);
    --accent: oklch(0.269 0 0);
    --accent-foreground: oklch(0.985 0 0);
    --destructive: oklch(0.704 0.191 22.216);
    --border: oklch(1 0 0 / 10%);
    --input: oklch(1 0 0 / 15%);
    --ring: oklch(0.556 0 0);
    --radius: 0.5rem;
    --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

* { border-color: var(--border); }

html { color-scheme: dark; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--background);
    color: var(--foreground);
    font-family: ui-sans-serif, system-ui, "Segoe UI", sans-serif;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

::selection {
    background: var(--primary);
    color: var(--primary-foreground);
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

code, kbd, samp {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.8125rem;
    color: var(--foreground);
    background: var(--muted);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 4px);
    padding: 0.05rem 0.35rem;
}

.icon-sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

.icon {
    width: 1rem;
    height: 1rem;
    display: inline-block;
    vertical-align: -0.125em;
    flex-shrink: 0;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Pointer opt-in from the shadcn Button docs (websites, not the desktop app). */
button:not(:disabled),
[role="button"]:not(:disabled),
.btn { cursor: pointer; }

/* Button — sugma-installer button.tsx, New York */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    white-space: nowrap;
    border-radius: calc(var(--radius) - 2px);
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.25;
    height: 2.25rem;
    padding: 0.5rem 1rem;
    border: 1px solid transparent;
    background: transparent;
    color: var(--foreground);
    text-decoration: none;
    user-select: none;
    transition: background-color 150ms, color 150ms, border-color 150ms, box-shadow 150ms, opacity 150ms;
}

.btn svg { pointer-events: none; flex-shrink: 0; }
.btn:has(svg):not(.btn-icon) { padding-inline: 0.75rem; }

.btn:focus-visible {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 50%, transparent);
}

.btn:disabled,
.btn.disabled {
    pointer-events: none;
    opacity: 0.5;
}

.btn-default {
    background: var(--primary);
    color: var(--primary-foreground);
}

.btn-default:hover { background: color-mix(in oklch, var(--primary) 90%, transparent); }

.btn-outline {
    border-color: var(--input);
    background: color-mix(in oklch, var(--input) 30%, transparent);
    box-shadow: var(--shadow-xs);
    color: var(--foreground);
}

.btn-outline:hover { background: color-mix(in oklch, var(--input) 50%, transparent); }

.btn-secondary {
    background: var(--secondary);
    color: var(--secondary-foreground);
}

.btn-secondary:hover { background: color-mix(in oklch, var(--secondary) 80%, transparent); }

.btn-ghost { background: transparent; color: var(--foreground); }
.btn-ghost:hover { background: color-mix(in oklch, var(--accent) 50%, transparent); color: var(--accent-foreground); }

.btn-link {
    height: auto;
    padding: 0;
    color: var(--primary);
    text-underline-offset: 4px;
}
.btn-link:hover { text-decoration: underline; background: transparent; }

.btn-sm { height: 2rem; gap: 0.375rem; padding: 0 0.75rem; border-radius: calc(var(--radius) - 2px); }
.btn-sm:has(svg):not(.btn-icon) { padding-inline: 0.625rem; }
.btn-lg { height: 2.5rem; padding: 0 1.5rem; border-radius: calc(var(--radius) - 2px); }
.btn-lg:has(svg):not(.btn-icon) { padding-inline: 1rem; }
.btn-icon { width: 2.25rem; height: 2.25rem; padding: 0; }
.btn-icon.btn-sm { width: 2rem; height: 2rem; }

a.btn { text-decoration: none; }
.btn.justify-start { justify-content: flex-start; }
.btn.w-full { min-width: 0; max-width: 100%; }
.btn .badge { pointer-events: none; }

/* Card — sugma-installer card.tsx */
.card {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding-block: 1.5rem;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 4px);
    background: var(--card);
    color: var(--card-foreground);
    box-shadow: var(--shadow-xs);
}

.card-table {
    padding-block: 0;
    gap: 0;
    overflow: hidden;
}

.card-header {
    display: grid;
    gap: 0.375rem;
    padding: 0 1.5rem;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: -0.025em;
    line-height: 1.2;
}

.card-description {
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

.card-content { padding: 0 1.5rem; }

.card-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 0 1.5rem;
    color: var(--muted-foreground);
    font-size: 0.75rem;
}

body .card > :not([data-slot]):not(.overflow-x-auto):not(.alert) {
    padding-inline: 1.5rem;
}

body .card > .alert { margin-inline: 1.5rem; }

.card h1,
.card h2,
.card h3,
.card summary {
    color: var(--foreground);
    font-weight: 600;
    letter-spacing: -0.025em;
}

.card h1 { font-size: 1.5rem; line-height: 1.2; }
.card h2 { font-size: 1.125rem; line-height: 1.3; }
.card h3,
.card summary { font-size: 0.875rem; }

.card p,
.card li,
.card td {
    font-size: 0.875rem;
    line-height: 1.55;
}

/* Badge — sugma-installer badge.tsx */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    gap: 0.25rem;
    overflow: hidden;
    border-radius: calc(var(--radius) - 2px);
    border: 1px solid transparent;
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.3;
    white-space: nowrap;
    background: var(--primary);
    color: var(--primary-foreground);
    transition: color 150ms, box-shadow 150ms;
}

.badge:focus-visible {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 50%, transparent);
}

.badge-secondary {
    background: var(--secondary);
    color: var(--secondary-foreground);
}

.badge-outline {
    background: transparent;
    border-color: var(--border);
    color: var(--foreground);
}

.badge-destructive {
    background: color-mix(in oklch, var(--destructive) 60%, transparent);
    color: #fff;
}

/* Alert — sugma-installer alert.tsx */
.alert {
    position: relative;
    display: grid;
    width: auto;
    grid-template-columns: 0 1fr;
    align-items: start;
    row-gap: 0.125rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--card-foreground);
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
}

.alert:has(> svg) {
    grid-template-columns: 1rem 1fr;
    column-gap: 0.75rem;
}

.alert > svg,
.alert > .icon {
    width: 1rem;
    height: 1rem;
    margin-top: 0.125rem;
    color: currentColor;
    grid-row: span 2;
}

.alert-title {
    grid-column: 2;
    min-height: 1rem;
    font-weight: 500;
    letter-spacing: -0.025em;
    line-height: 1.25;
    color: var(--foreground);
}

.alert-description {
    grid-column: 2;
    color: var(--muted-foreground);
    font-size: 0.875rem;
}

.alert-description p { margin: 0; line-height: 1.6; }
.alert-description ol,
.alert-description ul { margin: 0.25rem 0 0; }

/* Separator — sugma-installer separator.tsx */
.separator {
    flex-shrink: 0;
    background: var(--border);
    height: 1px;
    width: 100%;
}

.separator-v {
    flex-shrink: 0;
    background: var(--border);
    width: 1px;
    align-self: center;
    height: 1rem;
}

/* Input */
.field-label {
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.25;
    color: var(--foreground);
}

.input {
    height: 2.25rem;
    width: 100%;
    border-radius: calc(var(--radius) - 2px);
    border: 1px solid var(--input);
    background: transparent;
    color: var(--foreground);
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.25;
    outline: none;
    box-shadow: var(--shadow-xs);
}

select.input {
    appearance: none;
    padding-right: 2rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
    background-size: 1rem;
}

.input:focus-visible {
    border-color: var(--ring);
    box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 50%, transparent);
}

.input::placeholder { color: var(--muted-foreground); }

/* Table — shadcn table: muted header, row borders */
body .data-table {
    width: 100%;
    border-collapse: collapse;
    caption-side: bottom;
    font-size: 0.875rem;
    text-align: left;
}

body .data-table caption {
    padding: 0.75rem;
    caption-side: bottom;
    color: var(--muted-foreground);
    font-size: 0.75rem;
}

body .data-table thead { background: transparent; }

body .data-table thead tr { border-bottom: 1px solid var(--border); }

body .data-table th {
    height: 2.5rem;
    padding: 0 0.75rem;
    text-align: left;
    vertical-align: middle;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0;
    color: var(--muted-foreground);
    white-space: nowrap;
}

body .data-table td {
    padding: 0.5rem 0.75rem;
    vertical-align: middle;
    color: var(--muted-foreground);
}

body .data-table td:first-child {
    font-weight: 500;
    color: var(--foreground);
}

body .data-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background-color 150ms;
}

body .data-table tbody tr:last-child { border-bottom: 0; }

body .data-table tbody tr:hover {
    background: color-mix(in oklch, var(--muted) 50%, transparent);
}

body .table-head {
    height: 2.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--muted-foreground);
}

/* Page shell */
.page-header {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.page-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.025em;
    line-height: 1.2;
    color: var(--foreground);
}

#hero-title {
    font-size: clamp(2rem, 4vw, 2.25rem);
    line-height: 1.1;
}

.page-description {
    margin: 0;
    max-width: 42rem;
    font-size: 0.875rem;
    line-height: 1.55;
    color: var(--muted-foreground);
}

.section-title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: -0.025em;
    line-height: 1.3;
    color: var(--foreground);
}

.subsection-title {
    margin: 1.25rem 0 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: -0.025em;
    color: var(--foreground);
}

.toc-heading {
    margin: 0 0 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted-foreground);
}

.stat {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 2px);
    background: color-mix(in oklch, var(--muted) 35%, transparent);
    padding: 0.75rem 1rem;
}

body .stat p { margin: 0; }

.callout {
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 2px);
    background: color-mix(in oklch, var(--muted) 45%, transparent);
    padding: 1rem;
    font-size: 0.875rem;
}

.collapsible {
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 2px);
    background: transparent;
    padding: 0.75rem 1rem;
}

.feature {
    border-left: 1px solid var(--border);
    padding-left: 0.75rem;
}

.empty-state {
    display: flex;
    min-height: 8rem;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

.empty-state[hidden] { display: none; }

/* Tabs — shadcn tabs list / trigger */
.tabs-list {
    border-radius: calc(var(--radius) - 2px);
    background: var(--muted);
    padding: 0.25rem;
    color: var(--muted-foreground);
}

.tabs-trigger,
.pack-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    height: 2rem;
    border: 0;
    border-radius: calc(var(--radius) - 4px);
    background: transparent;
    color: var(--muted-foreground);
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
}

.tabs-trigger:hover,
.pack-tab:hover { color: var(--foreground); }

.tabs-trigger:focus-visible,
.pack-tab:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 50%, transparent);
}

.tabs-trigger[aria-selected="true"],
.pack-tab[aria-selected="true"] {
    background: var(--background);
    color: var(--foreground);
    box-shadow: var(--shadow-xs);
}

/* Site chrome */
.skip-link {
    position: absolute;
    left: 0.75rem;
    top: -3rem;
    z-index: 80;
    border-radius: calc(var(--radius) - 2px);
    background: var(--primary);
    color: var(--primary-foreground);
    padding: 0.4rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
}

.skip-link:focus { top: 0.5rem; }

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    border-bottom: 1px solid var(--border);
    background: color-mix(in oklch, var(--background) 80%, transparent);
    backdrop-filter: blur(8px);
}

.site-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: -0.025em;
    color: var(--foreground);
    text-decoration: none;
}

.site-brand:focus-visible,
.footer-link:focus-visible,
.toc-link:focus-visible {
    outline: none;
    border-radius: calc(var(--radius) - 2px);
    box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 50%, transparent);
}

.site-nav a[aria-current="page"],
#mobile-nav a[aria-current="page"] {
    background: var(--accent);
    color: var(--accent-foreground);
}

.site-footer {
    margin-top: auto;
    border-top: 1px solid var(--border);
    color: var(--muted-foreground);
    font-size: 0.875rem;
}

.footer-link {
    color: var(--muted-foreground);
    font-size: 0.875rem;
    text-decoration: none;
}

.footer-link:hover { color: var(--foreground); }

#mobile-nav { display: none; }
#mobile-nav.active {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    border-top: 1px solid var(--border);
    padding: 0.5rem;
}

@media (min-width: 768px) {
    #mobile-nav { display: none !important; }
}

.hero-grid {
    display: grid;
    gap: 2.5rem;
    align-items: center;
}

@media (min-width: 1024px) {
    .hero-grid { grid-template-columns: minmax(0, 1fr) 22rem; }
}

.item-list { margin: 0; }

.item {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}

.item:first-child { padding-top: 0; }
.item:last-child { border-bottom: 0; padding-bottom: 0; }

.item dt { color: var(--muted-foreground); }

.item dd {
    margin: 0;
    font-weight: 500;
    color: var(--foreground);
}

.step-list {
    margin: 0;
    padding-left: 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    color: var(--muted-foreground);
    font-size: 0.875rem;
}

.step-list strong {
    color: var(--foreground);
    font-weight: 500;
}

.choice-grid,
.pair-grid {
    display: grid;
    gap: 0.75rem;
}

@media (min-width: 768px) {
    .choice-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .pair-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.choice-card {
    gap: 0.75rem;
    height: 100%;
}

.choice-card .card-header { gap: 0.5rem; }

.choice-card .card-description { margin: 0; }

.scan-steps {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 4px);
    background: var(--card);
}

.scan-step {
    display: grid;
    grid-template-columns: 1.75rem minmax(0, 1fr) auto;
    gap: 0.75rem;
    align-items: center;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--border);
}

.scan-step:last-child { border-bottom: 0; }

@media (max-width: 520px) {
    .scan-step { grid-template-columns: 1.75rem minmax(0, 1fr); }
    .scan-step .badge { grid-column: 2; justify-self: start; }
}

.scan-num {
    display: grid;
    place-items: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: calc(var(--radius) - 2px);
    background: var(--secondary);
    color: var(--secondary-foreground);
    font-size: 0.75rem;
    font-weight: 600;
}

.scan-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--foreground);
}

.scan-detail {
    margin-top: 0.1rem;
    font-size: 0.8125rem;
    color: var(--muted-foreground);
}

.guide-table td:first-child {
    font-weight: 500;
    color: var(--foreground);
    white-space: nowrap;
}

/* Static replica of the Sugma launcher window. */
.launcher {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 4px);
    background: var(--background);
    box-shadow: var(--shadow-xs);
}

.launcher-bar {
    display: flex;
    height: 3rem;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border);
    padding: 0 1rem;
}

.launcher-title {
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1;
}

.launcher-sub {
    margin-top: 0.2rem;
    color: var(--muted-foreground);
    font-size: 0.75rem;
    line-height: 1;
}

.launcher-body {
    display: grid;
    gap: 0.75rem;
    padding: 0.75rem;
}

@media (min-width: 900px) {
    .launcher-body.split { grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); }
}

.launcher .card { gap: 0.75rem; padding-block: 0.75rem; }
.launcher .btn { width: 100%; }
.launcher .btn.btn-sm,
.launcher .btn-row .btn { width: auto; }
.launcher .btn-row { display: flex; gap: 0.5rem; }
.launcher .btn-row .btn { flex: 1; }

.launcher[inert] { cursor: default; }
.launcher[inert] .btn { pointer-events: none; }

.server-btn.selected {
    background: var(--accent);
    color: var(--accent-foreground);
}

.sign-code {
    border: 1px dashed var(--border);
    border-radius: calc(var(--radius) - 2px);
    padding: 0.5rem 0.75rem;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: 0.2em;
}

.alert-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.alert-stack {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.fake-field {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--foreground);
}

.fake-box {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    border: 1px solid var(--input);
    border-radius: 4px;
    background: transparent;
}

.fake-box[data-checked="true"] {
    background: var(--primary);
    border-color: var(--primary);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2318181b' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
    background-size: 0.75rem;
    background-position: center;
    background-repeat: no-repeat;
}

.launcher input[type="range"] {
    width: 100%;
    accent-color: var(--foreground);
}

.screen-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.launcher-stage {
    display: flex;
    min-height: 28rem;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1.5rem 1rem;
    text-align: center;
}

.mark {
    display: flex;
    width: 3rem;
    height: 3rem;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
}

.mark-ok { background: var(--primary); color: var(--primary-foreground); }
.mark-bad { background: color-mix(in oklch, var(--destructive) 15%, transparent); color: var(--destructive); }

.summary-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border);
    padding: 0.4rem 0;
    font-size: 0.875rem;
}

.summary-row:last-child { border-bottom: 0; }
.summary-row dt { color: var(--muted-foreground); }
.summary-row dd { margin: 0; text-align: right; }

.spec-chip {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 2px);
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.server-status.online { color: oklch(0.8 0.12 150); }

.step {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 0.5rem;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}

.step.pending { opacity: 0.55; }
.step .icon { display: block; width: 18px; height: 18px; }
.step .icon svg { display: none; width: 14px; height: 14px; }
.step.pending .icon-pending,
.step.running .icon-running,
.step.complete .icon-complete,
.step.error .icon-error { display: block; }
.step.running .icon-running { animation: step-spin 1s linear infinite; }
.step.complete .icon { color: oklch(0.8 0.12 150); }
.step.error .icon { color: var(--destructive); }
.step .details {
    grid-column: 2;
    color: var(--muted-foreground);
    font-size: 0.75rem;
}

@keyframes step-spin { to { transform: rotate(360deg); } }

.progress-bar {
    height: 8px;
    flex: 1;
    overflow: hidden;
    border-radius: 999px;
    background: var(--secondary);
}

.progress-bar-fill {
    height: 100%;
    background: var(--foreground);
}

.gfx-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 16px;
    background: transparent;
}

.gfx-slider::-webkit-slider-runnable-track {
    height: 6px;
    background: var(--secondary);
    border-radius: 999px;
}

.gfx-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 16px;
    width: 16px;
    margin-top: -5px;
    border: none;
    border-radius: 999px;
    background: var(--foreground);
}

.gfx-slider::-moz-range-track {
    height: 6px;
    background: var(--secondary);
    border-radius: 999px;
}

.gfx-slider::-moz-range-thumb {
    height: 16px;
    width: 16px;
    border: none;
    border-radius: 999px;
    background: var(--foreground);
}

.config-item {
    border: 1px solid transparent;
    border-radius: calc(var(--radius) - 2px);
    padding: 0.4rem 0.5rem;
    font-size: 0.875rem;
}

.config-item.selected { background: var(--accent); border-color: var(--border); }

.widget-grid {
    display: grid;
    gap: 0.75rem;
}

@media (min-width: 768px) {
    .widget-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .widget-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.link-grid {
    display: grid;
    gap: 1rem;
}

@media (min-width: 768px) {
    .link-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

a.card-link {
    color: inherit;
    text-decoration: none;
    transition: background-color 150ms, border-color 150ms;
}

a.card-link:hover {
    background: color-mix(in oklch, var(--accent) 55%, var(--card));
}

a.card-link:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 50%, transparent);
}

@media (max-width: 639px) {
    .hero-actions .btn { width: 100%; }
}

.toc-link {
    display: block;
    border-radius: calc(var(--radius) - 2px);
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    color: var(--muted-foreground);
    text-decoration: none;
}

.toc-link:hover,
.toc-link.active {
    background: var(--accent);
    color: var(--accent-foreground);
}

#scroll-top { z-index: 40; }

details summary {
    cursor: pointer;
    list-style: none;
    user-select: none;
}

details summary::-webkit-details-marker { display: none; }

details summary::before {
    content: "";
    display: inline-block;
    width: 0.4rem;
    height: 0.4rem;
    margin-right: 0.55rem;
    border-right: 1.5px solid var(--muted-foreground);
    border-bottom: 1.5px solid var(--muted-foreground);
    transform: rotate(-45deg) translateY(-1px);
    vertical-align: middle;
}

details[open] summary::before { transform: rotate(45deg) translateY(-1px); }
details[open] summary { margin-bottom: 0.75rem; }

@keyframes feedback-fade {
    0% { opacity: 0; }
    15% { opacity: 1; }
    75% { opacity: 1; }
    100% { opacity: 0; }
}

.feedback-anim { animation: feedback-fade 1.6s ease forwards; }

@media (prefers-reduced-motion: reduce) {
    .feedback-anim { animation: none; }
}

/* Author display:grid on tr overrides the hidden attribute. Keep filtered rows hidden. */
tr[hidden],
#modpack-table tr[hidden] {
    display: none !important;
}

.pack-sort .btn {
    min-height: 2.75rem;
    padding-inline: 0.9rem;
}

.tabs-scroll {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 0.25rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scroll-padding-inline: 0.25rem;
}

.tabs-scroll::-webkit-scrollbar { height: 4px; }

.tabs-scroll::after {
    content: "";
    flex: 0 0 0.25rem;
}

.tabs-scroll .tabs-trigger {
    flex: 0 0 auto;
    width: auto;
    min-height: 2.75rem;
    height: auto;
    padding: 0.375rem 0.9rem;
    white-space: nowrap;
}

@media (min-width: 768px) {
    .tabs-scroll .tabs-trigger { flex: 1 1 0; }
    .tabs-scroll::after { content: none; }
}

.toc-scroll {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
    padding-bottom: 0.15rem;
}

.toc-scroll::-webkit-scrollbar { height: 4px; }

.toc-scroll::after {
    content: "";
    flex: 0 0 0.25rem;
}

.toc-scroll .toc-link {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    min-height: 2.75rem;
    white-space: nowrap;
    scroll-snap-align: start;
    border: 1px solid var(--border);
    background: var(--card);
    padding: 0.5rem 0.9rem;
}

@media (min-width: 1024px) {
    .toc-scroll { display: none !important; }
}

@media (max-width: 767px) {
    #modpack-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        clip-path: inset(50%);
        white-space: nowrap;
        border: 0;
    }

    #modpack-table,
    #modpack-table tbody {
        display: block;
        width: 100%;
    }

    #modpack-table tbody tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "name download"
            "version kind"
            "note note";
        column-gap: 0.75rem;
        row-gap: 0.35rem;
        align-items: center;
        width: 100%;
        padding: 0.85rem 1rem;
    }

    #modpack-table tbody td {
        display: block;
        min-width: 0;
        padding: 0;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    #modpack-table tbody td:nth-child(1) { grid-area: name; }
    #modpack-table tbody td:nth-child(2) { grid-area: version; }
    #modpack-table tbody td:nth-child(3) { grid-area: kind; justify-self: end; }
    #modpack-table tbody td:nth-child(4) {
        grid-area: note;
        display: block !important;
    }
    #modpack-table tbody td:nth-child(5) { grid-area: download; justify-self: end; }
}

@media (max-width: 639px) {
    .launcher-bar {
        height: auto;
        flex-wrap: wrap;
        align-items: center;
        row-gap: 0.4rem;
        padding-top: 0.65rem;
        padding-bottom: 0.65rem;
    }

    .launcher-bar .badge {
        max-width: 100%;
        overflow: visible;
        white-space: normal;
    }

    .launcher .btn-row {
        flex-direction: column;
        align-items: stretch;
    }

    .launcher .btn-row .btn {
        width: 100%;
        flex: none;
        height: auto;
        min-height: 2.75rem;
        white-space: normal;
        text-align: center;
    }

    .launcher .card-content > .flex { flex-wrap: wrap; }

    .launcher .alert-row {
        flex-direction: column;
        align-items: stretch;
    }

    .launcher .alert-row > .btn {
        width: 100%;
    }

    .summary-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.15rem;
    }

    .summary-row dd { text-align: left; }

    .sign-code {
        max-width: 100%;
        font-size: 1.125rem;
        letter-spacing: 0.08em;
        overflow-wrap: anywhere;
    }

    .launcher-stage {
        min-height: 0;
        padding: 1.25rem 0.75rem;
    }
}
