:root {
    --bg-color: #8B4513;
    /* saddle brown - coklat meja klasik */
    --desk-light: #A0522D;
    /* sienna - lebih terang */
    --note-width: 200px;
    --note-height: 150px;
    --note-radius: 8px;
    --font: "Inter", Poppins, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
}

* {
    box-sizing: border-box
}

html,
body {
    height: 100%;
    margin: 0;
    font-family: var(--font);
    background:
        linear-gradient(135deg, #654321, #8B4513, #5D4037),
        url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0h100v100H0z' fill='none'/%3E%3Cpath d='M20 20h60v60H20z' stroke='%23000' stroke-width='0.5' fill='none'/%3E%3C/svg%3E");
    background-blend-mode: overlay;
    /* gradasi coklat meja kayu */
    color: #f0f0e6;
    overflow-x: hidden;
}

/* Container / desk */
.app {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px 16px;
    background: transparent;
}

/* Header improvements for mobile */
header.topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    color: #fff;
    padding: 8px 0;
    background: rgba(101, 67, 33, 0.3);
    border-radius: 12px;
    padding: 12px 16px;
    backdrop-filter: blur(10px);
}

.brand {
    font-weight: 700;
    font-size: 18px;
    display: flex;
    gap: 8px;
    align-items: center;
    flex: 1;
    min-width: 200px;
}

.tagline {
    font-weight: 400;
    opacity: 0.9;
    font-size: 12px;
}

.toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}


/* Buttons */
.btn {
    background: rgba(160, 82, 45, 0.25);
    color: white;
    border: 1px solid rgba(210, 180, 140, 0.3);
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    backdrop-filter: blur(5px);
    font-size: 14px;
    min-height: 40px;
    transition: all 0.2s ease;
}

.btn:hover {
    background: rgba(160, 82, 45, 0.4);
}

.btn:active {
    transform: translateY(1px);
    background: rgba(160, 82, 45, 0.5);
}

.select {
    background: rgba(160, 82, 45, 0.2);
    color: white;
    border: 1px solid rgba(210, 180, 140, 0.3);
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    min-height: 40px;
    backdrop-filter: blur(5px);
}

.select option {
    color: black;
}

/* workspace improvements */
.workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    padding: 12px;
    padding-bottom: 140px;
}

/* columns - mobile first approach */
.column {
    flex: 1;
    background: rgba(139, 69, 19, 0.15);
    /* semi transparan coklat meja */
    border-radius: 16px;
    padding: 16px;
    min-height: 300px;
    box-shadow:
        inset 0 0 40px rgba(101, 67, 33, 0.4),
        0 4px 20px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(160, 82, 45, 0.3);
    overflow: hidden;
    position: relative;
}

.column::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        linear-gradient(90deg, transparent 98%, rgba(160, 82, 45, 0.1) 100%),
        linear-gradient(0deg, transparent 98%, rgba(160, 82, 45, 0.1) 100%);
    background-size: 20px 20px;
    pointer-events: none;
    border-radius: 16px;
}

.col-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #fff;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.col-head h2 {
    margin: 0;
    font-size: 18px;
}

.col-body {
    position: relative;
    min-height: 250px;
    height: calc(100% - 40px);
}

/* note improvements for touch */
.note {
    width: var(--note-width);
    min-height: var(--note-height);
    background: #fff5a5;
    color: #111;
    border-radius: var(--note-radius);
    padding: 12px;
    position: absolute;
    box-shadow: 3px 4px 12px rgba(0, 0, 0, 0.28);
    cursor: grab;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow: hidden;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}

.note.dragging {
    opacity: 0.95;
    transform: scale(1.03) rotate(-1deg);
    box-shadow: 6px 8px 22px rgba(0, 0, 0, 0.45);
    cursor: grabbing;
    z-index: 999;
}

.note.editing {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.5), 3px 4px 12px rgba(0, 0, 0, 0.28);
    z-index: 1000;
}

.note .note-top {
    cursor: grab;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 6px;
    border-bottom: 1px dashed rgba(0, 0, 0, 0.1);
    user-select: none;
}

