:root {
    --bg-canvas: #EAE5DE;
    --surface-card: #FDFCFA;
    --surface-card-subtle: rgba(255, 255, 255, 0.82);
    --surface-card-nested: #F5F0E8;
    --text-primary: #1D1D1F;
    --text-secondary: #5A5652;
    --text-tertiary: #8C8780;
    --brand-primary: #4A3525;
    --brand-primary-dark: #36261B;
    --brand-tint-15: rgba(74, 53, 37, 0.10);
    --accent-green: #748067;
    --accent-green-dark: #5C6752;
    --accent-green-tint: rgba(116, 128, 103, 0.14);
    --accent-green-shadow: rgba(116, 128, 103, 0.28);
    --space-4: 4px;
    --space-6: 6px;
    --space-8: 8px;
    --space-10: 10px;
    --space-12: 12px;
    --space-16: 16px;
    --space-20: 20px;
    --space-24: 24px;
    --space-28: 28px;
    --space-32: 32px;
    --space-40: 40px;
    --space-48: 48px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 28px;
    --radius-capsule: 9999px;
    --glass-bg: rgba(245, 241, 235, 0.85);
    --glass-border: rgba(255, 255, 255, 0.65);
    --glass-highlight: inset 0 1px 1px 0 rgba(255, 255, 255, 0.9);
    --card-shadow: 0 10px 30px rgba(74, 53, 37, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
    --spring-smooth: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Roboto', 'SF Pro Text', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html {
    scrollbar-gutter: stable;
}

html, body {
    min-height: 100vh;
    width: 100%;
    color: var(--text-primary);
    background-color: var(--bg-canvas);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    overflow-x: hidden;
}

strong {
    font-weight: 600;
    color: var(--brand-primary);
}

.top-bar {
    position: fixed;
    top: var(--space-16);
    left: 50%;
    transform: translateX(-50%) translateZ(0);
    -webkit-transform: translateX(-50%) translateZ(0);
    width: calc(100% - var(--space-32));
    max-width: 1080px;
    height: 52px;
    background: var(--glass-bg);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-radius: var(--radius-capsule);
    border: 1px solid var(--glass-border);
    box-shadow: 0 10px 30px rgba(74, 53, 37, 0.08), var(--glass-highlight);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-20);
    z-index: 1000;
    transition: all 0.3s var(--spring-smooth);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: var(--space-12);
    text-decoration: none;
    min-height: 44px;
    flex-shrink: 0;
}

.logo-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(74, 53, 37, 0.15);
    background: var(--surface-card);
}

.brand-title {
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: -0.01em;
    color: var(--brand-primary);
}

.nav-links {
    display: flex;
    gap: var(--space-4);
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.85rem;
    padding: var(--space-8) var(--space-12);
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-capsule);
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
    opacity: 0.85;
    white-space: nowrap;
}

.nav-links a .nav-icon {
    display: none;
}

.nav-links a .nav-text {
    display: inline;
}

.nav-links a:hover {
    opacity: 1;
    background: rgba(74, 53, 37, 0.06);
}

.nav-links a.active {
    opacity: 1;
    font-weight: 600;
    color: var(--brand-primary);
    background: var(--brand-tint-15);
}

.main-container {
    position: relative;
    z-index: 10;
    width: 92%;
    max-width: 1080px;
    margin: 96px auto 120px auto;
    padding: var(--space-40) var(--space-32);
    background: var(--surface-card);
    border-radius: var(--radius-2xl);
    border: 1px solid rgba(74, 53, 37, 0.06);
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    isolation: isolate;
}

.page-header {
    text-align: center;
    margin-bottom: var(--space-32);
    max-width: 720px;
}

.page-header h1 {
    color: var(--brand-primary);
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.2;
    margin-bottom: var(--space-8);
}

.page-header p {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.5;
}

.btn-glass {
    min-height: 44px;
    padding: var(--space-12) var(--space-20);
    border-radius: var(--radius-capsule);
    background: linear-gradient(180deg, var(--accent-green) 0%, var(--accent-green-dark) 100%);
    color: #FFFFFF !important;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 12px var(--accent-green-shadow);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-8);
}

.btn-glass:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 18px rgba(116, 128, 103, 0.38);
}

.btn-glass:active {
    transform: scale(0.97);
}

.btn-glass svg {
    width: 18px;
    height: 18px;
    stroke: #FFFFFF;
    fill: none;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
    display: block;
}

.apple-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-top: 1px solid var(--glass-border);
    padding: var(--space-8) var(--space-16) calc(var(--space-8) + env(safe-area-inset-bottom, 0px)) var(--space-16);
    z-index: 1000;
    font-size: 0.75rem;
    color: var(--text-secondary);
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

.apple-footer-content {
    max-width: 1080px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: var(--space-8);
    text-align: center;
}

.apple-footer-content .pipe {
    color: var(--text-tertiary);
    opacity: 0.5;
}

.apple-footer-content summary {
    color: var(--brand-primary);
    cursor: pointer;
    list-style: none;
    font-weight: 500;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

.apple-footer-content summary::-webkit-details-marker { display: none; }
.apple-footer-content summary:hover { text-decoration: underline; }

.footer-popover {
    position: fixed;
    bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%) translateZ(0);
    -webkit-transform: translateX(-50%) translateZ(0);
    width: 90%;
    max-width: 420px;
    background: rgba(253, 252, 250, 0.95);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    padding: var(--space-20);
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    box-shadow: 0 16px 36px rgba(74, 53, 37, 0.12);
    font-size: 0.82rem;
    line-height: 1.45;
    color: var(--text-primary);
    text-align: left;
    z-index: 1001;
}

@media (max-width: 820px) {
    .top-bar {
        top: var(--space-8);
        width: calc(100% - var(--space-16));
        padding: 0 var(--space-12);
    }
    .brand-title { display: none; }
    
    .nav-links {
        gap: 2px;
        overflow: visible;
    }

    .nav-links a {
        min-width: 42px;
        min-height: 42px;
        padding: 0;
        border-radius: 50%;
    }

    .nav-links a .nav-text {
        display: none;
    }

    .nav-links a .nav-icon {
        display: block;
        width: 20px;
        height: 20px;
        stroke: currentColor;
        stroke-width: 2;
        fill: none;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .nav-links a.active {
        background: var(--brand-tint-15);
    }

    .main-container {
        margin: 80px auto calc(130px + env(safe-area-inset-bottom, 0px)) auto;
        padding: var(--space-32) var(--space-16);
        border-radius: var(--radius-xl);
        gap: var(--space-24);
    }

    .page-header h1 { font-size: 1.7rem; }
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
        transform: none !important;
    }
}
