/* ============================================
   AquaSentinel Brand System
   Water-themed design tokens, components & effects
   Matches pitch deck look and feel across all pages
   ============================================ */

/* --- Design Tokens --- */
:root {
    --aqua-primary: #2ea3f2;
    --aqua-dark: #1a8cd8;
    --aqua-light: #5bb8f5;
    --aqua-glow: rgba(46, 163, 242, 0.5);
    --success: #10B981;
    --danger: #EF4444;
    --warning: #F59E0B;
}

/* Dark Theme (default) — deep blue underwater palette */
[data-theme="dark"] {
    --bg-primary: #0a1628;
    --bg-secondary: #0d1f3c;
    --bg-tertiary: #1a2942;
    --text-primary: #ffffff;
    --text-secondary: #a0b4cc;
    --text-muted: #6b7f99;
    --glass-bg: rgba(255, 255, 255, 0.06);
    --glass-border: rgba(255, 255, 255, 0.12);
    --card-bg: rgba(255, 255, 255, 0.04);
    --nav-bg: rgba(10, 22, 40, 0.95);
    --shadow-color: rgba(0, 0, 0, 0.4);
}

/* Light Theme */
[data-theme="light"] {
    --bg-primary: #f0f7ff;
    --bg-secondary: #ffffff;
    --bg-tertiary: #dbeafe;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --glass-bg: rgba(0, 0, 0, 0.03);
    --glass-border: rgba(0, 0, 0, 0.08);
    --card-bg: rgba(255, 255, 255, 0.8);
    --nav-bg: rgba(255, 255, 255, 0.95);
    --shadow-color: rgba(0, 0, 0, 0.1);
    --aqua-glow: rgba(46, 163, 242, 0.3);
}

/* Lightest Theme — near-white clean palette */
[data-theme="lightest"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f0f7ff;
    --bg-tertiary: #dbeafe;
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --glass-bg: rgba(0, 0, 0, 0.02);
    --glass-border: rgba(0, 0, 0, 0.06);
    --card-bg: rgba(255, 255, 255, 0.9);
    --nav-bg: rgba(255, 255, 255, 0.98);
    --shadow-color: rgba(0, 0, 0, 0.08);
    --aqua-glow: rgba(46, 163, 242, 0.2);
}

/* Darkest Theme — deep abyss palette */
[data-theme="darkest"] {
    --bg-primary: #050a14;
    --bg-secondary: #08101e;
    --bg-tertiary: #0c1628;
    --text-primary: #ffffff;
    --text-secondary: #8899b0;
    --text-muted: #556680;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --card-bg: rgba(255, 255, 255, 0.02);
    --nav-bg: rgba(5, 10, 20, 0.98);
    --shadow-color: rgba(0, 0, 0, 0.6);
    --aqua-glow: rgba(46, 163, 242, 0.6);
}

/* --- Water Effect Opacity per Theme --- */
[data-theme="lightest"] .water-caustics,
[data-theme="lightest"] .water-droplet,
[data-theme="lightest"] .water-particle,
[data-theme="lightest"] .glow-orb,
[data-theme="lightest"] .water-ripple-container,
[data-theme="lightest"] .water-wave-container { opacity: 0.15; }

[data-theme="light"] .water-caustics,
[data-theme="light"] .water-droplet,
[data-theme="light"] .water-particle,
[data-theme="light"] .glow-orb,
[data-theme="light"] .water-ripple-container,
[data-theme="light"] .water-wave-container { opacity: 0.3; }

[data-theme="dark"] .water-caustics,
[data-theme="dark"] .water-droplet,
[data-theme="dark"] .water-particle,
[data-theme="dark"] .glow-orb,
[data-theme="dark"] .water-ripple-container,
[data-theme="dark"] .water-wave-container { opacity: 0.7; }

[data-theme="darkest"] .water-caustics,
[data-theme="darkest"] .water-droplet,
[data-theme="darkest"] .water-particle,
[data-theme="darkest"] .glow-orb,
[data-theme="darkest"] .water-ripple-container,
[data-theme="darkest"] .water-wave-container { opacity: 1.0; }

