@font-face {
    font-family: 'Mesgentia';
    src: url('/assets/fonts/Mesgentia.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    ascent-override: 100%;
    descent-override: 20%;
    line-gap-override: 0%;
}

@font-face {
    font-family: 'Mineko';
    src: url('/assets/fonts/Mineko.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    ascent-override: 97.5%;
    descent-override: 22.5%;
    line-gap-override: 0%;
}

@font-face {
    font-family: 'Minecraft';
    src: url('/assets/fonts/MinecraftRegular-Bmg3.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Minecraft';
    src: url('/assets/fonts/MinecraftBold-nMK1.otf') format('opentype');
    font-weight: bold;
    font-style: normal;
}

@font-face {
    font-family: 'Minecraft';
    src: url('/assets/fonts/MinecraftItalic-R8Mo.otf') format('opentype');
    font-weight: normal;
    font-style: italic;
}

@font-face {
    font-family: 'Minecraft';
    src: url('/assets/fonts/MinecraftBoldItalic-1y1e.otf') format('opentype');
    font-weight: bold;
    font-style: italic;
}

@font-face {
    font-family: 'Imprima';
    src: url('/assets/fonts/Imprima-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Lora';
    src: url('/assets/fonts/Lora-Regular.ttf?v=2') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Lora';
    src: url('/assets/fonts/Lora-Bold.ttf?v=2') format('truetype');
    font-weight: bold;
    font-style: normal;
}

@font-face {
    font-family: 'Lora';
    src: url('/assets/fonts/Lora-Italic.ttf?v=2') format('truetype');
    font-weight: normal;
    font-style: italic;
}

@font-face {
    font-family: 'Lora';
    src: url('/assets/fonts/Lora-BoldItalic.ttf?v=2') format('truetype');
    font-weight: bold;
    font-style: italic;
}

:root {
    --primary: #B8878C;
    --primary-light: #c9a8a8;
    --primary-lighter: #e8d4d4;
    --primary-hover: #dcc3c6;
    --sync-fill: #f1f1ef;
    --background: #FDF8F4;
    --cream: #f8f0f0;
    --text: #555;
    --text-muted: #6B6B6B;
    --border: #deb8b8;
    --white: #fff;
    --completed: #B8878C;
    --grid-bg: linear-gradient(rgba(222, 184, 184, 0.1) 1px, transparent 1px),
                linear-gradient(90deg, rgba(222, 184, 184, 0.1) 1px, transparent 1px);
    --scale: 1;
    --s: 1;
    --widget-width: 320px;
    --widget-height: 300px;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --background: #121212;
        --sync-fill: #2a2a2a;
        --white: #1e1e1e;
        --cream: #252525;
        --text: #e3e3e2;
        --text-muted: #9b9a97;
        --primary-light: #37352f;
        --primary-lighter: #2f2f2f;
        --border: #2f2f2f;
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --background: #121212;
    --sync-fill: #2a2a2a;
    --white: #1e1e1e;
    --cream: #252525;
    --text: #e3e3e2;
    --text-muted: #9b9a97;
    --primary-light: #37352f;
    --primary-lighter: #2f2f2f;
    --border: #2f2f2f;
    color-scheme: dark;
}

:root[data-theme="light"] {
    --background: #FDF8F4;
    --sync-fill: #f1f1ef;
    --white: #fff;
    --cream: #f8f0f0;
    --text: #555;
    --text-muted: #6B6B6B;
    --border: #deb8b8;
    color-scheme: light;
}

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

button, input, select, textarea {
    font-family: inherit;
}

html {
    background: transparent !important;
}

body {
    font-family: var(--font-family);
    background: transparent !important;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.y2k-window {
    width: var(--widget-width, 320px);
    height: var(--widget-height, auto);
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    zoom: var(--scale);
}

.y2k-title-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 10px;
    border-bottom: 1px solid var(--border);
}

.y2k-title-bar-left {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--border);
    letter-spacing: -0.3px;
}

.y2k-title-bar-left svg {
    width: 14px;
    height: 14px;
    vertical-align: middle;
}

.y2k-title-bar-right {
    display: flex;
    align-items: center;
    gap: 4px;
}

.y2k-window-icon {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}

.y2k-date-btn {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 18px;
    box-sizing: border-box;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0 10px;
    border-radius: 999px;
    transition: background-color 0.15s;
}

.y2k-date-btn:hover {
    background: transparent;
}

.y2k-date-btn:hover .y2k-date,
.y2k-date-btn:hover svg {
    color: var(--primary);
    opacity: 1;
}

.y2k-date {
    font-size: 10px;
    color: var(--text-muted);
}

.y2k-date-btn svg {
    color: var(--text-muted);
    opacity: 0.5;
}

.y2k-settings-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-muted);
    opacity: 0.6;
    transition: opacity 0.15s, background-color 0.15s;
    padding: 0;
}

.y2k-settings-btn:hover {
    opacity: 1;
    background: var(--primary-hover);
    color: var(--primary);
}

.y2k-settings-btn svg {
    display: block;
    transition: transform 0.3s ease;
}

.y2k-settings-btn:hover svg {
    transform: rotate(45deg);
}

.y2k-input-area {
    display: flex;
    gap: 6px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}

.y2k-task-input {
    flex: 1;
    padding: 6px 12px;
    font-size: 12px;
    font-family: inherit;
    color: var(--text);
    background: var(--white);
    border: 1px solid var(--primary-lighter);
    border-radius: 16px;
    outline: none;
    transition: border-color 0.15s;
}

.y2k-task-input::placeholder {
    color: var(--text-muted);
    opacity: 0.5;
}

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

.y2k-add-btn {
    width: 28px;
    height: 28px;
    min-width: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: var(--on-accent, var(--white));
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.15s, background-color 0.15s;
}

.y2k-add-btn:hover {
    background: var(--primary-hover);
}

.y2k-add-btn:active {
    transform: scale(0.9);
}

.y2k-add-btn svg {
    width: 14px;
    height: 14px;
}

.y2k-grid-container {
    flex: 1;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.y2k-grid-header {
    display: flex;
    padding: 5px 12px;
    border-bottom: 1px solid var(--border);
    background: var(--cream);
    flex-shrink: 0;
}

.y2k-habit-name-header {
    width: 120px;
    min-width: 120px;
    display: flex;
    align-items: center;
    font-size: 9px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding-right: 8px;
}

.y2k-day-header {
    display: flex;
    align-items: center;
    flex: 1;
    gap: 2px;
    overflow-x: auto;
    padding: 2px 0;
}

.y2k-day-header::-webkit-scrollbar {
    height: 4px;
    display: block;
}

.y2k-day-header::-webkit-scrollbar-track {
    background: transparent;
}

.y2k-day-header::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 2px;
}

.y2k-day-header::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

.y2k-day-number {
    width: 14px;
    min-width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 500;
    color: var(--text-muted);
    opacity: 0.7;
}

.y2k-day-number.today {
    color: var(--primary);
    opacity: 1;
    font-weight: 600;
}

.y2k-grid-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    background-color: var(--white);
    background-image: var(--grid-bg);
    background-size: 8px 8px;
    min-height: 100px;
}

