/* ===== RESET & BASE ===== */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background: linear-gradient(135deg, #0f0c29 0%, #1a1a2e 50%, #16213e 100%);
    color: #f0f0f0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    margin: 0;
    overflow-y: auto;
    padding: 40px 16px;
}

/* Animated background particles */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(2px 2px at 20% 30%, rgba(255, 255, 255, 0.1), transparent),
        radial-gradient(2px 2px at 40% 70%, rgba(255, 255, 255, 0.05), transparent),
        radial-gradient(2px 2px at 60% 20%, rgba(255, 255, 255, 0.08), transparent),
        radial-gradient(2px 2px at 80% 50%, rgba(255, 255, 255, 0.06), transparent),
        radial-gradient(2px 2px at 10% 80%, rgba(255, 255, 255, 0.07), transparent),
        radial-gradient(2px 2px at 90% 10%, rgba(255, 255, 255, 0.04), transparent);
    pointer-events: none;
    z-index: 0;
}

/* ===== CONTAINER ===== */
.container {
    text-align: center;
    position: relative;
    z-index: 1;
    width: 380px;
    max-width: 95vw;
    display: flex;
    flex-direction: column;
    gap: 24px;
    align-items: center;
}

/* ===== LAYOUT ROW ===== */
.layout-row {
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: 100%;
}

.col-oxygen {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
}

.col-keypad {
    width: 100%;
}

@media (min-width: 760px) {
    .container {
        width: 780px;
        max-width: 95vw;
    }

    .layout-row {
        flex-direction: row;
        align-items: flex-start;
    }

    .col-oxygen {
        flex: 1;
    }

    .col-keypad {
        flex: 1;
    }
}

h1 {
    font-size: 2em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 4px;
    background: linear-gradient(90deg, #00e5ff, #00c853);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===== OXYGEN PANEL (Gauge card) ===== */
.oxygen-panel {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 32px 28px 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    width: 100%;
}

/* ===== GAUGE ===== */
.gauge-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

.gauge-ring {
    position: relative;
    width: 220px;
    height: 220px;
}

.gauge-svg {
    width: 100%;
    height: 100%;
}

.gauge-arc-fill {
    transition: stroke-dasharray 0.8s cubic-bezier(0.4, 0, 0.2, 1), stroke 0.5s ease, filter 0.5s ease;
}

.gauge-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.gauge-time {
    font-size: 2.8em;
    font-weight: 700;
    letter-spacing: 2px;
    color: #00e5ff;
    text-shadow: 0 0 20px rgba(0, 229, 255, 0.4);
    transition: color 0.5s ease, text-shadow 0.5s ease;
}

.gauge-label {
    font-size: 0.85em;
    font-weight: 300;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 2px;
}

/* ===== PERCENTAGE BAR ===== */
.percentage-bar-wrapper {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
}

.percentage-bar {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
    position: relative;
}

.percentage-fill {
    height: 100%;
    width: 100%;
    border-radius: 4px;
    background: linear-gradient(90deg, #00e5ff, #00c853);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1),
        background 0.6s ease;
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.3);
}

.percentage-text {
    font-size: 0.9em;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    min-width: 42px;
    text-align: right;
}

/* ===== STATUS LINE ===== */
.status-line {
    margin-top: 14px;
    font-size: 0.75em;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.35);
    letter-spacing: 1px;
    transition: color 0.4s ease;
}

.status-line .dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #00c853;
    margin-right: 6px;
    animation: pulse 2s infinite;
}

.status-line.warning {
    color: rgba(255, 167, 38, 0.7);
}

.status-line.warning .dot {
    background: #ffa726;
}

.status-line.critical {
    color: rgba(255, 23, 68, 0.8);
}

.status-line.critical .dot {
    background: #ff1744;
    animation: pulsefast 0.6s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

@keyframes pulsefast {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.2;
    }
}

/* ===== REFILL BUTTON ===== */
.refill-btn {
    width: 100%;
    padding: 18px 24px;
    font-family: 'Outfit', sans-serif;
    font-size: 1.1em;
    font-weight: 600;
    letter-spacing: 1px;
    color: #fff;
    border: none;
    border-radius: 16px;
    background: linear-gradient(135deg, #00c853, #00e676);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 200, 83, 0.3);
    position: relative;
    overflow: hidden;
}

.refill-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    transition: left 0.5s ease;
}

.refill-btn:hover::after {
    left: 100%;
}

.refill-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 200, 83, 0.4);
}

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

.refill-btn:disabled {
    background: rgba(255, 255, 255, 0.08);
    box-shadow: none;
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
}