/* --- Theme Level Toggle Button --- */
.theme-level-btn {
    position: fixed;
    bottom: 200px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    cursor: pointer;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px var(--shadow-color);
}

.theme-level-btn:hover {
    border-color: var(--aqua-primary);
    box-shadow: 0 0 20px var(--aqua-glow);
}

.theme-level-btn .bar {
    width: 18px;
    height: 2px;
    border-radius: 1px;
    background: var(--text-muted);
    transition: background 0.3s ease;
}

.theme-level-btn .bar.active {
    background: var(--aqua-primary);
}

/* --- Base Reset & Typography --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: none;
    height: 100vh;
}

body {
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 50%, var(--bg-primary) 100%);
    color: var(--text-primary);
    line-height: 1.6;
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: none;
    height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
}

a {
    color: var(--aqua-primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* --- Document Container --- */
.doc-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px;
    position: relative;
    z-index: 1;
}

/* --- Document Header (glassmorphic with brand gradient) --- */
.doc-header {
    background: linear-gradient(135deg, rgba(46, 163, 242, 0.15), rgba(26, 140, 216, 0.1));
    border: 1px solid rgba(46, 163, 242, 0.2);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    color: var(--text-primary);
    padding: 30px;
    border-radius: 16px;
    margin-bottom: 30px;
}

.doc-header h1 {
    font-size: 28px;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #ffffff 0%, #a8d8ff 50%, #ffffff 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmer 3s linear infinite;
}

.doc-header p {
    color: var(--text-secondary);
}

/* --- Shimmer Text Effect --- */
@keyframes shimmer {
    0% { background-position: 0% center; }
    100% { background-position: 200% center; }
}

/* --- Back to Pack Link --- */
.back-to-pack {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--aqua-primary);
    text-decoration: none;
    margin-bottom: 2rem;
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.back-to-pack:hover {
    color: var(--aqua-light);
    text-decoration: none;
}

/* --- Glass Card --- */
.glass-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 25px;
    margin-bottom: 20px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover {
    border-color: rgba(46, 163, 242, 0.25);
    box-shadow: 0 0 30px rgba(46, 163, 242, 0.08);
}

/* --- Section Title (aqua h2) --- */
.section-title,
.glass-card h2 {
    color: var(--aqua-primary);
    font-size: 20px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(46, 163, 242, 0.3);
}

.glass-card h3 {
    color: var(--text-primary);
    font-size: 16px;
    margin: 20px 0 10px 0;
}

.glass-card p {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 15px;
}

.glass-card ul,
.glass-card ol {
    color: var(--text-secondary);
    margin-left: 20px;
    margin-bottom: 15px;
}

.glass-card li {
    margin-bottom: 8px;
    line-height: 1.6;
}

/* --- Tables (dark glassmorphic) --- */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}

th {
    background: rgba(46, 163, 242, 0.08);
    color: var(--aqua-primary);
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tr:hover td {
    background: rgba(46, 163, 242, 0.04);
}

td {
    color: var(--text-secondary);
}

/* --- Buttons --- */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--aqua-primary), var(--aqua-dark));
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(46, 163, 242, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(46, 163, 242, 0.4);
}

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

/* --- Highlight / Glow / Alert Boxes --- */
.highlight-box {
    background: rgba(46, 163, 242, 0.08);
    border: 1px solid rgba(46, 163, 242, 0.2);
    border-left: 4px solid var(--aqua-primary);
    padding: 15px 20px;
    border-radius: 8px;
    margin: 15px 0;
}

.highlight-box strong {
    color: var(--aqua-primary);
}

.glow-box {
    background: rgba(46, 163, 242, 0.06);
    border: 1px solid rgba(46, 163, 242, 0.25);
    border-radius: 12px;
    padding: 20px;
    margin: 15px 0;
    box-shadow: 0 0 20px rgba(46, 163, 242, 0.08);
}

