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

:root {
    --bg: #121212;
    --card: #181818;
    --card-hover: #212121;
    --accent: #1DB954;
    --accent-dark: #179443;
    --text: #FFFFFF;
    --text-secondary: #B3B3B3;
    --text-muted: #535353;
    --border: #282828;
    --surface: #282828;
    --surface-light: #404040;
    --radius: 12px;
    --radius-sm: 8px;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: #22d95e;
}

/* === Header === */
.header {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.5px;
}

.logo:hover {
    color: var(--accent);
}

.header-nav {
    display: flex;
    gap: 24px;
}

.header-nav a {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
}

.header-nav a:hover {
    color: var(--text);
}

/* === 3-Column Layout === */
.layout {
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px 24px;
    display: grid;
    grid-template-columns: 180px 1fr 320px;
    gap: 32px;
    align-items: start;
}

.sidebar {
    position: sticky;
    top: 92px;
}

.sidebar-left {
    display: flex;
    justify-content: center;
}

.sidebar-right {
    display: flex;
    flex-direction: column;
    gap: 24px;
    align-items: center;
}

/* === Main Content === */
.main {
    max-width: 720px;
    margin: 0 auto;
    width: 100%;
}

.main h1 {
    font-size: 1.75rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 32px;
    letter-spacing: -0.5px;
}

/* === Timer Card === */
.timer-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px 24px;
    text-align: center;
}

/* Mode Tabs */
.mode-tabs {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 32px;
}

.mode-tab {
    background: var(--surface);
    border: none;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 8px 20px;
    border-radius: 100px;
    cursor: pointer;
    transition: all 0.2s;
}

.mode-tab:hover {
    background: var(--surface-light);
    color: var(--text);
}

.mode-tab.active {
    background: var(--accent);
    color: var(--text);
}

/* Timer Display */
.timer-display {
    display: flex;
    justify-content: center;
    margin-bottom: 32px;
}

.timer-ring {
    position: relative;
    width: 260px;
    height: 260px;
}

.timer-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.ring-bg {
    fill: none;
    stroke: var(--surface);
    stroke-width: 6;
}

.ring-progress {
    fill: none;
    stroke: var(--accent);
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 753.98;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 0.5s ease;
}

.timer-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: 2px;
}

/* Controls */
.controls {
    display: flex;
    gap: 16px;
    justify-content: center;
    align-items: center;
    margin-bottom: 24px;
}

.btn {
    border: none;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    border-radius: 100px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background: var(--accent);
    color: var(--text);
    font-size: 1.125rem;
    padding: 14px 48px;
    min-width: 160px;
}

.btn-primary:hover {
    background: var(--accent-dark);
    transform: scale(1.02);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text-secondary);
    width: 48px;
    height: 48px;
    padding: 0;
}

.btn-secondary:hover {
    background: var(--surface-light);
    color: var(--text);
}

.btn-full {
    width: 100%;
    margin-top: 16px;
}

/* Session Counter */
.session-counter {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.session-count {
    color: var(--accent);
    font-weight: 700;
    font-size: 1.125rem;
}

/* === Stats Card === */
.stats-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-top: 24px;
}

.stats-card h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.stat-item {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}

.stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* === Settings Modal === */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal-overlay.open {
    display: flex;
}

.modal {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 400px;
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
}

.modal-close:hover {
    color: var(--text);
}

.modal-body {
    padding: 24px;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.setting-row label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.setting-row input[type="number"] {
    width: 80px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 0.875rem;
    padding: 8px 12px;
    text-align: center;
}

.setting-row input[type="number"]:focus {
    outline: none;
    border-color: var(--accent);
}

/* Toggle Switch */
.toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    cursor: pointer;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--surface);
    border-radius: 100px;
    transition: background 0.2s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    bottom: 3px;
    background: var(--text);
    border-radius: 50%;
    transition: transform 0.2s;
}

.toggle input:checked + .toggle-slider {
    background: var(--accent);
}

.toggle input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

/* === Content Section === */
.content-section {
    border-top: 1px solid var(--border);
    padding: 48px 24px;
}

.content-inner {
    max-width: 800px;
    margin: 0 auto;
}

.content-section h2 {
    font-size: 1.375rem;
    font-weight: 600;
    margin-bottom: 16px;
    margin-top: 32px;
    letter-spacing: -0.3px;
}

.content-section h2:first-child {
    margin-top: 0;
}

.content-section p {
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.7;
}

/* FAQ */
.faq-section {
    margin-top: 40px;
}

.faq-item {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 20px 24px;
    margin-bottom: 12px;
}

.faq-item h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text);
}

.faq-item p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0;
}

/* === Cross Links === */
.cross-links {
    background: var(--card);
    border-top: 1px solid var(--border);
    padding: 48px 24px;
}

.cross-links h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 24px;
    text-align: center;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    max-width: 600px;
    margin: 0 auto;
}

.tool-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 24px;
    text-align: center;
    transition: all 0.2s;
    color: var(--text);
}

.tool-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    color: var(--text);
}

.tool-icon {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 12px;
}

.tool-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.tool-card p {
    font-size: 0.813rem;
    color: var(--text-secondary);
}

/* === Footer === */
.footer {
    border-top: 1px solid var(--border);
    padding: 32px 24px;
    text-align: center;
}

.footer-inner {
    max-width: 800px;
    margin: 0 auto;
}

.footer-links {
    display: flex;
    gap: 24px;
    justify-content: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.footer-links a:hover {
    color: var(--text);
}

.footer-copy {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* === Ad Slots === */
.ad-slot {
    min-height: 250px;
}

.ad-slot-mobile {
    display: none;
    margin: 24px 0;
}

/* === Responsive === */
@media (max-width: 1200px) {
    .layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
    }

    .ad-slot-mobile {
        display: block;
    }

    .main {
        max-width: 600px;
    }
}

@media (max-width: 600px) {
    .main h1 {
        font-size: 1.375rem;
    }

    .timer-ring {
        width: 220px;
        height: 220px;
    }

    .timer-text {
        font-size: 2.75rem;
    }

    .timer-card {
        padding: 24px 16px;
    }

    .mode-tabs {
        gap: 4px;
    }

    .mode-tab {
        font-size: 0.8rem;
        padding: 6px 14px;
    }

    .btn-primary {
        padding: 12px 36px;
        font-size: 1rem;
        min-width: 140px;
    }

    .controls {
        gap: 12px;
    }

    .stats-grid {
        gap: 8px;
    }

    .stat-value {
        font-size: 1.375rem;
    }

    .content-section h2 {
        font-size: 1.125rem;
    }

    .faq-item {
        padding: 16px;
    }
}