.note .dotmenu {
    background: transparent;
    border: 0;
    font-size: 20px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.note .dotmenu:active {
    background: rgba(0, 0, 0, 0.1);
}

.note .content {
    flex: 1;
    outline: none;
    white-space: pre-wrap;
    word-break: break-word;
    padding-right: 6px;
    min-height: 80px;
    font-size: 14px;
    line-height: 1.4;
}

.note .meta {
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 12px;
}

/* stack improvements */
.stack {
    position: fixed;
    left: 16px;
    bottom: 120px;
    display: flex;
    flex-direction: column-reverse;
    align-items: flex-start;
    gap: 0;
    z-index: 50;
}

.stack .stack-note {
    width: 100px;
    height: 100px;
    background: #D2B48C;
    /* tan - warna kertas tua */
    border-radius: 8px;
    box-shadow:
        1px 2px 6px rgba(0, 0, 0, 0.3),
        inset 0 0 10px rgba(101, 67, 33, 0.2);
    margin-top: -70px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #654321;
    font-weight: 600;
    user-select: none;
    font-size: 14px;
    border: 1px solid #A0522D;
}

.stack .hint {
    position: absolute;
    top: -36px;
    left: 0;
    color: white;
    font-size: 13px;
    opacity: 0.95;
}

/* trash improvements */
.trash {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: 20px;
    width: 140px;
    height: 100px;
    border-radius: 14px;
    background: rgba(101, 67, 33, 0.4);
    color: #D2B48C;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    transition: all 0.18s ease;
    z-index: 40;
    border: 1px solid rgba(160, 82, 45, 0.5);
    backdrop-filter: blur(5px);
}

.trash.active {
    background: rgba(139, 0, 0, 0.7);
    transform: translateX(-50%) scale(1.05);
    color: white;
}

.trash-label {
    position: absolute;
    bottom: -22px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 12px;
}

/* menu dropdown improvements for touch */
.menu {
    position: fixed;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    padding: 12px;
    min-width: 200px;
    z-index: 1200;
    font-size: 14px;
    color: black;
}

.menu button {
    display: block;
    width: 100%;
    padding: 12px;
    border: 0;
    background: transparent;
    text-align: left;
    cursor: pointer;
    border-radius: 8px;
    font-size: 14px;
    min-height: 44px;
}

.menu button:active {
    background: #f2f2f2;
}

/* color swatches inside menu */
.swatches {
    display: flex;
    gap: 8px;
    padding: 8px;
    justify-content: center;
}

.swatch {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.swatch:active {
    transform: scale(0.95);
}

/* timer badge */
.timer-badge {
    font-size: 12px;
    padding: 6px 8px;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 6px;
}

/* small helpers */
.muted {
    color: #eee;
    opacity: 0.9;
    font-size: 13px;
}

/* Mobile-specific improvements */
@media (max-width: 768px) {
    .app {
        padding: 8px 12px;
        background: transparent;
    }

    .workspace {
        padding: 8px;
        padding-bottom: 160px;
        gap: 12px;
    }

    .column {
        background: rgba(255, 255, 255, 0.08);
        box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.3);
    }

    .note {
        width: 180px;
        min-height: 140px;
        padding: 10px;
    }

    .stack {
        left: 12px;
        bottom: 140px;
    }

    .stack .stack-note {
        width: 80px;
        height: 80px;
        margin-top: -60px;
        font-size: 12px;
    }

    .trash {
        width: 120px;
        height: 90px;
        bottom: 24px;
    }

    .brand {
        font-size: 16px;
    }

    .toolbar {
        gap: 6px;
    }

    .btn,
    .select {
        padding: 8px 10px;
        font-size: 13px;
        min-height: 36px;
    }
}

@media (min-width: 769px) {
    .workspace {
        flex-direction: row;
        padding-bottom: 140px;
    }

    .column {
        min-width: 320px;
        max-width: 900px;
    }
}

@media (max-width: 480px) {
    header.topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .toolbar {
        width: 100%;
        justify-content: space-between;
    }

    .btn,
    .select {
        flex: 1;
        text-align: center;
        min-width: 0;
    }

    .note {
        width: 160px;
        min-height: 130px;
    }

    .stack {
        bottom: 150px;
    }

    .stack .stack-note {
        width: 70px;
        height: 70px;
        margin-top: -50px;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    .note {
        cursor: default;
    }

    .note.dragging {
        cursor: default;
    }

    .btn:focus,
    .select:focus,
    .dotmenu:focus {
        outline: 2px solid rgba(255, 255, 255, 0.5);
    }
}

.note.done {
    opacity: 0.5;
    filter: grayscale(0.3);
    transition: opacity 0.3s, filter 0.3s;
}

/* expired / timer done visual */
@keyframes shake {
    0% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-6px);
    }

    40% {
        transform: translateX(6px);
    }

    60% {
        transform: translateX(-4px);
    }

    80% {
        transform: translateX(4px);
    }

    100% {
        transform: translateX(0);
    }
}

.note.expired {
    animation: shake 0.45s ease-in-out 3;
    background-color: #ffd5d5 !important;
    border: 1px solid #ff6b6b;
    box-shadow: 0 6px 18px rgba(255, 90, 90, 0.12);
}

.note .expired-badge {
    position: absolute;
    top: 6px;
    right: 32px;
    font-size: 13px;
    background: #ff6b6b;
    color: white;
    padding: 4px 6px;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
    z-index: 5;
    pointer-events: none;
}

/* temporary pulse for a short time (optional) */
.note.expired.pulse {
    animation: shake 0.45s ease-in-out 2, pulse 0.9s ease 1;
}

/* cursor when dragging (already suggested earlier) */
.note.dragging {
    cursor: grabbing !important;
}

/* (optional) visually indicate nearly-expired (last 10%) */
.note.near-expire {
    box-shadow: 0 0 0 4px rgba(255, 165, 0, 0.07);
}

