:root{
    color-scheme:light;

    --bg:#f4f7fb;
    --page-glow:radial-gradient(circle at top left, rgba(37,99,235,.18), transparent 34rem);
    --card:#ffffff;
    --card-soft:#f8fafc;
    --accent:#2563eb;
    --accent-dark:#1d4ed8;
    --border:#e5e7eb;
    --text:#111827;
    --muted:#64748b;

    --holiday:#ef4444;
    --holidayBg:#fee2e2;
    --holidayBorder:#fecaca;

    --optional:#f59e0b;
    --optionalBg:#fef3c7;
    --optionalBorder:#f59e0b;

    --shadow:0 14px 35px rgba(15,23,42,.08);
    --shadow-soft:0 6px 20px rgba(15,23,42,.07);
}

[data-theme="dark"]{
    color-scheme:dark;

    --bg:#0f172a;
    --page-glow:radial-gradient(circle at top left, rgba(59,130,246,.22), transparent 34rem);
    --card:#1e293b;
    --card-soft:#0f172a;
    --accent:#60a5fa;
    --accent-dark:#3b82f6;
    --border:#334155;
    --text:#f8fafc;
    --muted:#cbd5e1;

    --holiday:#fca5a5;
    --holidayBg:#7f1d1d;
    --holidayBorder:#ef4444;

    --optional:#fbbf24;
    --optionalBg:#78350f;
    --optionalBorder:#fbbf24;

    --shadow:0 14px 35px rgba(0,0,0,.35);
    --shadow-soft:0 6px 20px rgba(0,0,0,.25);
}

*{
    box-sizing:border-box;
}

html{
    min-height:100%;
}

body{
    min-height:100%;
    margin:0;
    font-family:"Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
    background:var(--page-glow), var(--bg);
    color:var(--text);
    padding:30px;
    transition:background .25s ease, color .25s ease;
}

button,
input{
    font:inherit;
}

.page{
    width:min(1500px, 100%);
    margin:0 auto;
}

.header{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:20px;
    margin-bottom:22px;
}

.title-block{
    min-width:0;
}

.eyebrow{
    display:inline-flex;
    align-items:center;
    gap:8px;
    margin-bottom:8px;
    padding:6px 10px;
    border:1px solid var(--border);
    border-radius:999px;
    background:rgba(255,255,255,.5);
    color:var(--muted);
    font-size:13px;
    font-weight:700;
    letter-spacing:.02em;
    text-transform:uppercase;
}

[data-theme="dark"] .eyebrow{
    background:rgba(30,41,59,.6);
}

h1{
    margin:0;
    font-size:clamp(26px, 3vw, 40px);
    line-height:1.05;
    letter-spacing:-.04em;
}

.header-right{
    display:flex;
    align-items:center;
    gap:15px;
    flex-shrink:0;
}

.theme-switch{
    display:flex;
    align-items:center;
    justify-content:center;
    gap:10px;
    background:var(--card);
    border:1px solid var(--border);
    border-radius:999px;
    padding:8px 14px;
    box-shadow:var(--shadow-soft);
    white-space:nowrap;
}

.theme-icon{
    font-size:18px;
    line-height:1;
}

.switch{
    position:relative;
    display:inline-block;
    width:58px;
    height:30px;
    flex-shrink:0;
}

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

.slider{
    position:absolute;
    inset:0;
    cursor:pointer;
    background:#cbd5e1;
    border-radius:30px;
    transition:all .25s ease;
}

.slider:before{
    content:"";
    position:absolute;
    width:24px;
    height:24px;
    left:3px;
    top:3px;
    background:white;
    border-radius:50%;
    box-shadow:0 2px 8px rgba(15,23,42,.25);
    transition:all .25s ease;
}

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

input:focus-visible + .slider{
    outline:3px solid rgba(37,99,235,.35);
    outline-offset:3px;
}

input:checked + .slider:before{
    transform:translateX(28px);
}

.selector{
    display:flex;
    gap:10px;
}

