/* ═══════════════════════════════════════
   Standalone Page - Shared Header & Sidebar
   sp- prefix = standalone page
   ═══════════════════════════════════════ */

/* ── Header ── */
.sp-header {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(10, 10, 8, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(201,168,76,0.12);
    z-index: 150;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    padding-top: env(safe-area-inset-top, 0);
}

.sp-brand {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
}

.sp-header-logo {
    height: 28px;
    width: auto;
    filter: invert(1) brightness(1.8);
    object-fit: contain;
}

.sp-header-yinyang {
    width: 24px;
    height: 24px;
    animation: spSpin 12s linear infinite;
    flex-shrink: 0;
}

.sp-menu-toggle {
    background: none;
    border: none;
    color: #f0ede8;
    font-size: 1.5rem;
    padding: 8px;
    cursor: pointer;
    border-radius: 2px;
    transition: background 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    line-height: 1;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sp-menu-toggle:active {
    background: rgba(255,255,255,0.08);
}
.sp-hamburger-icon {
    width: 22px;
    height: 22px;
    object-fit: contain;
    transition: opacity 0.3s;
}
.sp-menu-toggle.active .sp-hamburger-icon {
    opacity: 0.6;
}

/* ── Overlay ── */
.sp-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 190;
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.sp-sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* ── Sidebar ── */
.sp-sidebar {
    width: 260px;
    height: 100vh;
    height: 100dvh;
    background:
        linear-gradient(180deg, rgba(201,168,76,0.03) 0%, transparent 30%, rgba(201,168,76,0.02) 100%),
        #0c0b08;
    border-right: 1px solid rgba(201,168,76,0.1);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}
.sp-sidebar.open {
    transform: translateX(0);
    box-shadow: 8px 0 32px rgba(0,0,0,0.5);
}

.sp-sidebar-header {
    padding: 32px 24px 24px;
    text-align: center;
    border-bottom: 1px solid rgba(201,168,76,0.1);
    flex-shrink: 0;
}
.sp-sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}
.sp-sidebar-logo {
    height: 50px;
    width: auto;
    filter: invert(1) brightness(1.8);
    object-fit: contain;
}
.sp-yinyang-spin {
    width: 36px;
    height: 36px;
    animation: spSpin 12s linear infinite;
    flex-shrink: 0;
}

/* ── Nav Menu ── */
.sp-nav-menu {
    list-style: none;
    padding: 6px 0;
    margin: 0;
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}
.sp-nav-item {
    padding: 0;
    cursor: pointer;
    border-left: 2px solid transparent;
    position: relative;
    min-height: 46px;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.sp-nav-item a {
    color: rgba(255,255,255,0.55);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 24px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 1px;
    transition: all 0.3s;
}
.sp-nav-item:hover {
    background: rgba(201,168,76,0.04);
}
.sp-nav-item:hover a {
    color: #ffffff;
}
.sp-nav-item:active {
    background: rgba(201,168,76,0.07);
}
.sp-nav-item.active {
    background: rgba(201,168,76,0.06);
    border-left-color: #c9a84c;
}
.sp-nav-item.active a {
    color: #ffffff;
}
.sp-nav-item.active::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 18px;
    background: #c9a84c;
    border-radius: 0;
}

img.sp-nav-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    border-radius: 4px;
    vertical-align: middle;
    opacity: 0.7;
}
.sp-nav-item.active img.sp-nav-icon {
    opacity: 1;
}

/* ── Sidebar Footer ── */
.sp-sidebar-footer {
    padding: 16px;
    text-align: center;
    border-top: 1px solid rgba(201,168,76,0.08);
    font-size: 0.72rem;
    color: #857565;
    flex-shrink: 0;
}
.sp-footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 10px;
    margin-bottom: 10px;
}
.sp-footer-links a {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: #8a7538;
    text-decoration: none;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
    transition: color 0.2s;
}
.sp-footer-links a:hover {
    color: #e8d08a;
    text-decoration: underline;
}

/* ── Header right slot (e.g. rules button) ── */
.sp-header .btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid #8a7538;
    background: transparent;
    color: #c9a84c;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    flex-shrink: 0;
}
.sp-header .btn-icon:hover {
    background: rgba(201,168,76,0.12);
    border-color: #c9a84c;
}

/* ── Bottom Navigation (Mobile) ── */
.sp-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(12, 11, 8, 0.88);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(201,168,76,0.1);
    z-index: 150;
    justify-content: space-around;
    align-items: center;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.sp-bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.5);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.62rem;
    font-weight: 700;
    cursor: pointer;
    padding: 6px 4px;
    min-width: 56px;
    min-height: 48px;
    border-radius: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-tap-highlight-color: transparent;
    position: relative;
    letter-spacing: 1px;
    text-decoration: none;
}

.sp-bottom-nav-item::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 24px;
    height: 2px;
    background: #c9a84c;
    border-radius: 2px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sp-bottom-nav-item:active {
    transform: scale(0.92);
}

.sp-bottom-nav-item span {
    letter-spacing: -0.02em;
    font-weight: 400;
}

.sp-bottom-nav-icon {
    width: 23px;
    height: 23px;
    flex-shrink: 0;
    object-fit: contain;
    border-radius: 4px;
}

@media (max-width: 768px) {
    .sp-bottom-nav {
        display: flex;
    }
    body {
        padding-bottom: calc(64px + env(safe-area-inset-bottom, 0));
    }
}

/* ── Animation ── */
@keyframes spSpin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
