:root {
    --bg-primary: #0f1419;
    --bg-secondary: #1a1f26;
    --bg-card: #232a33;
    --bg-card-hover: #2a323d;
    --accent-blue: #4da3ff;
    --accent-cyan: #00d4aa;
    --accent-warm: #ff9f43;
    --accent-pink: #ff6b9d;
    --accent-purple: #a855f7;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-subtle: rgba(255, 255, 255, 0.08);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-anchor: none;
}

.app-container {
    max-width: 480px;
    margin: 0 auto;
    padding-top: 202px;
    padding-bottom: calc(72px + env(safe-area-inset-bottom));
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    max-width: 480px;
    margin: 0 auto;
    z-index: 100;
    background: var(--bg-primary);
    padding: 12px 16px 0;
    box-sizing: border-box;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
}

.header-text {
    display: flex;
    flex-direction: column;
    align-self: flex-start;
    gap: 2px;
}

.header-text h1 {
    font-family: 'Fraunces', serif;
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.5px;
    margin: 0;
    line-height: 1.1;
}

.header-text .water-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--accent-cyan);
    font-weight: 500;
    margin-top: 0;
}

.water-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--accent-cyan);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(0.8);
    }
}

/* Navigation Tabs */
.nav-tabs {
    display: flex;
    justify-content: space-around;
    padding: 0 env(safe-area-inset-right) 0 env(safe-area-inset-left);
    margin-bottom: 0;
}

.nav-tab {
    flex: 1;
    padding: 10px 4px 8px;
    border-radius: 0;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
}

@media (hover: hover) {
    .nav-tab:hover {
        color: var(--text-primary);
    }
}

.nav-tab.active {
    color: var(--accent-blue);
}

.nav-tab .tab-icon {
    font-size: 20px;
    line-height: 1;
}

.tab-label {
    font-size: 9px;
    line-height: 1;
}

/* Content Sections */
.section {
    display: none;
    padding: 0 16px;
    animation: fadeIn 0.3s ease;
}

.section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Calculator Card */
.calculator-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 20px 20px 10px;
    margin-top: 16px;
    margin-bottom: 16px;
    border: 1px solid var(--border-subtle);
}

.calc-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    font-weight: 600;
}

.selector-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.selector-btn {
    flex: 1;
    min-width: calc(33% - 6px);
    padding: 12px 8px;
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    position: relative;
}

@media (hover: hover) {
    .selector-btn:hover {
        border-color: var(--accent-blue);
        color: var(--text-primary);
    }
}

.selector-btn.active {
    background: rgba(77, 163, 255, 0.15);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

.selector-btn .size-hint {
    display: block;
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
}

#sizeGroup .selector-btn {
    padding-top: 8px;
    padding-bottom: 8px;
}

/* Colour selector — 5 buttons, single row */
#colourGroup .selector-btn {
    min-width: 0;
    padding: 12px 4px;
    font-size: 12px;
}

/* Colour selector specific styles */
.selector-btn.colour-white {
    border-left: 3px solid #f8fafc;
}

.selector-btn.colour-white.active {
    background: rgba(248, 250, 252, 0.1);
    border-color: #f8fafc;
    color: #f8fafc;
}

.selector-btn.colour-light {
    border-left: 3px solid #fcd34d;
}

.selector-btn.colour-light.active {
    background: rgba(252, 211, 77, 0.1);
    border-color: #fcd34d;
    color: #fcd34d;
}

.selector-btn.colour-colours {
    border-left: 3px solid #f472b6;
}

.selector-btn.colour-colours.active {
    background: rgba(244, 114, 182, 0.1);
    border-color: #f472b6;
    color: #f472b6;
}

.selector-btn.colour-darks {
    border-left: 3px solid #6366f1;
}

.selector-btn.colour-darks.active {
    background: rgba(99, 102, 241, 0.1);
    border-color: #6366f1;
    color: #6366f1;
}

.selector-btn.colour-mixed {
    border-left: 3px solid var(--accent-cyan);
}

.selector-btn.colour-mixed.active {
    background: rgba(0, 212, 170, 0.1);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}


.selector-group--wrap {
    flex-wrap: wrap;
}

.selector-group--wrap .selector-btn {
    flex: 1 1 calc(25% - 6px);
    min-width: 64px;
}

