:root {
    --navy: #0b1828;
    --ink: #1c140c;
    --ivory: #f6efe3;
    --gold: #d4af37;
    --gold-soft: #e8d5a3;
    --muted: #8d7d66;
    --line: rgba(212, 175, 55, 0.45);
    --shadow: 0 24px 56px rgba(0, 0, 0, 0.38);
    --font-serif: "Cormorant Garamond", "Palatino Linotype", Palatino, serif;
    --font-sans: "Outfit", "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    background: #07101b;
}

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

body {
    font-family: var(--font-sans);
    color: var(--ivory);
    background:
        radial-gradient(1200px 600px at 50% -10%, #1a3a5c 0%, transparent 55%),
        linear-gradient(180deg, #0b1828 0%, #07101b 100%);
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 6px 14px;
}

.glow {
    position: fixed;
    inset: auto -20% -20% -20%;
    height: 50%;
    background: radial-gradient(circle at 50% 0, rgba(212, 175, 55, 0.12), transparent 60%);
    pointer-events: none;
}

.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;
}

.page {
    width: min(420px, 100%);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.shell {
    position: relative;
    width: 100%;
    background: rgba(12, 28, 46, 0.88);
    border: 1px solid rgba(212, 175, 55, 0.32);
    border-radius: 22px;
    overflow: hidden;
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
    transition: border-radius 0.42s ease, background 0.42s ease, box-shadow 0.42s ease, border-color 0.42s ease;
}

.deck {
    position: relative;
    overflow: hidden;
    background: #07101c;
    touch-action: pan-y;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    transition: height 0.38s cubic-bezier(0.22, 0.9, 0.32, 1);
}

.deck-track {
    display: flex;
    align-items: flex-start;
    width: 100%;
    cursor: grab;
    will-change: transform;
    transition: transform 0.38s cubic-bezier(0.22, 0.9, 0.32, 1);
}

.deck-track.is-dragging {
    cursor: grabbing;
    transition: none;
}

.slide {
    flex: 0 0 100%;
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    height: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.card-portrait {
    width: min(98%, calc((100dvh - 170px) * 948 / 1659));
    aspect-ratio: 948 / 1659;
    margin: 8px auto 52px;
    position: relative;
    overflow: visible;
    filter: drop-shadow(0 14px 26px rgba(0, 0, 0, 0.42));
    cursor: zoom-in;
    transition: width 0.42s cubic-bezier(0.22, 0.9, 0.32, 1), margin 0.42s ease;
}

.card-photo {
    position: absolute;
    left: 50%;
    top: 50%;
    width: calc(100% * 1659 / 948);
    height: auto;
    transform: translate(-50%, -50%) rotate(90deg) scale(0.996);
    object-fit: contain;
    object-position: center;
    border-radius: 8px;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
}

.invite-face,
.face {
    width: calc(100% - 20px);
    margin: 10px auto 28px;
    padding: 22px 18px 28px;
    text-align: center;
    color: var(--ink);
    background: linear-gradient(180deg, #fbf6ec 0%, #f3ead8 100%);
    border: 1px solid var(--line);
    border-radius: 14px;
}

.invite-face {
    padding: 28px 18px 32px;
    overflow: visible;
}

.eyebrow {
    font-size: 0.64rem;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: #9a7b2f;
    font-weight: 500;
}

.invite-face .eyebrow {
    font-size: 0.82rem;
    letter-spacing: 0.26em;
}

.invite-face h1,
.face h2 {
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: clamp(1.35rem, 5.4vw, 1.85rem);
    line-height: 1.15;
    margin-top: 8px;
    color: #142334;
}

.invite-face h1 {
    font-size: clamp(1.78rem, 7.4vw, 2.38rem);
    line-height: 1.18;
    margin-top: 10px;
    overflow-wrap: break-word;
    padding: 0 4px;
}

.lede {
    margin-top: 6px;
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 0.98rem;
    color: #5c4a32;
}

.invite-face .lede {
    margin-top: 10px;
    font-size: 1.22rem;
    line-height: 1.35;
}

.flourish {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 12px 0 10px;
}

.flourish span {
    width: 44px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.flourish i {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--gold);
}

.times {
    list-style: none;
    display: grid;
    gap: 6px;
    margin: 0 auto 12px;
    width: min(280px, 100%);
}

.invite-face .times {
    width: min(340px, 100%);
    gap: 12px;
    margin: 4px auto 16px;
}

.times li {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 0.86rem;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.22);
}

.invite-face .times li {
    align-items: baseline;
    gap: 12px;
    font-size: 1.12rem;
    line-height: 1.3;
    padding-bottom: 10px;
}

.invite-face .times li span:first-child {
    text-align: left;
    overflow-wrap: break-word;
}

.times li span:last-child {
    font-family: var(--font-serif);
    font-size: 1.02rem;
    color: #6b542e;
    white-space: nowrap;
}

.invite-face .times li span:last-child {
    font-size: 1.34rem;
}

.next-event {
    margin: 18px 10px 0;
    padding: 14px 12px 12px;
    border-top: 1px solid rgba(212, 175, 55, 0.35);
    color: #142334;
}

.next-event .eyebrow {
    margin: 0;
}

.next-event h3 {
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: clamp(1.2rem, 4.6vw, 1.55rem);
    line-height: 1.2;
    margin: 6px 0 4px;
    color: #142334;
}

.next-event .event-photo {
    display: block;
    width: 100%;
    max-height: 180px;
    object-fit: cover;
    border-radius: 10px;
    margin: 10px 0 8px;
    border: 1px solid rgba(212, 175, 55, 0.35);
}

.next-event .event-when,
.next-event .event-place {
    margin: 0;
    font-size: 0.95rem;
    color: #6b542e;
}

.next-event .event-place {
    margin-top: 4px;
}

.face-event {
    min-height: 280px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 18px 14px 22px;
}

.face-event.has-flyer[data-event-view="flyer"] {
    padding: 8px 8px 16px;
    background: linear-gradient(180deg, #102033 0%, #0a1522 100%);
    border-color: rgba(212, 175, 55, 0.32);
}

.event-flyer-view {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.event-flyer-view[hidden],
.event-details-view[hidden] {
    display: none !important;
}

.event-flyer-btn {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    border-radius: 12px;
}

.event-flyer-btn:focus-visible {
    outline: 2px solid rgba(212, 175, 55, 0.75);
    outline-offset: 2px;
}

.event-flyer {
    display: block;
    width: 100%;
    height: auto;
    max-height: min(68dvh, calc(100dvh - 200px));
    aspect-ratio: 2 / 3;
    object-fit: contain;
    object-position: center;
    border-radius: 12px;
    border: 1px solid rgba(212, 175, 55, 0.35);
    background: #07101c;
}

.event-flyer-hint {
    margin: 0;
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--gold-soft);
}

.face-event h2 {
    margin-bottom: 4px;
}

.face-event .event-when,
.face-event .event-place {
    margin: 0;
    font-family: var(--font-serif);
    font-size: 1.12rem;
    color: #6b542e;
}

.face-event .event-place {
    margin-top: 6px;
}

.face-event .event-notes {
    margin: 12px 0 0;
    max-width: 32em;
    font-size: 0.92rem;
    line-height: 1.45;
    color: #4a3a24;
    overflow-wrap: break-word;
}

.event-back {
    margin: 0 0 8px;
    border: 0;
    background: transparent;
    color: #8a6a22;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.event-download {
    margin: 16px auto 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(212, 175, 55, 0.55);
    background: linear-gradient(180deg, #e3c66a 0%, #c49a2a 100%);
    color: #1a1408;
    font: inherit;
    font-weight: 600;
    font-size: 0.92rem;
    letter-spacing: 0.02em;
    text-decoration: none;
    border-radius: 999px;
    padding: 10px 16px;
    cursor: pointer;
}

.event-download:active {
    transform: translateY(1px);
}

.place,
.contacts,
.face-note {
    font-style: normal;
    font-size: 0.8rem;
    line-height: 1.4;
    color: var(--muted);
}

.invite-face .place,
.invite-face .contacts {
    font-size: 1.16rem;
    line-height: 1.45;
    color: #4a3a24;
}

.invite-face .place {
    display: grid;
    justify-items: center;
    gap: 2px;
    margin-top: 4px;
    font-size: 1.2rem;
}

.contacts {
    display: grid;
    gap: 2px;
    margin-top: 8px;
}

.invite-face .contacts {
    gap: 2px;
    margin-top: 16px;
}

.invite-face .contacts span {
    margin-top: 10px;
    font-size: 1.05rem;
    color: #5c4a32;
}

.invite-face .contacts span:first-child {
    margin-top: 0;
}

.invite-face .contacts a {
    color: #6b542e;
    text-decoration: none;
    font-family: var(--font-serif);
    font-size: 1.36rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.invite-face .church-site {
    margin-top: 14px;
    text-align: center;
}

.invite-face .church-site a {
    color: #6b542e;
    text-decoration: none;
    font-family: var(--font-serif);
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    border-bottom: 1px solid rgba(107, 84, 46, 0.35);
}

.invite-face .church-site a:active {
    opacity: 0.85;
}

.face-qr,
.face-text {
    min-height: 280px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.face-qr .eyebrow,
.face-qr h2,
.face-qr .face-note {
    transition: opacity 0.32s ease, max-height 0.32s ease, margin 0.32s ease;
}

.face-qr .eyebrow,
.face-qr h2 {
    max-height: 4em;
}

.face-qr .face-note {
    max-height: 5em;
}

.qr-hero {
    width: min(220px, 70vw);
    height: min(220px, 70vw);
    margin: 16px auto 12px;
    padding: 10px;
    background: #fff;
    border: 1px solid rgba(212, 175, 55, 0.35);
    border-radius: 12px;
    cursor: zoom-in;
    transition: width 0.42s cubic-bezier(0.22, 0.9, 0.32, 1), height 0.42s cubic-bezier(0.22, 0.9, 0.32, 1), margin 0.42s ease, padding 0.42s ease;
}

.qr-hero svg {
    width: 100%;
    height: 100%;
    display: block;
}

.face-text .sms {
    width: min(320px, 100%);
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sms-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px;
}

.sms input {
    width: 100%;
    border: 1px solid rgba(20, 35, 52, 0.18);
    background: #fff;
    color: var(--ink);
    border-radius: 11px;
    padding: 12px 12px;
    font: inherit;
    font-size: 0.95rem;
    user-select: text;
    -webkit-user-select: text;
}

.sms input::placeholder {
    color: rgba(28, 20, 12, 0.4);
}

.sms input:focus {
    outline: 2px solid rgba(212, 175, 55, 0.7);
    outline-offset: 1px;
}

button, a.action, #sms-send {
    touch-action: manipulation;
}

#sms-send {
    border: 0;
    background: linear-gradient(180deg, #e3c66a 0%, #c49a2a 100%);
    color: #1a1408;
    font: inherit;
    font-weight: 600;
    letter-spacing: 0.04em;
    border-radius: 11px;
    padding: 0 16px;
    min-width: 74px;
    cursor: pointer;
}

#sms-send:active {
    transform: translateY(1px);
}

#sms-send:disabled {
    opacity: 0.65;
    cursor: wait;
}

.intake-jump {
    margin: 16px auto 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(212, 175, 55, 0.55);
    background: linear-gradient(180deg, #e3c66a 0%, #c49a2a 100%);
    color: #1a1408;
    font: inherit;
    font-weight: 600;
    font-size: 0.92rem;
    letter-spacing: 0.02em;
    border-radius: 999px;
    padding: 10px 16px;
    cursor: pointer;
}

.intake-jump:active {
    transform: translateY(1px);
}

.face-intake {
    padding-bottom: 22px;
}

.face-intake .intake {
    width: min(320px, 100%);
    margin: 14px auto 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
}

.intake input,
.intake select,
.intake textarea {
    width: 100%;
    border: 1px solid rgba(20, 35, 52, 0.18);
    background: #fff;
    color: var(--ink);
    border-radius: 11px;
    padding: 11px 12px;
    font: inherit;
    font-size: 0.95rem;
    user-select: text;
    -webkit-user-select: text;
}

.intake textarea {
    min-height: 72px;
    resize: vertical;
}

.intake input:focus,
.intake select:focus,
.intake textarea:focus {
    outline: 2px solid rgba(212, 175, 55, 0.7);
    outline-offset: 1px;
}

.intake-hint {
    font-size: 0.78rem;
    color: var(--muted);
    margin: -2px 0 2px;
}

.intake-first {
    border: 1px solid rgba(212, 175, 55, 0.35);
    border-radius: 11px;
    padding: 8px 10px 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    align-items: center;
}

.intake-first legend {
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6b542e;
    padding: 0 4px;
}

.intake-first label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.92rem;
    color: var(--ink);
    cursor: pointer;
}

.intake-hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.intake-error {
    margin: 0;
    color: #8a1f1f;
    font-size: 0.88rem;
    font-weight: 500;
}

.intake-error[hidden] {
    display: none !important;
}

#intake-submit,
.intake-again {
    border: 0;
    background: linear-gradient(180deg, #e3c66a 0%, #c49a2a 100%);
    color: #1a1408;
    font: inherit;
    font-weight: 600;
    letter-spacing: 0.04em;
    border-radius: 11px;
    padding: 12px 16px;
    cursor: pointer;
}

#intake-submit:disabled {
    opacity: 0.65;
    cursor: wait;
}

#intake-thanks {
    padding: 8px 4px 6px;
}

#intake-thanks[hidden],
#intake-form-wrap[hidden] {
    display: none !important;
}

.intake-again {
    margin-top: 14px;
}

.dots {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 20px;
    display: flex;
    justify-content: center;
    gap: 7px;
    pointer-events: none;
    z-index: 2;
    transition: opacity 0.38s ease, transform 0.38s ease;
}

.dot {
    pointer-events: auto;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    border: 0;
    padding: 0;
    background: rgba(246, 239, 227, 0.38);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2);
    cursor: pointer;
}

.dot.is-on {
    background: var(--gold);
    transform: scale(1.15);
}

.dock {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    justify-content: center;
    justify-items: center;
    gap: 0;
    width: 100%;
    max-height: 88px;
    padding: 4px 4px 10px;
    border-top: 1px solid rgba(232, 213, 163, 0.12);
    overflow: hidden;
    transition: opacity 0.4s ease, transform 0.4s ease, max-height 0.42s ease, padding 0.42s ease, border-color 0.42s ease;
}

.dock.has-event {
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.dock.has-event .action {
    font-size: 0.58rem;
    padding: 6px 0;
}

.action {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    width: 100%;
    min-height: 52px;
    padding: 6px 2px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--ivory);
    text-decoration: none;
    font: inherit;
    font-size: 0.64rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    cursor: pointer;
}

.action:hover,
.action:focus-visible {
    background: rgba(212, 175, 55, 0.1);
    outline: none;
}

.action.is-on {
    background: rgba(212, 175, 55, 0.14);
    color: var(--gold-soft);
}

#btn-admin {
    display: none;
}