.alert-box {
    padding: 15px 20px;
    border-radius: 8px;
    margin: 15px 0;
    font-size: 0.95rem;
}

.alert-box.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--success);
}

.alert-box.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
}

.alert-box.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: var(--warning);
}

/* --- Status Badges --- */
.status-badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-pending { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.status-progress { background: rgba(46, 163, 242, 0.15); color: var(--aqua-primary); }
.status-complete { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.status-required { background: rgba(239, 68, 68, 0.15); color: var(--danger); }

/* ============================================
   WATER EFFECTS — from pitch deck
   ============================================ */

/* --- Caustic Light Overlay --- */
.water-caustics {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 20% 30%, rgba(46, 163, 242, 0.12) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 70%, rgba(46, 163, 242, 0.08) 0%, transparent 40%),
        radial-gradient(ellipse at 50% 50%, rgba(255, 255, 255, 0.04) 0%, transparent 60%);
    animation: causticsMove 10s ease-in-out infinite;
    z-index: 0;
    pointer-events: none;
    mix-blend-mode: screen;
}

@keyframes causticsMove {
    0%, 100% { transform: scale(1) translate(0, 0); }
    25% { transform: scale(1.1) translate(2%, -2%); }
    50% { transform: scale(0.95) translate(-1%, 1%); }
    75% { transform: scale(1.05) translate(1%, 2%); }
}

/* --- Floating Droplets --- */
.water-droplet {
    position: fixed;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    background: linear-gradient(135deg, rgba(46, 163, 242, 0.5) 0%, rgba(26, 140, 216, 0.2) 100%);
    box-shadow:
        inset -2px -2px 8px rgba(255, 255, 255, 0.3),
        inset 2px 2px 8px rgba(0, 0, 0, 0.1),
        0 0 20px rgba(46, 163, 242, 0.2);
    animation: dropletFloat var(--duration) ease-in-out infinite;
    animation-delay: var(--delay);
    opacity: 0.5;
    z-index: 0;
    pointer-events: none;
}

.water-droplet::after {
    content: '';
    position: absolute;
    top: 15%;
    left: 20%;
    width: 30%;
    height: 20%;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    filter: blur(2px);
}

@keyframes dropletFloat {
    0%, 100% { transform: translateY(0) rotate(0deg) scale(1); }
    25% { transform: translateY(-30px) rotate(5deg) scale(1.05); }
    50% { transform: translateY(-15px) rotate(-3deg) scale(0.95); }
    75% { transform: translateY(-40px) rotate(3deg) scale(1.02); }
}

/* --- Pink Accent Droplet (brand accent — random 1 of 6) --- */
.water-droplet-pink {
    background: linear-gradient(135deg, rgba(255, 45, 120, 0.5) 0%, rgba(200, 30, 90, 0.2) 100%) !important;
    box-shadow:
        inset -2px -2px 8px rgba(255, 255, 255, 0.3),
        inset 2px 2px 8px rgba(0, 0, 0, 0.1),
        0 0 20px rgba(255, 45, 120, 0.25) !important;
}

/* --- Rising Particles --- */
.water-particle {
    position: fixed;
    width: 4px;
    height: 4px;
    background: rgba(46, 163, 242, 0.6);
    border-radius: 50%;
    animation: particleRise var(--duration) ease-out infinite;
    animation-delay: var(--delay);
    z-index: 0;
    pointer-events: none;
}

@keyframes particleRise {
    0% { transform: translateY(100vh) scale(0); opacity: 0; }
    10% { opacity: 0.8; }
    90% { opacity: 0.3; }
    100% { transform: translateY(-100px) scale(1.5); opacity: 0; }
}

/* --- Glowing Orbs --- */
.glow-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(60px);
    animation: orbPulse 6s ease-in-out infinite;
    z-index: 0;
    pointer-events: none;
}

@keyframes orbPulse {
    0%, 100% { transform: scale(1); opacity: 0.25; }
    50% { transform: scale(1.3); opacity: 0.45; }
}