.y2k-grid-body::-webkit-scrollbar {
    width: 4px;
}

.y2k-grid-body::-webkit-scrollbar-track {
    background: transparent;
}

.y2k-grid-body::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 2px;
}

.y2k-grid-body::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

.y2k-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--text-muted);
    text-align: center;
}

.y2k-empty-state svg {
    margin-bottom: 8px;
}

.y2k-empty-icon {
    color: var(--primary);
    opacity: 0.7;
}

.y2k-empty-state p {
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 4px;
    color: var(--text);
}

.y2k-empty-state span {
    font-size: 10px;
    opacity: 0.7;
}

.y2k-habit-row {
    display: flex;
    align-items: center;
    padding: 6px 12px;
    border-bottom: 1px solid var(--border);
    transition: background-color 0.15s;
}

.y2k-habit-row:hover {
    background: var(--primary-hover);
}

.y2k-habit-row:last-child {
    border-bottom: none;
}

.y2k-habit-name {
    width: 120px;
    min-width: 120px;
    padding-right: 14px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
}

.y2k-habit-top {
    display: flex;
    align-items: center;
    gap: 4px;
}

.y2k-habit-progress {
    display: flex;
    align-items: center;
    gap: 4px;
}

.y2k-habit-bar {
    flex: 1;
    height: 3px;
    border-radius: 999px;
    background: var(--primary-lighter);
    overflow: hidden;
}

