/* ==================================================
   前台公共样式
   电脑端显示苹果框架，手机端全屏显示
   ================================================== */

:root {
    --background: #f3f6fb;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --text: #172033;
    --text-muted: #667085;
    --border: #dce3ed;
    --primary: #1f6feb;
    --primary-hover: #1758bd;
    --primary-soft: #e8f1ff;
    --success: #087443;
    --success-background: #e8f7ef;
    --error: #b42318;
    --error-background: #fff0ee;
    --warning: #8a6500;
    --warning-background: #fff8e6;
    --warning-border: #f3ce69;
    --shadow: 0 12px 35px rgba(17, 32, 62, 0.08);
    --shadow-soft: 0 6px 20px rgba(17, 32, 62, 0.06);
    --radius: 18px;
    --radius-small: 12px;
    --device-width: 430px;
    --device-height: 900px;
    --status-bar-height: 43px;
    --header-height: 58px;
    --bottom-nav-height: 78px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: #eef1f6;
    touch-action: pan-x pan-y;
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    background:
        radial-gradient(
            circle at 20% 15%,
            rgba(31, 111, 235, 0.1),
            transparent 28%
        ),
        radial-gradient(
            circle at 82% 80%,
            rgba(84, 105, 212, 0.1),
            transparent 30%
        ),
        #eef1f6;
    color: var(--text);
    font-family:
        Inter,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    line-height: 1.6;
    touch-action: pan-x pan-y;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button {
    border: 0;
}

img,
svg {
    max-width: 100%;
}

.container {
    width: calc(100% - 24px);
    margin-right: auto;
    margin-left: auto;
}


/* 苹果设备外框 */

.device-stage {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 16px;
}

.device-shell {
    position: relative;
    width: min(var(--device-width), calc(100vw - 32px));
    height: min(var(--device-height), calc(100dvh - 32px));
    min-height: 620px;
    padding: 10px;
    border: 2px solid #cbd3df;
    border-radius: 56px;
    background:
        linear-gradient(
            145deg,
            #f9fafc,
            #cfd6e1 48%,
            #f8fafc
        );
    box-shadow:
        0 30px 70px rgba(17, 32, 62, 0.2),
        inset 0 0 0 2px rgba(255, 255, 255, 0.9);
}

.device-shell::before {
    position: absolute;
    z-index: 3;
    inset: 5px;
    border: 1px solid rgba(79, 91, 112, 0.2);
    border-radius: 50px;
    content: "";
    pointer-events: none;
}

.device-screen {
    position: relative;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    display: flex;
    overflow: hidden;
    flex-direction: column;
    border-radius: 44px;
    background: var(--background);
}

.device-side-button {
    position: absolute;
    z-index: 0;
    width: 4px;
    border: 1px solid #b9c1cd;
    background: #d5dbe4;
}

.device-silent-button {
    top: 115px;
    left: -5px;
    height: 32px;
    border-radius: 4px 0 0 4px;
}

.device-volume-up {
    top: 166px;
    left: -6px;
    height: 58px;
    border-radius: 5px 0 0 5px;
}

.device-volume-down {
    top: 237px;
    left: -6px;
    height: 58px;
    border-radius: 5px 0 0 5px;
}

.device-power-button {
    top: 183px;
    right: -6px;
    height: 82px;
    border-radius: 0 5px 5px 0;
}


/* 苹果状态栏 */

.device-status-bar {
    position: relative;
    z-index: 90;
    width: 100%;
    height: var(--status-bar-height);
    min-height: var(--status-bar-height);
    flex: 0 0 var(--status-bar-height);
    display: grid;
    grid-template-columns: 1fr 132px 1fr;
    align-items: center;
    padding: 0 18px;
    background: rgba(255, 255, 255, 0.97);
    color: #172033;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.device-time {
    font-size: 12px;
    font-weight: 800;
}

.device-island {
    width: 132px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 11px;
    border-radius: 0 0 18px 18px;
    background: #11141a;
    justify-self: center;
}

.device-speaker {
    width: 42px;
    height: 5px;
    border-radius: 999px;
    background: #343943;
}

.device-camera {
    width: 7px;
    height: 7px;
    border: 2px solid #253451;
    border-radius: 50%;
    background: #10131a;
}

.device-status-icons {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}

.device-signal {
    height: 13px;
    display: flex;
    align-items: flex-end;
    gap: 2px;
}

.device-signal i {
    width: 3px;
    display: block;
    border-radius: 2px;
    background: #172033;
}

.device-signal i:nth-child(1) {
    height: 4px;
}

.device-signal i:nth-child(2) {
    height: 7px;
}

.device-signal i:nth-child(3) {
    height: 10px;
}

.device-signal i:nth-child(4) {
    height: 13px;
}

.device-wifi {
    position: relative;
    width: 15px;
    height: 11px;
    overflow: hidden;
}

.device-wifi::before {
    position: absolute;
    top: 2px;
    left: 1px;
    width: 13px;
    height: 13px;
    border: 2px solid #172033;
    border-right-color: transparent;
    border-bottom-color: transparent;
    border-radius: 50%;
    content: "";
    transform: rotate(45deg);
}

.device-wifi::after {
    position: absolute;
    bottom: 0;
    left: 6px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #172033;
    content: "";
}

.device-battery {
    position: relative;
    width: 22px;
    height: 11px;
    border: 1.5px solid #172033;
    border-radius: 3px;
}

.device-battery::before {
    position: absolute;
    inset: 2px;
    border-radius: 1px;
    background: #172033;
    content: "";
}

.device-battery::after {
    position: absolute;
    top: 3px;
    right: -4px;
    width: 2px;
    height: 5px;
    border-radius: 0 2px 2px 0;
    background: #172033;
    content: "";
}


/* 顶部导航 */

.site-header {
    position: relative;
    z-index: 80;
    width: 100%;
    height: var(--header-height);
    min-height: var(--header-height);
    flex: 0 0 var(--header-height);
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.header-content {
    height: 100%;
    min-height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: center;
}

.site-logo {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--text);
    font-size: 18px;
    font-weight: 850;
    letter-spacing: 0.3px;
}

.logo-mark {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background:
        linear-gradient(
            135deg,
            var(--primary),
            #174b9a
        );
    color: #ffffff;
    font-size: 16px;
    box-shadow: 0 6px 14px rgba(31, 111, 235, 0.22);
}

.logo-text {
    font-size: 18px;
}

.desktop-nav {
    display: none;
}


/* 内容滚动区域 */

.main-content {
    min-width: 0;
    min-height: 0;
    flex: 1 1 auto;
    overflow-x: hidden;
    overflow-y: auto;
    padding-top: 16px;
    padding-bottom: 22px;
    overscroll-behavior: contain;
    scrollbar-width: none;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
}

.main-content::-webkit-scrollbar {
    display: none;
}

.site-footer {
    display: none;
}


/* 系统消息 */

.messages {
    margin-bottom: 14px;
}

.message {
    margin-bottom: 8px;
    padding: 11px 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius-small);
    background: var(--surface);
    color: var(--text);
    font-size: 12px;
    line-height: 1.55;
    box-shadow: var(--shadow-soft);
}

