@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: 'America';
    src: url('/assets/fonts/America-Regular.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Cairopixel';
    src: url('/assets/fonts/Cairopixel-Regular.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Error 404';
    src: url('/assets/fonts/Error404-Regular.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Thaloria';
    src: url('/assets/fonts/Thaloria-Regular.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Gemini';
    src: url('/assets/fonts/Gemini-Regular.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Glina Script';
    src: url('/assets/fonts/GlinaScript-Regular.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Glina Script Thin';
    src: url('/assets/fonts/GlinaScript-Thin.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Evas Signatures';
    src: url('/assets/fonts/EvasSignatures-Regular.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Artsy Night';
    src: url('/assets/fonts/ArtsyNight-Regular.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Promesh';
    src: url('/assets/fonts/Promesh-Regular.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Promesh Mesh';
    src: url('/assets/fonts/PromeshMesh-Regular.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Promesh Stitch';
    src: url('/assets/fonts/PromeshStitch-Regular.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Promesh Two';
    src: url('/assets/fonts/PromeshTwo-Regular.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Promesh Two Fast';
    src: url('/assets/fonts/PromeshTwoFast-Regular.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Vyaz Pixel';
    src: url('/assets/fonts/VyazPixel-Regular.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Dispater';
    src: url('/assets/fonts/Dispater-Regular.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Hebdomadal';
    src: url('/assets/fonts/Hebdomadal-Regular.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Patung';
    src: url('/assets/fonts/Patung-Regular.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Vegan Days';
    src: url('/assets/fonts/VeganDays-Regular.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Alucky';
    src: url('/assets/fonts/Alucky-Regular.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Singlong';
    src: url('/assets/fonts/Singlong-Regular.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Kosolapa Script';
    src: url('/assets/fonts/Kosolapa-Regular.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'MoMo Signature';
    src: url('/assets/fonts/MomoSignature-Regular.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Pavot';
    src: url('/assets/fonts/Pavot-Regular.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Pixelcastle';
    src: url('/assets/fonts/Pixelcastle-Regular.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'TheMonse';
    src: url('/assets/fonts/TheMonse-Regular.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'MT ZYRO';
    src: url('/assets/fonts/ZyroSerif-Regular.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@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;
    --scale: 1;

    --grid-bg: rgba(200, 180, 180, 0.15);
    --accent: #B8878C;
    --widget-width: 480px;
    --widget-height: 420px;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color-scheme: light;
}

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

html {
    background: transparent !important;
}

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

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

.title-bar {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding: 0 12px;
    border-bottom: 1px solid var(--accent);
    background: var(--white);
    container-type: inline-size;
}

.title-left {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
}

.logo-img {
    height: 28px;
    width: auto;
    display: block;
}

.title {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 0.5px;
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: none;
    background: transparent;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.15s ease;
}

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

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

.nav-btn svg polyline,
.nav-btn svg line {
    stroke: #555;
    stroke-width: 2;
    fill: none;
}

.nav-btn:hover svg polyline,
.nav-btn:hover svg line {
    stroke: var(--accent);
}

.nav-btn.settings-btn {
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.nav-btn.settings-btn:hover {
    background: var(--primary-hover);
    color: var(--accent);
}

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

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

.month-display {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    min-width: 100px;
    text-align: center;
}

@container (max-width: 190px) {
    .title-left,
    .nav-controls {
        min-width: 0;
    }

    .title-left {
        gap: clamp(3px, 4.5cqi, 8px);
        padding: clamp(2px, 3cqi, 6px) 0;
    }

    .nav-controls {
        gap: clamp(2px, 3.5cqi, 6px);
    }

    .nav-btn {
        width: clamp(14px, 14cqi, 26px);
        height: clamp(14px, 14cqi, 26px);
    }

    .nav-btn svg {
        width: clamp(8px, 7.5cqi, 14px);
        height: clamp(8px, 7.5cqi, 14px);
    }

    .nav-btn.settings-btn svg {
        width: clamp(9px, 8.5cqi, 16px);
        height: clamp(9px, 8.5cqi, 16px);
    }

    .month-display {
        min-width: 0;
        font-size: clamp(8px, 7cqi, 13px);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

.calendar-container {
    padding: 10px;
    flex: 1;
    overflow-y: auto;
}

.calendar-container::-webkit-scrollbar {
    width: 3px;
}

.calendar-container::-webkit-scrollbar-track {
    background: transparent;
}

.calendar-container::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 3px;
}

.day-headers {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 3px;
    margin-bottom: 4px;
}

.day-headers span {
    font-size: calc(var(--note-size, 9px) * 1.11);
    font-weight: 700;
    color: var(--cal-ink, var(--text-muted));
    text-align: center;
    padding: 4px 0;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 3px;
    background-image:
        linear-gradient(var(--grid-bg) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-bg) 1px, transparent 1px);
    background-size: 12px 12px;
}

.day-cell {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 3px 5px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    cursor: text;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.calendar-grid.day-size-small .day-cell {
    min-height: 40px;
}
.calendar-grid.day-size-medium .day-cell {
    min-height: 60px;
}
.calendar-grid.day-size-large .day-cell {
    min-height: 80px;
}

.day-header {
    display: flex;
    align-items: center;
    gap: 3px;
    margin-bottom: 6px;
    flex-shrink: 0;
}

.event-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    width: calc(var(--note-size, 9px) * 1.11);
    height: calc(var(--note-size, 9px) * 1.11);
    flex-shrink: 0;
}

.event-indicator svg {
    width: 100%;
    height: 100%;
    color: var(--accent);
}

.day-cell:hover {
    background: var(--cream);
}

.day-cell.empty {
    background: transparent;
    border-color: transparent;
    cursor: default;
}

.day-cell.empty:hover {
    background: transparent;
}

.day-cell.today {
    border-color: var(--accent);
    border-width: 2px;
}

.day-cell.today .day-number {
    color: var(--accent);
    font-weight: 600;
}

.day-number {
    font-size: calc(var(--note-size, 9px) * 1.11);
    font-weight: 500;
    color: var(--cal-ink, var(--text-muted));
    flex-shrink: 0;
}

.day-notes {
    font-size: var(--note-size, 9px);
    color: var(--cal-ink, var(--accent));
    line-height: 1.3;
    flex: 1;
    overflow-y: auto;
    resize: none;
    text-align: center;
    background: transparent;
    border: none;
    outline: none;
    font-family: inherit;
}

.day-notes::placeholder {
    color: transparent;
}

.day-notes:focus {
    background: var(--cream);
    border-radius: 4px;
    padding: 2px;
}

.day-notes::-webkit-scrollbar {
    width: 3px;
}

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

.day-notes::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 3px;
}

@media (max-width: 640px) {
    .y2k-window {
        max-width: 100%;
    }

    .day-cell {
        min-height: 38px;
        padding: 2px 4px;
    }

    .day-number {
        font-size: 10px;
    }

    .day-notes {
        font-size: 9px;
    }
}

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

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

.settings-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--white);
    border-radius: 16px;
    border: 1px solid var(--accent);
    box-shadow: none;
    width: 220px;
    max-width: calc(100% - 24px);
    max-height: 80vh;
    overflow: hidden;
    box-sizing: border-box;
}

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

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

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

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

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

.settings-content {
    padding: 12px;
    max-height: calc(80vh - 4px);
    overflow-y: auto;
    overflow-x: hidden;
}

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

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

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

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

.setting-row:last-child {
    margin-bottom: 0;
}

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

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

.settings-section:last-child {
    margin-bottom: 0;
}

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

.symbol-picker {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.symbol-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.15s ease;
}

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

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

.symbol-btn:hover svg {
    color: var(--text);
}

.symbol-btn.active {
    background: var(--primary-lighter);
}

.symbol-btn.active svg {
    color: var(--accent);
}

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

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

.color-picker::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-picker::-webkit-color-swatch {
    border-radius: 50%;
    border: none;
}

.color-reset-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    padding: 0;
    border: none;
    border-radius: 999px;
    background: var(--primary-lighter);
    color: var(--text-muted);
    cursor: pointer;
    flex-shrink: 0;
}

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

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

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

/* the clear x is just the x: no pad shape, full strength so it reads in light and dark.
   koucal's own reset and remove xs match it, nari wants them consistent (10/02) */
.settings-panel .titlebar-clear,
.settings-panel .color-reset-btn {
    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,
.settings-panel .color-reset-btn svg {
    width: 10px;
    height: 10px;
}

.settings-panel .titlebar-clear:hover,
.settings-panel .color-reset-btn: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);
}

.color-preview {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

#gridColorPreview {
    background: var(--grid-bg);
}

#borderColorPreview {
    background: var(--accent);
}

.settings-btn.save:hover {
    filter: brightness(1.05);
}

.sync-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--primary-lighter);
}

.sync-status {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    background: transparent;
    border-radius: 999px;
    margin-bottom: 8px;
    text-align: center;
    border: 1px solid var(--primary-lighter);
}

.sync-status-text {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
}

.sync-status-text.synced {
    color: var(--primary);
}

.sync-status-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
}

.sync-status-indicator.synced {
    color: var(--primary);
}

.sync-status-indicator.syncing {
    color: var(--text-muted);
}

.sync-status-indicator.error {
    color: #c44;
}

.sync-status-indicator.not-synced {
    color: var(--text-muted);
}

.sync-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid var(--primary);
    border-top-color: transparent;
    border-radius: 50%;
    animation: sync-spin 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes sync-spin {
    to { transform: rotate(360deg); }
}

.sync-status-icon {
    font-size: 12px;
    line-height: 1;
}

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

.sync-btn {
    flex: 1;
    min-width: 80px;
    padding: 6px 10px;
    border: none;
    border-radius: 999px;
    font-size: 10px;
    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:not(.secondary):not(.danger) {
    background: var(--primary);
    color: var(--on-accent, white);
}

.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: 80px;
    padding: 6px 10px;
    border: none;
    border-radius: 999px;
    font-size: 10px;
    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: 10px;
    color: var(--text-muted);
    margin: 6px 0;
    text-align: center;
}

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

.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: wrap;
    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-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: 12px;
    padding: 12px;
    margin-bottom: 12px;
    border: 1px solid rgba(231, 76, 60, 0.3);
    display: flex;
    align-items: center;
    gap: 10px;
}

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

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

.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(8px);

    color: var(--primary);
    font-size: 11px;
    font-weight: 600;

    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    z-index: 1000;
    pointer-events: none;
}

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

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

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

.size-slider {
    flex: 1;
    min-width: 0; /* webkit won't shrink a range below 129px, so in a narrow embed the value would get pushed past the panel edge */
    height: 3px; /* koucard'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;
}

.day-size-select {
    width: 100%;
    padding: 6px 30px 6px 10px;
    border: none;
    border-radius: 999px;
    font-size: 10px;
    font-family: inherit;
    background: var(--primary-lighter);
    color: var(--text);
    cursor: pointer;
    outline: none;
    transition: background-color 0.15s ease;
    -webkit-appearance: none;
    appearance: none;
    -moz-appearance: none;
    /* kouread's grey chevron, the fleet's settings dropdown arrow (nari, 10/02) */
    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;
}

.day-size-select:focus {
    background-color: var(--primary-light);
}

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

.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;
    padding: 6px 10px;
}

.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);
}

.calendar-grid.hide-grid {
    background-image: none !important;
}

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

.y2k-window.hide-border .title-bar {
    background-color: transparent !important;
    border-bottom-color: transparent !important;
}

.y2k-window.hide-border .calendar-container,
.y2k-window.hide-border .calendar-grid {
    background-color: transparent !important;
}

.y2k-window.hide-border .day-cell {
    background-color: transparent !important;
    border-color: transparent !important;
}

.y2k-window.hide-border .calendar-container::-webkit-scrollbar {
    border-left: none !important;
}
.y2k-window.hide-border .calendar-container::-webkit-scrollbar-thumb {
    border: 2px solid transparent !important;
}

[data-shape="square"] .day-cell {
    border-radius: 0;
}

.view-link-row {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.view-link-btn {
    flex: 1;
    height: 18px; /* even with the hex and category boxes (nari, 10/02) */
    padding: 0 8px;
    border: none;
    border-radius: 999px;
    font-size: 9px;
    font-family: inherit;
    background: var(--primary-lighter);
    color: var(--text);
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.view-link-btn:hover {
    background: var(--primary-light);
}

.view-pinned-note {
    font-size: 9px;
    color: var(--text-muted);
    margin: 6px 0 0;
}

html.mini-cal .y2k-window {
    width: 250px;
    height: auto;
}

html.mini-cal .calendar-container {
    overflow: visible;
    padding: 8px 10px 12px;
}

html.mini-cal .calendar-grid .day-cell {
    min-width: 0;
    min-height: 0;
    aspect-ratio: 1;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--cream);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: default;
    overflow: visible;
}

html.mini-cal[data-shape="square"] .calendar-grid .day-cell {
    border-radius: 0;
}

html.mini-cal .calendar-grid .day-cell .day-number {
    font-size: 9px;
    line-height: 1.2;
}

html.mini-cal .day-headers span {
    font-size: 10px;
}

html.mini-cal .calendar-grid .day-cell .event-indicator {
    width: 7px;
    height: 7px;
    margin-top: 1px;
}

html.mini-cal .calendar-grid .day-cell .event-indicator svg {
    width: 7px;
    height: 7px;
}

html.mini-cal .calendar-grid .day-cell.has-event {
    background: var(--primary-lighter);
    cursor: pointer;
}

html.mini-cal .calendar-grid .day-cell.has-event:hover {
    transform: scale(1.08);
}

html.mini-cal .calendar-grid .day-cell.today {
    box-shadow: inset 0 0 0 1.5px var(--accent);
}

html.mini-cal .calendar-grid .day-cell.empty {
    background: transparent;
    box-shadow: none;
}

.day-popover {
    position: fixed;
    z-index: 5000;
    background: var(--white);
    border: 1px solid var(--accent);
    border-radius: 12px;
    padding: 8px 12px;
    min-width: 90px;
    max-width: 200px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

[data-shape="square"] .day-popover {
    border-radius: 0;
}

.day-popover-date {
    font-size: 9px;
    font-weight: 600;
    color: var(--cal-ink, var(--accent));
    letter-spacing: 0.3px;
    margin-bottom: 3px;
}

.day-popover-text {
    font-size: 11px;
    color: var(--text);
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
}

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

[data-shape="square"] .color-preview,
[data-shape="square"] .sync-status {
    border-radius: 0;
}

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

html:not(.mini-cal) .calendar-grid.day-size-xlarge .day-cell {
    min-height: 100px;
}

html.fill-embed:not(.mini-cal) body {
    padding: 0;
    height: 100vh;
}

html.fill-embed:not(.mini-cal) .y2k-window {
    width: 100%;
    height: 100%;
}

html.fill-embed:not(.mini-cal) .calendar-container {
    display: flex;
    flex-direction: column;
}

html.fill-embed:not(.mini-cal) .cal-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

html.fill-embed:not(.mini-cal) .calendar-grid {
    flex: 1;
    min-height: 0;
    grid-auto-rows: 1fr;
}

html.fill-embed:not(.mini-cal) .calendar-grid.cal-style-scrapbook .day-cell,
html.fill-embed:not(.mini-cal) .calendar-grid.cal-style-flip .day-cell {
    aspect-ratio: auto;
}

html.fill-embed:not(.mini-cal) .cal-cover-slot:not(.is-empty) {
    aspect-ratio: auto;
    height: 220px;
    flex-shrink: 0;
}

.cal-cover-slot {
    margin-bottom: 4px;
}

.cal-title-slot {
    margin-bottom: 4px;
    text-align: center;
}

html:not(.mini-cal) .calendar-grid.cal-style-scrapbook .day-cell,
html:not(.mini-cal) .calendar-grid.cal-style-flip .day-cell {
    padding: 3px 5px;
    border-radius: 8px;
    width: 100%;
    min-width: 0;
    aspect-ratio: 1 / 1;
    min-height: 0;
}

html:not(.mini-cal) .calendar-grid.cal-style-scrapbook.day-size-medium .day-cell,
html:not(.mini-cal) .calendar-grid.cal-style-flip.day-size-medium .day-cell {
    min-height: 66px;
}

html:not(.mini-cal) .calendar-grid.cal-style-scrapbook.day-size-large .day-cell,
html:not(.mini-cal) .calendar-grid.cal-style-flip.day-size-large .day-cell {
    min-height: 84px;
}

html:not(.mini-cal) .calendar-grid.cal-style-scrapbook.day-size-xlarge .day-cell,
html:not(.mini-cal) .calendar-grid.cal-style-flip.day-size-xlarge .day-cell {
    min-height: 104px;
}



html:not(.mini-cal)[data-shape="square"] .calendar-grid.cal-style-scrapbook .day-cell,
html:not(.mini-cal)[data-shape="square"] .calendar-grid.cal-style-flip .day-cell {
    border-radius: 0;
}

html.mini-cal .cal-cover-slot,
html.mini-cal .cal-title-slot {
    display: none !important;
}

/* mini: cog stays left, the month picker sits in the middle of the bar */
html.mini-cal .title-left {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
}

html.mini-cal .title-left .settings-btn {
    justify-self: start;
}

html.mini-cal .title-left .nav-controls {
    grid-column: 2;
}

.cal-cover-slot[hidden],
.cal-title-slot[hidden],
.sticker-layer[hidden],
.nav-btn[hidden] {
    display: none !important;
}

html:not(.mini-cal) .calendar-grid.cal-style-scrapbook,
html:not(.mini-cal) .calendar-grid.cal-style-flip {
    position: relative;
}

html:not(.mini-cal) .calendar-grid.cal-style-scrapbook .day-cell,
html:not(.mini-cal) .calendar-grid.cal-style-flip .day-cell {
    position: relative;
}

.day-photo {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    border-radius: inherit;
    z-index: 0;
    pointer-events: none;
    user-select: none;
}

.day-cell.has-photo .day-header,
.day-cell.has-photo .day-entries {
    position: relative;
    z-index: 1;
}

.day-cell.has-photo .day-entries {
    flex: 0 1 auto;
    margin-top: auto;
    gap: 2px;
}

.day-cell.has-photo .day-entry {
    background-color: color-mix(in srgb, var(--cal-chip, var(--white)) 78%, transparent);
    border-radius: 8px;
    padding: 2px 4px;
}

.day-cell.has-photo .day-entry.has-cat {
    background-color: color-mix(in srgb, var(--cat, var(--accent)) 50%, var(--cal-chip, var(--white)));
}

.day-cell.has-photo .day-entry.has-cat + .day-entry {
    margin-top: 0;
}

.day-cell.has-photo .day-entry.entry-new {
    flex: 0 0 auto;
    min-height: 0;
    padding: 0;
    background-color: transparent;
}

.day-cell.has-photo .day-number {
    background-color: color-mix(in srgb, var(--cal-chip, var(--white)) 62%, transparent);
    color: var(--cal-ink, var(--text));
    font-size: var(--note-size, 9px);
    padding:
        calc(0.15em + var(--cal-daynum-lift, 0em))
        calc(4px - var(--cal-daynum-nudge, 0em))
        calc(0.15em - var(--cal-daynum-lift, 0em))
        calc(4px + var(--cal-daynum-nudge, 0em));
    border-radius: 999px;
    line-height: 1.15;
}

.day-cell.has-photo .day-header {
    margin-bottom: 0;
}

.day-cell.has-photo .day-notes {
    flex: 0 1 auto;
    min-height: 0;
}

.day-cell.has-photo .day-entry .day-notes,
.day-cell.has-photo .day-entry .day-time-row {
    color: var(--row-ink, var(--cal-ink, var(--accent)));
}

[data-shape="square"] .day-cell.has-photo .day-number,
[data-shape="square"] .day-cell.has-photo .day-entry {
    border-radius: 0;
}

.day-photo-btn,
.day-photo-clear {
    position: absolute;
    top: 3px;
    right: 5px;
    width: calc(var(--note-size, 9px) * 1.33);
    height: calc(var(--note-size, 9px) * 1.33);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    border-radius: 999px;
    background: var(--white);
    color: var(--text-muted);
    cursor: pointer;
    z-index: 2;
}

.day-cell.has-photo .day-photo-btn {
    top: calc(6px + var(--note-size, 9px) * 1.33);
}

.day-photo-btn svg {
    width: var(--note-size, 9px);
    height: var(--note-size, 9px);
}

.day-photo-clear svg {
    width: calc(var(--note-size, 9px) * 0.89);
    height: calc(var(--note-size, 9px) * 0.89);
}

.day-cell:hover .day-photo-btn,
.day-cell:hover .day-photo-clear,
.day-photo-btn:focus-visible,
.day-photo-clear:focus-visible {
    display: flex;
}

.day-photo-btn:hover,
.day-photo-clear:hover {
    color: var(--accent);
}

[data-shape="square"] .day-photo-btn,
[data-shape="square"] .day-photo-clear {
    border-radius: 0;
}

.sticker-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 3;
}

html.mini-cal .sticker-layer {
    display: none !important;
}

html:not(.mini-cal) .cal-sticker {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 14%;
    transform: translate(-50%, -50%);
    pointer-events: auto;
    cursor: grab;
    touch-action: none;
    user-select: none;
}

html:not(.mini-cal) .cal-sticker:active {
    cursor: grabbing;
}

html:not(.mini-cal) .cal-sticker-img {
    display: block;
    width: 100%;
    height: auto;
    pointer-events: none;
    user-select: none;
}

html:not(.mini-cal) .cal-sticker.is-selected .cal-sticker-img {
    outline: 1px dashed var(--accent);
    outline-offset: 2px;
}

html:not(.mini-cal) .cal-sticker-handle {
    position: absolute;
    width: 9px;
    height: 9px;
    box-sizing: border-box;
    background: var(--white);
    border: 1px solid var(--accent);
    border-radius: 999px;
    transform: translate(-50%, -50%);
    z-index: 2;
    touch-action: none;
}

html:not(.mini-cal) .cal-sticker-handle::before {
    content: '';
    position: absolute;
    inset: -9px;
}

html:not(.mini-cal) .cal-sticker-handle-nw {
    left: 0;
    top: 0;
    cursor: nwse-resize;
}

html:not(.mini-cal) .cal-sticker-handle-ne {
    left: 100%;
    top: 0;
    cursor: nesw-resize;
}

html:not(.mini-cal) .cal-sticker-handle-se {
    left: 100%;
    top: 100%;
    cursor: nwse-resize;
}

html:not(.mini-cal) .cal-sticker-handle-sw {
    left: 0;
    top: 100%;
    cursor: nesw-resize;
}

html:not(.mini-cal) .cal-sticker-handle-rot {
    left: 50%;
    top: 100%;
    margin-top: 13px;
    width: 15px;
    height: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    cursor: grab;
}

html:not(.mini-cal) .cal-sticker-handle-rot:active {
    cursor: grabbing;
}

html:not(.mini-cal) .cal-sticker-handle-rot svg {
    width: 9px;
    height: 9px;
}

html:not(.mini-cal)[data-shape="square"] .cal-sticker-handle {
    border-radius: 0;
}

html:not(.mini-cal) .cal-sticker-tools {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 6px);
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 2px;
    border-radius: 999px;
    background: var(--white);
    border: 1px solid color-mix(in srgb, var(--border) 40%, transparent);
    white-space: nowrap;
    z-index: 1;
}

html:not(.mini-cal) .cal-sticker-tool {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
}

html:not(.mini-cal) .cal-sticker-tool svg {
    width: 11px;
    height: 11px;
}

html:not(.mini-cal) .cal-sticker-tool:hover {
    color: var(--accent);
}

html:not(.mini-cal) .cal-sticker-tool-remove:hover {
    color: #c0504d;
}

html:not(.mini-cal)[data-shape="square"] .cal-sticker-tools,
html:not(.mini-cal)[data-shape="square"] .cal-sticker-tool {
    border-radius: 0;
}

html:not(.mini-cal) .day-cell.has-photo {
    border-width: 0;
    outline: 1px solid var(--border);
    outline-offset: -1px;
}

html:not(.mini-cal) .day-cell.has-photo.today {
    outline-width: 2px;
    outline-color: var(--accent);
    outline-offset: -2px;
}

.y2k-window.hide-border html:not(.mini-cal) .day-cell.has-photo,
.y2k-window.hide-border .day-cell.has-photo {
    outline-color: transparent !important;
}

html:not(.mini-cal) .cal-title-slot {
    font-family: var(--cal-title-font, Georgia, 'Times New Roman', serif);
    font-size: var(--cal-title-size, 26px);
    color: var(--cal-title-ink, var(--accent));
    line-height: 1.5;
    padding-top: var(--cal-title-lift, 0.12em);
    text-align: center;
    overflow-x: clip;
    overflow-y: visible;
}

html:not(.mini-cal):not(.cal-style-original).title-pos-bottom .calendar-container {
    display: flex;
    flex-direction: column;
}

html:not(.mini-cal).title-pos-bottom .cal-cover-slot {
    order: 0;
}

html:not(.mini-cal).title-pos-bottom .cal-body {
    order: 1;
}

html:not(.mini-cal).title-pos-bottom .cal-title-slot {
    order: 2;
    margin-top: 6px;
    margin-bottom: 0;
}

html:not(.mini-cal):not(.cal-style-original).title-pos-cover .calendar-container {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas:
        "cover"
        "body";
}

html:not(.mini-cal).title-pos-cover .cal-cover-slot {
    grid-area: cover;
}

html:not(.mini-cal).title-pos-cover .cal-body {
    grid-area: body;
    min-width: 0;
}

html:not(.mini-cal).title-pos-cover .cal-title-slot {
    grid-area: cover;
    align-self: center;
    justify-self: center;
    margin: 0 0 4px;
    padding: 0 12px;
    max-width: 100%;
    text-align: center;
    pointer-events: none;
    position: relative;
    z-index: 2;
}

html:not(.mini-cal):not(.cal-style-original).title-pos-left .calendar-container,
html:not(.mini-cal):not(.cal-style-original).title-pos-right .calendar-container {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas:
        "cover cover"
        "title body";
}

html:not(.mini-cal):not(.cal-style-original).title-pos-right .calendar-container {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
        "cover cover"
        "body title";
}

html:not(.mini-cal).title-pos-left .cal-cover-slot,
html:not(.mini-cal).title-pos-right .cal-cover-slot {
    grid-area: cover;
}

html:not(.mini-cal).title-pos-left .cal-body,
html:not(.mini-cal).title-pos-right .cal-body {
    grid-area: body;
    min-width: 0;
}

html:not(.mini-cal).title-pos-left .cal-title-slot,
html:not(.mini-cal).title-pos-right .cal-title-slot {
    grid-area: title;
    writing-mode: vertical-rl;
    margin-bottom: 0;
    padding-top: 0;
    padding-block-start: var(--cal-title-lift, 0.12em);
    overflow: visible;
}

html:not(.mini-cal).title-pos-left .cal-title-slot:not([hidden]),
html:not(.mini-cal).title-pos-right .cal-title-slot:not([hidden]) {
    display: flex;
    align-items: center;
    justify-content: center;
}

html:not(.mini-cal).title-pos-left .cal-title-slot {
    transform: rotate(180deg);
    margin-right: 6px;
}

html:not(.mini-cal).title-pos-right .cal-title-slot {
    margin-left: 6px;
}

html:not(.mini-cal):not(.cal-style-original).title-pos-top.title-align-start .cal-title-slot {
    text-align: left;
}

html:not(.mini-cal):not(.cal-style-original).title-pos-top.title-align-center .cal-title-slot {
    text-align: center;
}

html:not(.mini-cal):not(.cal-style-original).title-pos-top.title-align-end .cal-title-slot {
    text-align: right;
}

html:not(.mini-cal):not(.cal-style-original).title-pos-bottom.title-align-start .cal-title-slot {
    text-align: left;
}

html:not(.mini-cal):not(.cal-style-original).title-pos-bottom.title-align-center .cal-title-slot {
    text-align: center;
}

html:not(.mini-cal):not(.cal-style-original).title-pos-bottom.title-align-end .cal-title-slot {
    text-align: right;
}

html:not(.mini-cal):not(.cal-style-original).title-pos-right.title-align-start .cal-title-slot {
    justify-content: flex-start;
}

html:not(.mini-cal):not(.cal-style-original).title-pos-right.title-align-center .cal-title-slot {
    justify-content: center;
}

html:not(.mini-cal):not(.cal-style-original).title-pos-right.title-align-end .cal-title-slot {
    justify-content: flex-end;
}

html:not(.mini-cal):not(.cal-style-original).title-pos-left.title-align-start .cal-title-slot {
    justify-content: flex-end;
}

html:not(.mini-cal):not(.cal-style-original).title-pos-left.title-align-center .cal-title-slot {
    justify-content: center;
}

html:not(.mini-cal):not(.cal-style-original).title-pos-left.title-align-end .cal-title-slot {
    justify-content: flex-start;
}

html:not(.mini-cal) .cal-cover-slot {
    position: relative;
    aspect-ratio: 16 / 7;
    overflow: hidden;
    border-radius: 8px;
    background: var(--white);
}

html:not(.mini-cal)[data-shape="square"] .cal-cover-slot {
    border-radius: 0;
}

html:not(.mini-cal) .cal-cover-slot.is-empty {
    aspect-ratio: auto;
    height: 28px;
    border: 1px dashed color-mix(in srgb, var(--border) 45%, transparent);
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
}

html:not(.mini-cal) .cal-cover-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    user-select: none;
}

html:not(.mini-cal) .cal-cover-slot.can-pan .cal-cover-img {
    cursor: grab;
    touch-action: none;
}

html:not(.mini-cal) .cal-cover-slot.can-pan.is-panning .cal-cover-img {
    cursor: grabbing;
}

html:not(.mini-cal) .cal-cover-add {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
}

html:not(.mini-cal) .cal-cover-add svg {
    width: 14px;
    height: 14px;
}

html:not(.mini-cal) .cal-cover-add:hover {
    color: var(--accent);
}

html:not(.mini-cal) .cal-cover-tools {
    position: absolute;
    right: 4px;
    bottom: 4px;
    display: none;
    align-items: center;
    gap: 2px;
    padding: 2px;
    border-radius: 999px;
    background: var(--white);
}

html:not(.mini-cal) .cal-cover-slot:hover .cal-cover-tools {
    display: flex;
}

html:not(.mini-cal) .cal-cover-tool {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    padding: 0;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
}

html:not(.mini-cal) .cal-cover-tool svg {
    width: 9px;
    height: 9px;
}

html:not(.mini-cal) .cal-cover-tool:hover {
    color: var(--accent);
}

html:not(.mini-cal) .cal-cover-tool-remove:hover {
    color: #c0504d;
}

html:not(.mini-cal)[data-shape="square"] .cal-cover-tools,
html:not(.mini-cal)[data-shape="square"] .cal-cover-tool {
    border-radius: 0;
}

html:not(.mini-cal) .cal-cover-tool:disabled {
    opacity: 0.3;
    cursor: default;
}

html:not(.mini-cal) .cal-cover-tool:disabled:hover {
    color: var(--text-muted);
}

.day-entries {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.day-entries::-webkit-scrollbar {
    width: 3px;
}

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

.day-entries::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 3px;
}

.day-entry {
    position: relative;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.day-entry.entry-new {
    flex: 1;
    min-height: 12px;
}

.day-entry .day-notes {
    flex: 0 0 auto;
    overflow: hidden;
}

.day-entry.entry-new .day-notes {
    flex: 1;
}

.entry-meta {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 1px;
    flex-shrink: 0;
}

.day-entry.has-meta {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 1px 8px;
}

.day-entry.has-cat {
    background: color-mix(in srgb, var(--cat, var(--accent)) 28%, transparent);
    border-radius: 4px;
    padding: 1px 4px;
}

[data-shape="square"] .day-entry.has-cat {
    border-radius: 0;
}

.day-entry.has-cat + .day-entry {
    margin-top: 2px;
}

.day-entry.has-meta .entry-meta {
    height: calc(var(--note-size, 9px) * 1.3);
    margin-bottom: 0;
}

.day-entry.has-meta .day-notes {
    flex: 1 1 calc(var(--note-size, 9px) * 7);
    min-width: 0;
    text-align: left;
}

.entry-meta[hidden] {
    display: none;
}

.entry-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--dot, var(--accent));
    flex-shrink: 0;
}

.day-cell .entry-dot {
    width: calc(var(--note-size, 9px) * 0.67);
    height: calc(var(--note-size, 9px) * 0.67);
}

[data-shape="square"] .entry-dot {
    border-radius: 0;
}

.entry-meta .day-time-row {
    width: auto;
    max-width: 100%;
    flex: 0 1 auto;
    margin: 0;
    font-size: var(--note-size, 9px);
    font-weight: 600;
}

.entry-tools {
    position: absolute;
    top: 0;
    right: 0;
    display: none;
    align-items: center;
    gap: calc(var(--note-size, 9px) * 0.22);
    height: calc(var(--note-size, 9px) * 1.33);
    padding: 0 calc(var(--note-size, 9px) * 0.22);
    border-radius: 999px;
    background: color-mix(in srgb, var(--white) 88%, transparent);
    z-index: 2;
}

[data-shape="square"] .entry-tools {
    border-radius: 0;
}

.day-entry:hover .entry-tools,
.day-entry:focus-within .entry-tools {
    display: flex;
}

.entry-tool {
    display: flex;
    align-items: center;
    justify-content: center;
    width: calc(var(--note-size, 9px) * 1.22);
    height: calc(var(--note-size, 9px) * 1.22);
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
}

.entry-tool svg {
    width: var(--note-size, 9px);
    height: var(--note-size, 9px);
}

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

.entry-tool.entry-x:hover {
    color: #c0504d;
}

.day-cat-picker {
    position: fixed;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 84px;
    padding: 4px;
    border: 1px solid var(--accent);
    border-radius: 10px;
    background: var(--white);
}

[data-shape="square"] .day-cat-picker {
    border-radius: 0;
}

.day-cat-option {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 2px 7px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--text);
    font-family: inherit;
    font-size: 10px;
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
}

[data-shape="square"] .day-cat-option {
    border-radius: 0;
}

.day-cat-option:hover {
    background: var(--primary-lighter);
}

.day-cat-option.active {
    font-weight: 600;
}

html.mini-cal .day-cat-picker,
html.mini-cal .entry-tools {
    display: none !important;
}

.day-popover-line {
    display: flex;
    align-items: flex-start;
    gap: 5px;
}

.day-popover-line + .day-popover-line {
    margin-top: 3px;
}

.day-popover-line .entry-dot {
    margin-top: 5px;
}

.day-popover-time {
    font-size: 9px;
    font-weight: 600;
    line-height: 1.4;
    padding-top: 1px;
    color: var(--cal-ink, var(--accent));
    flex-shrink: 0;
}

.category-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.category-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.category-row .color-picker {
    width: 18px;
    height: 18px;
}

.category-name {
    flex: 1;
    width: auto;
    text-align: left;
    font-family: inherit;
}

.category-add-btn {
    display: block;
    width: 100%;
    flex: none;
}

.category-list:not(:empty) + .category-add-btn {
    margin-top: 6px;
}

.category-add-btn[hidden] {
    display: none;
}

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

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

.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-btn {
    padding: 5px 12px;
    border: none;
    border-radius: 999px;
    font-size: 10px;
    font-family: inherit;
    background: var(--primary-lighter);
    color: var(--text);
    cursor: pointer;
}

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

.confirm-btn.danger {
    background: var(--accent);
    color: var(--on-accent, var(--white));
}

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

.day-time-row {
    display: block;
    width: 100%;
    margin: 0 0 1px 0;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--cal-ink, var(--accent));
    font-family: inherit;
    font-size: calc(var(--note-size, 9px) - 1px);
    line-height: 1.2;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    cursor: pointer;
    flex-shrink: 0;
}

.day-time-row:hover {
    text-decoration: underline;
}

html.mini-cal .day-time-row {
    display: none !important;
}

.day-time-picker {
    position: fixed;
    z-index: 100000;
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 4px 5px;
    border: 1px solid var(--accent);
    border-radius: 999px;
    background: var(--white);
}

[data-shape="square"] .day-time-picker {
    border-radius: 0;
}

.day-time-select {
    padding: 1px 3px;
    border: 1px solid color-mix(in srgb, var(--border) 40%, transparent);
    border-radius: 6px;
    background-color: var(--white);
    color: var(--text);
    font-family: inherit;
    font-size: 10px;
    cursor: pointer;
}

[data-shape="square"] .day-time-select {
    border-radius: 0;
}

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

.day-time-clear {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    padding: 0;
    margin-left: 2px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
}

.day-time-clear svg {
    width: 9px;
    height: 9px;
}

.day-time-clear:hover {
    color: #c0504d;
}

[data-shape="square"] .day-time-clear {
    border-radius: 0;
}

html.mini-cal .day-time-picker {
    display: none !important;
}

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

html.mini-cal .settings-section.full-only {
    display: none;
}


/* the embed block is the first thing inside the sync section, so its own top
   margin, padding and border doubled the section's own. one divider, not two.
   nari spotted the gap in koucard 2026-10-01. */
.sync-section > .share-link-section:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

/* 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.
   koucal opens settings on the overlay, so the panel itself is always a column. */
.settings-panel {
    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);
    }
}
