.shell-body {
    --ui-bg: #f8f6f2;
    --ui-paper: #fcfbf9;
    --ui-paper-2: #ffffff;
    --ui-ink: #48423b;
    --ui-muted: #9b9288;
    --ui-line: #ece7e0;
    --ui-accent: #a8836f;
    --ui-font: "Avenir Next", "Segoe UI", "Gill Sans", system-ui, sans-serif;
    --ui-serif: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;

    min-height: 100vh;
    margin: 0;
    color: var(--ui-ink);
    font-family: var(--ui-font);
    background-color: var(--ui-bg);
    background-image:
        radial-gradient(ellipse at 0% 0%, rgba(168, 131, 111, 0.02), transparent 48%),
        radial-gradient(ellipse at 100% 100%, rgba(120, 100, 80, 0.025), transparent 52%),
        linear-gradient(180deg, #faf8f5 0%, #f5f2ed 100%);
}

.shell-page {
    width: min(920px, calc(100% - 48px));
    margin: 0 auto;
    padding: 72px 0 64px;
}

.shell-page--narrow {
    width: min(420px, calc(100% - 48px));
}

.shell-kicker {
    margin: 0 0 10px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ui-muted);
}

.shell-head h1 {
    margin: 0;
    font-family: var(--ui-serif);
    font-size: 42px;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.shell-lead {
    margin: 14px 0 0;
    max-width: 36em;
    color: var(--ui-muted);
    font-size: 16px;
    line-height: 1.5;
}

.shell-lead code {
    font-size: 0.92em;
}

.shell-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-top: 40px;
}

.shell-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 180px;
    padding: 22px 24px;
    text-decoration: none;
    color: inherit;
    background: var(--ui-paper-2);
    border: 1px solid var(--ui-line);
    border-radius: 16px;
    box-shadow: 0 12px 28px rgba(62, 50, 40, 0.045);
}

.shell-card:hover {
    border-color: var(--ui-accent);
}

.shell-card-kicker {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ui-muted);
}

.shell-card strong {
    font-family: var(--ui-serif);
    font-size: 28px;
    font-weight: 600;
}

.shell-card span:last-child {
    color: var(--ui-muted);
    font-size: 15px;
    line-height: 1.45;
}

.shell-foot {
    margin: 28px 0 0;
}