.selector button{
    border:0;
    background:linear-gradient(135deg, var(--accent), var(--accent-dark));
    color:white;
    border-radius:13px;
    padding:11px 16px;
    cursor:pointer;
    font-size:14px;
    font-weight:800;
    box-shadow:0 7px 18px rgba(37,99,235,.25);
    transition:transform .2s ease, box-shadow .2s ease;
}

.selector button:hover{
    transform:translateY(-2px);
    box-shadow:0 10px 25px rgba(37,99,235,.28);
}

.selector button:active{
    transform:translateY(0);
}

.summary{
    display:grid;
    grid-template-columns:repeat(2, minmax(0, 1fr));
    gap:16px;
    margin-bottom:20px;
}

.summary-card{
    display:flex;
    align-items:center;
    gap:14px;
    padding:16px;
    border:1px solid var(--border);
    border-radius:20px;
    background:var(--card);
    box-shadow:var(--shadow-soft);
}

.summary-number{
    display:grid;
    place-items:center;
    width:46px;
    height:46px;
    border-radius:16px;
    background:rgba(37,99,235,.1);
    color:var(--accent);
    font-weight:900;
    font-size:22px;
    flex-shrink:0;
}

.optional-note .summary-number{
    background:var(--optionalBg);
    color:var(--optional);
    border:2px dashed var(--optionalBorder);
}

.summary-card strong,
.summary-card span{
    display:block;
}

.summary-card span{
    margin-top:2px;
    color:var(--muted);
    font-size:14px;
}

.grid{
    display:grid;
    grid-template-columns:repeat(auto-fit, minmax(330px, 1fr));
    gap:20px;
}

.month{
    background:var(--card);
    border:1px solid var(--border);
    border-radius:22px;
    padding:16px;
    box-shadow:var(--shadow);
}

.month-title{
    margin:0 0 14px;
    text-align:center;
    font-size:20px;
    font-weight:900;
    letter-spacing:-.02em;
}

.days-header,
.days{
    display:grid;
    grid-template-columns:repeat(7, 1fr);
}

.days-header{
    margin-bottom:7px;
}

.days-header div{
    text-align:center;
    color:var(--muted);
    font-size:13px;
    font-weight:900;
}

.days{
    gap:5px;
}

.day{
    position:relative;
    display:flex;
    align-items:center;
    justify-content:center;
    min-height:40px;
    border-radius:12px;
    background:var(--card-soft);
    color:var(--text);
    font-size:14px;
    font-weight:700;
    cursor:default;
    user-select:none;
}

.blank{
    visibility:hidden;
}

.holiday{
    background:var(--holidayBg);
    color:var(--holiday);
    border:1px solid var(--holidayBorder);
    font-weight:900;
}

.optional-holiday{
    background:var(--optionalBg);
    color:var(--optional);
    border:2px dashed var(--optionalBorder);
    font-weight:900;
}

.today{
    position:relative;
}

.today::after{
    content:'';
    position:absolute;
    width:10px;
    height:10px;
    border-radius:50%;
    background:#547bd7;
    top:3px;
    right:3px;
}

.tooltip{
    position:absolute;
    bottom:calc(100% + 8px);
    left:50%;
    transform:translateX(-50%) translateY(4px);
    max-width:230px;
    padding:7px 10px;
    border-radius:10px;
    background:#111827;
    color:#fff;
    font-size:12px;
    font-weight:800;
    white-space:nowrap;
    opacity:0;
    visibility:hidden;
    pointer-events:none;
    transition:all .18s ease;
    z-index:20;
    box-shadow:0 8px 20px rgba(0,0,0,.25);
}

.day:hover .tooltip,
.day:focus-within .tooltip{
    opacity:1;
    visibility:visible;
    transform:translateX(-50%) translateY(0);
}

.legend{
    margin-top:24px;
    background:var(--card);
    border:1px solid var(--border);
    border-radius:22px;
    padding:20px;
    box-shadow:var(--shadow);
}

