/* ===== CSS Variables ===== */
:root {
    --bg-dark: #1a1a2e;
    --bg-card: #16213e;
    --bg-input: #0f3460;
    --primary: #7b68ee;
    --primary-hover: #6a5acd;
    --success: #00d26a;
    --warning: #ffc107;
    --danger: #ff6b6b;
    --text: #e8e8e8;
    --text-muted: #a0a0a0;
    --transition-speed: 0.3s;
    --border-radius: 12px;
}

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

html {
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh;
    line-height: 1.5;
}

/* ===== Container ===== */
.container {
    max-width: 480px;
    margin: 0 auto;
    padding: 20px 16px;
    min-height: 100vh;
    min-height: 100dvh;
}

/* ===== Screen Management ===== */
.screen {
    display: none;
    flex-direction: column;
    gap: 24px;
    animation: fadeIn 0.3s ease;
}

.screen.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Header ===== */
.header {
    text-align: center;
    padding: 20px 0;
}

.header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* ===== Days Container ===== */
.days-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.day-input {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
    padding: 14px 16px;
    border-radius: var(--border-radius);
    transition: background var(--transition-speed);
}

.day-input:focus-within {
    background: var(--bg-input);
}

.day-label {
    width: 36px;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.hour-slider {
    flex: 1;
    height: 48px;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    cursor: pointer;
}

/* Slider Track */
.hour-slider::-webkit-slider-runnable-track {
    height: 8px;
    background: var(--bg-input);
    border-radius: 4px;
}

.hour-slider::-moz-range-track {
    height: 8px;
    background: var(--bg-input);
    border-radius: 4px;
}

/* Slider Thumb */
.hour-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 28px;
    height: 28px;
    background: var(--primary);
    border-radius: 50%;
    margin-top: -10px;
    box-shadow: 0 2px 8px rgba(123, 104, 238, 0.4);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.hour-slider::-moz-range-thumb {
    width: 28px;
    height: 28px;
    background: var(--primary);
    border-radius: 50%;
    border: none;
    box-shadow: 0 2px 8px rgba(123, 104, 238, 0.4);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.hour-slider:active::-webkit-slider-thumb {
    transform: scale(1.15);
    box-shadow: 0 3px 12px rgba(123, 104, 238, 0.6);
}

.hour-slider:active::-moz-range-thumb {
    transform: scale(1.15);
    box-shadow: 0 3px 12px rgba(123, 104, 238, 0.6);
}

.hour-value {
    width: 44px;
    text-align: right;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary);
}

/* ===== Summary ===== */
.summary {
    text-align: center;
    padding: 16px;
    background: var(--bg-card);
    border-radius: var(--border-radius);
}

.summary-text {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.summary-text strong {
    color: var(--text);
    font-size: 1.1rem;
}

/* ===== Buttons ===== */
.btn-primary,
.btn-secondary,
.btn-outline {
    width: 100%;
    min-height: 52px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-speed);
    touch-action: manipulation;
}

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

.btn-primary:hover,
.btn-primary:active {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text);
    border: 2px solid var(--primary);
}

.btn-secondary:hover,
.btn-secondary:active {
    background: var(--primary);
}

.btn-outline {
    background: transparent;
    color: var(--text-muted);
    border: 2px solid var(--bg-card);
}

.btn-outline:hover,
.btn-outline:active {
    border-color: var(--text-muted);
    color: var(--text);
}

/* ===== Result Card ===== */
.result-card {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 32px 24px;
    text-align: center;
    border: 3px solid transparent;
}

.result-card.success {
    border-color: var(--success);
}

.result-card.warning {
    border-color: var(--warning);
}

.result-card.danger {
    border-color: var(--danger);
}

.result-emoji {
    font-size: 4rem;
    margin-bottom: 16px;
    animation: bounce 0.6s ease;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.result-debt {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.result-card.success .result-debt {
    color: var(--success);
}

.result-card.warning .result-debt {
    color: var(--warning);
}

.result-card.danger .result-debt {
    color: var(--danger);
}

.result-level {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 12px;
}

.result-detail {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* ===== Tips Section ===== */
.tips-section {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 20px;
}

.tips-section h2 {
    font-size: 1.1rem;
    margin-bottom: 16px;
}

.tips-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tips-list li {
    padding-left: 24px;
    position: relative;
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
}

.tips-list li::before {
    content: "•";
    position: absolute;
    left: 8px;
    color: var(--primary);
    font-weight: bold;
}

/* ===== Actions ===== */
.actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ===== Toast ===== */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-card);
    color: var(--text);
    padding: 14px 24px;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    font-size: 0.95rem;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ===== Responsive ===== */
@media (min-width: 480px) {
    .container {
        padding: 32px 24px;
    }

    .header h1 {
        font-size: 2rem;
    }

    .day-input {
        padding: 16px 20px;
    }

    .result-card {
        padding: 40px 32px;
    }

    .result-emoji {
        font-size: 5rem;
    }

    .result-debt {
        font-size: 3rem;
    }
}

/* ===== Accessibility ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for keyboard navigation */
.hour-slider:focus {
    outline: 2px solid var(--primary);
    outline-offset: 4px;
}

button:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
