:root {
    /* default: palette1 */
    --bg: #f4f4f6;
    --bg-alt: #807FE1;
    --accent: #3D266D;
    --accent-strong: #8636e0;
    --text-main: #1a1a1a;
    --text-soft: #555;
    --border-soft: rgba(0, 0, 0, 0.1);
    --radius: 10px;
    --button-shape: 9999px;
    --shape-bg: rgba(255, 255, 255, 0.95);
}

.logo-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text-main);
}

#app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Palettes */
/* Cosmic Ink */
.palette1 {
    --bg: #f4f4f6;
    --bg-alt: #807FE1;
    --accent: #3D266D;
    --accent-strong: #8636e0;
    --text-main: #111827;
}

/* Soft Forest */
.palette2 {
    --bg: #036f4d;
    --bg-alt: #c5e2dd;
    --accent: #3d5243;
    --accent-strong: #be5050;
    --text-main: #1a1a1a;
}

/* Rosewood */
.palette3 {
    --bg: #70242f;
    --bg-alt: #f9cde4;
    --accent: #ba7536;
    --accent-strong: #cc331e;
    --text-main: #1c1012;
}

/* Candy Crush */
.palette4 {
    --bg: #ff4625;
    --bg-alt: #ffc0cb;
    --accent: #ff6347;
    --accent-strong: #e74168;
    --text-main: #000;
}

/* Lemonade */
.palette5 {
    --bg: #ff5ac2;
    --bg-alt: #ffff84;
    --accent: #ff98aa;
    --accent-strong: #fa69bb;
    --text-main: #000;
}

/* River Mist */
.palette6 {
    --bg: #eff6ff;
    --bg-alt: #93c5fd;
    --accent: #06b6d4;
    --accent-strong: #0ea5e9;
    --text-main: #0f172a;
}

/* shapes */
.shape-default .btn {
    border-radius: 8px;
}

.shape-flower .btn {
    background: rgba(230, 230, 230, 0.589);
    clip-path: shape(
        from 20% 0%,
        curve to 35% 5% with 27% 0%,
        curve to 50% 0% with 42% 0%,
        curve to 65% 5% with 58% 0%,
        curve to 80% 0% with 73% 0%,
        curve to 95% 30% with 100% 15%,
        curve to 100% 50% with 100% 50%,
        curve to 95% 70% with 100% 85%,
        curve to 80% 100% with 88% 100%,
        curve to 65% 95% with 73% 100%,
        curve to 50% 100% with 58% 100%,
        curve to 35% 95% with 42% 100%,
        curve to 20% 100% with 27% 100%,
        curve to 5% 70% with 0% 85%,
        curve to 0% 50% with 0% 50%,
        curve to 5% 30% with 0% 15%,
        curve to 20% 0% with 12% 0%
    );
}

.shape-film .btn {
    background: rgba(230, 230, 230, 0.589);
    clip-path: polygon(
        0% 0%, 10% 0%, 10% 8%, 15% 8%, 15% 0%,
        35% 0%, 35% 8%, 40% 8%, 40% 0%,
        60% 0%, 60% 8%, 65% 8%, 65% 0%,
        85% 0%, 85% 8%, 90% 8%, 90% 0%, 100% 0%,
        100% 100%, 90% 100%, 90% 92%, 85% 92%, 85% 100%,
        65% 100%, 65% 92%, 60% 92%, 60% 100%,
        40% 100%, 40% 92%, 35% 92%, 35% 100%,
        15% 100%, 15% 92%, 10% 92%, 10% 100%, 0% 100%
    );
}

.shape-batman .btn {
    background: rgba(230, 230, 230, 0.589);
    clip-path: shape(
        from 0% 20%,
        line to 35% 20%,
        curve to 42% 0% with 38% 10%,
        curve to 46% 18% with 44% 10%,
        curve to 54% 18% with 50% 25%,
        curve to 58% 0% with 56% 10%,
        curve to 65% 20% with 62% 10%,
        line to 100% 20%,
        curve to 100% 75% with 90% 50%,
        curve to 75% 90% with 85% 70%,
        curve to 50% 100% with 65% 80%,
        curve to 25% 90% with 35% 80%,
        curve to 0% 75% with 15% 70%,
        curve to 0% 20% with 10% 50%
    );
}

