@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: '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: #333;
    --text-muted: #888;
    --border: #deb8b8;
    --white: #fff;
    --bubble-user: #B8878C;
    --bubble-user-text: #fff;
    --bubble-other: #f0f0f0;
    --bubble-other-text: #333;
    --scale: 1;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --koubrain-width: 320px;
    --koubrain-height: 480px;
    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;
        --bubble-other: #252525;
        --bubble-other-text: #e3e3e2;
        --primary-light: #37352f;
        --primary-lighter: #2f2f2f;
        color-scheme: dark;
    }
}

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

:root[data-theme="light"] {
    --background: #FDF8F4;
    --sync-fill: #f1f1ef;
    --white: #fff;
    --cream: #f8f0f0;
    --text: #333;
    --text-muted: #888;
    --bubble-other: #f0f0f0;
    --bubble-other-text: #333;
    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;
    align-items: center;
    justify-content: center;
    padding: 20px;
}


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


.y2k-title-bar {
    background: var(--white);
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    user-select: none;
}

.y2k-title-bar-left {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 24px; /* the buttons went 24 -> 18, this keeps the bar its old height */
}

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

.y2k-title-text {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--primary);
}

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

/* the title bar buttons share the settings icon's 18px hover shape (kou-theme sizes the cog at 18), nari 10/02 */
.y2k-action-btn, .y2k-settings-btn {
    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);
    transition: background-color 0.15s, color 0.15s;
    padding: 0;
}

.y2k-action-btn:hover, .y2k-settings-btn:hover {
    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);
}

#filter-fav-btn.active {
    color: #ff6b6b;
}

#filter-fav-btn.active svg {
    fill: #ff6b6b;
}


.chat-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px;
    display: flex;
    flex-direction: column;
    background-color: var(--white);
    background-image: var(--pattern-img, none);
    background-size: var(--pattern-size, auto);
    background-position: var(--pattern-pos, 0 0);
}

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 8px;
}


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

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

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

.y2k-empty-icon {
    width: 32px;
    height: 32px;
    opacity: 0.7;
    margin-bottom: 8px;
    color: var(--primary);
}


.message-wrapper {
    display: flex;
    justify-content: flex-end;
}

.message-wrapper.other {
    justify-content: flex-start;
}

.message-bubble {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: var(--message-font-size, 12px);
    line-height: 1.5;
    word-wrap: break-word;
    position: relative;
}

.message-bubble.user {
    background: var(--bubble-user);
    color: var(--bubble-user-text);
}

.message-bubble.other {
    background: var(--bubble-other);
    color: var(--bubble-other-text);
}

.message-bubble.image-bubble {
    background: transparent !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
}

.message-bubble.image-bubble .message-image {
    max-width: 100%;
    border-radius: 12px;
    display: block;
}

[data-shape="square"] .message-bubble,
[data-shape="square"] .message-image,
[data-shape="square"] .message-bubble.image-bubble .message-image {
    border-radius: 0;
}

.message-bubble.favorited + .message-time::before {
    content: '♡';
    display: block;
    text-align: center;
    font-size: 10px;
    line-height: 1;
    margin-bottom: 3px;
    color: var(--primary);
}

.message-image {
    max-width: 200px;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.15s;
}

.message-image:hover {
    transform: scale(1.02);
}

.message-time {
    font-size: 9px;
    color: var(--text-muted);
    margin-top: 4px;
    margin-left: 8px;
    text-align: right;
    align-self: flex-end;
}

.message-wrapper.other .message-time {
    text-align: left;
}


.input-area {
    padding: 10px 12px;
    background: var(--white);
    border-top: 1px solid var(--border);
}

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

.input-container {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--cream);
    border-radius: 20px;
    padding: 2px 8px;
}

.attach-btn {
    width: 24px;
    height: 24px;
    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, color 0.15s;
}

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

.heart-btn {
    width: 24px;
    height: 24px;
    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, color 0.15s;
}

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

.heart-btn.active {
    color: #ff6b6b;
}

.message-input {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    font-size: var(--message-font-size, 12px);
    font-family: var(--font-family);
    padding: 4px 4px;
    outline: none;
    color: var(--text);
}

.message-input::placeholder {
    color: var(--text-muted);
}

.send-btn {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--on-accent, var(--white));
    transition: background-color 0.15s, transform 0.15s;
}

.send-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.05);
}


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

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

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

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

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

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

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

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

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

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

#bubble-color::-webkit-color-swatch-wrapper,
#accent-color::-webkit-color-swatch-wrapper,
#pattern-color::-webkit-color-swatch-wrapper,
#line-color::-webkit-color-swatch-wrapper {
    padding: 0;
}

#bubble-color::-webkit-color-swatch,
#accent-color::-webkit-color-swatch,
#pattern-color::-webkit-color-swatch,
#line-color::-webkit-color-swatch {
    border: none;
    border-radius: 50%;
}

/* title bar swatch comes from kou-theme.css at 28px; koubrain 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);
}

.font-select {
    width: 100%;
    padding: 6px 28px 6px 12px;
    font-size: 10px;
    font-family: inherit;
    background: var(--primary-lighter);
    border: none;
    border-radius: 999px;
    cursor: pointer;
    color: var(--text);
    appearance: none;
    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;
    outline: none;
    transition: background-color 0.15s, box-shadow 0.15s;
}

.font-select:focus {
    outline: none;
    background-color: var(--white);
    box-shadow: 0 0 0 1px var(--primary-light);
}

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

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

.scale-slider {
    flex: 1;
    min-width: 0; /* webkit won't shrink a range below 129px, guards a narrow embed */
    -webkit-appearance: none;
    appearance: none;
    height: 3px;
    background: var(--primary-lighter);
    border-radius: 2px;
    outline: none;
}

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

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