.message.success {
    border-color: #9bd7b9;
    background: var(--success-background);
    color: var(--success);
}

.message.error {
    border-color: #f2aaa3;
    background: var(--error-background);
    color: var(--error);
}

.message.warning {
    border-color: var(--warning-border);
    background: var(--warning-background);
    color: var(--warning);
}


/* 公共按钮和辅助类 */

.primary-button,
.secondary-button {
    display: inline-flex;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 12px;
    font-weight: 800;
    cursor: pointer;
    transition:
        transform 0.15s ease,
        background 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease;
}

.primary-button {
    border: 1px solid var(--primary);
    background: var(--primary);
    color: #ffffff;
}

.primary-button:hover,
.primary-button:active {
    border-color: var(--primary-hover);
    background: var(--primary-hover);
    color: #ffffff;
}

.secondary-button {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
}

.secondary-button:hover,
.secondary-button:active {
    border-color: var(--primary);
    color: var(--primary);
}

.primary-button:active,
.secondary-button:active {
    transform: scale(0.985);
}

.primary-button:disabled,
.secondary-button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.full-width {
    width: 100%;
}

.large-button {
    min-height: 52px;
    font-size: 16px;
}

.copy-success,
.primary-button.copied {
    border-color: var(--success) !important;
    background: var(--success) !important;
    color: #ffffff !important;
}

