/* ===== 浏览器应用 — Safari 风格 ===== */

#scene-browser {
    background: #1c1c1e;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

/* ── 导航栏 ── */
.browser-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: calc(14px + var(--safe-top)) 10px 4px;
    flex-shrink: 0;
    position: relative;
}

.browser-nav-back {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    border-radius: 50%;
}

.browser-nav-back:active {
    background: rgba(255, 255, 255, 0.1);
}

.browser-nav-back svg {
    width: 20px;
    height: 20px;
    stroke: rgba(255, 255, 255, 0.85);
    stroke-width: 2.5;
    fill: none;
}

/* ── URL 地址栏 ── */
.browser-url-bar {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 12px;
    height: 36px;
    border-radius: 18px;
    background: rgba(44, 44, 46, 0.8);
    cursor: pointer;
    transition: background 0.2s;
    position: relative;
    z-index: 2;
}

.browser-url-bar:active {
    background: rgba(58, 58, 60, 0.8);
}

.browser-url-icon {
    width: 14px;
    height: 14px;
    fill: rgba(255, 255, 255, 0.35);
    flex-shrink: 0;
}

.browser-url-text {
    flex: 1;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.browser-url-cancel {
    display: none;
    font-size: 13px;
    color: #007AFF;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 4px 0;
    font-family: inherit;
    flex-shrink: 0;
}

.browser-url-bar.editing .browser-url-cancel {
    display: block;
}

.browser-url-bar.editing .browser-url-text {
    display: none;
}

/* ── 地址栏右侧按钮组 ── */
.browser-nav-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.browser-nav-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
}

.browser-nav-btn:active {
    background: rgba(255, 255, 255, 0.1);
}

.browser-nav-btn svg {
    width: 18px;
    height: 18px;
    stroke: rgba(255, 255, 255, 0.65);
    stroke-width: 1.8;
    fill: none;
}

/* ── 标签栏（多标签切换） ── */
.browser-tab-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 14px 6px;
    flex-shrink: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.browser-tab-bar::-webkit-scrollbar {
    display: none;
}

.browser-tab {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 14px;
    height: 30px;
    border-radius: 15px;
    background: rgba(44, 44, 46, 0.6);
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.browser-tab:active {
    background: rgba(58, 58, 60, 0.8);
}

.browser-tab.active {
    background: rgba(255, 255, 255, 0.12);
}

.browser-tab-icon {
    font-size: 12px;
    line-height: 1;
}

.browser-tab-title {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.65);
    font-weight: 500;
    white-space: nowrap;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.browser-tab.active .browser-tab-title {
    color: rgba(255, 255, 255, 0.9);
}

.browser-tab-close {
    width: 16px;
    height: 16px;
    border: none;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    padding: 0;
    opacity: 0.4;
}

.browser-tab-close:active {
    opacity: 0.8;
}

.browser-tab-close svg {
    width: 10px;
    height: 10px;
    stroke: rgba(255, 255, 255, 0.5);
    stroke-width: 2;
    fill: none;
}

.browser-new-tab {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border: none;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
}

.browser-new-tab:active {
    background: rgba(255, 255, 255, 0.08);
}

.browser-new-tab svg {
    width: 16px;
    height: 16px;
    stroke: rgba(255, 255, 255, 0.5);
    stroke-width: 1.8;
    fill: none;
}

/* ── 内容区 ── */
.browser-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px 16px 20px;
}

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

/* ── 收藏夹标题 ── */
.browser-section-title {
    font-size: 20px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.9);
    letter-spacing: -0.3px;
    padding: 12px 0 10px;
}

/* ── 收藏夹书签网格 ── */
.browser-bookmarks {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    padding: 4px 0 16px;
}

.browser-bookmark {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    padding: 8px 4px;
    border-radius: 12px;
    transition: background 0.2s;
    border: none;
    background: transparent;
    font-family: inherit;
}

.browser-bookmark:active {
    background: rgba(255, 255, 255, 0.06);
}

.browser-bookmark-icon {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    position: relative;
    z-index: 2;
    transition: transform 0.15s ease;
}

.browser-bookmark:active .browser-bookmark-icon {
    transform: scale(0.92);
}

.browser-bookmark-name {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 64px;
}

/* 书签图标颜色 */
.browser-bookmark-icon.bg-google { background: linear-gradient(135deg, #4285F4, #34A853); }
.browser-bookmark-icon.bg-bilibili { background: linear-gradient(135deg, #FB7299, #00A1D6); }
.browser-bookmark-icon.bg-github { background: linear-gradient(135deg, #333, #6e5494); }
.browser-bookmark-icon.bg-zhihu { background: linear-gradient(135deg, #0066FF, #0084FF); }
.browser-bookmark-icon.bg-weibo { background: linear-gradient(135deg, #E6162D, #FF8200); }
.browser-bookmark-icon.bg-douban { background: linear-gradient(135deg, #007722, #00A650); }
.browser-bookmark-icon.bg-netease { background: linear-gradient(135deg, #C20C0C, #E62222); }
.browser-bookmark-icon.bg-taobao { background: linear-gradient(135deg, #FF4400, #FF6A00); }

/* ── 常用网站列表 ── */
.browser-section-subtitle {
    font-size: 17px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    padding: 12px 0 8px;
    letter-spacing: -0.2px;
}

.browser-frequent-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 0 20px;
}

.browser-frequent-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.2s;
    border: none;
    background: transparent;
    font-family: inherit;
    width: 100%;
    text-align: left;
}

.browser-frequent-item:active {
    background: rgba(255, 255, 255, 0.06);
}

.browser-frequent-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}

.browser-frequent-info {
    flex: 1;
    min-width: 0;
}

.browser-frequent-name {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 500;
}

.browser-frequent-url {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.3);
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.browser-frequent-action {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.2s;
}

.browser-frequent-item:active .browser-frequent-action {
    opacity: 0.6;
}

.browser-frequent-action svg {
    width: 14px;
    height: 14px;
    stroke: rgba(255, 255, 255, 0.4);
    stroke-width: 2;
    fill: none;
}

/* ── 隐私报告卡片 ── */
.browser-privacy-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 14px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    margin-top: 8px;
    position: relative;
    z-index: 2;
    transition: transform 0.15s ease;
}

.browser-privacy-card:active {
    transform: scale(0.98);
}

.browser-privacy-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(52, 199, 89, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.browser-privacy-icon svg {
    width: 22px;
    height: 22px;
    stroke: #34C759;
    stroke-width: 1.8;
    fill: none;
}

.browser-privacy-info {
    flex: 1;
}

.browser-privacy-title {
    font-size: 15px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

.browser-privacy-desc {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 2px;
}

.browser-privacy-chevron {
    width: 14px;
    height: 14px;
    stroke: rgba(255, 255, 255, 0.3);
    stroke-width: 2;
    fill: none;
    flex-shrink: 0;
}

/* ── Toast 提示 ── */
.browser-toast {
    position: absolute;
    bottom: calc(40px + var(--safe-bottom));
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    padding: 8px 18px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 50;
    white-space: nowrap;
}

.browser-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
