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

:root {
    --primary: #667eea;
    --primary-dark: #764ba2;
    --text: #1a1a2e;
    --text-light: #6b7280;
    --border: #e5e7eb;
    --shadow: 0 30px 60px -22px rgba(15, 23, 42, .5);
}

html { scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    color: var(--text);
    background: radial-gradient(1100px 520px at 50% -220px, #eef1ff 0%, rgba(255,255,255,0) 62%), #fff;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}
body.is-dragging, body.is-panning { cursor: grabbing !important; user-select: none; }
body.is-dragging iframe, body.is-panning iframe { pointer-events: none !important; }

a { text-decoration: none; color: inherit; }

.topbar {
    position: sticky; top: 0; z-index: 50;
    background: rgba(255,255,255,.82);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}
.topbar-inner {
    max-width: 1360px; margin: 0 auto; padding: 0 24px;
    height: 60px; display: flex; align-items: center;
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}
.brand-icon {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 14px -6px rgba(102,126,234,.9);
    flex: 0 0 auto;
}
.brand-icon svg {
    display: block;
    width: 100%;
    height: 100%;
}
.brand-sub {
    font-size: 12px; font-weight: 400; color: var(--text-light);
    padding-left: 10px; border-left: 1px solid var(--border);
}

.showcase { max-width: 1360px; margin: 0 auto; padding: 22px 24px 0; }

/* 输入区：标题与输入框同一行 */
.panel { max-width: 960px; margin: 0 auto; padding: 26px 0 0; }
.url-form {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}
.panel-title {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -.2px;
    white-space: nowrap;
    margin: 0;
    background: linear-gradient(135deg, var(--text) 0%, var(--primary) 110%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.input-wrap {
    flex: 1 1 320px;
    min-width: 0;
    max-width: 480px;
    display: flex; align-items: center; gap: 10px;
    height: 46px; padding: 0 16px;
    background: #fff; border: 1px solid var(--border); border-radius: 12px;
    transition: border-color .2s, box-shadow .2s;
}
.input-wrap:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(102,126,234,.12); }
.input-wrap input {
    flex: 1; min-width: 0; height: 100%;
    border: 0; outline: 0; background: transparent;
    font-size: 15px; font-family: inherit; color: var(--text);
}
.input-wrap input::placeholder { color: #a9aebc; }

.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 8px; height: 46px; padding: 0 24px;
    border: 0; border-radius: 12px;
    font-size: 15px; font-weight: 500; font-family: inherit;
    cursor: pointer;
    transition: transform .2s, box-shadow .2s, border-color .2s, color .2s, background .2s;
    white-space: nowrap;
}
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 10px 22px -10px rgba(102,126,234,.95);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 14px 28px -10px rgba(102,126,234,1); }
.btn-ghost {
    background: #fff; color: var(--text);
    border: 1px solid var(--border);
    box-shadow: 0 2px 6px rgba(15,23,42,.04);
}
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-1px); }
.btn-sm { height: 38px; padding: 0 16px; font-size: 13.5px; border-radius: 10px; }

.toolbar {
    display: flex; justify-content: center; flex-wrap: wrap;
    gap: 10px; margin-top: 20px; align-items: center;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}
.input-wrap.shake {
    animation: shake .4s ease;
    border-color: #ef4444;
    box-shadow: 0 0 0 4px rgba(239,68,68,.1);
}

/* 预设 + 设备选择器 */
.preset-row, .device-picker {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
}
.picker-label {
    font-size: 13px;
    color: var(--text-light);
    margin-right: 4px;
}
.preset-btn {
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    color: var(--text-light);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: all .2s;
}
.preset-btn:hover { border-color: var(--primary); color: var(--primary); }
.preset-btn.active {
    background: rgba(102,126,234,.1);
    border-color: rgba(102,126,234,.5);
    color: var(--primary);
    font-weight: 600;
}
.seg-btn {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--text-light);
    font-size: 12.5px;
    font-family: inherit;
    cursor: pointer;
    transition: all .2s;
}
.seg-btn:hover { border-color: var(--primary); color: var(--primary); }
.seg-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border-color: transparent;
}