body.is-signed-in #btn-admin,
html.is-signed-in #btn-admin {
    display: flex;
}

body.is-signed-in #btn-directions,
html.is-signed-in #btn-directions {
    display: none;
}

.action-icon {
    color: var(--gold);
    display: grid;
    place-items: center;
}

.action-icon .fs-exit {
    display: none;
}

.action.is-on .fs-enter {
    display: none;
}

.action.is-on .fs-exit {
    display: block;
}

.pwa-install {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    width: 100%;
    padding: 0 14px 12px;
    text-align: center;
}

.pwa-install[hidden] {
    display: none !important;
}

.pwa-install-btn {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--gold);
    font-family: var(--font-sans);
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    line-height: 1.3;
    padding: 6px 8px 2px;
    cursor: pointer;
    text-decoration: underline;
    text-decoration-color: rgba(212, 175, 55, 0.5);
    text-underline-offset: 3px;
}

.pwa-install-btn:hover,
.pwa-install-btn:focus-visible {
    color: var(--gold-soft);
    outline: none;
}

.pwa-install-hint {
    margin: 0;
    max-width: 22rem;
    color: var(--gold-soft);
    font-size: 0.72rem;
    font-weight: 400;
    line-height: 1.4;
}

.pwa-install-hint strong {
    display: block;
    color: var(--gold);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    margin-bottom: 1px;
}