.y2k-habit-bar-fill {
    height: 100%;
    border-radius: 999px;
    background: var(--primary);
    transition: width 0.3s ease, opacity 0.3s ease;
}

.y2k-habit-pct {
    font-size: 8px;
    color: var(--text-muted);
    min-width: 20px;
    text-align: right;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.y2k-habit-text {
    flex: 1;
    font-size: 11px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 106px;
}

.y2k-habit-delete {
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s, background-color 0.15s;
    flex-shrink: 0;
}

.y2k-habit-row:hover .y2k-habit-delete {
    opacity: 0.4;
}

.y2k-habit-delete:hover {
    opacity: 1 !important;
    background: var(--primary-hover);
}

.y2k-habit-delete svg {
    width: 10px;
    height: 10px;
    color: var(--text-muted);
}

.y2k-day-checkboxes {
    display: flex;
    flex: 1;
    gap: 2px;
    overflow-x: auto;
    scrollbar-width: none;
}

.y2k-day-checkboxes::-webkit-scrollbar {
    display: none;
}

.y2k-checkbox {
    width: 14px;
    height: 14px;
    min-width: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--primary-light);
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s, transform 0.1s;
}

.y2k-checkbox:hover {
    border-color: var(--primary);
    background: var(--primary-hover);
}

.y2k-checkbox:active {
    transform: scale(0.85);
}

.y2k-checkbox.checked {
    background: var(--primary);
    border-color: var(--primary);
}

.y2k-checkbox svg {
    width: 8px;
    height: 8px;
    color: var(--white);
    opacity: 0;
    transition: opacity 0.15s;
}

.y2k-checkbox.square {
    border-radius: 2px;
}

.y2k-checkbox.heart,
.y2k-checkbox.star,
.y2k-checkbox.crescent,
.y2k-checkbox.diamond {
    background: transparent;
    border: none;
    width: 14px;
    height: 14px;
}

.y2k-checkbox.heart svg,
.y2k-checkbox.star svg,
.y2k-checkbox.crescent svg,
.y2k-checkbox.diamond svg {
    width: 13px;
    height: 13px;
    stroke: var(--primary-light);
    stroke-width: 1.5px;
    fill: transparent;
    opacity: 1;
}

.y2k-checkbox.heart:hover svg,
.y2k-checkbox.star:hover svg,
.y2k-checkbox.crescent:hover svg,
.y2k-checkbox.diamond:hover svg {
    stroke: var(--primary);
}

.y2k-checkbox.heart.checked svg,
.y2k-checkbox.star.checked svg,
.y2k-checkbox.crescent.checked svg,
.y2k-checkbox.diamond.checked svg {
    stroke: var(--primary);
    fill: var(--primary);
}

.y2k-checkbox.pixel-heart {
    background: transparent;
    border: none;
    width: 14px;
    height: 14px;
}

.y2k-checkbox.pixel-heart svg {
    width: 13px;
    height: 13px;
    stroke: none !important;
    stroke-width: 0 !important;
    fill: none;
    opacity: 1;
}

.y2k-checkbox.pixel-heart svg .outline-path {
    fill: var(--primary-light);
    display: block;
}

.y2k-checkbox.pixel-heart svg .filled-path {
    display: none;
}

.y2k-checkbox.pixel-heart:hover svg .outline-path {
    fill: var(--primary);
}

.y2k-checkbox.pixel-heart.checked svg .outline-path {
    display: none;
}

.y2k-checkbox.pixel-heart.checked svg .filled-path {
    display: block;
    fill: var(--primary);
}

.y2k-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 12px;
    border-top: 1px solid var(--border);
    background: var(--white);
}

.y2k-footer-left {
    font-size: 10px;
    color: var(--text-muted);
    padding-top: 1px;
}

.y2k-progress {
    font-weight: 500;
}

.y2k-footer-right {
    display: flex;
    gap: 8px;
}

.y2k-clear-btn {
    font-size: 10px;
    font-family: inherit;
    color: var(--text-muted);
    background: transparent;
    border: 1px dotted var(--border);
    padding: 4.5px 10px 3.5px;
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 0.15s, background-color 0.15s, color 0.15s;
}

.y2k-clear-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-hover);
}

