/**
 * Troupe UI — SNSG brand (Scot Nery Style Guide) + Material 3 surfaces + Levi ease.
 * Canonical guide: Drive …/Playbooks/General Scot Fun/scotfun-style-guide.md
 */
@import url('https://fonts.googleapis.com/css2?family=Corben:wght@400;700&family=Lexend:wght@400;500;600&display=swap');

:root {
    /* SNSG palette */
    --tp-blue: #37498f;
    --tp-brown: #34241d;
    --tp-pink: #d90368;
    --tp-cream: #eadeda;
    --tp-yellow-pale: #f0dca4;
    --tp-yellow-gold: #f5d96d;
    --tp-yellow-bright: #ffd400;

    --tp-font: "Corben", Georgia, serif;
    --tp-font-label: "Lexend", system-ui, sans-serif;
    --tp-size: 14px;

    --tp-bg: var(--tp-cream);
    --tp-surface: #fff;
    --tp-surface-dim: #faf8f6;
    --tp-on-surface: var(--tp-brown);
    --tp-on-soft: #444;
    --tp-muted: #6b6560;
    --tp-faint: #9a948e;
    --tp-outline: #ddd8d4;
    --tp-outline-variant: #ece8e4;

    --tp-link: var(--tp-pink);
    --tp-focus: var(--tp-pink);

    --tp-ok: #2e7d32;
    --tp-ok-soft: #e8f5e9;
    --tp-warn: var(--tp-yellow-gold);
    --tp-warn-soft: #fff9e0;
    --tp-bad: #c62828;

    --tp-pill: 999px;
    --tp-radius: 12px;

    --tp-shadow-1: 0 1px 2px rgba(52, 36, 29, 0.06), 0 1px 3px rgba(52, 36, 29, 0.08);
    --tp-shadow-2: 0 2px 6px rgba(52, 36, 29, 0.08), 0 4px 12px rgba(52, 36, 29, 0.06);

    --tp-ease: 0.2s cubic-bezier(0.2, 0, 0, 1);
    --tp-ease-out: 0.25s cubic-bezier(0, 0, 0, 1);
}

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

html {
    font-family: var(--tp-font);
    font-size: var(--tp-size);
    -webkit-font-smoothing: antialiased;
    text-size-adjust: 100%;
}

body {
    font-family: var(--tp-font);
    font-size: var(--tp-size);
    color: var(--tp-on-soft);
    background: var(--tp-bg);
    margin: 0;
    min-height: 100vh;
    line-height: 1.5;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; }

a { color: var(--tp-link); text-decoration: none; transition: opacity var(--tp-ease); }
a:hover { opacity: 0.75; text-decoration: underline; }

/* Brand strip — SNSG blue → pink → yellow */
.top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 12px;
    background: var(--tp-surface);
    border-bottom: 1px solid var(--tp-outline-variant);
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: var(--tp-shadow-1);
}

.top::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--tp-blue), var(--tp-pink), var(--tp-yellow-bright));
}

.top .title {
    font-family: var(--tp-font);
    font-weight: 700;
    font-size: 15px;
    color: var(--tp-blue);
    letter-spacing: 0;
}

.top .title i { color: var(--tp-pink); margin-right: 4px; }

.top .meta {
    font-family: var(--tp-font-label);
    color: var(--tp-muted);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-top: 2px;
}