.pwa-install-btn[hidden],
.pwa-install-hint[hidden] {
    display: none !important;
}

.ctx-menu {
    position: fixed;
    z-index: 60;
    min-width: 196px;
    padding: 6px;
    background: #12263c;
    border: 1px solid rgba(212, 175, 55, 0.4);
    border-radius: 14px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
}

.ctx-menu[hidden] {
    display: none;
}

.ctx-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    border: 0;
    background: transparent;
    color: var(--ivory);
    font: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    text-align: left;
    padding: 11px 12px;
    border-radius: 10px;
    cursor: pointer;
}

.ctx-item svg {
    color: var(--gold);
    flex-shrink: 0;
}

.ctx-item:hover,
.ctx-item:focus-visible {
    background: rgba(212, 175, 55, 0.12);
    outline: none;
}

#btn-full {
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.login-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding:
        max(18px, env(safe-area-inset-top))
        max(16px, env(safe-area-inset-right))
        max(22px, env(safe-area-inset-bottom))
        max(16px, env(safe-area-inset-left));
}

.login-overlay[hidden] {
    display: none !important;
}

.login-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(7, 16, 27, 0.82);
    backdrop-filter: blur(12px);
}

.login-sheet {
    position: relative;
    width: min(420px, 100%);
    max-height: min(92dvh, 760px);
    overflow: auto;
    background:
        radial-gradient(720px 280px at 50% -10%, rgba(212, 175, 55, 0.16), transparent 58%),
        linear-gradient(180deg, #12263c 0%, #0b1828 100%);
    border: 1px solid rgba(212, 175, 55, 0.42);
    border-radius: 20px;
    padding: 32px 22px 28px;
    box-shadow: 0 28px 64px rgba(0, 0, 0, 0.5);
    text-align: center;
    color: var(--ivory);
}

.login-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--gold-soft);
    cursor: pointer;
    display: grid;
    place-items: center;
}

.login-close:hover,
.login-close:focus-visible {
    background: rgba(212, 175, 55, 0.12);
    color: var(--gold);
    outline: none;
}

.login-kicker {
    font-size: 0.92rem;
    letter-spacing: 0.34em;
    text-transform: uppercase;
    color: var(--gold);
    font-weight: 500;
}

.login-sheet h2 {
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: clamp(1.7rem, 6.4vw, 2.15rem);
    line-height: 1.2;
    margin-top: 10px;
    color: var(--ivory);
    overflow-wrap: break-word;
}