.refill-icon {
    font-size: 1.3em;
    font-weight: 700;
}

/* ===== KEYPAD PANEL ===== */
.keypad-panel {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 28px 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    width: 100%;
}

.keypad-header {
    font-size: 1em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.lock-icon {
    font-size: 1.1em;
}

/* Keypad display */
.keypad-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 16px 20px;
    margin-bottom: 18px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.digit-slot {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 52px;
    font-size: 2em;
    font-weight: 700;
    color: #fff;
    border-bottom: 3px solid rgba(255, 255, 255, 0.15);
    transition: border-color 0.3s ease, color 0.3s ease;
}

.digit-slot.filled {
    border-color: rgba(255, 255, 255, 0.4);
}

.keypad-display.error {
    border-color: rgba(255, 23, 68, 0.6);
    box-shadow: 0 0 16px rgba(255, 23, 68, 0.2);
    animation: shake 0.4s ease;
}

.keypad-display.success {
    border-color: rgba(255, 167, 38, 0.6);
    box-shadow: 0 0 16px rgba(255, 167, 38, 0.3);
}

.keypad-display.locked {
    border-color: rgba(255, 167, 38, 0.4);
    box-shadow: 0 0 12px rgba(255, 167, 38, 0.15);
}

.keypad-display.locked .digit-slot {
    color: #ffa726;
    border-color: rgba(255, 167, 38, 0.3);
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-6px);
    }

    40% {
        transform: translateX(6px);
    }

    60% {
        transform: translateX(-4px);
    }

    80% {
        transform: translateX(4px);
    }
}

/* Keypad grid */
.keypad-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.key-btn {
    padding: 16px 0;
    font-family: 'Outfit', sans-serif;
    font-size: 1.3em;
    font-weight: 600;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    color: #fff;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: transform 0.1s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.key-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.key-btn:active {
    transform: scale(0.93);
    background: rgba(255, 255, 255, 0.18);
}

.key-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none;
}

.key-clear {
    background: rgba(255, 23, 68, 0.15);
    border-color: rgba(255, 23, 68, 0.2);
    color: #ff1744;
}

.key-clear:hover {
    background: rgba(255, 23, 68, 0.25);
}

.key-enter {
    background: rgba(255, 167, 38, 0.15);
    border-color: rgba(255, 167, 38, 0.2);
    color: #ffa726;
}

.key-enter:hover {
    background: rgba(255, 167, 38, 0.25);
}

/* Keypad feedback */
.keypad-feedback {
    margin-top: 14px;
    font-size: 0.8em;
    font-weight: 400;
    letter-spacing: 1px;
    min-height: 22px;
    transition: color 0.3s ease;
}

.keypad-feedback.error {
    color: #ff1744;
}

.keypad-feedback.success {
    color: #ffa726;
}

/* ===== DYNAMIC GAUGE STATES ===== */
/* Optimal oxygen (>50%) */
.state-optimal .gauge-time {
    color: #00e5ff;
    text-shadow: 0 0 20px rgba(0, 229, 255, 0.4);
}

.state-optimal .percentage-fill {
    background: linear-gradient(90deg, #00e5ff, #00c853);
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.3);
}

/* Nominal oxygen (25–50%) */
.state-high .gauge-time {
    color: #66bb6a;
    text-shadow: 0 0 20px rgba(102, 187, 106, 0.4);
}

.state-high .percentage-fill {
    background: linear-gradient(90deg, #66bb6a, #43a047);
    box-shadow: 0 0 10px rgba(102, 187, 106, 0.3);
}

/* Medium oxygen (30–60%) */
.state-medium .gauge-time {
    color: #ffa726;
    text-shadow: 0 0 20px rgba(255, 167, 38, 0.4);
}

.state-medium .percentage-fill {
    background: linear-gradient(90deg, #ffa726, #ff9100);
    box-shadow: 0 0 10px rgba(255, 167, 38, 0.3);
}

/* Low oxygen (<30%) */
.state-low .gauge-time {
    color: #ff1744;
    text-shadow: 0 0 20px rgba(255, 23, 68, 0.5);
    animation: textpulse 1.2s infinite;
}

.state-low .percentage-fill {
    background: linear-gradient(90deg, #ff1744, #d50000);
    box-shadow: 0 0 14px rgba(255, 23, 68, 0.4);
}

@keyframes textpulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 420px) {
    .container {
        width: 100%;
    }

    .gauge-ring {
        width: 180px;
        height: 180px;
    }

    .gauge-time {
        font-size: 2.2em;
    }
}