.settings-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 220px;
    max-height: 80vh;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 16px;
    display: none;
    flex-direction: column;
    z-index: 1000;
    box-shadow: none;
    overflow: hidden;
    box-sizing: border-box;
}

.settings-content::-webkit-scrollbar {
    width: 4px;
}

.settings-content::-webkit-scrollbar-track {
    background: transparent;
}

.settings-content::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 2px;
}

.settings-panel.active {
    display: flex;
}

.settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    display: none;
    z-index: 999;
}

.settings-overlay.active {
    display: block;
}

.settings-content {
    padding: 12px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
}

.settings-select {
    width: 100%;
    padding: 6px 12px;
    font-size: 10px;
    font-family: inherit;
    border: none;
    border-radius: 999px;
    background: var(--primary-lighter);
    color: var(--text);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    outline: none;
    transition: all 0.15s ease;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 1 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
}

.settings-select:hover {
    background-color: var(--primary-hover);
}

.settings-select:focus {
    border-color: var(--primary);
}

.settings-select option {
    background: var(--white);
    color: var(--text);
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--primary-lighter);
}

.settings-header h3 {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.settings-close {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-muted);
    opacity: 0.5;
    transition: opacity 0.15s, background-color 0.15s;
    padding: 0;
}

.settings-close:hover {
    opacity: 1;
    background: var(--primary-hover);
}

.settings-section {
    margin-bottom: 12px;
}

.settings-label {
    font-size: 9px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 6px;
    display: block;
}

.slider-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.size-slider {
    flex: 1;
    min-width: 0; /* webkit won't shrink a range below 129px, guards a narrow embed */
    height: 3px; /* the fleet's thin slider: 3px tint track, 12px thumb (nari, 10/02) */
    -webkit-appearance: none;
    appearance: none;
    background: var(--primary-lighter);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.size-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
}

.size-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: none;
}

.slider-value {
    font-size: 10px;
    color: var(--text-muted);
    min-width: 45px;
    text-align: right;
}

.color-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

#accent-color {
    width: 18px;
    height: 18px;
    border: 1px solid var(--primary-lighter);
    border-radius: 50%;
    cursor: pointer;
    -webkit-appearance: none;
    padding: 0;
    background: transparent;
}

#accent-color::-webkit-color-swatch-wrapper {
    padding: 0;
}

#accent-color::-webkit-color-swatch {
    border: none;
    border-radius: 50%;
}

/* title bar swatch comes from kou-theme.css at 28px; koubit keeps every swatch even with its hex box */
.settings-panel #titlebar-color,
.settings-panel .titlebar-clear {
    width: 18px;
    height: 18px;
}

/* the clear x is just the x: no pad shape, full strength so it reads in light and dark */
.settings-panel .titlebar-clear {
    background: none;
    opacity: 1;
    margin-left: -6px;
}

/* a 10px x; its ink sits 8px from the hex box, the same gap as the swatch (nari, 10/02) */
.settings-panel .titlebar-clear svg {
    width: 10px;
    height: 10px;
}

.settings-panel .titlebar-clear:hover {
    color: var(--text);
}

.color-hex {
    width: 62px;
    height: 18px;
    font-size: 10px;
    font-family: inherit;
    color: var(--text);
    font-weight: 400;
    background: var(--primary-lighter);
    border: none;
    border-radius: 999px;
    padding: 3px 6px;
    text-align: center;
    outline: none;
    transition: background-color 0.15s ease;
}

.color-hex:focus {
    background: var(--primary-light);
}

.shape-toggle {
    display: flex;
    gap: 4px;
}

.shape-btn {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
}

.shape-btn:hover {
    background: var(--primary-hover);
}

/* the selected shape matches the settings icon picker: soft fill, no outline */
.shape-btn.active {
    background: var(--primary-lighter);
    border-color: transparent;
}

.shape-btn svg {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
}

.shape-btn.active svg {
    color: var(--primary);
}

.month-picker-overlay {
    position: absolute;
    top: 36px;
    left: 12px;
    width: 200px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    display: none;
    z-index: 100;
    box-sizing: border-box;
}

.month-picker-overlay.active {
    display: block;
}

.month-picker-popup {
    padding: 12px;
}

.month-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.month-picker-nav {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-muted);
    transition: background-color 0.15s;
}

.month-picker-nav:hover {
    background: var(--primary-hover);
}

.month-picker-year {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
}

.month-picker-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
}