.login-tag {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 1.22rem;
    margin-top: 8px;
    color: var(--gold-soft);
}

.login-form {
    margin-top: 22px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
}

.login-form label {
    font-size: 1.02rem;
    font-weight: 500;
    color: var(--gold-soft);
    margin-top: 6px;
}

.login-form input {
    width: 100%;
    border: 1px solid rgba(212, 175, 55, 0.28);
    background: #fff;
    color: var(--ink);
    border-radius: 12px;
    padding: 14px 14px;
    font: inherit;
    font-size: 1.12rem;
}

.login-pass-wrap {
    position: relative;
}

.login-pass-wrap input {
    padding-right: 52px;
}

.login-pass-toggle {
    position: absolute;
    top: 50%;
    right: 4px;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #6b542e;
    display: grid;
    place-items: center;
    cursor: pointer;
}

.login-pass-toggle:hover,
.login-pass-toggle:focus-visible {
    color: #0b1828;
    background: rgba(212, 175, 55, 0.18);
    outline: none;
}

.login-pass-toggle[aria-pressed="true"] {
    color: #0b1828;
}

.login-pass-toggle .login-pass-eye-off[hidden],
.login-pass-toggle .login-pass-eye[hidden] {
    display: none;
}

.login-form input::placeholder {
    color: rgba(28, 20, 12, 0.4);
}

.login-form input:focus {
    outline: 2px solid rgba(212, 175, 55, 0.75);
    outline-offset: 1px;
}

.login-error {
    margin: 4px 0 0;
    color: #f0b4a8;
    font-size: 1.02rem;
    line-height: 1.4;
}

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

#login-submit {
    margin-top: 12px;
    border: 0;
    background: linear-gradient(180deg, #e3c66a 0%, #c49a2a 100%);
    color: #1a1408;
    font: inherit;
    font-size: 1.18rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    border-radius: 12px;
    padding: 14px 16px;
    min-height: 52px;
    cursor: pointer;
}

#login-submit:active {
    transform: translateY(1px);
}

#login-submit:disabled {
    opacity: 0.65;
    cursor: wait;
}

.login-note {
    margin-top: 14px;
    font-size: 1.05rem;
    line-height: 1.45;
    color: var(--gold-soft);
}

.login-sends {
    margin-top: 20px;
    text-align: left;
}

.login-sends h3 {
    font-family: var(--font-serif);
    font-size: 1.28rem;
    font-weight: 600;
    color: var(--ivory);
}

.login-sends-empty {
    margin-top: 10px;
    font-size: 1.08rem;
    line-height: 1.4;
    color: var(--gold-soft);
}

.login-sends-empty[hidden],
.login-sends-scroll[hidden] {
    display: none;
}

.login-sends-scroll {
    margin-top: 12px;
    max-height: min(42vh, 340px);
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    border: 1px solid rgba(212, 175, 55, 0.28);
    border-radius: 12px;
    background: rgba(7, 16, 27, 0.45);
}

.login-sends-table {
    width: 100%;
    min-width: 280px;
    border-collapse: collapse;
    table-layout: fixed;
}

.login-sends-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #12263c;
    color: var(--gold);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: left;
    padding: 12px 12px 10px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.28);
}

.login-sends-table th:nth-child(1),
.login-sends-table td:nth-child(1) {
    width: 28%;
}

.login-sends-table th:nth-child(2),
.login-sends-table td:nth-child(2) {
    width: 32%;
}

.login-sends-table th:nth-child(3),
.login-sends-table td:nth-child(3) {
    width: 40%;
}

.login-sends-table td {
    padding: 12px;
    border-top: 1px solid rgba(212, 175, 55, 0.14);
    vertical-align: top;
    word-break: break-word;
}

.login-sends-table tbody tr:first-child td {
    border-top: 0;
}

.login-sends-table tbody tr:nth-child(even) {
    background: rgba(7, 16, 27, 0.28);
}

.login-send-name {
    font-size: 1.08rem;
    font-weight: 600;
    color: var(--ivory);
}

.login-send-phone {
    font-family: var(--font-serif);
    font-size: 1.12rem;
    color: var(--gold-soft);
}

.login-send-when {
    font-size: 1.02rem;
    line-height: 1.35;
    color: var(--gold-soft);
}

.login-signed-actions {
    margin-top: 18px;
    display: grid;
    gap: 8px;
}

.login-secondary,
#login-signout {
    border: 0;
    border-radius: 12px;
    min-height: 48px;
    font: inherit;
    font-size: 1.08rem;
    font-weight: 600;
    cursor: pointer;
}

.login-secondary {
    background: transparent;
    color: var(--gold-soft);
    border: 1px solid rgba(212, 175, 55, 0.35);
}

.login-secondary:hover,
.login-secondary:focus-visible {
    background: rgba(212, 175, 55, 0.1);
    outline: none;
}

#login-signout {
    background: linear-gradient(180deg, #e3c66a 0%, #c49a2a 100%);
    color: #1a1408;
}

body.is-login {
    overflow: hidden;
}

.face-calendar {
    position: relative;
    text-align: center;
    color: var(--ivory);
    background:
        radial-gradient(720px 280px at 50% -10%, rgba(212, 175, 55, 0.16), transparent 58%),
        linear-gradient(180deg, #12263c 0%, #0b1828 100%);
    padding: 22px 14px 20px;
}

.cal-sheet,
.cal-day-sheet {
    position: relative;
    width: 100%;
    text-align: center;
    color: var(--ivory);
}

.cal-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--gold-soft);
    cursor: pointer;
    display: grid;
    place-items: center;
}

.cal-close:hover,
.cal-close:focus-visible {
    background: rgba(212, 175, 55, 0.12);
    color: var(--gold);
    outline: none;
}

.cal-kicker {
    font-size: 0.82rem;
    letter-spacing: 0.34em;
    text-transform: uppercase;
    color: var(--gold);
    font-weight: 500;
}

.cal-sheet h2,
.cal-day-sheet h2 {
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: clamp(1.55rem, 6vw, 2rem);
    line-height: 1.2;
    margin-top: 8px;
    color: var(--ivory);
}

.cal-tag {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 1.05rem;
    margin-top: 6px;
    color: var(--gold-soft);
}

