@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Fraunces:opsz,wght@9..144,500;9..144,600&display=swap');

:root {
    color-scheme: light;
    --paper: #f4f1e8;
    --paper-deep: #e9e3d6;
    --ink: #20231f;
    --muted: #72766d;
    --line: #d8d3c8;
    --white: #fffefa;
    --moss: #3b5846;
    --moss-dark: #263e32;
    --coral: #c5533b;
    --coral-light: #f3d6c8;
    --olive: #dbe3cb;
    --shadow: 0 20px 60px rgba(32, 35, 31, .08);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background-color: var(--paper);
    background-image: radial-gradient(rgba(47, 59, 44, .075) .65px, transparent .65px);
    background-size: 15px 15px;
    font-family: 'DM Sans', sans-serif;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
[hidden] { display: none !important; }
.page-shell { width: min(1160px, calc(100% - 48px)); margin: auto; }
.masthead { min-height: 82px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.wordmark { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; font-size: 14px; font-weight: 700; }
.wordmark b { color: var(--moss); }
.wordmark-mark { display: grid; place-items: center; width: 36px; height: 36px; color: var(--white); background: var(--moss); font-size: 11px; letter-spacing: .08em; }
.masthead-right { display: flex; align-items: center; gap: 22px; }
.connection-state { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.connection-state::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #a2a69a; }
.connection-state.is-demo::before { background: var(--coral); }
.connection-state.is-ready::before { background: #5b825c; }
.back-link { color: var(--muted); text-decoration: none; font-size: 12px; }
.back-link:hover, .text-button:hover { color: var(--coral); }
main { padding: 44px 0 70px; }
.page-heading { min-height: 138px; display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 1px solid var(--line); padding-bottom: 24px; margin-bottom: 34px; }
.eyebrow { margin: 0 0 10px; color: var(--coral); font-size: 10px; line-height: 1.3; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1, .auth-copy h2, .section-heading h2, .action-dialog h2 { font-family: 'Fraunces', Georgia, serif; font-weight: 500; }
h1 { margin-bottom: 0; font-size: 48px; line-height: 1.08; }
.account-name { margin-bottom: 3px; color: var(--muted); font-size: 13px; }
.auth-section { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 420px); gap: 64px; align-items: start; padding: 42px 0 70px; }
.auth-copy { max-width: 450px; padding-top: 8px; }
.auth-copy h2 { margin-bottom: 13px; font-size: 36px; }
.auth-copy > p:last-child { max-width: 370px; color: var(--muted); font-size: 14px; line-height: 1.7; }
.auth-box { padding: 23px; border: 1px solid var(--line); background: var(--white); box-shadow: var(--shadow); }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 21px; background: var(--paper); }
.segment { min-height: 37px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; font-weight: 600; }
.segment.active { background: var(--white); color: var(--ink); box-shadow: 0 1px 4px rgba(32, 35, 31, .1); }
label { display: block; margin: 14px 0 7px; color: #50554d; font-size: 11px; font-weight: 700; }
input, select, textarea { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 0; padding: 10px 12px; background: #fff; color: var(--ink); outline: none; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--moss); box-shadow: 0 0 0 3px rgba(59, 88, 70, .12); }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 9px; min-height: 43px; padding: 0 16px; border: 1px solid transparent; border-radius: 0; text-decoration: none; cursor: pointer; font-size: 12px; font-weight: 700; transition: background-color .18s ease, transform .18s ease; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { opacity: .52; cursor: not-allowed; }
.button-dark { color: white; background: var(--ink); }
.button-dark:hover:not(:disabled) { background: var(--moss-dark); }
.button-accent { color: white; background: var(--coral); }
.button-accent:hover:not(:disabled) { background: #a84632; }
.button-outline { color: var(--ink); border-color: var(--line); background: transparent; }
.button-outline:hover { border-color: var(--moss); }
.full-width { width: 100%; margin-top: 18px; }
.inline-message, .dialog-message, .page-message { min-height: 18px; margin: 10px 0 0; color: var(--coral); font-size: 12px; }
.client-workspace { animation: reveal .4s ease both; }
.library-section { padding: 28px 0 32px; border-bottom: 1px solid var(--line); }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 18px; }
.section-heading .eyebrow { margin-bottom: 6px; }
.section-heading h2 { margin: 0; font-size: 27px; }
.count-label { color: var(--muted); font-size: 12px; }
.owned-list { display: grid; gap: 9px; }
.owned-row { display: grid; grid-template-columns: 60px minmax(0, 1fr) auto auto; align-items: center; gap: 16px; min-height: 83px; padding: 10px 14px; background: var(--white); border: 1px solid var(--line); animation: reveal .4s ease both; }
.owned-thumb { width: 60px; height: 60px; object-fit: cover; background: var(--olive); }
.owned-thumb-placeholder { display: grid; place-items: center; color: var(--moss); font-family: 'Fraunces', Georgia, serif; font-size: 23px; }
.course-name { margin: 0 0 5px; font-size: 14px; font-weight: 700; }
.course-meta { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.access-pill, .payment-status { display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px; background: var(--olive); color: var(--moss-dark); font-size: 10px; font-weight: 700; text-transform: uppercase; white-space: nowrap; }
.access-pill.expired, .payment-status.failed, .payment-status.refunded, .payment-status.rejected { background: var(--coral-light); color: #873b2d; }
.access-pill.inactive, .payment-status.pending, .payment-status.requested, .payment-status.approved { background: #e9e5da; color: #64685f; }
.course-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.course-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); background: var(--white); animation: reveal .45s ease both; }
.course-card:nth-child(3n + 2) { animation-delay: 50ms; }
.course-card:nth-child(3n + 3) { animation-delay: 100ms; }
.course-art { display: block; width: 100%; height: 150px; object-fit: cover; background: var(--olive); }
.course-art-placeholder { position: relative; display: flex; align-items: end; padding: 15px; overflow: hidden; color: var(--moss-dark); background: var(--olive); font-family: 'Fraunces', Georgia, serif; font-size: 22px; }
.course-card:nth-child(4n + 2) .course-art-placeholder { color: #793d30; background: var(--coral-light); }
.course-card:nth-child(4n + 3) .course-art-placeholder { color: #4d5147; background: #e1d9c8; }
.course-card:nth-child(4n + 4) .course-art-placeholder { color: #314c55; background: #d4e2dc; }
.course-card-body { padding: 16px; }
.course-card-body h3 { min-height: 40px; margin: 0 0 7px; font-size: 15px; line-height: 1.35; }
.course-description { min-height: 40px; margin: 0 0 17px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.course-card-bottom { display: flex; align-items: end; justify-content: space-between; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.price { color: var(--moss-dark); font-size: 16px; font-weight: 700; white-space: nowrap; }
.price small { display: block; margin-bottom: 4px; color: var(--muted); font-size: 9px; font-weight: 500; }
.payment-list { display: grid; gap: 8px; }
.payment-row { display: grid; grid-template-columns: minmax(130px, 1fr) auto auto minmax(100px, auto); align-items: center; gap: 18px; min-height: 58px; padding: 10px 14px; border: 1px solid var(--line); background: rgba(255, 254, 250, .72); }
.payment-course { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 600; }
.payment-amount { font-size: 12px; font-weight: 700; white-space: nowrap; }
.payment-meta, .empty-state { color: var(--muted); font-size: 11px; }
.empty-state { padding: 20px; border: 1px dashed var(--line); }
.page-message { margin-top: 22px; }
.page-footer { display: flex; justify-content: space-between; padding: 20px 0 25px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.text-button { padding: 0; border: 0; background: none; color: var(--moss); cursor: pointer; font-weight: 700; }
.action-dialog, .player-dialog { width: min(440px, calc(100% - 28px)); max-width: none; padding: 25px; border: 1px solid var(--line); border-radius: 0; background: var(--white); color: var(--ink); box-shadow: 0 28px 90px rgba(22, 31, 23, .24); }
.action-dialog::backdrop, .player-dialog::backdrop { background: rgba(22, 31, 23, .58); backdrop-filter: blur(3px); }
.dialog-topline { display: flex; justify-content: space-between; align-items: center; }
.dialog-topline .eyebrow { margin: 0; }
.action-dialog h2 { margin: 17px 0 8px; font-size: 29px; }
.dialog-summary { color: var(--muted); font-size: 12px; line-height: 1.6; }
.icon-button { width: 32px; height: 32px; border: 1px solid var(--line); background: transparent; cursor: pointer; font-size: 20px; line-height: 1; }
.qr-payload { max-height: 130px; overflow: auto; padding: 10px; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--paper); color: var(--ink); font-size: 10px; }
.player-dialog { width: min(900px, calc(100% - 28px)); }
.player-dialog video { display: block; width: 100%; max-height: 70vh; margin-top: 16px; background: #111; }
.payment-application { grid-template-columns: minmax(0, 1fr) minmax(320px, 480px); gap: 48px; padding-top: 30px; }
.payment-application .auth-box { width: 100%; }
.payment-application .auth-copy h2 { max-width: 390px; }
.selection-summary { margin-top: 9px; padding: 11px 12px; border-left: 2px solid var(--moss); background: var(--olive); color: var(--moss-dark); font-size: 12px; font-weight: 700; }
.payment-result { max-width: 760px; padding: 24px 0 34px; border-top: 1px solid var(--line); animation: reveal .3s ease both; }
.payment-result h2 { margin-bottom: 8px; font-family: 'Fraunces', Georgia, serif; font-size: 28px; font-weight: 500; }
.payment-result > p:not(.eyebrow) { color: var(--muted); font-size: 13px; line-height: 1.6; }
.payment-result .button { margin-top: 8px; }
@keyframes reveal { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 760px) {
    .page-shell { width: min(100% - 32px, 600px); }
    .masthead { min-height: 70px; }
    .masthead-right { gap: 12px; }
    .back-link { font-size: 0; }
    .back-link span { font-size: 16px; }
    main { padding-top: 32px; }
    .page-heading { min-height: 112px; align-items: end; }
    h1 { font-size: 38px; }
    .auth-section { grid-template-columns: 1fr; gap: 22px; padding: 25px 0 45px; }
    .payment-application { gap: 16px; }
    .auth-copy h2 { font-size: 30px; }
    .auth-box { padding: 18px; }
    .course-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .owned-row { grid-template-columns: 48px minmax(0, 1fr) auto; gap: 10px; padding: 9px; }
    .owned-thumb { width: 48px; height: 48px; }
    .owned-row .button { grid-column: 2 / 4; width: 100%; }
    .payment-row { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; }
    .payment-row .payment-status { justify-self: start; }
    .payment-row .button { justify-self: end; }
}
@media (max-width: 440px) {
    .page-shell { width: calc(100% - 24px); }
    .wordmark { gap: 7px; font-size: 11px; }
    .wordmark-mark { width: 31px; height: 31px; }
    .masthead-right { gap: 8px; }
    .connection-state { font-size: 10px; }
    .page-heading { min-height: 100px; }
    h1 { font-size: 34px; }
    .course-grid { grid-template-columns: 1fr; }
    .course-art { height: 175px; }
    .section-heading h2 { font-size: 24px; }
    .section-heading { align-items: center; }
    .button-outline { min-height: 38px; padding: 0 10px; }
}