.shape-blob .btn {
    background: rgba(230, 230, 230, 0.589);
    padding: 0.75rem;
    clip-path: shape(from 87.45% 45.02%, curve to 92.48% 56.45% with 90.99% 50.00%, curve to 92.05% 69.35% with 93.97% 62.91%, curve to 82.42% 77.15% with 90.14% 75.80%, curve to 71.01% 83.22% with 74.69% 78.49%, curve to 61.91% 91.53% with 67.33% 87.95%, curve to 49.74% 96.95% with 56.49% 95.12%, curve to 38.70% 91.46% with 42.99% 98.79%, curve to 25.99% 85.79% with 34.41% 84.13%, curve to 15.38% 80.54% with 17.56% 87.44%, curve to 14.30% 66.90% with 13.20% 73.65%, curve to 13.33% 55.08% with 15.41% 60.16%, curve to 11.20% 44.30% with 11.25% 50.00%, curve to 11.95% 32.32% with 11.14% 38.59%, curve to 16.84% 21.25% with 12.75% 26.06%, curve to 27.31% 15.38% with 20.92% 16.44%, curve to 38.83% 11.12% with 33.70% 14.32%, curve to 50.39% 5.23% with 43.95% 7.93%, curve to 62.85% 5.60% with 56.83% 2.53%, curve to 72.70% 14.03% with 68.88% 8.67%, curve to 79.11% 24.51% with 76.53% 19.39%, curve to 82.80% 34.84% with 81.69% 29.63%, curve to 87.45% 45.02% with 83.91% 40.04%);
}


/* top bar */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 1.5rem;
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border-soft);
    position: relative;
    color: var(--text-main);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.brand h1 {
    font-size: 1.2rem;
    margin: 0;
}

/* settings panel */
.top-settings-panel {
    position: absolute;
    top: 3rem;
    right: 1.5rem;
    background: rgba(255,255,255,0.98);
    border-radius: 14px;
    padding: 0.9rem 1rem;
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.18);
    flex-direction: column;
    gap: 0.7rem;
    z-index: 1000;
    min-width: 260px;
    border: 1px solid var(--border-soft);
    display: none;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.settings-label {
    color: var(--text-main);
}

/* palette grid */
.palette-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.35rem;
    width: 100%;
}

.palette-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    border-radius: 999px;
    border: 1px solid var(--border-soft);
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
    background: #fff;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    justify-content: flex-start;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, transform 0.1s ease;
}

.palette-chip:hover {
    border-color: var(--accent-strong);
    background: #f9fafb;
    transform: translateY(-1px);
}

.palette-chip.active {
    border-color: var(--accent-strong);
    box-shadow: 0 0 0 2px rgba(134, 54, 224, 0.18);
    background: #f5f3ff;
}

.palette-chip.palette-custom-open {
    grid-column: 1 / -1;
    justify-content: center;
    font-weight: 500;
}

.palette-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
}

.custom-palette-panel {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-soft);
    font-size: 0.8rem;
}

.custom-palette-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.custom-palette-grid label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem;
}

.custom-palette-grid input[type="color"] {
    border-radius: 6px;
    border: 1px solid var(--border-soft);
    padding: 0;
    width: 40px;
    height: 24px;
    background: transparent;
}

.custom-apply-btn {
    width: 100%;
    justify-content: center;
}

/* shape selector preview */
.shape-select-wrap {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* draft row */
.draft-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* layout */
.main-layout {
    flex: 1;
    display: flex;
    padding: 1rem 1.5rem 1.5rem;
    justify-content: center;
}

.editor-section {
    background: #ffffffee;
    border-radius: 16px;
    padding: 1.25rem 1.5rem 1.5rem;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    gap: 0.75rem;
}

/* editor header */
.editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

/* rich editor */
.rich-editor {
    flex: 1;
    min-height: 480px;
    padding: 1.5rem;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    font-family: Georgia, serif;
    font-size: 1.1rem;
    line-height: 1.7;
    overflow-y: auto;
    background: #fff;
}

.rich-editor:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(61, 82, 67, 0.1);
    outline: none;
}

