:root {
    color-scheme: light;
    --browser-chrome: #bbdef5;
    --background: #f1faff;
    --surface: #eff9ff;
    --text-primary: #18243f;
    --text-secondary: #344e64;
    --text-tertiary: #496277;
    --divider: #526f8e40;
    --accent: #176d9c;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
/* Safari may derive browser chrome from the root/body rather than theme-color. */
html { background: var(--browser-chrome); }
body {
    min-width: 280px;
    min-height: 100vh;
    min-height: 100svh;
    color: var(--text-primary);
    background: var(--browser-chrome);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    letter-spacing: 0;
    -webkit-font-smoothing: antialiased;
}
body.modal-open { overflow: hidden; }
button { color: inherit; font: inherit; letter-spacing: 0; touch-action: manipulation; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; }
.page-shell {
    --photo-height: 440px;
    position: relative;
    isolation: isolate;
    width: 100%;
    min-height: 100vh;
    min-height: 100svh;
    background: var(--background);
    padding-bottom: calc(36px + env(safe-area-inset-bottom));
}
.page-shell::before { content: ''; position: absolute; z-index: -1; top: calc(var(--photo-height) - 80px); bottom: 0; left: 0; width: 100%; background: url('/static/languo-silk-bg.webp') center / 100% 100% no-repeat; pointer-events: none; }
.hero-visual { position: absolute; z-index: -1; inset: 0 0 auto; height: var(--photo-height); background: var(--browser-chrome); pointer-events: none; -webkit-mask-image: linear-gradient(#000 64%, transparent 100%); mask-image: linear-gradient(#000 64%, transparent 100%); }
.hero-visual picture { display: block; width: 100%; max-width: 1100px; height: 100%; margin: 0 auto; -webkit-mask-image: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent); mask-image: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent); }
.hero-photo { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 25%; }
.app-header { display: flex; position: relative; flex-direction: column; align-items: center; padding: max(calc(var(--photo-height) - 104px), env(safe-area-inset-top)) 20px 26px; text-align: center; }
.logo-stage { display: grid; place-items: center; width: 104px; height: 104px; }
.app-icon { display: block; width: 104px; height: 104px; border: 1px solid #dfffff; border-radius: 24px; object-fit: cover; box-shadow: 0 0 0 4px #ffffff40, -8px 6px 24px #50dfec55, 8px 12px 24px #a996e855; }
.app-name { margin-top: 14px; font-size: 44px; font-weight: 700; line-height: 1.25; color: #3c54ba; text-shadow: 0 1px 0 #fff, 0 3px 0 #8395bd40; }
@supports (background-clip: text) or (-webkit-background-clip: text) {
    .app-name { background: linear-gradient(110deg, #168cbb 5%, #435bc5 50%, #9955b8 95%); -webkit-background-clip: text; background-clip: text; color: transparent; text-shadow: none; }
}
.app-description { margin-top: 12px; color: var(--text-secondary); font-size: 17px; line-height: 1.6; }
.app-slogan { margin-top: 6px; color: var(--text-tertiary); font-size: 13px; line-height: 1.6; }
.action-section, .page-note { position: relative; width: calc(100% - 64px); max-width: 800px; margin: 0 auto; }
.section-title { margin-bottom: 16px; color: var(--text-primary); font-size: 14px; font-weight: 500; line-height: 1.5; }
.section-title::after { content: ''; display: block; width: 20px; height: 2px; margin-top: 7px; background: #36a6d6; border-radius: 1px; }
.action-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.action-row {
    position: relative;
    isolation: isolate;
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) 20px;
    gap: 16px;
    align-items: center;
    width: 100%;
    min-height: 100px;
    padding: 22px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: linear-gradient(115deg, #e8ffffed, #f1f5ffed 55%, #f9e9fff2) padding-box, linear-gradient(115deg, #6ee8ef, #fff 50%, #d6a8ed) border-box;
    box-shadow: inset 0 1px 0 1px #ffffffcc, 0 6px 18px #6b80a624;
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 160ms ease, border-color 160ms ease;
}
.action-row:hover { border-color: #537fb4; box-shadow: inset 0 0 0 3px #ffffff80, 0 5px 16px #567cc52b; }
.action-row:active { border-color: #4267a5; box-shadow: inset 0 0 0 3px #91cbf33b; }
.action-row:disabled { cursor: wait; }
.action-row:disabled .action-chevron { opacity: .4; }
.action-primary { background: linear-gradient(115deg, #baf6f9f5, #eaf3ffed 55%, #f1defff2) padding-box, linear-gradient(120deg, #65e5e3, #fff 45%, #d1a9ed) border-box; color: #132b3e; box-shadow: inset 0 1px 0 1px #ffffffcc, -2px 4px 14px #4bd5df30, 2px 4px 14px #bf9cdd30; }
.action-primary:hover { border-color: #32b7c4; }
.action-primary:active { border-color: #1c82a6; }
.action-primary .action-meta { color: var(--text-secondary); }
.action-copy { min-width: 0; }
.action-title, .action-meta { display: block; overflow-wrap: anywhere; }
.action-title { font-size: 17px; font-weight: 600; line-height: 1.45; }
.action-meta { margin-top: 5px; color: var(--text-secondary); font-size: 12px; line-height: 1.5; }
.action-icon { display: block; width: 28px; height: 28px; flex: 0 0 auto; color: #4c61d0; filter: drop-shadow(-1px -1px 0 #a5fff5) drop-shadow(1px 2px 0 #c7b0ee); }
.action-chevron { display: block; width: 20px; height: 20px; }
.help-section { margin-top: 30px; }
.help-section .action-list { display: block; }
.help-section .action-row { min-height: 84px; padding: 18px 0; border: 0; border-top: 1px solid var(--divider); border-bottom: 1px solid var(--divider); border-radius: 0; background: transparent; }
.help-section .action-row { box-shadow: none; }
.help-section .action-row:hover { background: #ffffff45; box-shadow: none; }
.help-section .action-title { font-size: 14px; font-weight: 500; }
.help-section .action-icon { width: 26px; height: 26px; }
.help-section .action-chevron { color: var(--text-tertiary); }
.page-note { display: flex; justify-content: space-between; gap: 12px; padding-top: 22px; color: var(--text-tertiary); font-size: 11px; line-height: 1.7; }
.page-note span { overflow-wrap: anywhere; }
.page-note .footer-brand { flex-shrink: 0; color: var(--text-secondary); }
.download-feedback { margin-top: 14px; padding: 10px 12px; border-left: 2px solid #a62d48; background: #fff6f4ed; color: #92293c; font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.download-feedback[hidden] { display: none; }

.modal { position: fixed; z-index: 1000; inset: 0; display: none; align-items: center; justify-content: center; padding: 24px; background: #14374880; }
.modal.show { display: flex; }
.modal-content { width: 100%; max-width: 480px; max-height: calc(100vh - 48px); max-height: calc(100svh - 48px); overflow-y: auto; border: 1px solid #e6ffff; border-radius: 8px; background: #f0faff; box-shadow: 0 24px 80px #263e6b4d; padding-bottom: env(safe-area-inset-bottom); }
.modal-header { position: sticky; z-index: 1; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 16px 16px 24px; border-bottom: 1px solid var(--divider); background: #f0faff; }
.modal-title { min-width: 0; font-size: 18px; font-weight: 600; line-height: 1.45; }
.close-btn { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 40px; width: 40px; height: 40px; border: 0; border-radius: 4px; background: transparent; cursor: pointer; }
.close-btn:hover, .close-btn:active { background: #dceef7; }
.close-icon { width: 22px; height: 22px; }
.modal-body { padding: 4px 24px 24px; }
.steps { list-style: none; }
.step { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 14px; align-items: start; padding: 20px 0; color: var(--text-secondary); font-size: 14px; line-height: 1.8; }
.step + .step { border-top: 1px solid var(--divider); }
.step-number { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border: 1px solid #9eb6cd; border-radius: 50%; color: var(--accent); font-size: 12px; font-weight: 600; }
.step strong { color: var(--text-primary); font-weight: 500; }
.tips { padding-top: 16px; border-top: 1px solid var(--divider); color: var(--text-tertiary); font-size: 12px; line-height: 1.8; }

@media (max-width: 600px) {
    .page-shell { --photo-height: clamp(190px, calc(88vw - 44px), 360px); }
    /* Reserve room for both downloads and the expanded browser toolbar. */
    @supports (height: 100svh) {
        .page-shell { --photo-height: clamp(190px, min(calc(88vw - 44px), calc(100svh - 430px - env(safe-area-inset-bottom))), 360px); }
    }
    .action-section, .page-note { width: calc(100% - 44px); }
    .hero-visual picture { -webkit-mask-image: none; mask-image: none; }
    .hero-photo { object-position: center; }
    .app-header { padding-bottom: 20px; }
    .app-icon { width: 88px; height: 88px; border-radius: 20px; }
    .logo-stage { width: 88px; height: 88px; }
    .app-name { font-size: 36px; margin-top: 10px; }
    .app-description { font-size: 15px; margin-top: 8px; }
    .section-title { margin-bottom: 12px; }
    .action-list { grid-template-columns: minmax(0, 1fr); gap: 10px; }
    .action-row { min-height: 84px; padding: 16px 18px; }
    .action-title { font-size: 16px; }
    .help-section { margin-top: 24px; }
    .page-note { font-size: 10px; }
    .modal { align-items: flex-end; padding: 0; }
    .modal-content { max-width: none; max-height: calc(100svh - 24px); border-radius: 8px 8px 0 0; }
}
@media (max-width: 359px) {
    .action-section, .page-note { width: calc(100% - 32px); }
    .action-row { gap: 12px; padding: 16px 12px; }
    .app-description { font-size: 14px; }
    .page-note { flex-wrap: wrap; }
}
@media (max-width: 600px) and (max-height: 650px) {
    .app-header { padding-bottom: 14px; }
    .logo-stage, .app-icon { width: 72px; height: 72px; }
    .app-icon { border-radius: 16px; }
    .app-name { margin-top: 8px; font-size: 32px; }
    .app-description { margin-top: 6px; font-size: 14px; }
    .app-slogan { margin-top: 4px; font-size: 12px; }
    .action-row { min-height: 78px; padding-top: 12px; padding-bottom: 12px; }
}
@media (min-width: 601px) and (max-height: 800px) {
    .page-shell { --photo-height: clamp(220px, 42svh, 360px); }
    .hero-visual picture { max-width: calc(var(--photo-height) * 2.6); }
}
@media (min-width: 601px) and (max-height: 500px) {
    .hero-visual picture { max-width: 640px; }
    .app-header { padding-top: calc(var(--photo-height) - 136px); padding-bottom: 16px; }
    .logo-stage, .app-icon { width: 64px; height: 64px; }
    .app-icon { border-radius: 15px; }
    .app-name { margin-top: 8px; font-size: 30px; }
    .app-description { margin-top: 8px; font-size: 13px; }
    .app-slogan { margin-top: 4px; font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; } }
