/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* 配色方案 - 中国风 */
    --primary-color: #d4574e;      /* 朱红 */
    --primary-dark: #b8403a;       /* 深朱红 */
    --primary-light: #e88a84;      /* 浅朱红 */
    --secondary-color: #d4a373;    /* 赭石 */
    --background: #1a1410;         /* 墨色背景 */
    --surface: #2d2520;            /* 深棕表面 */
    --surface-light: #3d322a;      /* 浅棕表面 */
    --text-primary: #f5ebe0;       /* 米白 */
    --text-secondary: #d4c5b9;     /* 浅米 */
    --text-muted: #9e8f82;         /* 灰褐 */
    --success: #6b9062;            /* 青绿 */
    --error: #c94c4c;              /* 朱砂 */
    --warning: #d4a373;            /* 赭石 */

    /* 阴影 */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(212, 87, 78, 0.3);

    /* 圆角 */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* 间距 */
    --spacing-xs: 8px;
    --spacing-sm: 12px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
                 'Microsoft YaHei', sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 容器 */
.container {
    position: relative;
    max-width: 500px;
    margin: 0 auto;
    padding: var(--spacing-lg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 背景装饰 */
.bg-decoration {
    position: fixed;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(212, 87, 78, 0.12) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.bg-blur-circle {
    position: fixed;
    bottom: -30%;
    left: -30%;
    width: 80%;
    height: 80%;
    background: radial-gradient(circle, rgba(212, 163, 115, 0.08) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
    animation: float 20s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(20px, 20px); }
}

/* 头部 */
.header {
    position: relative;
    z-index: 1;
    text-align: center;
    margin-bottom: var(--spacing-xl);
    padding-top: var(--spacing-lg);
}

.title {
    font-size: clamp(2rem, 8vw, 2.5rem);
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-light), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: var(--spacing-sm);
    letter-spacing: -0.02em;
}

.title .emoji {
    display: inline-block;
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.subtitle {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 300;
    letter-spacing: 0.05em;
}

/* 主内容区 */
.main-content {
    position: relative;
    z-index: 1;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

/* 设置卡片 */
.settings-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.setting-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.setting-label .icon {
    font-size: 1.2rem;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.radius-slider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: var(--surface-light);
    outline: none;
    -webkit-appearance: none;
}

.radius-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(212, 87, 78, 0.4);
    transition: transform 0.2s ease;
}

.radius-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.radius-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(212, 87, 78, 0.4);
    transition: transform 0.2s ease;
}

.radius-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
}

.radius-value {
    min-width: 60px;
    text-align: right;
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-light);
}

/* 结果卡片 */
.result-card {
    background: var(--surface);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.result-card::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: var(--radius-xl);
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: -1;
}

.result-card.active::before {
    opacity: 0.3;
}

.result-placeholder {
    text-align: center;
    color: var(--text-muted);
}

.dice-button {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    border-radius: 50%;
    width: 120px;
    height: 120px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 24px rgba(212, 87, 78, 0.4);
    margin-bottom: var(--spacing-md);
}

.dice-button:hover {
    transform: translateY(-8px) scale(1.05);
    box-shadow: 0 16px 32px rgba(212, 87, 78, 0.5);
}

.dice-button:active {
    transform: translateY(-4px) scale(1.02);
}

.dice-icon {
    font-size: 4rem;
    animation: float-dice 3s ease-in-out infinite;
}

@keyframes float-dice {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-10px) rotate(5deg); }
    75% { transform: translateY(-10px) rotate(-5deg); }
}

.result-placeholder p {
    font-size: 1rem;
    line-height: 1.8;
}

.result-content {
    width: 100%;
    animation: fadeInUp 0.5s ease;
}

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

.restaurant-name {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--spacing-lg);
    text-align: center;
    line-height: 1.3;
    background: linear-gradient(135deg, var(--text-primary), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}


.restaurant-info {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.info-item {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
    transition: background 0.2s ease;
}

.info-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.info-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.info-text {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.5;
    word-break: break-word;
}

.navigate-btn {
    width: 100%;
    margin-top: var(--spacing-md);
    padding: var(--spacing-md) var(--spacing-lg);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(212, 87, 78, 0.3);
}

.navigate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(212, 87, 78, 0.4);
}