.rich-editor:empty:before {
    content: attr(placeholder);
    color: var(--text-soft);
    pointer-events: none;
}

/* stats */
.stats {
    font-size: 0.85rem;
    color: var(--text-soft);
    white-space: nowrap;
}

/* title */
.title-input {
    flex: 1;
    border: none;
    border-bottom: 1px solid var(--border-soft);
    font-size: 1.1rem;
    padding: 0.2rem 0;
    background: transparent;
}

.title-input:focus {
    outline: none;
    border-bottom-color: var(--accent);
}

/* toolbar */
.toolbar {
    margin-top: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    border-radius: 16px;
    padding: 0.25rem 0.5rem;
    background: var(--bg-alt);
    color: var(--bg);
}

.toolbar-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.toolbar .action-btn {
    background: rgba(255, 255, 255, 0.95);
    min-width: 2rem;
}

/* font select */
.toolbar-font {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    background: rgba(255, 255, 255, 0.5);
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
}

.toolbar-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #1a1a1a;
}

#fontSelect {
    border-radius: 999px;
    border: 1px solid var(--border-soft);
    padding: 0.2rem 0.6rem;
    font-size: 0.8rem;
    background: rgba(255, 255, 255, 0.9);
    outline: none;
}

/* font preview per option */
#fontSelect .font-georgia { font-family: 'Georgia', serif; }
#fontSelect .font-times { font-family: 'Times New Roman', serif; }
#fontSelect .font-inter { font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
#fontSelect .font-arial { font-family: 'Arial', sans-serif; }
#fontSelect .font-courier { font-family: 'Courier New', monospace; }

/* pomodoro */
.toolbar-pomodoro {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    white-space: nowrap;
    background: rgba(0,0,0,0.14);
    border-radius: 999px;
    padding: 0.25rem 0.5rem;
}

.app-break .toolbar-pomodoro {
    background: rgba(191, 6, 6, 0.35);
}

.app-sprint .toolbar-pomodoro {
    background: rgba(255, 255, 255, 0.25);
}

.toolbar-pomodoro span#timerClock {
    font-weight: 600;
}

.toolbar-pomodoro input[type="number"] {
    width: 3rem;
    padding: 0.15rem 0.3rem;
    border-radius: 999px;
    border: 1px solid var(--border-soft);
    font-size: 0.75rem;
}

input[type="number"],
select {
    border-radius: 999px;
    border: 1px solid var(--border-soft);
    padding: 0.25rem 0.6rem;
    font-size: 0.8rem;
    background: rgba(255, 255, 255, 0.9);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

input[type="number"]:focus,
select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(134, 54, 224, 0.15);
    background: #fff;
}

/* buttons */
.btn {
    border-radius: var(--radius, 999px);
    border: 1px solid #00000090;
    background: rgba(255, 255, 255, 0.95);
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    cursor: pointer;
    transition:
        background 0.15s ease,
        transform 0.1s ease,
        box-shadow 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
    color: var(--text-main);
}

.btn:hover {
    transform: translateY(-1px);
    border: 1px solid #00000090;
    background: var(--bg-alt);
    color: var(--bg);
    box-shadow: 0 3px 6px rgba(15, 23, 42, 0.2);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.16);
}

.btn.primary:hover {
    background: var(--accent-strong);
    color: #fff;
    border-color: var(--accent);
}

.btn.mini {
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
}

/* export */
.export-row {
    margin-top: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.export-group {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
}

/* timer labels */
#timerLabel {
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.15rem 0.4rem;
    border-radius: 999px;
    background: rgba(255,255,255,0.9);
    color: var(--text-main);
}

#timerClock {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--bg);
}

/* responsive */
@media (max-width: 880px) {
    .main-layout {
        padding: 0.75rem;
    }

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

    .toolbar-pomodoro {
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .top-settings-panel {
        right: 0.75rem;
    }
}