:root {
    --bg-wood: #2c241b;
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --text-primary: #ffffff;
    --text-secondary: #e0e0e0;
    --accent-color: #ffb74d;

    /* Post-it Colors */
    --note-yellow: #fef6a0;
    --note-blue: #a0eefe;
    --note-green: #a0feae;
    --note-pink: #fea0ea;
    --note-purple: #dcd0ff;

    --font-hand: 'Ma Shan Zheng', cursive;
    --font-ui: 'Outfit', 'Noto Sans SC', sans-serif;
}

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

body {
    font-family: var(--font-ui);
    background-color: var(--bg-wood);
    /* Wood texture pattern */
    background-image:
        linear-gradient(rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.3)),
        url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%233e3226' fill-opacity='0.4' fill-rule='evenodd'%3E%3Cpath d='M0 38.59l2.83-2.83 1.41 1.41L1.41 40H0v-1.41zM0 1.4l2.83 2.83 1.41-1.41L1.41 0H0v1.41zM38.59 40l-2.83-2.83 1.41-1.41L40 38.59V40h-1.41zM40 1.41l-2.83 2.83-1.41-1.41L38.59 0H40v1.41zM20 18.6l2.83-2.83 1.41 1.41L21.41 20l2.83 2.83-1.41 1.41L20 21.41l-2.83 2.83-1.41-1.41L18.59 20l-2.83-2.83 1.41-1.41L20 18.59z'/%3E%3C/g%3E%3C/svg%3E");
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    transition: filter 0.3s ease;
}

/* Privacy Mode Blur */
body.privacy-active .board-grid,
body.privacy-active #focus-mode-container {
    filter: blur(8px);
    transition: filter 0.5s ease;
}

body.privacy-active .board-grid:hover,
body.privacy-active #focus-mode-container:hover {
    filter: blur(0);
}

.app-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* Ambient Light Vignette */
.ambient-light {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.05) 0%, rgba(0, 0, 0, 0.6) 90%);
    pointer-events: none;
    z-index: 1;
}

/* Header */
.glass-header {
    height: 70px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 32px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--accent-color);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.toolbar {
    display: flex;
    gap: 16px;
}

.tool-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-secondary);
    width: 40px;
    height: 40px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.tool-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.tool-btn.active {
    background: var(--accent-color);
    color: #3e2723;
    border-color: var(--accent-color);
}

.tool-btn.primary {
    background: var(--accent-color);
    color: #3e2723;
    border: none;
    box-shadow: 0 4px 15px rgba(255, 183, 77, 0.3);
}

.tool-btn.primary:hover {
    background: #ffa726;
    transform: translateY(-2px) scale(1.05);
}

/* Main Board */
.board-grid {
    flex: 1;
    padding: 40px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    grid-auto-rows: 280px;
    gap: 40px;
    overflow-y: auto;
    z-index: 10;
    perspective: 1000px;
    /* Custom Scrollbar */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.board-grid::-webkit-scrollbar {
    width: 8px;
}

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

.board-grid::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

/* Note Cards */
.note-card {
    position: relative;
    width: 280px;
    height: 280px;
    padding: 24px;
    background: var(--note-yellow);
    color: #333;
    font-family: var(--font-hand);
    font-size: 1.6rem;
    line-height: 1.4;
    box-shadow: 2px 10px 20px rgba(0, 0, 0, 0.25);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    /* Paper texture effect */
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.05'/%3E%3C/svg%3E");
    transform-origin: center top;
    margin: auto;
    /* Center in grid cell */
}

.note-card:hover {
    transform: scale(1.05) rotate(0deg) !important;
    /* Reset rotation on hover */
    box-shadow: 5px 20px 30px rgba(0, 0, 0, 0.3);
    z-index: 20;
}

/* Pin Styling */
.pin {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    color: #d32f2f;
    font-size: 1.5rem;
    filter: drop-shadow(2px 4px 2px rgba(0, 0, 0, 0.3));
    z-index: 5;
}

/* Tape Styling (Alternative to Pin) */
.tape {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%) rotate(-2deg);
    width: 100px;
    height: 30px;
    background-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(2px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.note-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    word-break: break-word;
    overflow: hidden;
}

.note-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    font-family: var(--font-ui);
    font-size: 0.8rem;
    color: rgba(0, 0, 0, 0.5);
    opacity: 0;
    /* Hidden by default */
    transition: opacity 0.2s;
}

.note-card:hover .note-footer {
    opacity: 1;
}

.actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(0, 0, 0, 0.6);
    font-size: 1rem;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
}

.action-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #000;
}

.action-btn.check:hover {
    color: #2e7d32;
}