.shell-text-btn {
    padding: 0;
    border: 0;
    background: none;
    color: var(--ui-muted);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.shell-text-btn:hover {
    color: var(--ui-accent);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 32px;
    padding: 24px;
    background: var(--ui-paper-2);
    border: 1px solid var(--ui-line);
    border-radius: 16px;
    box-shadow: 0 12px 28px rgba(62, 50, 40, 0.045);
}

.login-form label {
    font-size: 13px;
    font-weight: 600;
}

.login-form input {
    height: 44px;
    padding: 0 12px;
    border: 1px solid var(--ui-line);
    border-radius: 8px;
    background: var(--ui-paper);
    color: var(--ui-ink);
    font: inherit;
    font-size: 16px;
}

.login-form input:focus {
    outline: 2px solid color-mix(in srgb, var(--ui-accent) 45%, transparent);
    border-color: var(--ui-accent);
}

.login-form button[type="submit"] {
    margin-top: 8px;
    height: 44px;
    border: 0;
    border-radius: 8px;
    background: var(--ui-accent);
    color: #fffcf8;
    font: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}

.login-form button[type="submit"]:hover {
    filter: brightness(0.95);
}

.login-form button[type="submit"]:disabled {
    opacity: 0.6;
    cursor: default;
}

.login-error {
    margin: 0;
    color: #9a2f2f;
    font-size: 13px;
    font-weight: 600;
}

@media (max-width: 700px) {
    .shell-cards {
        grid-template-columns: 1fr;
    }

    .shell-head h1 {
        font-size: 34px;
    }
}

.shell-kits { margin: 28px 0 0; padding: 20px 22px; border: 1px solid var(--shell-line, rgba(127,127,127,.3)); border-radius: 14px; }
.shell-kits h2 { margin: 0 0 6px; font-size: 17px; }
.shell-kits p { margin: 0 0 14px; font-size: 13.5px; opacity: .75; }
.shell-kit-list { display: flex; flex-wrap: wrap; gap: 10px; }
.shell-kit-btn { display: inline-flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 10px; border: 1px solid currentColor; background: transparent; color: inherit; font: inherit; font-weight: 600; cursor: pointer; }
.shell-kit-btn img { height: 24px; max-width: 80px; object-fit: contain; }

/* ---------------------------------------------------------------------------
   Home ("What do you want to do?") and new-deck steps
   presentation.css is loaded for the slide thumbnails; it sets body to the
   deck background with overflow hidden, so the shell takes both back here. */
.shell-body {
    --ui-text-2: #6f665c; /* secondary text that still reads at 5:1 on the paper */
    --ui-focus: color-mix(in srgb, var(--ui-accent) 55%, transparent);
    overflow: auto;
}

.shell-page--home {
    width: min(1040px, calc(100% - 32px));
    padding-top: 56px;
}

.shell-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid var(--ui-line);
    border-radius: 10px;
    background: var(--ui-paper-2);
    color: var(--ui-ink);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.shell-btn:hover { border-color: var(--ui-accent); color: var(--ui-accent); }
.shell-btn--primary { background: var(--ui-accent); border-color: var(--ui-accent); color: #fffcf8; }
.shell-btn--primary:hover { background: #94705d; border-color: #94705d; color: #fffcf8; }
.shell-btn--small { min-height: 30px; padding: 0 12px; font-size: 13px; }
.shell-body :is(button, a, input, textarea):focus-visible { outline: 2px solid var(--ui-focus); outline-offset: 2px; }

.home-grid {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: 20px;
    margin-top: 36px;
    align-items: start;
}

.home-new {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    min-height: 280px;
    padding: 28px;
    border: 1px solid var(--ui-accent);
    border-radius: 18px;
    background: linear-gradient(160deg, #fffdfa 0%, #f6efe7 100%);
    color: var(--ui-ink);
    font: inherit;
    text-align: left;
    cursor: pointer;
    box-shadow: 0 14px 32px rgba(62, 50, 40, 0.07);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.home-new:hover { transform: translateY(-2px); box-shadow: 0 18px 40px rgba(62, 50, 40, 0.11); }
.home-new-plus {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    margin-bottom: auto;
    border-radius: 14px;
    background: var(--ui-accent);
    color: #fffcf8;
    font-size: 28px;
    line-height: 1;
}
.home-new strong { font-family: var(--ui-serif); font-size: 28px; font-weight: 600; line-height: 1.15; }
.home-new span:last-child { color: var(--ui-text-2); font-size: 15px; line-height: 1.5; }

.home-continue {
    padding: 22px 24px;
    border: 1px solid var(--ui-line);
    border-radius: 18px;
    background: var(--ui-paper-2);
    box-shadow: 0 12px 28px rgba(62, 50, 40, 0.045);
}
.home-continue h2 { margin: 0 0 14px; font-family: var(--ui-serif); font-size: 20px; font-weight: 600; }
.home-sub { margin: 18px 0 10px; font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ui-text-2); }
.home-empty { margin: 0; color: var(--ui-text-2); font-size: 15px; }

.home-deck {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    gap: 16px;
    align-items: center;
    padding: 10px;
    border: 1px solid var(--ui-line);
    border-radius: 12px;
    color: inherit;
    text-decoration: none;
}
.home-deck:hover { border-color: var(--ui-accent); }
.home-deck-info { display: grid; gap: 4px; min-width: 0; }
.home-deck-info strong { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-deck-info span { color: var(--ui-text-2); font-size: 13px; }

.home-recent { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.home-recent-item {
    display: grid;
    gap: 8px;
    width: 100%;
    padding: 8px;
    border: 1px solid var(--ui-line);
    border-radius: 10px;
    background: var(--ui-paper);
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.home-recent-item:hover { border-color: var(--ui-accent); }
.home-recent-item > span { display: grid; gap: 2px; min-width: 0; }
.home-recent-item strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-recent-item > span > span { color: var(--ui-text-2); font-size: 12px; }

.home-open { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 18px; }
.home-open-hint { color: var(--ui-text-2); font-size: 13px; }

.home-secondary { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
.home-action {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    border: 1px solid var(--ui-line);
    border-radius: 12px;
    background: var(--ui-paper-2);
    color: var(--ui-ink);
    font-weight: 600;
    text-decoration: none;
}
.home-action:hover { border-color: var(--ui-accent); color: var(--ui-accent); }
.home-action[aria-disabled="true"] { opacity: 0.55; }

/* Slide thumbnails (shell/deckThumb.js): a real slide, scaled. */
.deck-thumb {
    width: 100%;
    border-radius: 6px;
    box-shadow: 0 0 0 1px rgba(62, 50, 40, 0.12);
    pointer-events: none;
}
/* Thumbnail boxes have a fixed height; the slide fits inside whichever way round it is. */
.home-deck-thumb, .home-recent-thumb, .nd-looks .nd-thumb { display: grid; place-items: center; container-type: size; }
.home-deck-thumb { height: 120px; }
.home-recent-thumb { height: 84px; }
.nd-looks .nd-thumb { height: 120px; }
:is(.home-deck-thumb, .home-recent-thumb, .nd-looks .nd-thumb) .deck-thumb { width: min(100cqw, 100cqh * var(--thumb-ratio, 1.78)); }

/* ---- New-deck steps ---- */
.nd-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.nd-steps { display: flex; gap: 8px 22px; margin: 0; padding: 0; list-style: none; color: var(--ui-text-2); font-size: 14px; font-weight: 600; }
.nd-steps li { display: inline-flex; align-items: center; gap: 8px; }
.nd-step-num { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--ui-line); font-size: 12px; }
.nd-steps .is-current { color: var(--ui-ink); }
.nd-steps .is-current .nd-step-num { background: var(--ui-accent); border-color: var(--ui-accent); color: #fffcf8; }
.nd-steps .is-done .nd-step-num { border-color: var(--ui-accent); color: var(--ui-accent); }

.nd-body { margin-top: 32px; }
.nd-title { margin: 0; font-family: var(--ui-serif); font-size: 34px; font-weight: 600; letter-spacing: -0.01em; }
.nd-lead { margin: 8px 0 0; color: var(--ui-text-2); font-size: 15px; }

.nd-sources { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-top: 24px; }
.nd-source, .nd-look, .nd-size, .nd-kit {
    display: grid;
    align-content: start;
    gap: 6px;
    padding: 16px;
    border: 1px solid var(--ui-line);
    border-radius: 14px;
    background: var(--ui-paper-2);
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.nd-source strong { font-size: 16px; }
.nd-source span, .nd-size span { color: var(--ui-text-2); font-size: 13px; line-height: 1.45; }
:is(.nd-source, .nd-look, .nd-size, .nd-kit):hover { border-color: var(--ui-accent); }
:is(.nd-source, .nd-look, .nd-size, .nd-kit).is-selected { border-color: var(--ui-accent); box-shadow: 0 0 0 2px var(--ui-accent); }

.nd-detail { display: grid; gap: 14px; margin-top: 22px; padding: 20px; border: 1px solid var(--ui-line); border-radius: 14px; background: var(--ui-paper); }
.nd-field { display: grid; gap: 6px; font-size: 13px; font-weight: 600; }
.nd-field input, .nd-field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--ui-line);
    border-radius: 8px;
    background: var(--ui-paper-2);
    color: var(--ui-ink);
    font: inherit;
    font-size: 15px;
    font-weight: 400;
    line-height: 1.5;
    resize: vertical;
}
.nd-file { display: flex; align-items: center; gap: 12px; }
.nd-file-name { color: var(--ui-text-2); font-size: 14px; }
.nd-howto { margin: 0; padding-left: 20px; display: grid; gap: 8px; font-size: 14px; }
.nd-hint { margin-left: 8px; color: var(--ui-text-2); font-size: 13px; }
.nd-kits { display: flex; flex-wrap: wrap; gap: 10px; }
.nd-kit { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; }
.nd-kit img { height: 24px; max-width: 80px; object-fit: contain; }

.nd-looks { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; margin-top: 24px; }
.nd-look { padding: 10px; font-size: 14px; font-weight: 600; }
.nd-sizes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 24px; align-items: end; }
.nd-size strong { font-size: 15px; }
.nd-sizes .nd-thumb { display: grid; place-items: center; height: 220px; container-type: size; }
/* Fits the box whichever way round the slide is. */
.nd-sizes .deck-thumb { width: min(100cqw, 100cqh * var(--thumb-ratio, 1.78)); }

.nd-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--ui-line); }
.nd-foot-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.nd-error { margin: 0; color: #9a2f2f; font-size: 14px; font-weight: 600; }

@media (max-width: 760px) {
    .home-grid { grid-template-columns: 1fr; }
    .home-new { min-height: 0; }
    .home-deck { grid-template-columns: 120px minmax(0, 1fr); }
    .nd-sizes { grid-template-columns: 1fr; }
    .nd-sizes .nd-thumb { height: 160px; }
    .nd-title { font-size: 28px; }
}

@media (prefers-reduced-motion: reduce) {
    .home-new { transition: none; }
    .home-new:hover { transform: none; }
}

#home-drive[hidden] { display: none; }
#home-drive-list .shell-btn { width: 100%; overflow-wrap: anywhere; }

.login-form[hidden], .login-form [hidden] { display: none; }