.brand img {
    width: 32px;
    /* sesuaikan ukuran */
    height: 32px;
    object-fit: contain;
}

/* Tema Papan Tulis Hijau Tradisional */
/* Tema Papan Tulis Hijau Tradisional */
body.theme-papan {
    background:
        linear-gradient(135deg, #2f4f4f 0%, #1e3e3e 50%, #2f4f4f 100%),
        url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 0h1v60h-1zM0 30h60v1H0z' stroke='%233a5f5f' stroke-width='0.5' fill='none'/%3E%3C/svg%3E");
    background-blend-mode: overlay;
    color: #f0f0f0;
}

body.theme-papan .app {
    background: transparent;
}

body.theme-papan header.topbar {
    background: rgba(47, 79, 79, 0.6);
    border: 1px solid rgba(90, 130, 130, 0.4);
    backdrop-filter: blur(15px);
}

body.theme-papan .btn {
    background: rgba(90, 130, 130, 0.3);
    color: #e0e0e0;
    border: 1px solid rgba(120, 160, 160, 0.4);
    backdrop-filter: blur(8px);
}

body.theme-papan .btn:hover {
    background: rgba(90, 130, 130, 0.5);
}

body.theme-papan .btn:active {
    background: rgba(90, 130, 130, 0.6);
}

body.theme-papan .select {
    background: rgba(90, 130, 130, 0.25);
    color: #e0e0e0;
    border: 1px solid rgba(120, 160, 160, 0.4);
    backdrop-filter: blur(8px);
}

body.theme-papan .column {
    background: rgba(47, 79, 79, 0.25);
    border: 1px solid rgba(90, 130, 130, 0.4);
    box-shadow:
        inset 0 0 50px rgba(0, 0, 0, 0.4),
        0 6px 25px rgba(0, 0, 0, 0.3);
}

body.theme-papan .column::before {
    background:
        linear-gradient(90deg, transparent 98%, rgba(120, 160, 160, 0.15) 100%),
        linear-gradient(0deg, transparent 98%, rgba(120, 160, 160, 0.15) 100%);
    background-size: 25px 25px;
}

body.theme-papan .col-head h2 {
    color: #ffffff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

body.theme-papan .muted {
    color: #b8d4d4;
}

/* HAPUS bagian ini yang menimpa warna note */
/*
body.theme-papan .note {
    background: #f8f8f5 !important;
    color: #2f4f4f !important;
    box-shadow: 
        3px 4px 15px rgba(0, 0, 0, 0.4),
        inset 0 0 0 1px rgba(47, 79, 79, 0.1);
    font-family: "Chalkboard", "Comic Sans MS", cursive, var(--font);
}
*/

/* Sebagai gantinya, buat style khusus hanya untuk note default di tema papan */
body.theme-papan .note[style*="background: #fff5a5"],
body.theme-papan .note[style*="background:#fff5a5"],
body.theme-papan .note:not([style*="background:"]) {
    background: #f8f8f5 !important;
    color: #2f4f4f !important;
}

/* Style untuk content note di tema papan */
body.theme-papan .note .content {
    color: inherit;
    /* Biarkan mewarisi warna dari parent */
    background: transparent;
}

body.theme-papan .note .note-top {
    border-bottom: 1px dashed rgba(47, 79, 79, 0.3);
}

body.theme-papan .note .dotmenu {
    color: #5a8282;
}

body.theme-papan .note .dotmenu:active {
    background: rgba(47, 79, 79, 0.15);
}

body.theme-papan .timer-badge {
    background: rgba(47, 79, 79, 0.2);
    color: #2f4f4f;
    border: 1px solid rgba(47, 79, 79, 0.3);
}

/* Stack notes untuk papan tulis */
body.theme-papan .stack .stack-note {
    background: #e8e8e0;
    color: #5a8282;
    border: 1px solid rgba(90, 130, 130, 0.6);
    box-shadow:
        2px 3px 10px rgba(0, 0, 0, 0.3),
        inset 0 0 8px rgba(47, 79, 79, 0.2);
}

/* Trash untuk papan tulis */
body.theme-papan .trash {
    background: rgba(47, 79, 79, 0.5);
    color: #a8c8c8;
    border: 1px solid rgba(120, 160, 160, 0.6);
    backdrop-filter: blur(8px);
}

body.theme-papan .trash.active {
    background: rgba(139, 0, 0, 0.7);
    color: white;
}

/* Menu untuk papan tulis */
body.theme-papan .menu {
    background: #2f4f4f;
    color: white;
    border: 1px solid #5a8282;
}

body.theme-papan .menu button {
    color: white;
}

body.theme-papan .menu button:active {
    background: rgba(90, 130, 130, 0.3);
}

/* Warna notes khusus untuk papan tulis - hanya swatch di menu */
body.theme-papan .swatch[data-color="#fff5a5"] {
    background: #f8f8f5 !important;
    /* putih kapur */
    border: 2px solid #5a8282;
}

/* Efek kapur untuk text */
body.theme-papan .brand,
body.theme-papan .tagline,
body.theme-papan .col-head h2 {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}