.copy-error {
    border-color: var(--error) !important;
    background: var(--error) !important;
    color: #ffffff !important;
}

.page-description {
    color: var(--text-muted);
}

.break-value {
    overflow-wrap: anywhere;
    word-break: break-word;
}


/* 底部五栏导航 */

.mobile-bottom-nav {
    position: relative;
    z-index: 100;
    width: 100%;
    min-width: 0;
    min-height: var(--bottom-nav-height);
    flex: 0 0 var(--bottom-nav-height);
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    padding: 7px 7px 19px;
    border-top: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 -8px 24px rgba(17, 32, 62, 0.08);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.mobile-nav-item {
    width: 100%;
    min-width: 0;
    min-height: 51px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 2px;
    padding: 4px 2px;
    border-radius: 10px;
    background: transparent;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
}

.mobile-nav-item:hover,
.mobile-nav-item.active {
    background: var(--primary-soft);
    color: var(--primary);
}

.mobile-nav-icon {
    width: 22px;
    height: 22px;
    display: block;
}

.mobile-nav-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

.mobile-nav-item > span:last-child {
    overflow: hidden;
    font-size: 10px;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.device-home-indicator {
    position: absolute;
    z-index: 110;
    bottom: 6px;
    left: 50%;
    width: 112px;
    height: 4px;
    border-radius: 999px;
    background: #172033;
    opacity: 0.72;
    pointer-events: none;
    transform: translateX(-50%);
}


/* 手机端 */

@media (max-width: 480px) {
    html,
    body {
        width: 100%;
        height: 100%;
        overflow: hidden;
        background: var(--background);
        touch-action: pan-x pan-y;
    }

    body {
        min-height: 100vh;
        min-height: 100dvh;
    }

    input,
    select,
    textarea {
        font-size: 16px !important;
    }

    .device-stage {
        width: 100%;
        height: 100vh;
        height: 100dvh;
        min-height: 0;
        display: block;
        padding: 0;
    }

    .device-shell {
        width: 100%;
        height: 100%;
        min-height: 0;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }

    .device-shell::before,
    .device-side-button,
    .device-status-bar,
    .device-home-indicator {
        display: none;
    }

    .device-screen {
        width: 100%;
        height: 100vh;
        height: 100dvh;
        min-height: 0;
        display: flex;
        overflow: hidden;
        flex-direction: column;
        border-radius: 0;
        background: var(--background);
    }

    .container {
        width: calc(100% - 18px);
    }

    .main-content {
        min-width: 0;
        min-height: 0;
        flex: 1 1 auto;
        overflow-x: hidden;
        overflow-y: auto;
        padding-top: 13px;
        padding-bottom: 18px;
        overscroll-behavior: contain;
        scrollbar-width: none;
        touch-action: pan-y;
        -webkit-overflow-scrolling: touch;
    }

    .mobile-bottom-nav {
        position: relative;
        right: auto;
        bottom: auto;
        left: auto;
        width: 100%;
        min-height: auto;
        flex: 0 0 auto;
        padding:
            7px
            max(4px, env(safe-area-inset-right))
            calc(8px + env(safe-area-inset-bottom))
            max(4px, env(safe-area-inset-left));
    }
}

@media (max-width: 360px) {
    .container {
        width: calc(100% - 14px);
    }

    .mobile-bottom-nav {
        padding-right: 2px;
        padding-left: 2px;
    }

    .mobile-nav-item {
        padding-right: 1px;
        padding-left: 1px;
    }

    .mobile-nav-item > span:last-child {
        font-size: 9px;
    }
}