.selector-btn[data-recommended="true"]::after {
    content: '';
    display: block;
    width: 13px;
    height: 13px;
    position: absolute;
    top: 3px;
    right: 3px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 13 13'%3E%3Ccircle cx='6.5' cy='6.5' r='6' fill='%2300d4aa'/%3E%3Cpath d='M3.5 6.5L5.5 8.5L9.5 4.5' stroke='white' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
}

.cycle-rec {
    font-size: 13px;
    color: var(--accent-warm);
    padding: 8px 12px;
    background: rgba(255, 159, 67, 0.08);
    border-radius: 8px;
    margin-top: 8px;
    margin-bottom: 4px;
}

/* Result card sits inside .header — no positioning needed */
.result-display-sticky {
    padding-top: 16px;
}

/* Scroll-fade gradient below the combined header */
.header::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    height: 28px;
    background: linear-gradient(to bottom, var(--bg-primary), transparent);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.header.scrolled::after {
    opacity: 1;
}

/* Result Display with Cup */
.result-display {
    background: linear-gradient(135deg, rgba(77, 163, 255, 0.1), rgba(0, 212, 170, 0.1));
    border-radius: var(--radius-lg);
    padding: 8px 14px 10px;
    border: 1px solid rgba(77, 163, 255, 0.2);
}

.result-row {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: space-between;
}

.result-text {
    flex: 1;
    text-align: center;
}

.result-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.result-value {
    font-family: 'Fraunces', serif;
    font-size: 48px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.1;
    white-space: nowrap;
}

.result-unit {
    font-size: 26px;
    font-weight: 400;
}

.result-dose-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.result-temp-row {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 4px;
}

.temp-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    background: rgba(255, 159, 67, 0.15);
    border-radius: var(--radius-sm);
    color: var(--accent-warm);
    font-size: 18px;
    font-weight: 600;
}

/* Washer Visual */
.washer-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 80px;
}

.washer-wrapper {
    position: relative;
    width: 60px;
    height: 75px;
}

.washer-svg {
    width: 100%;
    height: 100%;
}

#drumFill {
    transition: fill 0.4s ease;
}

/* Detergent Cup Visual */
.cup-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 80px;
}

.cup-wrapper {
    position: relative;
    width: 60px;
    height: 75px;
}

.cup-svg {
    width: 100%;
    height: 100%;
}

/* Result card selector pills */
.result-pill {
    margin-top: 6px;
    padding: 5px 8px;
    width: 100%;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    min-height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.result-pill::after {
    content: ' ▾';
    opacity: 0.5;
}
.result-pill:active {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.22);
}

.cup-fill {
    transition: all 0.5s ease;
}

.cup-comparison {
    font-size: 12px;
    color: var(--accent-pink);
    font-weight: 500;
}


.install-nudge {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 16px 12px;
    padding: 10px 12px;
    background: rgba(77, 163, 255, 0.12);
    border: 1px solid rgba(77, 163, 255, 0.3);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 12px;
}

.install-nudge[hidden] {
    display: none;
}

.install-text {
    flex: 1;
}

.install-dismiss {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
}


.detergent-guide {
    margin-top: -10px;
    margin-bottom: 16px;
    font-size: 12px;
    color: var(--text-secondary);
    padding-left: 2px;
}

.range-control {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    margin-bottom: 6px;
}

.range-control input[type="range"] {
    flex: 1;
    accent-color: var(--accent-blue);
}

.range-value {
    min-width: 52px;
    text-align: right;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
}

.concentration-note {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 16px;
    padding-left: 2px;
}


/* Bottom Sheet + Backdrop */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.modal-backdrop.visible { opacity: 1; }
.modal-backdrop[hidden] { display: none; }

.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 480px;
    margin: 0 auto;
    background: var(--bg-card);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: 0 20px 32px;
    z-index: 201;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}
.bottom-sheet.visible { transform: translateY(0); }
.bottom-sheet[hidden] { display: none; }

.sheet-handle {
    width: 36px;
    height: 4px;
    background: var(--border-subtle);
    border-radius: 2px;
    margin: 10px auto 12px;
}
.sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.sheet-title {
    font-weight: 600;
    font-size: 16px;
}
.sheet-done {
    background: none;
    border: none;
    color: var(--accent-blue);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    padding: 4px 8px;
}
.sheet-body .selector-group { margin-bottom: 12px; }
.sheet-body .calc-label { margin-bottom: 8px; }

