:root {
    --live-font-scale: 1;
    --las-accent: #ff4d6a;
    --las-bg: #171717;
    --las-card: #222;
    --las-card-2: #2a2a2a;
    --las-text: #f4f4f4;
    --las-muted: #999;
    --las-line: rgba(255, 255, 255, .09);
}

.las-modal {
    position: fixed;
    inset: 0;
    z-index: 10080;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
    box-sizing: border-box;
    background: rgba(0, 0, 0, .68);
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s ease, visibility .2s ease;
    -webkit-tap-highlight-color: transparent;
}

.las-modal.show { opacity: 1; visibility: visible; }

.las-sheet {
    width: min(100%, 480px);
    height: min(92dvh, 820px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: var(--las-text);
    background: var(--las-bg);
    border: 1px solid var(--las-line);
    border-bottom: 0;
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -20px 70px rgba(0, 0, 0, .48);
    transform: translateY(28px);
    transition: transform .22s ease;
    font-size: calc(15px * var(--live-font-scale));
}

.las-modal.show .las-sheet { transform: translateY(0); }

.las-sheet > header {
    min-height: 62px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 0 0 auto;
    padding: max(12px, env(safe-area-inset-top)) 18px 10px;
    box-sizing: border-box;
}

.las-sheet > header > div { display: flex; align-items: baseline; gap: 9px; }
.las-sheet > header span { color: var(--las-accent); font-size: .78em; font-weight: 800; letter-spacing: .08em; }
.las-sheet > header h2 { margin: 0; font-size: 1.22em; line-height: 1.2; }

.las-icon-btn {
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: #bbb;
    background: rgba(255, 255, 255, .07);
    font: inherit;
    font-size: 1.55em;
    line-height: 1;
    cursor: pointer;
}

.las-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    flex: 0 0 auto;
    gap: 5px;
    margin: 0 16px 10px;
    padding: 4px;
    border-radius: 13px;
    background: #202020;
}

.las-tabs button {
    min-height: 44px;
    border: 0;
    border-radius: 10px;
    color: #888;
    background: transparent;
    font: inherit;
    font-size: .88em;
    cursor: pointer;
}