.wrap {
    max-width: 560px;
    margin: 0 auto;
    padding: 10px 12px 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.block {
    background: var(--tp-surface);
    border: none;
    border-radius: var(--tp-radius);
    padding: 12px 14px;
    box-shadow: var(--tp-shadow-1);
}

.block-label {
    font-family: var(--tp-font-label);
    color: var(--tp-blue);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.block-label i {
    width: 14px;
    text-align: center;
    font-size: 11px;
    color: var(--tp-pink);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid var(--tp-outline);
    background: var(--tp-surface);
    color: var(--tp-brown);
    border-radius: var(--tp-pill);
    padding: 7px 14px;
    font-family: var(--tp-font-label);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    text-decoration: none;
    line-height: 1.2;
    transition: background var(--tp-ease), border-color var(--tp-ease), color var(--tp-ease), box-shadow var(--tp-ease);
}

.btn:hover {
    background: var(--tp-surface-dim);
    border-color: var(--tp-blue);
    color: var(--tp-blue);
    text-decoration: none;
    opacity: 1;
}

.btn.primary,
.btn.filled {
    border-color: var(--tp-yellow-bright);
    background: var(--tp-yellow-bright);
    color: var(--tp-brown);
}

.btn.primary:hover,
.btn.filled:hover {
    background: var(--tp-yellow-gold);
    border-color: var(--tp-yellow-gold);
    color: var(--tp-brown);
}

.btn.done {
    background: var(--tp-ok-soft);
    border-color: #a5d6a7;
    color: var(--tp-ok);
    cursor: default;
}

.btn:disabled { opacity: 0.38; cursor: not-allowed; }

.icon-btn {
    border: none;
    background: transparent;
    color: var(--tp-muted);
    width: 36px;
    height: 36px;
    border-radius: var(--tp-pill);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 14px;
    transition: background var(--tp-ease), color var(--tp-ease);
}

.icon-btn:hover {
    background: rgba(55, 73, 143, 0.08);
    color: var(--tp-blue);
    text-decoration: none;
    opacity: 1;
}

.icon-btn:focus-visible {
    outline: 2px solid var(--tp-focus);
    outline-offset: 2px;
}

.stream-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--tp-outline-variant);
}

.stream-row:last-child { border-bottom: none; }

.stream-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--tp-outline);
    flex-shrink: 0;
}

.stream-dot.live { background: var(--tp-pink); }
.stream-dot.done { background: var(--tp-faint); }

.stream-meta { flex: 1; min-width: 0; }

.stream-meta .label {
    font-weight: 700;
    font-size: 13px;
    color: var(--tp-brown);
}

.stream-meta .sub {
    font-family: var(--tp-font-label);
    color: var(--tp-muted);
    font-size: 11px;
    margin-top: 2px;
}

.stream-actions { display: flex; gap: 6px; flex-shrink: 0; }

.supply-list { display: flex; flex-wrap: wrap; gap: 6px; }

.supply-pill {
    border: 1px solid var(--tp-outline);
    border-radius: var(--tp-pill);
    padding: 6px 12px;
    font-family: var(--tp-font-label);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.03em;
    color: var(--tp-brown);
    text-decoration: none;
    white-space: nowrap;
    background: var(--tp-surface-dim);
    transition: background var(--tp-ease), border-color var(--tp-ease);
}

.supply-pill:hover {
    background: var(--tp-surface);
    border-color: var(--tp-blue);
    color: var(--tp-blue);
    text-decoration: none;
    opacity: 1;
}

.first-banner {
    background: var(--tp-warn-soft);
    border: none;
    border-radius: var(--tp-radius);
    padding: 14px;
    text-align: center;
    box-shadow: var(--tp-shadow-1);
}

.first-banner strong {
    display: block;
    font-size: 15px;
    font-weight: 700;
    color: var(--tp-brown);
    margin-bottom: 4px;
}

.first-banner strong i { color: var(--tp-pink); }

.first-banner p {
    color: var(--tp-muted);
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 10px;
}

.tp-ltns-starter { margin-top: 12px; text-align: left; }

.tp-ltns-starter .tp-ltns-area {
    min-height: 88px;
    margin: 8px 0 0;
}

.tp-discord-meter {
    height: 4px;
    background: var(--tp-outline-variant);
    border-radius: var(--tp-pill);
    overflow: hidden;
    margin: 8px auto 0;
    max-width: 200px;
}

.tp-discord-meter span {
    display: block;
    height: 100%;
    background: var(--tp-pink);
    border-radius: var(--tp-pill);
    transition: width 0.3s ease;
}

.block .tp-ltns-starter .tp-actions { justify-content: flex-start; }

.first-banner .tp-actions { margin-top: 8px; justify-content: center; }

.do-it-text { color: var(--tp-on-soft); line-height: 1.5; margin-bottom: 10px; }

.guarantee-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 13px;
}

.guarantee-item { display: flex; align-items: flex-start; gap: 8px; }

.troupe-done { color: var(--tp-muted); font-size: 13px; line-height: 1.5; }