.sheet-rec {
    padding: 10px 12px;
    margin-bottom: 12px;
    background: rgba(0, 212, 170, 0.1);
    border: 1px solid rgba(0, 212, 170, 0.2);
    border-radius: var(--radius-md);
    font-size: 12px;
    color: var(--accent-cyan);
}

/* Load type sheet grid */
.load-type-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.load-type-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.load-type-option.active {
    border-color: var(--accent-cyan);
    background: rgba(0, 212, 170, 0.1);
    color: var(--accent-cyan);
}
.load-type-option:active {
    opacity: 0.7;
}

/* Info Cards */
.info-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 12px;
    border: 1px solid var(--border-subtle);
}

.info-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.info-card-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.info-card-icon.blue {
    background: rgba(77, 163, 255, 0.15);
}

.info-card-icon.cyan {
    background: rgba(0, 212, 170, 0.15);
}

.info-card-icon.warm {
    background: rgba(255, 159, 67, 0.15);
}

.info-card-icon.pink {
    background: rgba(255, 107, 157, 0.15);
}

.info-card-icon.purple {
    background: rgba(168, 85, 247, 0.15);
}

.info-card-title {
    font-weight: 600;
    font-size: 15px;
}

.info-card-content {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.info-card-content strong {
    color: var(--text-primary);
}

/* Collapsible Sections */
.collapsible {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    margin-bottom: 12px;
    border: 1px solid var(--border-subtle);
    overflow: hidden;
}

.collapsible-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    cursor: pointer;
    transition: background 0.2s ease;
}

@media (hover: hover) {
    .collapsible-header:hover {
        background: var(--bg-card-hover);
    }
}

.collapsible-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.collapsible-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.collapsible-title {
    font-weight: 600;
    font-size: 15px;
}

.collapsible-chevron {
    font-size: 18px;
    color: var(--text-muted);
    transition: transform 0.3s ease;
}

.collapsible.open .collapsible-chevron {
    transform: rotate(180deg);
}

.collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.collapsible.open .collapsible-content {
    max-height: 2000px;
}

.collapsible-inner {
    padding: 0 16px 16px;
    border-top: 1px solid var(--border-subtle);
}

/* Temperature Guide */
.temp-guide {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.temp-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.temp-badge-sm {
    min-width: 60px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    text-align: center;
}

.temp-badge-sm.cold {
    background: rgba(77, 163, 255, 0.2);
    color: var(--accent-blue);
}

.temp-badge-sm.warm {
    background: rgba(255, 159, 67, 0.2);
    color: var(--accent-warm);
}

.temp-badge-sm.hot {
    background: rgba(255, 107, 157, 0.2);
    color: var(--accent-pink);
}

.temp-desc {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Tips List */
.tips-list {
    margin-top: 12px;
}

.tip-item {
    display: flex;
    gap: 8px;
    padding: 4px 0;
}

.tip-icon {
    flex-shrink: 0;
    font-size: 14px;
}

.tip-text {
    font-size: 14px;
    color: var(--text-secondary);
}

.tip-text--warn {
    color: var(--accent-pink);
}

/* Key Fact Banner */
.key-fact {
    position: relative;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
    border-radius: var(--radius-lg);
    padding: 16px;
    padding-right: 32px;
    margin-bottom: 16px;
    color: var(--bg-primary);
}

.key-fact-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    color: var(--bg-primary);
    opacity: 0.4;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 4px;
    transition: opacity 0.2s;
}

@media (hover: hover) {
    .key-fact-close:hover {
        opacity: 0.7;
    }
}

.key-fact-title {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.why-tip {
    font-size: 11px;
    font-weight: 600;
    color: var(--bg-primary);
    background: rgba(255, 255, 255, 0.4);
    padding: 2px 6px;
    border-radius: 999px;
}

.key-fact-text {
    font-size: 13px;
    opacity: 0.9;
}

/* Maintenance Checklist */
.checklist {
    margin-top: 12px;
}

.check-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-subtle);
}

.check-item:last-child {
    border-bottom: none;
}

.check-circle {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0, 212, 170, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--accent-cyan);
    font-size: 12px;
}

.check-content {
    flex: 1;
}

.check-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 2px;
}

.check-desc {
    font-size: 13px;
    color: var(--text-muted);
}