.las-tabs button.active { color: #fff; background: #333; box-shadow: 0 2px 8px rgba(0, 0, 0, .2); font-weight: 700; }

.las-sheet > main {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0 16px max(26px, env(safe-area-inset-bottom));
    scrollbar-width: thin;
    scrollbar-color: #444 transparent;
}

.las-panel { display: none; }
.las-panel.active { display: block; animation: lasPanelIn .18s ease; }
.las-panel > h3, .las-section-title h3 { margin: 16px 2px 9px; color: #ddd; font-size: .88em; font-weight: 700; }
.las-panel > h3.las-spaced { margin-top: 24px; }

.las-setting-row,
.las-number-row,
.las-select-row {
    position: relative;
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 13px;
    box-sizing: border-box;
    border-bottom: 1px solid var(--las-line);
    background: var(--las-card);
    cursor: pointer;
}

.las-setting-row:first-of-type,
.las-panel h3 + .las-setting-row,
.las-number-row { border-radius: 13px 13px 0 0; }
.las-setting-row + .las-setting-row,
.las-setting-row + .las-number-row,
.las-select-row + .las-setting-row { border-radius: 0; }
.las-number-row:last-of-type,
.las-select-row,
.las-setting-row:last-of-type { border-radius: 0 0 13px 13px; border-bottom: 0; }

.las-setting-row > span,
.las-number-row > span,
.las-select-row > span { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.las-setting-row b,
.las-number-row b,
.las-select-row b { color: #eee; font-size: .94em; line-height: 1.35; }
.las-setting-row small,
.las-number-row small,
.las-select-row small { color: var(--las-muted); font-size: .76em; line-height: 1.35; font-weight: 400; }

.las-setting-row input[type="checkbox"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.las-switch {
    position: relative;
    width: 46px;
    height: 27px;
    flex: 0 0 auto;
    border-radius: 20px;
    background: #454545;
    transition: background .18s ease;
}

.las-switch::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 21px;
    height: 21px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, .3);
    transition: transform .18s ease;
}

.las-setting-row input:checked + .las-switch { background: var(--las-accent); }
.las-setting-row input:checked + .las-switch::after { transform: translateX(19px); }
.las-setting-row input:focus-visible + .las-switch { outline: 2px solid #fff; outline-offset: 2px; }

.las-inline-fields {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px;
    color: #777;
    background: #1f1f1f;
    border-bottom: 1px solid var(--las-line);
}

.las-inline-fields label { display: flex; align-items: center; gap: 7px; color: #aaa; font-size: .8em; }
.las-inline-fields input,
.las-number-row input,
.las-select-row select {
    min-height: 44px;
    box-sizing: border-box;
    border: 1px solid #414141;
    border-radius: 9px;
    outline: 0;
    color: #eee;
    background: #2b2b2b;
    color-scheme: dark;
    font: inherit;
}

.las-inline-fields input { width: 108px; padding: 0 8px; }
.las-number-row input { width: 68px; padding: 0 9px; text-align: center; }
.las-select-row select { min-width: 92px; padding: 0 9px; }
.las-inline-fields input:focus-visible,
.las-number-row input:focus-visible,
.las-select-row select:focus-visible { border-color: var(--las-accent); box-shadow: 0 0 0 2px rgba(255, 77, 106, .18); }

.las-notice-status {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 3px 2px;
    color: #888;
    font-size: .74em;
}

.las-section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.las-section-title button {
    min-height: 40px;
    padding: 0 9px;
    border: 0;
    color: #aaa;
    background: transparent;
    font: inherit;
    font-size: .75em;
    cursor: pointer;
}

.las-history { overflow: hidden; border-radius: 13px; background: var(--las-card); }
.las-empty { padding: 30px 14px; color: #777; text-align: center; font-size: .82em; }
.las-history-item { min-height: 70px; display: flex; align-items: flex-start; gap: 10px; padding: 12px 13px; box-sizing: border-box; border-bottom: 1px solid var(--las-line); }
.las-history-item:last-child { border-bottom: 0; }
.las-history-dot { width: 8px; height: 8px; flex: 0 0 auto; margin-top: 6px; border-radius: 50%; background: #777; }
.las-history-dot.followed { background: var(--las-accent); box-shadow: 0 0 0 4px rgba(255, 77, 106, .1); }
.las-history-item > div { min-width: 0; }
.las-history-item b { display: block; color: #e8e8e8; font-size: .88em; }
.las-history-item p { max-width: 100%; margin: 3px 0; overflow: hidden; color: #aaa; font-size: .78em; line-height: 1.4; white-space: nowrap; text-overflow: ellipsis; }
.las-history-item small { color: #666; font-size: .68em; }

.las-a11y-preview {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 7px;
    padding: 16px;
    border: 1px solid var(--las-line);
    border-radius: 14px;
    background: linear-gradient(145deg, #292929, #202020);
    font-size: calc(1em * var(--live-font-scale));
}
.las-a11y-preview b { color: #fff; }
.las-a11y-preview span { color: #aaa; font-size: .8em; }
.las-a11y-preview button,
.las-button-row button,
.las-cleanup-card button {
    min-height: 42px;
    padding: 0 15px;
    border: 0;
    border-radius: 11px;
    color: #ccc;
    background: #353535;
    font: inherit;
    font-size: .82em;
    cursor: pointer;
}
.las-a11y-preview button,
.las-button-row button.primary { color: #fff; background: var(--las-accent); }

.las-storage-grid {
    min-height: 90px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1px;
    overflow: hidden;
    border: 1px solid var(--las-line);
    border-radius: 14px;
    background: var(--las-line);
}
.las-storage-grid > div { min-height: 76px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; background: var(--las-card); }
.las-storage-grid b { color: #eee; font-size: 1em; }
.las-storage-grid span { color: #777; font-size: .72em; }
.las-storage-grid .las-storage-loading { grid-column: 1 / -1; color: #888; font-size: .82em; }
.las-storage-note { margin: 9px 3px 0; color: #777; font-size: .7em; line-height: 1.55; }

.las-background-tool,
.las-cleanup-card { padding: 13px; border: 1px solid var(--las-line); border-radius: 14px; background: var(--las-card); }
.las-background-preview {
    height: 130px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 11px;
    color: #777;
    background: #191919 center / cover no-repeat;
    font-size: .8em;
}
.las-background-preview.has-image { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12); }
.las-background-meta { margin: 9px 2px 11px; color: #888; font-size: .72em; line-height: 1.45; }
.las-button-row { display: flex; gap: 8px; }
.las-button-row button { flex: 1; }
.las-button-row button:disabled { opacity: .5; cursor: wait; }
.las-cleanup-card p { margin: 0 0 12px; color: #999; font-size: .76em; line-height: 1.65; }
.las-cleanup-card button.danger { width: 100%; color: #ff7186; background: rgba(255, 77, 106, .1); }

.las-confirm {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 22px;
    box-sizing: border-box;
    background: rgba(0, 0, 0, .74);
    backdrop-filter: blur(5px);
}
.las-confirm > div { width: min(100%, 350px); padding: 20px; box-sizing: border-box; border: 1px solid var(--las-line); border-radius: 18px; color: #eee; background: #222; box-shadow: 0 18px 55px rgba(0, 0, 0, .45); }
.las-confirm h3 { margin: 0 0 9px; font-size: 1.05em; }
.las-confirm p { margin: 0; color: #aaa; font-size: .8em; line-height: 1.65; }
.las-confirm > div > div { display: flex; gap: 9px; margin-top: 18px; }
.las-confirm button { flex: 1; min-height: 43px; border: 0; border-radius: 11px; color: #bbb; background: #333; font: inherit; cursor: pointer; }
.las-confirm button.danger { color: #fff; background: var(--las-accent); }

.las-follow-notice {
    position: fixed;
    inset: 0;
    z-index: 10075;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
    background: rgba(0, 0, 0, .58);
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s ease, visibility .2s ease;
}
.las-follow-notice.show { opacity: 1; visibility: visible; }
.las-follow-card { width: min(100%, 330px); padding: 24px 20px 18px; box-sizing: border-box; border: 1px solid rgba(255, 255, 255, .1); border-radius: 22px; color: #eee; background: #1d1d1d; box-shadow: 0 22px 65px rgba(0, 0, 0, .52); text-align: center; transform: scale(.96); transition: transform .2s ease; }
.las-follow-notice.show .las-follow-card { transform: scale(1); }
.las-follow-tag { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 15px; color: #ff7990; background: rgba(255, 77, 106, .1); font-size: 11px; font-weight: 800; letter-spacing: .04em; }
.las-follow-tag i { width: 6px; height: 6px; border-radius: 50%; background: var(--las-accent); box-shadow: 0 0 0 4px rgba(255, 77, 106, .12); }
.las-follow-avatar { width: 64px; height: 64px; display: flex; align-items: center; justify-content: center; margin: 18px auto 11px; border-radius: 50%; color: #fff; background: linear-gradient(145deg, #484848, #292929); font-size: 24px; font-weight: 800; }
.las-follow-card > strong { display: block; font-size: 18px; }
.las-follow-card > p { min-height: 20px; margin: 7px 0 19px; color: #999; font-size: 13px; line-height: 1.5; }
.las-follow-actions { display: flex; gap: 9px; }
.las-follow-actions button { flex: 1; min-height: 44px; border: 0; border-radius: 12px; color: #bbb; background: #303030; font-size: 14px; cursor: pointer; }
.las-follow-actions button.primary { color: #fff; background: var(--las-accent); font-weight: 700; }

.las-fallback-toast {
    position: fixed;
    left: 50%;
    bottom: max(90px, calc(env(safe-area-inset-bottom) + 72px));
    z-index: 10100;
    max-width: min(82vw, 360px);
    padding: 10px 15px;
    border-radius: 13px;
    color: #fff;
    background: rgba(25, 25, 25, .96);
    box-shadow: 0 8px 30px rgba(0, 0, 0, .35);
    font-size: 13px;
    line-height: 1.45;
    text-align: center;
    transform: translateX(-50%);
}

html.live-a11y-reduce-motion #layer-live *,
html.live-a11y-reduce-motion #layer-live-room *,
html.live-a11y-reduce-motion .las-modal *,
html.live-a11y-reduce-motion .las-follow-notice * {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
}

html.live-a11y-gifts-off #layer-live-room .live-gift-fullscreen,
html.live-a11y-gifts-off #layer-live-room .live-combo { display: none !important; }
html.live-a11y-particles-off #layer-live-room .live-atmo-particle { display: none !important; }
html.live-a11y-redpackets-off #layer-live-room .live-redpacket { display: none !important; }

html.live-a11y-high-contrast #layer-live,
html.live-a11y-high-contrast #layer-live-room { --live-muted: #d3d3d3; }
html.live-a11y-high-contrast #layer-live .live-card,
html.live-a11y-high-contrast #layer-live-room .live-room-tool-btn,
html.live-a11y-high-contrast #layer-live-room .live-danmaku-item,
html.live-a11y-high-contrast #layer-live-room .live-gift-panel,
html.live-a11y-high-contrast #layer-live-room .live-decor-panel,
html.live-a11y-high-contrast #layer-live-room .live-rank-panel { border: 1px solid rgba(255, 255, 255, .42) !important; }
html.live-a11y-high-contrast #layer-live :is(.live-card-name, .live-card-title, .live-history-name, .live-history-title),
html.live-a11y-high-contrast #layer-live-room :is(.live-room-host-name, .live-room-host-sub, .live-danmaku-text, .live-gift-name) { color: #fff !important; text-shadow: 0 1px 2px #000; }
html.live-a11y-high-contrast .las-sheet { --las-text: #fff; --las-muted: #d0d0d0; --las-line: rgba(255, 255, 255, .32); }
#layer-live-room .live-danmaku-item { opacity: var(--live-danmaku-opacity, 1); }
html.live-a11y-high-contrast .las-sheet button:focus-visible,
html.live-a11y-high-contrast #layer-live button:focus-visible,
html.live-a11y-high-contrast #layer-live-room button:focus-visible { outline: 3px solid #fff !important; outline-offset: 2px; }

#layer-live :is(.live-plaza-tab, .live-tab, .live-card-name, .live-card-title, .live-history-name, .live-history-title, .live-history-meta, .live-empty),
#layer-live-room :is(.live-room-host-name, .live-room-host-sub, .live-room-input, .live-danmaku-item, .live-announcement, .live-host-activity-bar, .live-gift-name, .live-gift-cost, .live-decor-label, .live-rank-name, button) {
    font-size: calc(1em * var(--live-font-scale));
}

html.live-a11y-muted #layer-live-room audio,
html.live-a11y-muted #layer-live-room video { volume: 0; }

.las-user-background { background-color: #111 !important; }

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

@media (min-width: 560px) and (min-height: 700px) {
    .las-modal { align-items: center; padding: 24px; }
    .las-sheet { border-bottom: 1px solid var(--las-line); border-radius: 24px; }
}

@media (prefers-reduced-motion: reduce) {
    .las-modal,
    .las-sheet,
    .las-panel.active,
    .las-follow-notice,
    .las-follow-card { animation: none !important; transition: none !important; }
}

@media (max-width: 360px) {
    .las-sheet > main { padding-left: 11px; padding-right: 11px; }
    .las-inline-fields { gap: 5px; }
    .las-inline-fields input { width: 96px; }
}