/* --- Expanding Ripples --- */
.water-ripple-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
}

.water-ripple {
    position: absolute;
    border: 2px solid rgba(46, 163, 242, 0.3);
    border-radius: 50%;
    animation: rippleExpand var(--duration) ease-out infinite;
    animation-delay: var(--delay);
    opacity: 0;
}

@keyframes rippleExpand {
    0% { width: 0; height: 0; opacity: 0.6; }
    100% { width: 500px; height: 500px; opacity: 0; margin-left: -250px; margin-top: -250px; }
}

/* --- Wave Footer --- */
.water-wave-container {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 120px;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
}

.water-wave {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 200%;
    height: 100%;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 320'%3E%3Cpath fill='rgba(46,163,242,0.08)' d='M0,192L48,176C96,160,192,128,288,138.7C384,149,480,203,576,208C672,213,768,171,864,165.3C960,160,1056,192,1152,197.3C1248,203,1344,181,1392,170.7L1440,160L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z'%3E%3C/path%3E%3C/svg%3E") repeat-x;
    background-size: 50% 100%;
    animation: waveMove 8s linear infinite;
}

.water-wave:nth-child(2) {
    bottom: 8px;
    opacity: 0.5;
    animation-duration: 12s;
    animation-direction: reverse;
}

.water-wave:nth-child(3) {
    bottom: 16px;
    opacity: 0.3;
    animation-duration: 16s;
}

@keyframes waveMove {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* --- Password Screen --- */
#password-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a1628 0%, #1a2942 50%, #0d1f3c 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

#password-screen.hidden {
    display: none;
}

.lock-box {
    background: var(--glass-bg, rgba(255, 255, 255, 0.06));
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.12));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 40px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5), 0 0 60px rgba(46, 163, 242, 0.15);
    max-width: 400px;
    width: 90%;
}

.lock-box h2 {
    color: var(--text-primary, #ffffff);
    margin: 0 0 10px 0;
    font-family: 'Poppins', sans-serif;
    border: none;
}

.lock-box p {
    color: var(--text-secondary, #a0b4cc);
    margin: 0 0 25px 0;
    font-family: 'Open Sans', sans-serif;
}

.lock-box input {
    width: 100%;
    padding: 15px;
    font-size: 18px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid var(--glass-border, rgba(255, 255, 255, 0.12));
    border-radius: 8px;
    text-align: center;
    letter-spacing: 8px;
    margin-bottom: 15px;
    color: var(--text-primary, #ffffff);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.lock-box input:focus {
    outline: none;
    border-color: var(--aqua-primary);
    box-shadow: 0 0 20px rgba(46, 163, 242, 0.3);
}

.lock-box input::placeholder {
    color: var(--text-muted, #6b7f99);
    letter-spacing: normal;
}

.lock-box button {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, var(--aqua-primary), var(--aqua-dark));
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(46, 163, 242, 0.3);
}

.lock-box button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(46, 163, 242, 0.4);
}

.lock-box .error {
    color: var(--danger);
    margin-top: 10px;
    display: none;
    font-family: 'Open Sans', sans-serif;
}

.lock-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--aqua-primary), var(--aqua-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    box-shadow: 0 0 30px rgba(46, 163, 242, 0.4);
}

.lock-icon svg {
    fill: white;
}

/* --- Shake Animation (password error) --- */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.lock-box.shake {
    animation: shake 0.5s ease-in-out;
}

/* --- Back-to-Pack Top Bar (injected by JS) --- */
.brand-nav-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 48px;
    background: rgba(10, 22, 40, 0.9);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-bottom: 1px solid var(--glass-border, rgba(255, 255, 255, 0.12));
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 1000;
}

.brand-nav-bar a {
    color: var(--aqua-primary);
    font-family: 'Poppins', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s;
}