.month-btn {
    padding: 6px 4px;
    font-size: 10px;
    font-family: inherit;
    color: var(--text);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
}

.month-btn:hover {
    background: var(--primary-hover);
}

.month-btn.current {
    font-weight: 600;
    color: var(--primary);
}

.month-btn.selected {
    background: var(--primary);
    color: var(--on-accent, var(--white));
}

.month-btn.selected:hover {
    background: var(--primary-hover);
}

.month-picker-today {
    width: 100%;
    margin-top: 10px;
    padding: 6px;
    font-size: 10px;
    font-family: inherit;
    color: var(--primary);
    background: transparent;
    border: 1px dotted var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.15s;
}

.month-picker-today:hover {
    background: var(--primary-hover);
}

@media (max-width: 400px) {
    body {
        padding: 8px;
    }

    .y2k-window {
        max-width: 100%;
        min-width: auto;
    }

    .y2k-grid-container {
        min-height: 180px;
        max-height: 250px;
    }

    .y2k-habit-text {
        max-width: 60px;
    }

    .settings-panel,
    .month-picker-overlay {
        max-width: calc(100% - 24px);
    }
}

.y2k-grid-body {
    overflow-y: auto;
    overflow-x: hidden;
}

.y2k-grid-body[data-scroll-x] {
    scroll-behavior: smooth;
}

.sync-section {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.sync-section label {
    display: block;
    font-size: 9px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 6px;
}

.sync-status-panel {
    background: var(--primary-lighter);
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 8px;
    border: 1px solid var(--primary-lighter);
}

.sync-status-panel .unlink-btn {
    width: 100%;
    margin-top: 8px;
    padding: 5px 10px;
    font-size: 9px;
}

.sync-status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    min-height: 24px;
}

.sync-status-row:not(:last-child) {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.sync-label {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 500;
    line-height: 1.3;
}

.sync-value {
    font-size: 10px;
    color: var(--text);
    font-weight: 500;
    line-height: 1.3;
    display: flex;
    align-items: center;
}

.sync-time-value {
    color: var(--text-muted);
    font-size: 10px;
}

.sync-code-row {
    flex-wrap: nowrap;
    gap: 6px;
}

.sync-code-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    background: var(--white);
    border-radius: 999px;
    border: 1px solid var(--primary-lighter);
    min-width: 0;
    gap: 6px;
    flex-shrink: 1;
    max-width: 100%;
    cursor: pointer;
    transition: all 0.15s ease;
}

.sync-code-pill:hover {
    background: var(--primary-hover);
}

.sync-code-pill:active {
    transform: scale(0.97);
}

.sync-code-value {
    font-family: 'Courier Prime', monospace;
    font-size: 10px;
    font-weight: 600;
    color: var(--primary);
    letter-spacing: 0.3px;
    margin-top: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}



.share-link-section {
    margin-top: 10px;
    padding-top: 10px;
    margin-bottom: 10px;
    border-top: 1px solid var(--primary-lighter);
}

.share-link-section label {
    display: block;
    font-size: 9px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 6px;
}

.share-link-container {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--primary-lighter);
    border-radius: 999px;
    padding: 6px 6px 6px 10px;
}