.cal-next-sunday {
    display: block;
    width: 100%;
    margin: 16px 0 14px;
    border: 0;
    border-radius: 12px;
    padding: 13px 14px;
    font: inherit;
    font-size: 0.98rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    background: linear-gradient(180deg, #e3c66a 0%, #c49a2a 100%);
    color: #1a1408;
}

.cal-next-sunday:hover,
.cal-next-sunday:focus-visible {
    filter: brightness(1.05);
    outline: none;
}

.cal-month {
    margin-top: 10px;
}

.cal-month-name {
    font-family: var(--font-serif);
    font-size: 1.18rem;
    color: var(--gold-soft);
    margin: 8px 0 8px;
}

.cal-weekdays,
.cal-weeks {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.cal-weekdays span {
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--gold);
    padding: 2px 0 6px;
}

.cal-day {
    min-height: 46px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--ivory);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 5px 2px 4px;
    font: inherit;
    font-size: 0.92rem;
}

button.cal-day {
    cursor: pointer;
}

button.cal-day:hover,
button.cal-day:focus-visible {
    border-color: rgba(212, 175, 55, 0.55);
    background: rgba(212, 175, 55, 0.12);
    outline: none;
}

.cal-day.is-pad {
    visibility: hidden;
}

.cal-day.is-empty {
    color: rgba(246, 239, 227, 0.42);
    background: transparent;
}

.cal-day.is-today {
    border-color: rgba(212, 175, 55, 0.7);
    box-shadow: inset 0 0 0 1px rgba(212, 175, 55, 0.28);
}

.cal-day-num {
    line-height: 1;
}

.cal-marks {
    display: flex;
    gap: 3px;
    min-height: 6px;
}