.legend-head{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:16px;
    margin-bottom:16px;
}

.legend h2{
    margin:0;
    font-size:22px;
    letter-spacing:-.02em;
}

.badges{
    display:flex;
    flex-wrap:wrap;
    justify-content:flex-end;
    gap:8px;
}

.badge{
    display:inline-flex;
    align-items:center;
    gap:8px;
    padding:8px 10px;
    border-radius:999px;
    font-size:13px;
    font-weight:900;
}

.badge:before{
    content:"";
    width:14px;
    height:14px;
    border-radius:4px;
    display:inline-block;
}

.badge-holiday{
    background:var(--holidayBg);
    color:var(--holiday);
}

.badge-holiday:before{
    background:var(--holidayBg);
    border:1px solid var(--holidayBorder);
}

.badge-optional{
    background:var(--optionalBg);
    color:var(--optional);
}

.badge-optional:before{
    background:var(--optionalBg);
    border:2px dashed var(--optionalBorder);
}

.holiday-list{
    list-style:none;
    margin:0;
    padding:0;
    columns:2;
    column-gap:30px;
}

.holiday-list li{
    break-inside:avoid;
    display:flex;
    justify-content:space-between;
    gap:12px;
    margin:0 0 9px;
    padding:10px 12px;
    border-radius:14px;
    background:var(--card-soft);
    border:1px solid var(--border);
}

.holiday-list strong{
    white-space:nowrap;
}

.holiday-list span{
    text-align:right;
    color:var(--muted);
    font-weight:700;
}

.holiday-list .optional-item{
    border-color:var(--optionalBorder);
    background:var(--optionalBg);
}

.holiday-list .optional-item span,
.holiday-list .optional-item strong{
    color:var(--optional);
}

@media(max-width:900px){
    .header{
        flex-direction:column;
        align-items:stretch;
    }

    .title-block{
        text-align:center;
    }

    .header-right{
        width:100%;
        justify-content:center;
    }
}

@media(max-width:768px){
    body{
        padding:12px;
    }

    .header{
        gap:14px;
        margin-bottom:16px;
    }

    .title-block{
        text-align:center;
    }

    .eyebrow{
        font-size:11px;
        margin-bottom:7px;
    }

    h1{
        font-size:25px;
        line-height:1.15;
    }

    .header-right{
        width:100%;
        flex-direction:column;
        gap:12px;
    }

    .theme-switch{
        width:100%;
        min-height:52px;
        padding:10px 12px;
    }

    .switch{
        width:64px;
        height:34px;
    }

    .slider:before{
        width:28px;
        height:28px;
    }

    input:checked + .slider:before{
        transform:translateX(30px);
    }

    .theme-icon{
        font-size:20px;
    }

    .selector{
        width:100%;
    }

    .selector button{
        flex:1;
        min-height:48px;
        padding:11px 10px;
        font-size:16px;
    }

    .summary{
        grid-template-columns:1fr;
        gap:12px;
    }

    .grid{
        grid-template-columns:1fr;
        gap:14px;
    }

    .month{
        padding:13px;
        border-radius:18px;
    }

    .day{
        min-height:42px;
        border-radius:11px;
        font-size:15px;
    }

    .legend{
        padding:16px;
        border-radius:18px;
    }

    .legend-head{
        flex-direction:column;
        align-items:stretch;
    }

    .badges{
        justify-content:flex-start;
    }

    .holiday-list{
        columns:1;
    }

    .holiday-list li{
        flex-direction:column;
        gap:3px;
    }

    .holiday-list span{
        text-align:left;
    }
}

@media(max-width:390px){
    h1{
        font-size:22px;
    }

    .day{
        min-height:38px;
        font-size:14px;
    }

    .days{
        gap:4px;
    }
}

.weekend{
    background:rgba(107,114,128,.18);
    color:#374151;
}

[data-theme="dark"] .weekend{
    background:rgba(255,255,255,.08);
    color:#d1d5db;
}

.holiday,
.optional-holiday{
    z-index:2;
}