.navigate-btn:active {
    transform: translateY(0);
}

.navigate-icon {
    font-size: 1.2rem;
}

/* 统计栏与结果列表 */
.stats-bar {
    background: rgba(212, 87, 78, 0.1);
    border-radius: var(--radius-md);
    border: 1px solid rgba(212, 87, 78, 0.2);
    overflow: hidden;
}

.stats-toggle {
    width: 100%;
    padding: var(--spacing-md);
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-sm);
    transition: background 0.3s ease;
}

.stats-toggle:hover {
    background: rgba(212, 87, 78, 0.15);
}

.stats-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.stats-text strong {
    color: var(--primary-light);
    font-weight: 700;
    font-size: 1.1rem;
}

.toggle-icon {
    font-size: 0.8rem;
    color: var(--text-muted);
    transition: transform 0.3s ease;
}

.stats-toggle.expanded .toggle-icon {
    transform: rotate(180deg);
}

/* 结果列表 */
.results-list {
    max-height: 400px;
    overflow-y: auto;
    padding: var(--spacing-sm);
    background: rgba(0, 0, 0, 0.2);
}

.result-item {
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    background: var(--surface);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
    cursor: pointer;
}

.result-item:hover {
    background: var(--surface-light);
    border-color: var(--primary-color);
    transform: translateX(4px);
}

.result-item:last-child {
    margin-bottom: 0;
}

.result-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-xs);
}

.result-item-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.result-item-distance {
    font-size: 0.85rem;
    color: var(--primary-light);
    font-weight: 600;
    white-space: nowrap;
}

.result-item-address {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: var(--spacing-sm);
}

.result-item-nav {
    padding: var(--spacing-xs) var(--spacing-md);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    transition: all 0.3s ease;
}

.result-item-nav:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(212, 87, 78, 0.4);
}

.result-item-nav:active {
    transform: translateY(0);
}

/* 滚动条样式 */
.results-list::-webkit-scrollbar {
    width: 6px;
}

.results-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.results-list::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.results-list::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* 按钮 */
.action-buttons {
    display: flex;
    gap: var(--spacing-md);
}

.btn {
    flex: 1;
    padding: var(--spacing-md) var(--spacing-lg);
    border: none;
    border-radius: var(--radius-lg);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.btn:hover::before {
    opacity: 1;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px rgba(212, 87, 78, 0.5);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-icon {
    font-size: 1.3rem;
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: var(--spacing-xl);
}

.spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto var(--spacing-md);
    border: 4px solid rgba(212, 87, 78, 0.2);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin-loader 1s linear infinite;
}

@keyframes spin-loader {
    to { transform: rotate(360deg); }
}

.loading p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* 错误提示 */
.error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.error-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.error-message p {
    color: var(--error);
    font-size: 0.95rem;
}

/* 页脚 */
.footer {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: var(--spacing-lg) 0;
    margin-top: auto;
}

.footer p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* 工具类 */
.hidden {
    display: none !important;
}

/* 响应式设计 */
@media (max-width: 480px) {
    .container {
        padding: var(--spacing-md);
    }

    .header {
        padding-top: var(--spacing-md);
        margin-bottom: var(--spacing-lg);
    }

    .title {
        font-size: 2rem;
    }

    .settings-card,
    .result-card {
        padding: var(--spacing-lg);
    }

    .restaurant-name {
        font-size: 1.5rem;
    }
}

@media (max-width: 360px) {
    .container {
        padding: var(--spacing-sm);
    }

    .settings-card,
    .result-card {
        padding: var(--spacing-md);
    }

    .btn {
        font-size: 1rem;
        padding: var(--spacing-sm) var(--spacing-md);
    }
}

/* 横屏适配 */
@media (orientation: landscape) and (max-height: 500px) {
    .header {
        margin-bottom: var(--spacing-md);
        padding-top: var(--spacing-sm);
    }

    .main-content {
        gap: var(--spacing-md);
    }

    .result-card {
        min-height: 200px;
    }
}

/* 暗色模式优化 */
@media (prefers-color-scheme: dark) {
    body {
        background: var(--background);
    }
}