.brand-nav-bar a:hover {
    color: var(--aqua-light, #5bb8f5);
    text-decoration: none;
}

.brand-nav-bar .nav-title {
    color: var(--text-secondary, #a0b4cc);
    font-family: 'Poppins', sans-serif;
    font-size: 0.85rem;
    font-weight: 400;
}

body[data-show-nav="true"] {
    padding-top: 48px;
}

/* --- Pre/Code blocks --- */
pre {
    background: rgba(0, 0, 0, 0.3);
    color: #e2e8f0;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 13px;
    border: 1px solid var(--glass-border);
}

code {
    background: rgba(46, 163, 242, 0.1);
    color: var(--aqua-light);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}

/* ============================================
   RESPONSIVE — Mobile & Tablet
   ============================================ */

/* --- Tablet (max-width: 768px) --- */
@media (max-width: 768px) {
    .doc-container {
        padding: 24px 16px;
    }

    .doc-header {
        padding: 22px 18px;
        border-radius: 12px;
        margin-bottom: 20px;
    }

    .doc-header h1 {
        font-size: 22px;
    }

    .glass-card {
        padding: 18px;
        border-radius: 12px;
        margin-bottom: 16px;
    }

    .section-title,
    .glass-card h2 {
        font-size: 18px;
    }

    /* Scrollable tables */
    .glass-card table,
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }

    th, td {
        padding: 10px 12px;
        font-size: 0.85rem;
    }

    /* Lock box */
    .lock-box {
        padding: 30px 24px;
        max-width: 360px;
    }

    /* Nav bar */
    .brand-nav-bar {
        padding: 0 16px;
    }

    .brand-nav-bar .nav-title {
        font-size: 0.8rem;
        max-width: 45%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Theme toggle */
    .theme-level-btn {
        bottom: 140px;
        right: 14px;
        width: 40px;
        height: 40px;
    }

    /* Buttons — bigger touch targets */
    .btn-primary {
        padding: 14px 24px;
        font-size: 15px;
        min-height: 44px;
    }

    /* Pre/code blocks */
    pre {
        padding: 14px;
        font-size: 12px;
    }

    /* Reduce water effects on tablet to save performance */
    .water-droplet { display: none; }
    .water-particle { display: none; }
    .glow-orb { filter: blur(40px); }
}

/* --- Mobile (max-width: 640px) --- */
@media (max-width: 640px) {
    html {
        font-size: 15px;
    }

    .doc-container {
        padding: 16px 12px;
    }

    .doc-header {
        padding: 18px 14px;
        border-radius: 10px;
        margin-bottom: 16px;
    }

    .doc-header h1 {
        font-size: 20px;
        line-height: 1.3;
    }

    .doc-header p {
        font-size: 0.9rem;
    }

    .glass-card {
        padding: 14px;
        border-radius: 10px;
        margin-bottom: 14px;
    }

    .glass-card h3 {
        font-size: 15px;
    }

    .glass-card p {
        font-size: 0.9rem;
        line-height: 1.6;
    }

    .glass-card ul,
    .glass-card ol {
        margin-left: 16px;
    }

    .glass-card li {
        font-size: 0.9rem;
    }

    /* Status badges stack better */
    .status-badge {
        font-size: 0.7rem;
        padding: 2px 8px;
    }

    /* Highlight boxes */
    .highlight-box,
    .glow-box {
        padding: 12px 14px;
    }

    .alert-box {
        padding: 12px 14px;
        font-size: 0.9rem;
    }

    /* Lock screen */
    .lock-box {
        padding: 24px 18px;
        max-width: 320px;
    }

    .lock-box input {
        font-size: 16px; /* prevents iOS zoom */
        padding: 12px;
        letter-spacing: 6px;
    }

    .lock-box button {
        padding: 14px;
        font-size: 15px;
    }

    .lock-icon {
        width: 50px;
        height: 50px;
    }

    /* Back to pack link */
    .back-to-pack {
        font-size: 0.85rem;
        margin-bottom: 1.5rem;
    }

    /* Kill all water effects on mobile for performance */
    .water-caustics { display: none; }
    .water-droplet { display: none; }
    .water-particle { display: none; }
    .glow-orb { display: none; }
    .water-ripple-container { display: none; }
    .water-wave-container { height: 60px; }
}

/* --- Small Mobile (max-width: 400px) --- */
@media (max-width: 400px) {
    html {
        font-size: 14px;
    }

    .doc-container {
        padding: 12px 10px;
    }

    .doc-header h1 {
        font-size: 18px;
    }

    .glass-card {
        padding: 12px;
        border-radius: 8px;
    }

    .section-title,
    .glass-card h2 {
        font-size: 16px;
        margin-bottom: 10px;
        padding-bottom: 8px;
    }

    th, td {
        padding: 8px 10px;
        font-size: 0.8rem;
    }

    .brand-nav-bar {
        padding: 0 12px;
        height: 44px;
    }

    .brand-nav-bar a {
        font-size: 0.8rem;
    }

    body[data-show-nav="true"] {
        padding-top: 44px;
    }

    .lock-box {
        padding: 20px 14px;
    }
}

/* --- Touch Devices (no hover) --- */
@media (hover: none) {
    .glass-card:hover {
        border-color: var(--glass-border);
        box-shadow: none;
    }

    .glass-card:active {
        transform: scale(0.99);
        transition: transform 0.1s ease;
    }

    .btn-primary:hover {
        transform: none;
        box-shadow: 0 4px 15px rgba(46, 163, 242, 0.3);
    }

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

    .theme-level-btn:hover {
        border-color: var(--glass-border);
        box-shadow: 0 4px 15px var(--shadow-color);
    }

    .theme-level-btn:active {
        transform: scale(0.95);
    }

    tr:hover td {
        background: transparent;
    }

    .lock-box button:hover {
        transform: none;
    }

    .lock-box button:active {
        transform: scale(0.98);
    }
}

/* --- Landscape Phone --- */
@media (max-height: 500px) and (max-width: 900px) {
    .doc-container {
        padding: 12px 16px;
    }

    .doc-header {
        padding: 14px 16px;
        margin-bottom: 12px;
    }

    .doc-header h1 {
        font-size: 18px;
    }

    .glass-card {
        padding: 12px 16px;
        margin-bottom: 10px;
    }

    #password-screen {
        align-items: flex-start;
        padding-top: 10px;
    }

    .lock-box {
        padding: 16px;
    }

    .lock-icon {
        width: 40px;
        height: 40px;
        margin-bottom: 10px;
    }

    .lock-box h2 {
        font-size: 16px;
    }

    .lock-box p {
        margin-bottom: 12px;
        font-size: 0.85rem;
    }

    .theme-level-btn {
        bottom: 60px;
    }
}

/* --- Print Styles --- */
@media print {
    body {
        background: white !important;
        color: black !important;
        padding-top: 0 !important;
    }

    .brand-nav-bar,
    .water-caustics,
    .water-droplet,
    .water-particle,
    .glow-orb,
    .water-wave-container,
    #password-screen {
        display: none !important;
    }

    .glass-card,
    .doc-header,
    .lock-box {
        background: white !important;
        border: 1px solid #ddd !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        box-shadow: none !important;
        color: black !important;
    }

    .glass-card h2,
    .section-title {
        color: #1a1a2e !important;
        border-bottom-color: #ddd !important;
    }

    .glass-card p,
    .glass-card li,
    td {
        color: #333 !important;
    }

    th {
        background: #f0f0f0 !important;
        color: #333 !important;
    }

    .doc-header h1 {
        -webkit-text-fill-color: #1a1a2e !important;
        color: #1a1a2e !important;
        background: none !important;
        animation: none !important;
    }

    .doc-header p {
        color: #666 !important;
    }

    .highlight-box {
        background: #f0f8ff !important;
        border-color: #ccc !important;
    }

    .highlight-box strong {
        color: #1a1a2e !important;
    }

    a {
        color: #333 !important;
    }
}