.share-link-input {
    flex: 1;
    min-width: 0;
    padding: 4px 0;
    border: none;
    background: transparent;
    font-size: 9px;
    font-family: inherit;
    color: var(--text);
    outline: none;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.share-copy-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    background: var(--primary);
    color: var(--on-accent, white);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.share-copy-btn:hover {
    opacity: 0.85;
    transform: scale(1.05);
}

.share-copy-btn:active {
    transform: scale(0.95);
}

.share-copy-btn svg {
    flex-shrink: 0;
}

.sync-error-panel {
    background: rgba(231, 76, 60, 0.1);
    border-radius: 999px;
    padding: 8px 12px;
    margin-bottom: 8px;
    border: 1px solid rgba(231, 76, 60, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
}

.sync-error-icon {
    font-size: 14px;
    color: #c0392b;
}

.sync-error-message {
    font-size: 10px;
    color: #c0392b;
    flex: 1;
}

.sync-controls {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.sync-btn {
    flex: 1;
    min-width: 60px;
    padding: 6px 10px;
    border: none;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s ease;
    background: var(--primary);
    color: var(--on-accent, white);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sync-btn:hover {
    opacity: 0.85;
    transform: scale(1.02);
}

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

.sync-btn.secondary {
    background: var(--sync-fill);
    color: var(--text);
}

.sync-btn.danger {
    background: rgba(231, 76, 60, 0.15);
    color: #c0392b;
}

.sync-btn.danger:hover {
    background: rgba(231, 76, 60, 0.25);
}

#sync-code-input {
    flex: 1;
    min-width: 60px;
    padding: 6px 10px;
    border: none;
    border-radius: 999px;
    font-size: 9px;
    font-family: inherit;
    background: var(--primary-lighter);
    transition: background-color 0.15s ease;
}

#sync-code-input:focus {
    outline: none;
    background: var(--primary-light);
}

.sync-hint {
    font-size: 9px;
    color: var(--text-muted);
    margin: 6px 0 0 0;
    text-align: center;
}

.sync-buttons-row {
    display: flex;
    flex-direction: row;
    gap: 6px;
    width: 100%;
}

.sync-buttons-row .sync-btn {
    flex: 1;
    min-width: 0;
    font-size: 9px;
}

.setting-toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.setting-toggle-row .settings-label {
    margin-bottom: 0;
}

.cute-toggle {
    position: relative;
    display: inline-block;
    width: 32px;
    height: 18px;
    flex-shrink: 0;
}

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--primary-lighter);
    transition: .2s ease;
    border-radius: 999px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 2px;
    bottom: 2px;
    background-color: var(--white);
    transition: .2s ease;
    border-radius: 50%;
}

.cute-toggle input:checked + .toggle-slider {
    background-color: var(--primary);
}

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

.y2k-window.hide-grid .y2k-grid-body {
    background-image: none !important;
}

.y2k-window.hide-border {
    border-color: transparent !important;
    background: transparent !important;
    box-shadow: none !important;
}

.y2k-window.hide-border .y2k-title-bar,
.y2k-window.hide-border .y2k-input-area,
.y2k-window.hide-border .y2k-grid-header,
.y2k-window.hide-border .y2k-grid-body,
.y2k-window.hide-border .y2k-footer {
    background-color: transparent !important;
    background: transparent !important;
    border-top-color: transparent !important;
    border-bottom-color: transparent !important;
}

.y2k-window.hide-border .y2k-habit-row {
    border-bottom-color: transparent !important;
}

.y2k-window.hide-border .y2k-grid-body::-webkit-scrollbar {
    border-left: none !important;
}
.y2k-window.hide-border .y2k-grid-body::-webkit-scrollbar-thumb {
    border: 2px solid transparent !important;
}
.y2k-window.hide-border .y2k-grid-body::-webkit-scrollbar-button {
    border-bottom: none !important;
    border-top: none !important;
}

/* the confirm popup: no dim (the overlay stays only so a tap outside closes it), as wide as its words
   and never wider than the panel's rows, flat. same as kouid (nari, 10/07) */
.confirm-popup-overlay {
    position: fixed;
    inset: 0;
    background: transparent;
    display: none;
    z-index: 1050;
}

.confirm-popup-overlay.active {
    display: block;
}

.confirm-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: max-content;
    padding: 14px 16px;
    display: none;
    flex-direction: column;
    gap: 14px;
    z-index: 1060;
    box-sizing: border-box;
    max-width: 196px;
}

.confirm-popup.active {
    display: flex;
}

.confirm-popup-message {
    font-size: 11px;
    line-height: 1.5;
    color: var(--text);
    text-align: center;
}

.confirm-popup-actions {
    display: flex;
    justify-content: center;
    gap: 6px;
}

.confirm-popup-btn {
    font-size: 10px;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 50px;
    cursor: pointer;
    background: var(--white);
    color: var(--text);
    font-family: inherit;
    transition: background-color 0.15s, border-color 0.15s;
}

.confirm-popup-btn:hover {
    background-color: rgba(0, 0, 0, 0.04);
}

.confirm-popup-btn.danger {
    color: #e53e3e;
    border-color: #feb2b2;
}

.confirm-popup-btn.danger:hover {
    background: #fff5f5;
}

[data-shape="square"] .confirm-popup,
[data-shape="square"] .confirm-popup-btn {
    border-radius: 0;
}