/* Bottom Note */
.bottom-note {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-top: 24px;
    text-align: center;
    border: 1px solid var(--border-subtle);
}

.bottom-note-text {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.6;
}

.bottom-note-text strong {
    color: var(--accent-cyan);
}

.version-tag {
    display: inline-block;
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

/* Section Headers */
.section-header {
    font-family: 'Fraunces', serif;
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-left: 2px;
}

/* Machine Info Card */
.machine-card {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.1), rgba(77, 163, 255, 0.1));
    border: 1px solid rgba(168, 85, 247, 0.2);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 16px;
}

.machine-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.machine-icon {
    width: 40px;
    height: 40px;
    background: rgba(168, 85, 247, 0.2);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.machine-name {
    font-weight: 600;
    font-size: 14px;
}

.machine-model {
    font-size: 12px;
    color: var(--text-muted);
}


/* Reference Table */
.ref-table {
    width: 100%;
    margin-top: 12px;
    border-collapse: collapse;
}

.ref-table th,
.ref-table td {
    padding: 10px 8px;
    text-align: left;
    font-size: 12px;
    border-bottom: 1px solid var(--border-subtle);
}

.ref-table th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ref-table td {
    color: var(--text-secondary);
}

.ref-table tr:last-child td {
    border-bottom: none;
}


/* Active Press States */
.selector-btn:active { transform: scale(0.96); }
.selector-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}
.nav-tab:active { transform: scale(0.96); }
.collapsible-header:active { background: var(--bg-card-hover); }
.preset-tip-toggle:active { background: var(--bg-card-hover); }
.install-dismiss:active { transform: scale(0.95); }
.key-fact-close:active { opacity: 0.8; }


/* Custom Range Slider */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: var(--bg-primary);
    border-radius: 3px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-blue);
    border: 2px solid var(--bg-card);
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-blue);
    border: 2px solid var(--bg-card);
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    cursor: pointer;
}

/* Bottom Tab Bar */
.nav-tabs-wrapper {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 480px;
    margin: 0 auto;
    background: var(--bg-card);
    border-top: 1px solid var(--border-subtle);
    z-index: 50;
    padding-bottom: env(safe-area-inset-bottom);
}

/* Animate Key-Fact Dismiss */
.key-fact-dismissing {
    animation: dismissFact 0.3s ease forwards;
    overflow: hidden;
}

@keyframes dismissFact {
    0% { opacity: 1; max-height: 200px; margin-bottom: 16px; }
    50% { opacity: 0; }
    100% { opacity: 0; max-height: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0; }
}

/* Preset Tip Card */
.preset-tip {
    background: var(--bg-card);
    border: 1px solid rgba(0, 212, 170, 0.25);
    border-radius: var(--radius-lg);
    margin-top: 16px;
    margin-bottom: 0;
    overflow: hidden;
}
.preset-tip[hidden] { display: none; }
.preset-tip-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
}
@media (hover: hover) {
    .preset-tip-toggle:hover { background: var(--bg-card-hover); }
}
.preset-tip-title {
    font-weight: 600;
    font-size: 13px;
    color: var(--accent-cyan);
}
.preset-tip-chevron {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    flex-shrink: 0;
    transition: transform 0.3s ease;
}
.preset-tip.open .preset-tip-chevron {
    transform: rotate(180deg);
}
.preset-tip-body {
    height: 0;
    overflow: hidden;
    transition: height 0.3s ease;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.6;
}
.preset-tip-inner {
    padding: 0 8px 12px;
}


/* Mobile optimizations */
@media (max-width: 380px) {
    .selector-btn {
        min-width: calc(50% - 4px);
        font-size: 12px;
    }

    .result-value {
        font-size: 26px;
    }

    .cup-wrapper {
        width: 75px;
        height: 95px;
    }

    .nav-tab {
        padding: 8px 2px 6px;
    }
}

/* Landscape guard — app is portrait-only */
@media (orientation: landscape) and (max-height: 600px) {
    body::before {
        content: 'Please rotate your device to portrait mode';
        position: fixed;
        inset: 0;
        z-index: 9999;
        display: flex;
        align-items: center;
        justify-content: center;
        background: var(--bg-primary);
        color: var(--text-secondary);
        font-size: 16px;
        text-align: center;
        padding: 24px;
    }
}