/* ================= 页脚 ================= */
.footer {
    border-top: 1px solid var(--border);
    padding: 26px 24px;
    font-size: 13px;
    color: var(--text-light);
    margin-top: 56px;
}
.footer-inner {
    max-width: 1360px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px 20px;
}
.footer-brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    transition: color .2s;
    flex: 0 0 auto;
}
.footer-brand:hover { color: var(--primary); }
.footer-brand-icon {
    width: 24px;
    height: 24px;
    border-radius: 7px;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px -4px rgba(102,126,234,.9);
    flex: 0 0 auto;
}
.footer-brand-icon svg {
    display: block;
    width: 100%;
    height: 100%;
}
.footer-brand-name { letter-spacing: .5px; }
.footer-copy {
    flex: 1 1 auto;
    text-align: center;
}
.footer-beian {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    flex: 0 0 auto;
    font-size: 12.5px;
}
.footer-beian a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--text-light);
    transition: color .2s;
    white-space: nowrap;
}
.footer-beian a:hover { color: var(--primary); }
.beian-icon {
    width: 14px;
    height: 14px;
    display: block;
}

/* ================= 响应式 ================= */
@media (max-width: 900px) {
    .footer-inner {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    .footer-beian {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px 14px;
    }
}

@media (max-width: 720px) {
    .topbar-inner { padding: 0 16px; height: 56px; }
    .brand-sub { display: none; }
    .showcase { padding: 16px 16px 0; }

    .panel { padding-top: 20px; }
    .panel-title {
        font-size: 15px;
        width: 100%;
        text-align: center;
        white-space: normal;
    }
    .url-form { gap: 10px; }
    .input-wrap { flex: 1 1 100%; max-width: none; }
    .url-form .btn-primary { flex: 1 1 100%; }
    .btn-sm { padding: 0 12px; font-size: 12.5px; height: 34px; }

    .footer { padding: 20px 16px; }
    .footer-beian { font-size: 12px; }
}
/* ================= 按钮组 + 弹出面板 ================= */
.btn-group {
    position: relative;
    display: inline-flex;
    align-items: stretch;
}
.btn-group > .btn {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}
.btn-settings {
    width: 32px;
    height: 38px;
    padding: 0;
    border: 1px solid var(--border);
    border-left: 0;
    border-top-right-radius: 10px;
    border-bottom-right-radius: 10px;
    background: #fff;
    color: var(--text-light);
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    font-family: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all .2s;
}
.btn-settings:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: rgba(102,126,234,.04);
}
.btn-group:hover > .btn {
    border-color: var(--primary);
    color: var(--primary);
}

.popover {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 240px;
    padding: 14px 16px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 12px 40px -8px rgba(15,23,42,.25);
    border: 1px solid rgba(102,126,234,.18);
    z-index: 200;
    cursor: default;
}
.popover[hidden] { display: none; }
.popover-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-light);
    letter-spacing: .3px;
    margin-bottom: 10px;
}
.popover-value {
    color: var(--primary);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.popover input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(102,126,234,.25), rgba(102,126,234,.6));
    outline: 0;
    cursor: pointer;
}
.popover input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--primary);
    box-shadow: 0 2px 6px -2px rgba(102,126,234,.8);
    cursor: grab;
    transition: transform .15s;
}
.popover input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.15); }
.popover input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--primary);
    cursor: grab;
}
.popover input[type="text"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    color: var(--text);
    outline: 0;
    transition: border-color .2s, box-shadow .2s;
    background: #fff;
}
.popover input[type="text"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102,126,234,.12);
}
.popover input[type="text"]::placeholder { color: #a9aebc; }

/* ================= 热门场景入口 ================= */
.hot-links {
    max-width: 960px;
    margin: 56px auto 0;
    padding: 0 24px;
}
.hot-links-title {
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 20px;
    color: var(--text);
}
.hot-links-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}
.hot-link {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    font-size: 14px;
    color: var(--text);
    transition: all .2s;
}
.hot-link:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(102, 126, 234, .04);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px -8px rgba(102, 126, 234, .6);
}
@media (max-width: 720px) {
    .hot-links { margin-top: 40px; padding: 0 16px; }
    .hot-link { padding: 8px 16px; font-size: 13px; }
}