.cal-mark {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.cal-mark-service {
    background: var(--gold);
}

.cal-mark-event {
    background: #f6efe3;
    box-shadow: 0 0 0 1px rgba(212, 175, 55, 0.45);
}

.cal-legend {
    display: flex;
    justify-content: center;
    gap: 18px;
    margin-top: 14px;
    font-size: 0.78rem;
    color: var(--gold-soft);
}

.cal-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.cal-day-overlay,
.cal-day-panel {
    position: relative;
    margin-top: 16px;
    padding: 16px 12px 12px;
    border: 1px solid rgba(212, 175, 55, 0.36);
    border-radius: 14px;
    background: rgba(7, 16, 27, 0.45);
    text-align: left;
}

.cal-day-overlay[hidden],
.cal-day-panel[hidden] {
    display: none !important;
}

.cal-day-sheet {
    width: 100%;
    max-height: none;
    text-align: left;
    padding: 0;
}

.face-calendar .cal-close {
    position: absolute;
    top: 4px;
    right: 4px;
}

.cal-day-list {
    list-style: none;
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cal-day-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px 12px;
    align-items: center;
    padding: 12px;
    border: 1px solid rgba(212, 175, 55, 0.28);
    border-radius: 12px;
    background: rgba(7, 16, 27, 0.35);
}

.cal-day-item h3 {
    font-family: var(--font-serif);
    font-size: 1.12rem;
    font-weight: 600;
    color: var(--ivory);
}

.cal-day-item p {
    grid-column: 1;
    font-size: 0.82rem;
    color: var(--gold-soft);
}

.cal-add {
    border: 0;
    border-radius: 10px;
    padding: 8px 12px;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    background: linear-gradient(180deg, #e3c66a 0%, #c49a2a 100%);
    color: #1a1408;
    white-space: nowrap;
}

.cal-add:hover,
.cal-add:focus-visible {
    filter: brightness(1.05);
    outline: none;
}

body.is-calendar {
    overflow: auto;
}

@media (min-width: 900px) and (hover: hover) {
    .face-calendar {
        padding: 32px 36px 36px;
        width: calc(100% - 28px);
        margin: 16px auto 38px;
    }
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 22px;
    transform: translateX(-50%);
    max-width: min(360px, calc(100% - 32px));
    background: #f6efe3;
    color: #1c140c;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 0.88rem;
    line-height: 1.4;
    box-shadow: var(--shadow);
    z-index: 140;
}

.toast[hidden] {
    display: none;
}

.sms.invalid #sms-phone {
    border-color: #e07a6a;
}

@media (min-width: 720px) and (orientation: portrait),
       (min-width: 720px) and (hover: hover) {
    body {
        padding: 40px 24px;
    }
}

@media (min-width: 900px) and (hover: hover) {
    body {
        padding: 36px 28px 40px;
    }

    .page {
        width: min(980px, calc(100vw - 48px));
    }

    .card-portrait {
        width: min(94%, 920px);
        aspect-ratio: 1659 / 948;
        margin: 22px auto 44px;
    }

    .card-photo {
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        transform: none;
        object-fit: contain;
    }

    .invite-face {
        display: grid;
        grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
        grid-template-areas:
            "kicker kicker"
            "title title"
            "lede lede"
            "flourish flourish"
            "times info"
            "times phone"
            "times web";
        column-gap: 56px;
        row-gap: 8px;
        padding: 42px 48px 46px;
        margin: 20px auto 40px;
        width: calc(100% - 28px);
        text-align: left;
        color: #f3ead8;
        background:
            radial-gradient(720px 280px at 12% 0%, rgba(212, 175, 55, 0.14), transparent 52%),
            linear-gradient(180deg, #12263c 0%, #0b1828 100%);
        border: 1px solid rgba(212, 175, 55, 0.42);
        box-shadow: 0 18px 36px rgba(0, 0, 0, 0.28);
    }

    .invite-face .eyebrow {
        grid-area: kicker;
        color: #e8d5a3;
        font-size: 0.78rem;
        letter-spacing: 0.28em;
    }

    .invite-face h1 {
        grid-area: title;
        color: #f6efe3;
        font-size: clamp(2rem, 3.2vw, 2.7rem);
        line-height: 1.12;
        margin-top: 6px;
        padding: 0;
    }

    .invite-face .lede {
        grid-area: lede;
        color: #e8d5a3;
        font-size: 1.35rem;
        margin-top: 4px;
    }

    .invite-face .flourish {
        grid-area: flourish;
        justify-content: flex-start;
        margin: 8px 0 18px;
    }

    .invite-face .times {
        grid-area: times;
        width: 100%;
        margin: 0;
        align-self: stretch;
        gap: 14px;
    }

    .invite-face .times::before,
    .invite-face .place::before,
    .invite-face .contacts::before,
    .invite-face .church-site::before {
        display: block;
        margin-bottom: 10px;
        font-family: var(--font-sans);
        font-size: 0.68rem;
        font-style: normal;
        font-weight: 600;
        letter-spacing: 0.22em;
        text-transform: uppercase;
        color: #d4af37;
    }

    .invite-face .times::before {
        content: "Service times";
    }

    .invite-face .times li {
        font-size: 1.18rem;
        color: #f6efe3;
        border-bottom-color: rgba(212, 175, 55, 0.28);
        padding-bottom: 12px;
    }

    .invite-face .times li span:last-child {
        color: #e8d5a3;
        font-size: 1.42rem;
    }

    .invite-face .place,
    .invite-face .contacts {
        text-align: left;
        justify-items: start;
        align-self: start;
        margin-top: 0;
        color: #e8d5a3;
    }

    .invite-face .place {
        grid-area: info;
        font-size: 1.28rem;
        line-height: 1.45;
        gap: 4px;
    }

    .invite-face .place::before {
        content: "Location";
    }

    .invite-face .contacts {
        grid-area: phone;
        gap: 4px;
        margin-top: 18px;
    }

    .invite-face .contacts::before {
        content: "Church phone";
    }

    .invite-face .contacts span {
        margin-top: 0;
        font-size: 1.12rem;
        color: #d8c7a2;
    }

    .invite-face .contacts a {
        color: #f3ead8;
        font-size: 1.7rem;
        letter-spacing: 0.02em;
    }

    .invite-face .contacts a:hover {
        color: #e8d5a3;
    }

    .invite-face .church-site {
        grid-area: web;
        text-align: left;
        justify-self: start;
        margin-top: 18px;
    }

    .invite-face .church-site::before {
        display: block;
        margin-bottom: 10px;
        content: "Church website";
        font-family: var(--font-sans);
        font-size: 0.68rem;
        font-style: normal;
        font-weight: 600;
        letter-spacing: 0.22em;
        text-transform: uppercase;
        color: #d4af37;
    }

    .invite-face .church-site a {
        color: #f3ead8;
        font-size: 1.28rem;
        border-bottom-color: rgba(232, 213, 163, 0.4);
    }

    .invite-face .church-site a:hover {
        color: #e8d5a3;
    }

    .invite-face .intake-jump {
        display: none;
    }

    .face {
        width: calc(100% - 28px);
        margin: 16px auto 38px;
        padding: 32px 36px 36px;
        min-height: 280px;
    }

    .qr-hero {
        width: min(240px, 36vw);
        height: min(240px, 36vw);
    }

    .dots {
        bottom: 14px;
    }
}

.splash {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(720px 420px at 50% 28%, rgba(212, 175, 55, 0.16), transparent 58%),
        linear-gradient(180deg, #0d1c30 0%, #07101b 100%);
    color: var(--gold-soft);
    transition: opacity 0.55s ease, visibility 0.55s ease;
}

.splash-inner {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: min(340px, 100%);
}

.splash-kicker {
    font-size: 0.82rem;
    letter-spacing: 0.38em;
    text-transform: uppercase;
    color: var(--gold);
}

.splash-name {
    font-family: var(--font-serif);
    font-size: 1.85rem;
    line-height: 1.2;
    margin-top: 10px;
    color: var(--ivory);
}

.splash-tag {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 1.12rem;
    margin-top: 12px;
    color: var(--gold-soft);
}

.splash-bar {
    width: 96px;
    height: 2px;
    margin-top: 22px;
    border-radius: 99px;
    background: rgba(212, 175, 55, 0.18);
    overflow: hidden;
}

.splash-bar span {
    display: block;
    height: 100%;
    width: 42%;
    background: linear-gradient(90deg, transparent, #d4af37, #e8d5a3, transparent);
    animation: splashBar 1.15s ease-in-out infinite;
}

.splash.is-done {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

body.is-booting {
    overflow: hidden;
}

body.is-ready .card-portrait {
    animation: cardRise 0.95s cubic-bezier(0.22, 0.9, 0.32, 1) both;
}

body.is-ready .shell {
    animation: shellGlow 1.15s ease both;
}

body.is-ready .dots,
body.is-ready .dock,
body.is-ready .pwa-install {
    animation: navFade 0.7s ease 0.28s both;
}

@keyframes splashPulse {
    0%, 100% { transform: scale(1); opacity: 0.85; }
    50% { transform: scale(1.06); opacity: 1; }
}

@keyframes splashBar {
    from { transform: translateX(-130%); }
    to { transform: translateX(280%); }
}

@keyframes cardRise {
    from {
        opacity: 0;
        transform: translateY(22px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shellGlow {
    from {
        border-color: rgba(212, 175, 55, 0.12);
        box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
    }
    to {
        border-color: rgba(212, 175, 55, 0.32);
        box-shadow: var(--shadow), 0 0 42px rgba(212, 175, 55, 0.16);
    }
}

@keyframes navFade {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

html.is-fs,
html:fullscreen,
html:-webkit-full-screen {
    background: #07101b;
    height: 100dvh;
}

html.is-fs body,
html:fullscreen body,
html:-webkit-full-screen body,
body.is-fs {
    position: fixed;
    inset: 0;
    width: 100dvw;
    height: 100dvh;
    min-height: 100dvh;
    min-width: 100dvw;
    overflow: auto;
    padding:
        max(12px, env(safe-area-inset-top))
        max(12px, env(safe-area-inset-right))
        max(16px, env(safe-area-inset-bottom))
        max(12px, env(safe-area-inset-left));
}

html.is-fs .page,
html:fullscreen .page,
html:-webkit-full-screen .page,
body.is-fs .page {
    width: min(460px, 100%);
    min-height: calc(100dvh - 32px);
    justify-content: center;
}

html.is-fs .shell,
html:fullscreen .shell,
html:-webkit-full-screen .shell,
body.is-fs .shell {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

html.is-fs .card-portrait,
html:fullscreen .card-portrait,
html:-webkit-full-screen .card-portrait,
body.is-fs .card-portrait {
    width: min(96%, calc((100dvh - 170px) * 948 / 1659));
}

html.is-fs .glow,
html:fullscreen .glow,
html:-webkit-full-screen .glow,
body.is-fs .glow {
    display: none;
}

@media (min-width: 900px) and (hover: hover) {
    html.is-fs .page,
    html:fullscreen .page,
    html:-webkit-full-screen .page,
    body.is-fs .page {
        width: min(1400px, calc(100vw - 32px));
        min-height: calc(100dvh - 32px);
    }

    html.is-fs .card-portrait,
    html:fullscreen .card-portrait,
    html:-webkit-full-screen .card-portrait,
    body.is-fs .card-portrait {
        width: min(96%, calc((100dvh - 140px) * 1659 / 948));
        aspect-ratio: 1659 / 948;
        margin: 16px auto 40px;
    }
}

html.is-focus,
html.is-focus.is-fs {
    overflow: hidden;
}

html.is-focus body,
html.is-focus.is-fs body,
html.is-focus:fullscreen body,
body.is-focus {
    padding:
        env(safe-area-inset-top)
        env(safe-area-inset-right)
        env(safe-area-inset-bottom)
        env(safe-area-inset-left);
    overflow: hidden;
}

html.is-focus .page,
html.is-focus.is-fs .page,
html.is-focus:fullscreen .page,
html.is-focus:-webkit-full-screen .page,
body.is-focus .page {
    width: 100vw;
    max-width: none;
    min-height: 100dvh;
    justify-content: center;
}

html.is-focus .shell,
html.is-focus.is-fs .shell,
body.is-focus .shell {
    background: transparent;
    border-color: transparent;
    border-radius: 0;
    box-shadow: none;
}

html.is-focus .dock {
    animation: none !important;
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 0;
    max-height: 0;
    padding: 0;
    opacity: 0;
    transform: translateY(22px);
    pointer-events: none;
    border-top-width: 0;
    overflow: hidden;
}

html.is-focus .pwa-install {
    display: none !important;
}

html.is-focus .dots {
    animation: none !important;
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    visibility: hidden;
}

html.is-focus[data-focus="photo"] .card-portrait,
html.is-focus.is-fs[data-focus="photo"] .card-portrait {
    width: min(100vw, calc(100dvh * 948 / 1659)) !important;
    margin: 0 auto !important;
    cursor: zoom-out;
}

html.is-focus[data-focus="qr"] .face-qr {
    background: transparent;
    border: 0;
    margin: 0;
    padding: 0;
    min-height: calc(100dvh - 12px);
    width: 100%;
}

html.is-focus[data-focus="qr"] .face-qr .eyebrow,
html.is-focus[data-focus="qr"] .face-qr h2,
html.is-focus[data-focus="qr"] .face-qr .face-note {
    opacity: 0;
    max-height: 0;
    margin: 0;
    overflow: hidden;
}

html.is-focus[data-focus="qr"] .qr-hero {
    width: min(96vmin, 720px);
    height: min(96vmin, 720px);
    margin: 0;
    padding: 16px;
    cursor: zoom-out;
}

@media (min-width: 900px) and (hover: hover) {
    html.is-focus[data-focus="photo"] .card-portrait,
    html.is-focus.is-fs[data-focus="photo"] .card-portrait {
        width: min(100vw, calc(100dvh * 1659 / 948));
    }
}

/* Phones/tablets in landscape: keep the portrait card UI (CSS fallback when OS lock is ignored). */
@media (orientation: landscape) and (max-width: 899px),
       (orientation: landscape) and (hover: none) and (pointer: coarse) {
    html {
        width: 100dvw;
        height: 100dvh;
        overflow: hidden;
        overscroll-behavior: none;
    }

    html,
    html.is-fs,
    html:fullscreen,
    html:-webkit-full-screen,
    html.is-focus,
    html.is-focus.is-fs {
        background: #07101b;
    }

    body,
    html.is-fs body,
    html:fullscreen body,
    html:-webkit-full-screen body,
    body.is-fs,
    html.is-focus body,
    html.is-focus.is-fs body,
    html.is-focus:fullscreen body,
    body.is-focus {
        position: fixed;
        inset: auto;
        width: 100dvh;
        height: 100dvw;
        min-width: 100dvh;
        min-height: 100dvw;
        max-width: none;
        overflow: auto;
        top: 0;
        left: 100dvw;
        margin: 0;
        transform-origin: top left;
        transform: rotate(90deg);
        padding:
            max(8px, env(safe-area-inset-right))
            max(6px, env(safe-area-inset-bottom))
            max(14px, env(safe-area-inset-left))
            max(6px, env(safe-area-inset-top));
    }

    html[data-turn="-90"] body,
    html[data-turn="-90"].is-fs body,
    html[data-turn="-90"]:fullscreen body,
    html[data-turn="-90"]:-webkit-full-screen body,
    html[data-turn="-90"] body.is-fs,
    html[data-turn="-90"].is-focus body,
    html[data-turn="-90"].is-focus.is-fs body,
    html[data-turn="-90"] body.is-focus {
        top: 100dvh;
        left: 0;
        transform: rotate(-90deg);
        padding:
            max(8px, env(safe-area-inset-left))
            max(6px, env(safe-area-inset-top))
            max(14px, env(safe-area-inset-right))
            max(6px, env(safe-area-inset-bottom));
    }

    .page,
    html.is-fs .page,
    html:fullscreen .page,
    html:-webkit-full-screen .page,
    body.is-fs .page,
    html.is-focus .page,
    html.is-focus.is-fs .page,
    html.is-focus:fullscreen .page,
    html.is-focus:-webkit-full-screen .page,
    body.is-focus .page {
        width: min(420px, 100%);
        min-height: calc(100dvw - 28px);
        max-width: none;
    }

    html.is-fs .page,
    html:fullscreen .page,
    html:-webkit-full-screen .page,
    body.is-fs .page {
        width: min(460px, 100%);
    }

    html.is-focus .page,
    html.is-focus.is-fs .page,
    body.is-focus .page {
        width: 100%;
        min-height: 100%;
    }

    .card-portrait {
        width: min(98%, calc((100dvw - 170px) * 948 / 1659));
    }

    html.is-fs .card-portrait,
    html:fullscreen .card-portrait,
    html:-webkit-full-screen .card-portrait,
    body.is-fs .card-portrait {
        width: min(96%, calc((100dvw - 170px) * 948 / 1659));
    }

    html.is-focus[data-focus="photo"] .card-portrait,
    html.is-focus.is-fs[data-focus="photo"] .card-portrait {
        width: min(100%, calc(100dvw * 948 / 1659)) !important;
        margin: 0 auto !important;
    }

    html.is-focus[data-focus="qr"] .face-qr {
        min-height: calc(100dvw - 12px);
        width: 100%;
    }

    html.is-focus[data-focus="qr"] .qr-hero {
        width: min(96%, 720px);
        height: min(96%, 720px);
    }

    .qr-hero {
        width: min(220px, 58%);
        height: min(220px, 58%);
    }

    .login-overlay {
        padding:
            max(18px, env(safe-area-inset-right))
            max(16px, env(safe-area-inset-bottom))
            max(22px, env(safe-area-inset-left))
            max(16px, env(safe-area-inset-top));
    }

    html[data-turn="-90"] .login-overlay {
        padding:
            max(18px, env(safe-area-inset-left))
            max(16px, env(safe-area-inset-top))
            max(22px, env(safe-area-inset-right))
            max(16px, env(safe-area-inset-bottom));
    }

    .login-sheet,
    .cal-sheet,
    .cal-day-sheet {
        max-height: min(92dvw, 760px);
    }

    .splash {
        padding: 24px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .splash,
    .splash-ring,
    .splash-bar span,
    body.is-ready .card-portrait,
    body.is-ready .shell,
    body.is-ready .dots,
    body.is-ready .dock,
    body.is-ready .pwa-install,
    .deck,
    .deck-track,
    .card-portrait,
    .qr-hero,
    .shell,
    .dock,
    .pwa-install,
    .dots,
    .login-overlay,
    .login-sheet,
    .cal-sheet,
    .cal-day-sheet {
        animation: none !important;
        transition: none !important;
    }

    .splash.is-done {
        opacity: 0;
        visibility: hidden;
    }
}

body.is-scan {
    overflow: hidden;
}

.scan-overlay {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: grid;
    place-items: center;
    padding:
        max(12px, env(safe-area-inset-top))
        max(12px, env(safe-area-inset-right))
        max(16px, env(safe-area-inset-bottom))
        max(12px, env(safe-area-inset-left));
    background: rgba(7, 16, 27, 0.88);
    backdrop-filter: blur(14px);
}

.scan-overlay[hidden] {
    display: none !important;
}

.scan-sheet {
    position: relative;
    width: min(440px, 100%);
    max-height: min(96dvh, 860px);
    overflow: auto;
    background:
        radial-gradient(720px 280px at 50% -10%, rgba(212, 175, 55, 0.16), transparent 58%),
        linear-gradient(180deg, #12263c 0%, #0b1828 100%);
    border: 1px solid rgba(212, 175, 55, 0.42);
    border-radius: 20px;
    padding: 22px 18px 20px;
    color: #f4ead6;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.scan-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    border: 0;
    background: transparent;
    color: #e8d5a3;
    cursor: pointer;
    border-radius: 999px;
}

.scan-close:hover,
.scan-close:focus-visible {
    background: rgba(255, 255, 255, 0.08);
}

.scan-overlay .eyebrow {
    margin: 0 0 4px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    font-size: 0.72rem;
    color: rgba(232, 213, 163, 0.72);
}

.scan-overlay h2 {
    margin: 0 0 12px;
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: 1.7rem;
    font-weight: 600;
}

.scan-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    max-height: min(52dvh, 420px);
    border-radius: 14px;
    overflow: hidden;
    background: #050910;
    border: 1px solid rgba(212, 175, 55, 0.28);
}

.scan-frame video,
.scan-frame img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.scan-reading {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(5, 9, 16, 0.62);
    font-weight: 600;
    letter-spacing: 0.04em;
}

.scan-reading[hidden],
.scan-frame video[hidden],
.scan-frame img[hidden] {
    display: none !important;
}

.scan-cam-error,
.scan-form-error {
    margin: 10px 0 0;
    color: #f0b4a8;
    font-size: 0.9rem;
}

.scan-cam-error[hidden],
.scan-form-error[hidden] {
    display: none !important;
}

.scan-cam-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 14px;
}

.scan-shutter {
    width: 72px;
    height: 72px;
    border-radius: 999px;
    border: 4px solid #e8d5a3;
    background: #f6efe3;
    color: #07101c;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
}

.scan-shutter:disabled {
    opacity: 0.45;
    cursor: default;
}

.scan-retake,
.scan-start,
.scan-manual,
.scan-back,
#scan-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 16px;
    border-radius: 999px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.scan-retake,
.scan-start,
.scan-back {
    border: 1px solid rgba(212, 175, 55, 0.45);
    background: transparent;
    color: #f4ead6;
}

.scan-manual {
    display: block;
    width: 100%;
    margin-top: 12px;
    border: 0;
    background: transparent;
    color: #d7b56a;
    text-decoration: underline;
    text-underline-offset: 3px;
}

#scan-submit {
    width: 100%;
    margin-top: 8px;
    border: 0;
    background: #d7b56a;
    color: #07101c;
}

#scan-submit:disabled {
    opacity: 0.55;
}

.scan-form {
    display: grid;
    gap: 8px;
}

.scan-form input,
.scan-form textarea {
    width: 100%;
    box-sizing: border-box;
    border-radius: 12px;
    border: 1px solid rgba(212, 175, 55, 0.28);
    background: rgba(7, 16, 27, 0.55);
    color: #f6efe3;
    padding: 11px 12px;
    font: inherit;
}

.scan-form textarea {
    min-height: 72px;
    resize: vertical;
}

.scan-first {
    border: 0;
    margin: 4px 0;
    padding: 0;
}

.scan-first legend {
    font-size: 0.82rem;
    color: rgba(244, 234, 214, 0.78);
    margin-bottom: 6px;
}

.scan-first-row {
    display: flex;
    gap: 14px;
}

.scan-first label {
    display: flex;
    gap: 6px;
    align-items: center;
    font-size: 0.92rem;
}

.scan-more {
    margin: 4px 0 0;
}

.scan-more > summary {
    cursor: pointer;
    color: #d7b56a;
    font-weight: 600;
    list-style: none;
}

.scan-more > summary::-webkit-details-marker {
    display: none;
}

.scan-more-fields {
    display: grid;
    gap: 8px;
    margin-top: 8px;
}

.scan-form-actions {
    display: grid;
    gap: 8px;
    margin-top: 6px;
}

@media (max-height: 700px) {
    .scan-frame {
        max-height: 38dvh;
        aspect-ratio: 4 / 3;
    }
}
