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

:root {
    --color-bg: #000000;
    --color-text: #ffffff;
    --color-text-secondary: #8e8e93;
    --color-accent: #ffffff;
    --color-glow: rgba(255, 255, 255, 0.4);
    --font-stack: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Arial, sans-serif;
    --transition-smooth: cubic-bezier(0.4, 0.0, 0.2, 1);
}

body {
    background-color: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-stack);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    position: fixed;
    overscroll-behavior: none;
    transition: background-color 0.3s var(--transition-smooth);
}

.container {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    min-height: 100vh;
    padding: clamp(1.5rem, 5vh, 3rem) clamp(1rem, 5vw, 2rem);
    max-width: 600px;
    margin: 0 auto;
}

header {
    text-align: center;
    padding-bottom: 0.5rem;
}

.logo {
    width: clamp(338px, 90vw, 563px);
    height: auto;
    display: block;
    margin: 0 auto;
}

.halat-logo {
    width: clamp(30px, 8.75vw, 50px);
    height: auto;
    display: block;
    margin: 1rem auto 0;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    gap: 2rem;
}

.meter-container {
    position: relative;
    width: clamp(280px, 70vw, 450px);
    height: clamp(280px, 70vw, 450px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.analog-meter {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
}

.tick-marks line {
    stroke: #888;
    stroke-width: 2;
}

.tick-marks .major {
    stroke: #aaa;
    stroke-width: 3;
}

.tick-marks text {
    fill: #aaa;
    font-size: 12px;
    font-family: var(--font-stack);
    text-anchor: middle;
    font-weight: 500;
}

#needle {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
    transition: transform 0.1s cubic-bezier(0.4, 0.0, 0.2, 1);
    will-change: transform;
}

.meter-display {
    position: absolute;
    bottom: 25%;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    background: rgba(0, 0, 0, 0.7);
    padding: 0.75rem 2rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
}

.level-text {
    font-size: clamp(2rem, 8vw, 3.5rem);
    font-weight: 300;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    color: #fff;
}

.level-unit {
    font-size: clamp(0.875rem, 2vw, 1rem);
    color: var(--color-text-secondary);
    font-weight: 400;
    letter-spacing: 0.1em;
}


.error-message {
    background: rgba(255, 59, 48, 0.15);
    color: #ff3b30;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    font-size: 0.875rem;
    line-height: 1.5;
    text-align: center;
    display: none;
    max-width: 90%;
}

.error-message.visible {
    display: block;
}

.error-message button {
    margin-top: 0.75rem;
    background: rgba(255, 59, 48, 0.2);
    border: none;
    color: #ff3b30;
    font-family: var(--font-stack);
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s var(--transition-smooth);
    -webkit-tap-highlight-color: transparent;
}

.error-message button:hover,
.error-message button:focus {
    background: rgba(255, 59, 48, 0.3);
    outline: none;
}

footer {
    width: 100%;
    padding-top: 0;
    margin-top: -3rem;
}

.controls {
    display: flex;
    justify-content: center;
    width: 100%;
}

.primary-btn {
    background: var(--color-accent);
    color: var(--color-bg);
    border: none;
    font-family: var(--font-stack);
    font-size: 1rem;
    font-weight: 500;
    padding: 1rem 2rem;
    border-radius: 24px;
    cursor: pointer;
    transition: all 0.2s var(--transition-smooth);
    width: 100%;
    max-width: 200px;
    margin: 0 auto;
    -webkit-tap-highlight-color: transparent;
}

.primary-btn:hover {
    transform: scale(1.02);
}

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

.primary-btn:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 4px;
}

.primary-btn.active {
    background: #ff3b30;
    color: var(--color-text);
}

@media (prefers-reduced-motion: reduce) {
    #needle,
    .primary-btn {
        transition: none;
    }
    
    .analog-meter {
        filter: none;
    }
}

@media (max-width: 400px) {
    .container {
        padding: 1rem 0.75rem;
    }
}