[data-shape="square"] .y2k-habit-bar,
[data-shape="square"] .y2k-habit-bar-fill,
[data-shape="square"] .y2k-habit-delete,
[data-shape="square"] .month-picker-overlay,
[data-shape="square"] .month-picker-nav,
[data-shape="square"] .month-picker-today {
    border-radius: 0;
}

[data-shape="square"] #sync-code-input {
    border-radius: 0;
}

.window-style-toggle .window-style-btn.active {
    color: var(--on-accent, var(--white));
}

.week-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 18px;
    box-sizing: border-box;
    padding: 0 4px;
}

.week-nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-muted);
    transition: background-color 0.15s, color 0.15s;
}

.week-nav-btn:hover {
    background-color: transparent;
    color: var(--primary);
}

.current-week-label {
    font-size: 10px;
    font-weight: 400;
    color: var(--text);
    padding: 0 4px;
    background: transparent;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
}

.current-week-label:hover {
    color: var(--primary);
}

[data-shape="square"] .week-nav-btn {
    border-radius: 0;
}

[data-titlebar="custom"] .y2k-title-bar .current-week-label,
[data-titlebar="custom"] .y2k-title-bar .week-nav-btn {
    color: var(--kou-titlebar-text);
}

/* on a colored title bar the date still answers the hover, by softening its own bar text.
   the accent can't be used there: a bar the same color as the accent would swallow it
   (nari, 10/02: the hover shouldn't depend on anyone's title bar color) */
[data-titlebar="custom"] .y2k-title-bar .y2k-date-btn:hover .y2k-date,
[data-titlebar="custom"] .y2k-title-bar .y2k-date-btn:hover svg,
[data-titlebar="custom"] .y2k-title-bar .current-week-label:hover,
[data-titlebar="custom"] .y2k-title-bar .week-nav-btn:hover svg {
    color: var(--kou-titlebar-text);
    opacity: 0.5;
}

[data-shape="square"] .y2k-grid-body::-webkit-scrollbar-thumb,
[data-shape="square"] .y2k-day-header::-webkit-scrollbar-thumb,
[data-shape="square"] .settings-content::-webkit-scrollbar-thumb {
    border-radius: 0;
}

html:not([data-view="week"]) .week-nav,
html:not([data-view="week"]) .week-only,
html[data-view="week"] #month-btn {
    display: none;
}

html[data-view="week"] .y2k-day-header,
html[data-view="week"] .y2k-day-checkboxes {
    gap: 0;
    overflow-x: hidden;
}

html[data-view="week"] .y2k-day-number {
    flex: 1;
    width: auto;
    min-width: 0;
    height: auto;
    flex-direction: column;
    gap: 1px;
    line-height: 1;
}

html[data-view="week"] .y2k-dow {
    font-size: 8px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    opacity: 0.8;
}

html[data-view="week"] .y2k-dom {
    font-size: 9px;
}

.y2k-week-cell {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.week-embed-block {
    margin-bottom: 10px;
}

.week-embed-hint {
    text-align: center;
}

/* the title stays put while the settings scroll, like kourie's. it sits outside
   the scroller now, in the same spot as before, and the scroller keeps its 4px
   gutter so the line under the title ends where the rows do. nari 2026-10-02. */
.settings-panel.active {
    display: flex;
    flex-direction: column;
}

.settings-panel > .settings-header {
    flex-shrink: 0;
    margin: 12px 16px 0 12px;
}

.settings-panel > .settings-content {
    min-height: 0;
    scrollbar-gutter: stable;
}

/* the pill words (Curve / Square, Outline / Filled): the line is trimmed to the letters, then
   lifted so the middle point between the capital tops and the lowercase tops sits at the middle
   of the pill. it reads each font's own cap and x-heights, so it fits every widget font; same 25px
   pill. browsers without text-box or the cap unit keep a centered line. nari, 10/02 */
.settings-panel .window-style-btn {
    text-box: trim-both cap alphabetic;
    height: 25px;
    padding-top: 0;
    padding-bottom: 0;
    padding-bottom: calc((1cap - 1ex) / 2);
}

/* Imprima sits a hair high with the rule above, so it comes down a quarter pixel (nari's pick) */
@container style(--font-family: 'Imprima', sans-serif) {
    .settings-panel .window-style-btn {
        padding-bottom: calc((1cap - 1ex) / 2 - 0.5px);
    }
}