.action-btn.edit:hover {
    color: #1565c0;
}

.action-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.action-btn.disabled:hover {
    background: none;
    color: rgba(0, 0, 0, 0.6);
}

/* Stamp Effect */
.stamp-mark {
    position: absolute;
    bottom: 20px;
    right: 20px;
    border: 3px solid #d32f2f;
    color: #d32f2f;
    font-family: 'Black Ops One', sans-serif;
    /* Stencil font fallback */
    font-weight: 900;
    font-size: 2rem;
    padding: 4px 12px;
    text-transform: uppercase;
    border-radius: 8px;
    opacity: 0;
    transform: scale(2) rotate(-15deg);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    mix-blend-mode: multiply;
}

.note-card.checked .stamp-mark {
    opacity: 0.7;
    transform: scale(1) rotate(-15deg);
}

/* Colors */
.color-yellow {
    background-color: var(--note-yellow);
}

.color-blue {
    background-color: var(--note-blue);
}

.color-green {
    background-color: var(--note-green);
}

.color-pink {
    background-color: var(--note-pink);
}

.color-purple {
    background-color: var(--note-purple);
}

/* Focus Mode */
#focus-mode-container {
    position: absolute;
    top: 70px;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(5px);
}

.focus-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
    width: 100%;
    height: 100%;
    justify-content: center;
}

.focus-controls {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
}

#focus-card-slot .note-card {
    width: 400px;
    height: 400px;
    font-size: 2.2rem;
    transform: rotate(0deg) !important;
    cursor: default;
}

.glass-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 12px 32px;
    border-radius: 30px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    gap: 10px;
}

.glass-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.3s;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.glass-panel {
    background: rgba(30, 30, 30, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 32px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    color: white;
    transform: translateY(0);
    transition: transform 0.3s;
}

.modal.hidden .glass-panel {
    transform: translateY(20px);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.close-modal {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s;
}

.close-modal:hover {
    color: white;
}

.setting-group {
    margin-bottom: 20px;
}

.setting-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.input-wrapper {
    display: flex;
    gap: 8px;
}

input[type="text"],
input[type="password"],
input[type="number"] {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 12px;
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    outline: none;
}

input:focus {
    border-color: var(--accent-color);
}

.hint {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 6px;
}

.divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 24px 0;
}

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

/* Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.2);
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
}

input:checked+.slider {
    background-color: var(--accent-color);
}

input:checked+.slider:before {
    transform: translateX(24px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

.primary-btn {
    background: var(--accent-color);
    color: #3e2723;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.primary-btn:hover {
    background: #ffa726;
    transform: translateY(-1px);
}

.danger-btn {
    background: rgba(211, 47, 47, 0.2);
    color: #ff8a80;
    border: 1px solid rgba(211, 47, 47, 0.5);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.danger-btn:hover {
    background: rgba(211, 47, 47, 0.4);
}

/* Editor Specific */
.note-editor {
    background: var(--note-yellow);
    /* Default bg, will change via JS */
    color: #333;
}

.note-editor .modal-header h2,
.note-editor .close-modal {
    color: #333;
}

.color-picker {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    justify-content: center;
}

.color-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.2s;
}

.color-btn.active {
    border-color: #333;
    transform: scale(1.2);
}

#note-input {
    width: 100%;
    height: 200px;
    background: transparent;
    border: none;
    font-family: var(--font-hand);
    font-size: 1.8rem;
    color: #333;
    resize: none;
    outline: none;
    line-height: 1.5;
}

#note-input::placeholder {
    color: rgba(0, 0, 0, 0.4);
}

.editor-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

/* Helper Classes */
.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
    .board-grid {
        padding: 20px;
        gap: 20px;
    }

    .note-card {
        width: 100%;
        height: auto;
        min-height: 200px;
        aspect-ratio: 1/1;
    }

    #focus-card-slot .note-card {
        width: 90vw;
        height: 90vw;
        font-size: 1.5rem;
    }

    .glass-header {
        padding: 0 16px;
    }

    .logo span {
        display: none;
        /* Hide text on small screens */
    }
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 2000;
    pointer-events: none;
}

.toast {
    background: rgba(30, 30, 30, 0.9);
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 0.95rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    pointer-events: auto;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.success {
    border-left: 4px solid #4caf50;
}

.toast.error {
    border-left: 4px solid #f44336;
}

.toast.info {
    border-left: 4px solid #2196f3;
}

.toast i {
    font-size: 1.1rem;
}

.toast.success i {
    color: #4caf50;
}

.toast.error i {
    color: #f44336;
}

.toast.info i {
    color: #2196f3;
}