body.tp-auth {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.box {
    background: var(--tp-surface);
    border: none;
    border-radius: var(--tp-radius);
    padding: 28px 24px;
    max-width: 380px;
    width: 100%;
    text-align: center;
    box-shadow: var(--tp-shadow-2);
}

.box i { font-size: 28px; color: var(--tp-pink); margin-bottom: 12px; }

.box p { color: var(--tp-muted); line-height: 1.5; margin-bottom: 16px; }

.box form { display: flex; flex-direction: column; gap: 8px; }

.box input {
    border: 1px solid var(--tp-outline);
    border-radius: var(--tp-pill);
    padding: 10px 16px;
    font: inherit;
    font-size: var(--tp-size);
    text-align: center;
    background: var(--tp-surface);
    transition: border-color var(--tp-ease), box-shadow var(--tp-ease);
}

.box input:focus {
    outline: none;
    border-color: var(--tp-focus);
    box-shadow: 0 0 0 2px rgba(217, 3, 104, 0.15);
}

.box button {
    border: none;
    background: var(--tp-yellow-bright);
    color: var(--tp-brown);
    border-radius: var(--tp-pill);
    padding: 10px 16px;
    font-family: var(--tp-font-label);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background var(--tp-ease);
}

.box button:hover { background: var(--tp-yellow-gold); }

.box h1 {
    font-size: 18px;
    font-weight: 700;
    color: var(--tp-blue);
    margin: 0 0 10px;
}

.box .lead {
    font-family: var(--tp-font-label);
    color: var(--tp-muted);
    font-size: 13px;
    line-height: 1.5;
    margin: 0 0 16px;
}

.box .tp-actions { justify-content: center; margin-top: 4px; }

.box .note a { color: var(--tp-link); }

.box .note { color: var(--tp-faint); font-size: 12px; margin-top: 12px; line-height: 1.45; }

/* Confirm / processing */
body.tp-confirm {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.tp-confirm .box { max-width: 400px; }

.tp-confirm .box i.fa-person-running {
    font-size: 24px;
    color: var(--tp-pink);
    margin-bottom: 12px;
}

.tp-spinner-icon {
    display: inline-block;
    transform-origin: center center;
    animation: tp-running-spin 0.9s linear infinite;
}

@keyframes tp-running-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}


body.tp-checkout {
    max-width: 440px;
    margin: 0 auto;
    padding: 20px 16px 32px;
    background: var(--tp-bg);
}

.tp-checkout h1 {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 8px;
    color: var(--tp-blue);
    letter-spacing: 0;
}

.tp-checkout .lead {
    font-family: var(--tp-font-label);
    color: var(--tp-muted);
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin: 0 0 16px;
}

.tp-checkout .row {
    display: grid;
    grid-template-columns: 72px 1fr;
    gap: 4px 12px;
    align-items: start;
    padding: 12px 0;
    border-bottom: 1px solid var(--tp-outline-variant);
}

.tp-checkout .row:first-of-type { border-top: 1px solid var(--tp-outline-variant); }

.tp-checkout .row-check { grid-template-columns: auto 1fr 72px; }

.tp-checkout label { cursor: pointer; }

.tp-checkout .price {
    font-family: var(--tp-font-label);
    color: var(--tp-brown);
    white-space: nowrap;
    font-weight: 600;
    text-align: right;
}

.tp-checkout .price-sub {
    color: var(--tp-muted);
    font-size: 11px;
    font-weight: 400;
    display: block;
    margin-top: 2px;
}

.tp-checkout .muted {
    color: var(--tp-muted);
    font-size: 12px;
    line-height: 1.4;
}

.tp-checkout button[type="submit"] {
    font-family: var(--tp-font-label);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border: none;
    background: var(--tp-yellow-bright);
    color: var(--tp-brown);
    border-radius: var(--tp-pill);
    padding: 12px 18px;
    cursor: pointer;
    margin-top: 16px;
    width: 100%;
    transition: background var(--tp-ease), transform var(--tp-ease-out);
}

.tp-checkout button[type="submit"]:hover { background: var(--tp-yellow-gold); }

.tp-checkout button[type="submit"]:active { transform: scale(0.99); }

.tp-checkout .guarantee {
    margin-top: 14px;
    font-size: 12px;
    color: var(--tp-muted);
    border-top: 1px solid var(--tp-outline-variant);
    padding-top: 12px;
    line-height: 1.45;
}

.tp-checkout .guarantee strong { color: var(--tp-brown); font-weight: 700; }

.tp-checkout .tp-checkout-return { margin-top: 16px; text-align: center; color: var(--tp-faint); font-size: 12px; }

.tp-checkout input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: var(--tp-pink);
}

