* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-card: #16213e;
    --accent: #e94560;
    --accent-glow: rgba(233, 69, 96, 0.3);
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --success: #4ecca3;
    --warning: #f9a825;
    --radius: 12px;
    --up-color: #4ecca3;
    --down-color: #e94560;
    --hold-color: #f9a825;
    --rest-color: #7c83ff;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    padding-bottom: env(safe-area-inset-bottom);
}

#app {
    max-width: 480px;
    margin: 0 auto;
    padding: 16px;
    position: relative;
}

.lang-btn {
    position: fixed;
    top: 12px;
    right: 12px;
    background: var(--bg-card);
    border: 1px solid var(--text-secondary);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    z-index: 100;
}

header {
    text-align: center;
    padding: 20px 0 10px;
}

header h1 {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), #ff6b8a);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 4px;
}

.tabs {
    display: flex;
    gap: 8px;
    margin: 20px 0 16px;
    background: var(--bg-secondary);
    padding: 4px;
    border-radius: var(--radius);
}

.tab {
    flex: 1;
    padding: 10px 8px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.tab.active {
    background: var(--accent);
    color: white;
    box-shadow: 0 2px 8px var(--accent-glow);
}

.mode-panel {
    display: none;
}

.mode-panel.active {
    display: block;
}

.config-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 10px;
}

.config-card label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.config-card input {
    width: 100%;
    background: var(--bg-primary);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 12px 14px;
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    outline: none;
    transition: border-color 0.2s;
    -webkit-appearance: none;
}

.config-card input:focus {
    border-color: var(--accent);
}

.config-row {
    display: flex;
    gap: 10px;
}

.config-row .config-card {
    flex: 1;
}

.btn-start {
    width: 100%;
    padding: 16px;
    margin-top: 8px;
    background: linear-gradient(135deg, var(--accent), #c23152);
    border: none;
    border-radius: var(--radius);
    color: white;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 2px;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.2s;
}

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

/* Preset Cards */
.preset-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.preset-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px;
    cursor: pointer;
    transition: transform 0.1s, border-color 0.2s;
    border: 1px solid transparent;
}

.preset-card:active {
    transform: scale(0.98);
}

.preset-card:hover {
    border-color: var(--accent);
}

.preset-card .preset-name {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px;
}

.preset-card .preset-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.preset-card .preset-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.preset-tag {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
}

/* Timer Screen */
.hidden {
    display: none !important;
}

#timer-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

#timer-screen.hidden {
    display: none !important;
}

.timer-display {
    text-align: center;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.timer-action {
    font-size: 36px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-bottom: 12px;
    transition: color 0.3s;
    min-height: 44px;
}

.timer-action.action-up {
    color: var(--up-color);
    text-shadow: 0 0 30px rgba(78, 204, 163, 0.4);
}

.timer-action.action-down {
    color: var(--down-color);
    text-shadow: 0 0 30px rgba(233, 69, 96, 0.4);
}

.timer-action.action-hold {
    color: var(--hold-color);
    text-shadow: 0 0 30px rgba(249, 168, 37, 0.4);
}

.timer-action.action-rest {
    color: var(--rest-color);
    text-shadow: 0 0 30px rgba(124, 131, 255, 0.4);
}

.timer-countdown {
    font-size: 80px;
    font-weight: 200;
    font-variant-numeric: tabular-nums;
    letter-spacing: 4px;
    margin-bottom: 24px;
}

.timer-progress {
    width: 100%;
    max-width: 300px;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 16px;
}

.timer-progress-bar {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.1s linear, background-color 0.3s;
    width: 0%;
}

.timer-info {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.timer-kegel-counter {
    font-size: 20px;
    color: var(--accent);
    font-weight: 600;
    margin-top: 8px;
}

.timer-controls {
    display: flex;
    gap: 16px;
    width: 100%;
    max-width: 300px;
    padding-bottom: env(safe-area-inset-bottom);
}

.btn-control {
    flex: 1;
    padding: 16px;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 1px;
}

.btn-pause {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-stop {
    background: var(--accent);
    color: white;
}

/* Vibration pulse animation */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.timer-action.pulsing {
    animation: pulse 0.5s ease-in-out;
}

/* Desktop adjustments */
@media (min-width: 481px) {
    #app {
        padding-top: 20px;
    }
}

/* Small phones */
@media (max-height: 600px) {
    .timer-countdown {
        font-size: 56px;
    }
    .timer-action {
        font-size: 28px;
    }
}
