:root {
    --font-sans: 'Inter', -apple-system, sans-serif;
    --bg: #0E1117;
    --surface: #161B26;
    --surface-2: #1E2433;
    --border: rgba(129, 140, 248, .08);
    --border-hover: rgba(129, 140, 248, .2);
    --primary: #818CF8;
    --primary-glow: rgba(129, 140, 248, .1);
    --break: #F472B6;
    --done: #4ADE80;
    --text: #E2E8F0;
    --text-muted: #94A3B8;
    --text-dim: #64748B;
    --red: #F87171;
    --radius: 12px;
    --radius-sm: 8px
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased
}

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6
}

.header {
    padding: .7rem 2rem;
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
    background: rgba(14, 17, 23, .85);
    position: sticky;
    top: 0;
    z-index: 50
}

.header-inner {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between
}

.logo {
    display: flex;
    align-items: center;
    gap: .6rem
}

.logo-icon {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(129, 140, 248, .08);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-size: 1rem
}

.logo-text {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary)
}

.header-actions {
    display: flex;
    align-items: center;
    gap: .5rem
}

.streak {
    font-size: .75rem;
    color: var(--text-muted)
}

.main {
    max-width: 1000px;
    margin: 0 auto;
    padding: 1rem 2rem 3rem
}

.layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 1rem;
    align-items: start
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: .75rem
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .85rem
}

.panel-title {
    font-size: .65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    margin-bottom: .5rem
}

.subject-list {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    margin-bottom: .5rem;
    max-height: 200px;
    overflow-y: auto
}

.sub-pill {
    display: flex;
    align-items: center;
    gap: .35rem;
    font-size: .73rem;
    padding: .3rem .45rem;
    border-radius: 6px;
    background: var(--surface-2);
    cursor: pointer;
    border: 1px solid transparent;
    transition: all .15s
}

.sub-pill:hover,
.sub-pill.active {
    border-color: var(--primary)
}

.sub-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0
}

.sub-target {
    font-size: .6rem;
    color: var(--text-dim);
    margin-left: auto
}

.add-subject {
    display: flex;
    flex-direction: column;
    gap: .3rem
}

.input {
    width: 100%;
    padding: .3rem .45rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-family: var(--font-sans);
    font-size: .75rem;
    outline: none
}

.input:focus {
    border-color: var(--primary)
}

.input--sm {
    width: 70px
}

.color-input {
    width: 100%;
    height: 28px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: none;
    cursor: pointer
}

.timer-presets {
    display: flex;
    gap: .3rem
}

.preset {
    flex: 1;
    padding: .3rem;
    font-size: .7rem;
    font-weight: 600;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    text-align: center;
    transition: all .15s
}

.preset:hover,
.preset.active {
    border-color: var(--primary);
    color: var(--primary)
}

.content {
    min-width: 0
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: .75rem
}

.timer-card {
    text-align: center
}

.subject-select {
    display: block;
    width: 100%;
    max-width: 200px;
    margin: 0 auto .75rem;
    padding: .3rem .5rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: .78rem;
    outline: none
}

.timer-ring {
    position: relative;
    display: inline-block;
    margin-bottom: .5rem
}

.timer-ring svg {
    display: block
}

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

.timer-time {
    display: block;
    font-size: 2rem;
    font-weight: 900;
    font-variant-numeric: tabular-nums
}

.timer-label {
    font-size: .65rem;
    color: var(--text-dim);
    text-transform: uppercase
}

.timer-controls {
    display: flex;
    gap: .4rem;
    justify-content: center;
    margin-bottom: .5rem
}

.note-input {
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
    display: block;
    resize: vertical;
    padding: .4rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-family: var(--font-sans);
    font-size: .72rem;
    outline: none
}

.stats-row {
    display: flex;
    gap: .5rem;
    margin-bottom: .75rem
}

.stat {
    flex: 1;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .35rem;
    text-align: center
}

.stat-val {
    display: block;
    font-size: 1rem;
    font-weight: 800;
    color: var(--primary)
}

.stat-label {
    font-size: .55rem;
    color: var(--text-dim);
    text-transform: uppercase
}

.history {
    max-height: 250px;
    overflow-y: auto
}

.hist-item {
    display: flex;
    gap: .5rem;
    align-items: center;
    padding: .3rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, .03);
    font-size: .72rem
}

.hist-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0
}

.hist-time {
    color: var(--text-dim);
    margin-left: auto;
    white-space: nowrap
}

.hist-note {
    font-size: .65rem;
    color: var(--text-dim);
    font-style: italic;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: .2rem;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: .78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s ease
}

.btn--primary {
    background: var(--primary);
    color: #fff;
    padding: .4rem .7rem
}

.btn--primary:hover {
    opacity: .9
}

.btn--ghost {
    background: transparent;
    color: var(--text-muted);
    padding: .3rem .5rem
}

.btn--ghost:hover {
    background: rgba(129, 140, 248, .06);
    color: var(--text)
}

.btn--sm {
    font-size: .7rem;
    padding: .25rem .4rem
}

.hidden {
    display: none !important
}

.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(120%);
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: .5rem .85rem;
    border-radius: var(--radius-sm);
    font-size: .78rem;
    font-weight: 500;
    box-shadow: 0 4px 24px rgba(0, 0, 0, .4);
    opacity: 0;
    pointer-events: none;
    transition: all .4s cubic-bezier(.16, 1, .3, 1);
    z-index: 100
}

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

@media(max-width:700px) {
    .layout {
        grid-template-columns: 1fr
    }

    .header {
        padding: .7rem 1rem
    }

    .main {
        padding: 1rem
    }

    .stats-row {
        flex-wrap: wrap
    }
}