.tp-mark { color: var(--tp-faint); }
.tp-mark.ok { color: var(--tp-ok); }
.tp-mark.bad { color: var(--tp-bad); }
.tp-body-text { color: var(--tp-muted); font-size: 13px; line-height: 1.5; margin: 0; }
.tp-body-text + .tp-body-text { margin-top: 8px; }
.tp-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tp-title-line { font-weight: 700; margin-bottom: 4px; color: var(--tp-brown); }
.tp-sub-line { font-family: var(--tp-font-label); color: var(--tp-muted); font-size: 12px; margin-bottom: 10px; }
.tp-center { text-align: center; }
.tp-muted { color: var(--tp-muted); }

.top-actions { display: flex; gap: 6px; align-items: center; }

.tp-inline-form { display: inline; }

.tp-icon-warn { color: var(--tp-pink); }

.tp-snowball-chip {
    display: inline-block;
    margin-right: 8px;
    font-family: var(--tp-font-label);
    font-size: 11px;
    color: var(--tp-muted);
}

.tp-discord-progress { font-weight: 600; color: var(--tp-blue); }

.tp-date-chip { font-size: 12px; white-space: nowrap; }

a.back-link {
    font-family: var(--tp-font-label);
    color: var(--tp-muted);
    font-size: 12px;
    text-decoration: none;
}

a.back-link:hover { color: var(--tp-blue); opacity: 1; }

/* Repackage pack */
body.tp-repackage { background: var(--tp-bg); min-height: 100vh; }

.tp-repackage-intro {
    color: var(--tp-muted);
    font-size: 13px;
    line-height: 1.5;
}

.tp-script-area {
    width: 100%;
    min-height: 140px;
    border: 1px solid var(--tp-outline);
    border-radius: var(--tp-radius);
    padding: 10px;
    font: inherit;
    font-size: 13px;
    line-height: 1.45;
    resize: vertical;
    color: var(--tp-brown);
    background: var(--tp-surface-dim);
}

.tp-script-area:focus {
    outline: none;
    border-color: var(--tp-focus);
    box-shadow: 0 0 0 2px rgba(217, 3, 104, 0.12);
}

.btn.copy-done { background: var(--tp-ok-soft); border-color: #a5d6a7; color: var(--tp-ok); }

.tp-camp-progress {
    display: flex;
    gap: 6px;
    margin-bottom: 4px;
}

.tp-camp-seg {
    flex: 1;
    height: 4px;
    border-radius: var(--tp-pill);
    background: var(--tp-outline);
}

.tp-camp-seg.upcoming { background: var(--tp-outline-variant); }
.tp-camp-seg.live { background: var(--tp-pink); }
.tp-camp-seg.done { background: var(--tp-blue); }

.tp-activity-tag {
    font-family: var(--tp-font-label);
    font-size: 10px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--tp-muted);
    margin-left: 6px;
}

.tp-activity-tag i { font-size: 9px; margin-right: 2px; color: var(--tp-pink); }

.tp-ham-code {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.tp-ham-code input {
    border: 1px solid var(--tp-outline);
    border-radius: var(--tp-pill);
    padding: 10px 16px;
    font: inherit;
    text-align: center;
    background: var(--tp-surface);
}

.tp-ham-code button {
    border: none;
    background: var(--tp-surface-dim);
    color: var(--tp-brown);
    border-radius: var(--tp-pill);
    padding: 10px 16px;
    font-family: var(--tp-font-label);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
}

.tp-stream-soon { background: var(--tp-warn-soft); }

.tp-admin-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--tp-font-label);
    font-size: 12px;
}

.tp-admin-table th,
.tp-admin-table td {
    text-align: left;
    padding: 6px 8px 6px 0;
    border-bottom: 1px solid var(--tp-outline-variant);
    vertical-align: top;
}

.tp-admin-table th {
    color: var(--tp-muted);
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-size: 10px;
}

.tp-log {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px;
    line-height: 1.45;
    color: var(--tp-muted);
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
}

.tp-code-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.tp-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 13px;
    background: var(--tp-surface-dim);
    padding: 4px 8px;
    border-radius: 6px;
    color: var(--tp-brown);
}