.chat-container::-webkit-scrollbar {
    width: 4px;
}

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

.chat-container::-webkit-scrollbar-thumb {
    background: var(--primary-lighter);
    border-radius: 2px;
}

.chat-container::-webkit-scrollbar-thumb:hover {
    background: var(--primary-hover);
}


.grid-pattern {
    background-image: var(--grid-bg);
    background-size: 8px 8px;
}


.browser-block {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--primary-lighter);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    font-family: var(--font-family);
}

.browser-block.visible {
    display: flex;
}

.browser-block-window {
    background: var(--white);
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 8px 32px var(--primary-lighter);
    overflow: hidden;
    max-width: 300px;
    background-image: 
        linear-gradient(var(--primary-lighter) 1px, transparent 1px),
        linear-gradient(90deg, var(--primary-lighter) 1px, transparent 1px);
    background-size: 12px 12px;
}

.browser-block-titlebar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--cream);
    border-bottom: 1px solid var(--border);
}

.browser-block-titlebar-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.browser-block-logo {
    width: 18px;
    height: 18px;
    opacity: 0.8;
}

.browser-block-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--primary);
}

.browser-block-window-btns {
    display: flex;
    gap: 4px;
}

.browser-block-btn {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary-lighter);
    border: 1px solid var(--border);
}

.browser-block-content {
    padding: 40px 24px;
    text-align: center;
    background: var(--white);
}

.browser-block-icon {
    margin-bottom: 16px;
}

.browser-block-moon {
    width: 50px;
    height: 50px;
    opacity: 0.75;
}

.browser-block-heading {
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 10px;
}

.browser-block-message {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 6px;
    line-height: 1.5;
}

.browser-block-message strong {
    color: var(--primary);
    font-weight: 600;
}

.browser-block-submessage {
    font-size: 11px;
    color: var(--text-muted);
    opacity: 0.7;
    margin-bottom: 20px;
}

.browser-block-stars {
    display: flex;
    justify-content: center;
    gap: 10px;
    font-size: 12px;
    color: var(--primary-light);
}


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

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

.sync-status {
    margin-bottom: 12px;
}

.sync-status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--primary-lighter);
    border-radius: 16px;
    font-size: 11px;
    color: var(--text-muted);
}

.sync-status-indicator.synced {
    background: rgba(156, 175, 136, 0.2);
    color: #7a8a6a;
}

.sync-status-indicator.syncing {
    background: var(--primary-lighter);
    color: var(--primary);
}

.sync-status-indicator.error {
    background: rgba(220, 120, 120, 0.2);
    color: #a05050;
}

.sync-status-icon {
    width: 14px;
    height: 14px;
}

.sync-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid var(--primary-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.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: 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;
    border: 1px solid var(--primary-lighter);
}

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

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

.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-controls 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;
    text-align: center;
    text-transform: uppercase;
}

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

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

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

.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-hint {
    font-size: 9px;
    color: var(--text-muted);
    margin: 6px 0 0 0;
    text-align: center;
}


.koubrain-toast {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translate(-50%, 10px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes fadeOut {
    from { opacity: 1; transform: translate(-50%, 0); }
    to { opacity: 0; transform: translate(-50%, 10px); }
}


.message-menu {
    position: fixed;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 4px;
    z-index: 1000;
    box-shadow: 0 8px 24px var(--primary-lighter);
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 110px;
    animation: menuFadeIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: top left;
}

@keyframes menuFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-5px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.menu-item {
    width: 100%;
    padding: 6px 12px;
    font-size: 11px;
    font-family: var(--font-family);
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    color: var(--text);
    transition: background-color 0.15s, color 0.15s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.menu-item:hover {
    background: var(--primary-hover);
    color: var(--primary);
}

.menu-item.delete-btn:hover {
    background: rgba(220, 120, 120, 0.15);
    color: #e07070;
}

.menu-icon {
    font-size: 11px;
    color: var(--text-muted);
    transition: color 0.15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
}

.menu-icon svg {
    display: block;
    width: 10px;
    height: 10px;
}

.menu-item:hover .menu-icon {
    color: var(--primary);
}

.menu-item.delete-btn:hover .menu-icon {
    color: #e07070;
}

.favorite-btn .menu-icon {
    color: var(--primary);
}

.menu-separator {
    height: 1px;
    background: var(--border);
    margin: 4px 6px;
    opacity: 0.4;
}


.image-preview-container {
    position: relative;
    display: inline-flex;
    margin-bottom: 8px;
    border-radius: 8px;
    overflow: visible;
    border: 1px solid var(--border);
    background: var(--cream);
    padding: 4px;
}

#image-preview {
    height: 50px;
    width: auto;
    border-radius: 6px;
    display: block;
    object-fit: cover;
}

.cancel-image-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 16px;
    height: 16px;
    background: var(--primary);
    color: var(--on-accent, var(--white));
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.15s, background-color 0.15s;
}

.cancel-image-btn:hover {
    transform: scale(1.1);
    background: #ff6b6b;
}

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

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

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

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

[data-titlebar="custom"] .y2k-window.hide-border .y2k-title-bar #settings-btn svg,
[data-titlebar="custom"] .y2k-window.hide-border .y2k-title-bar #settings-btn svg * {
    color: var(--primary, var(--border-color, #b8878c));
}

.y2k-window.hide-border .chat-container,
.y2k-window.hide-border .input-area {
    background-color: transparent !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,
[data-shape="square"] .message-menu,
[data-shape="square"] .menu-item {
    border-radius: 0;
}

[data-shape="square"] .confirm-popup,
[data-shape="square"] .message-menu {
    box-shadow: none;
}

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

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


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