@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@400;700&family=Montserrat:wght@300;400;600&family=Dancing+Script:wght@400;700&family=Patrick+Hand&family=Indie+Flower&family=Shadows+Into+Light&family=VT323&display=swap');

:root {
    /* Palette */
    --bg-paper: #f7f4ed;
    --text-primary: #4a4a4a;

    /* Scrapbook Colors */
    --note-cream: #fff9e6;
    --note-pink: #e2c2c6;
    --note-blue: #c4d7e0;
    --note-green: #b8c6a9;
    --note-lavender: #e6e6fa;
    --note-peach: #ffdab9;
    --note-mint: #e0f2f1;

    /* Expanded Palette */
    --note-white: #ffffff;
    --note-rose: #f8bbd0;
    --note-sky: #b3e5fc;
    --note-teal: #b2dfdb;
    --note-orange: #ffe0b2;
    --note-gold: #fff9c4;
    --note-indigo: #c5cae9;
    --note-brown: #d7ccc8;
    --note-lime: #f0f4c3;

    /* User Requested */
    --note-blush: #f5dbdf;
    --note-silver: #d7d7d7;
    --note-slate: #7393b3;

    /* Accents */
    --tape-color: rgba(255, 255, 255, 0.4);
    --shadow-soft: rgba(0, 0, 0, 0.1);
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-paper);
    /* Pattern of subtle stars */
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23dccfc6' fill-opacity='0.4'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    font-family: 'Montserrat', sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
}

header {
    text-align: center;
    padding: 3rem 1rem 1rem;
    color: #5d5d5d;
    position: relative;
    z-index: 10;
}

.logout-link {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 1.5rem;
    text-decoration: none;
    opacity: 0.3;
    transition: opacity 0.3s;
}

.logout-link:hover {
    opacity: 1;
}

h1 {
    font-size: 3rem;
    font-weight: 300;
    letter-spacing: 2px;
    margin: 0;
    text-transform: uppercase;
    position: relative;
    display: inline-block;
}

h1::after {
    content: '☾';
    position: absolute;
    top: -25px;
    right: -35px;
    font-size: 3.5rem;
    color: #ffd8a8;
}

.subtitle {
    font-family: 'Caveat', cursive;
    font-size: 1.5rem;
    color: #888;
    margin-top: 5px;
}

.board {
    width: 90%;
    max-width: 1200px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 40px;
    padding: 40px 20px 100px;
    position: relative;
    align-items: flex-start;
    /* Support absolute children */
    min-height: 80vh;
    /* Ensure drop area */
}

/* Scrapbook Note Styles */
.note {
    width: 260px;
    min-height: 260px;
    background-color: var(--note-cream);
    box-shadow: 2px 5px 15px var(--shadow-soft);
    padding: 50px 20px 20px;
    box-sizing: border-box;
    font-family: 'Caveat', cursive;
    font-size: 1.4rem;
    color: #444;
    position: relative;
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
    z-index: 2000;
    /* Ensure above notes (which go up to 1000) */
    display: flex;
    flex-shrink: 0 !important;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.3s ease;
    outline: none !important;
    /* Asegura que no haya borde de selección */
}

/* Shapes - CORREGIDO: Sin bordes de debug */
/* Shapes - Allow resizing to override */
.note.wide {
    width: 320px;
    min-height: 220px;
}

.note.tall {
    width: 220px;
    min-height: 320px;
}

/* Washi Tape Effect */
.note::before {
    content: '';
    position: absolute;
    top: -15px;
    left: 50%;
    width: 30%;
    /* Dynamic width */
    min-width: 80px;
    height: 35px;
    background-color: rgba(220, 220, 220, 0.4);
    transform: translateX(-50%) rotate(-2deg);
    backdrop-filter: blur(2px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border-left: 2px solid rgba(255, 255, 255, 0.3);
    border-right: 2px solid rgba(255, 255, 255, 0.3);
    pointer-events: none;
    /* Allow clicking handles underneath */
}

.resize-handle {
    position: absolute;
    bottom: 5px;
    right: 5px;
    width: 15px;
    height: 15px;
    cursor: nwse-resize;
    z-index: 20;
    /* Visual indicator: little corner triangle */
    background: linear-gradient(135deg, transparent 50%, #999 50%);
    opacity: 0.3;
    transition: opacity 0.2s;
    border-radius: 2px;
}

.note:hover .resize-handle {
    opacity: 0.8;
}

/* SIZES */
.note.size-small {
    width: 200px;
    min-height: 200px;
    font-size: 1.2rem;
    padding: 40px 15px 15px;
}

.note.size-large {
    width: 340px;
    min-height: 340px;
    font-size: 1.6rem;
    padding: 60px 25px 25px;
}

.note:hover {
    transform: scale(1.02) !important;
    z-index: 10;
    box-shadow: 5px 15px 25px rgba(0, 0, 0, 0.15);
}

.note-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    /* Establish height context */
    overflow-y: auto;
    scrollbar-width: none;
    line-height: 1.4;
}

.note-content::-webkit-scrollbar {
    display: none;
}

/* Image in Note */
.note-image {
    margin-bottom: 10px;
    text-align: center;
    flex: 1;
    /* Take available space */
    display: flex;
    overflow: hidden;
    /* Crop */
    min-height: 0;
    justify-content: center;
    align-items: center;
    /* Center image vertically */
    height: 100%;
    /* Pass down height to img */
}

.note-image img {
    width: 100%;
    height: var(--img-zoom, 100%) !important;
    /* Scale height */
    object-fit: cover;
    /* Crop to fit */
    border-radius: 4px;
    border: 3px solid #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    display: block;
}

/* Zoom Indicator */
.zoom-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 1.2rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 200003;
    /* Higher than resize handle */
    pointer-events: none;
    /* Let clicks pass through */
    opacity: 0;
    transition: opacity 0.3s ease;
    border: 1px solid #ddd;
    font-family: 'Segoe UI', sans-serif;
    /* Clean font */
    white-space: nowrap;
}

.zoom-indicator.visible {
    opacity: 1;
}

/* Fonts */
.font-caveat {
    font-family: 'Caveat', cursive;
}

.font-dancing {
    font-family: 'Dancing Script', cursive;
}

.font-patrick {
    font-family: 'Patrick Hand', cursive;
}

.note-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: 15px;
    border-top: 1px dashed rgba(0, 0, 0, 0.1);
    padding-top: 10px;
}

.note-meta {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.note-signature {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 2px;
    font-style: italic;
}

.note-date {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.75rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0;
    padding: 0;
}

.delete-btn {
    background: none;
    border: none;
    color: #999;
    font-size: 1.2rem;
    padding: 0 5px;
    cursor: pointer;
    line-height: 1;
    font-family: 'Montserrat', sans-serif;
    opacity: 0;
    transition: opacity 0.2s, color 0.2s;
    margin-left: 10px;
}

.note:hover .delete-btn {
    opacity: 1;
}

.delete-btn:hover {
    color: #cc5454;
    opacity: 1;
}

/* Theme Classes */
.color-yellow {
    background-color: var(--note-cream);
}

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

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

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

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

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

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

/* Tape variations */
.color-pink::before,
.color-lavender::before {
    background-color: rgba(255, 255, 255, 0.3);
}

/* Add Button */
.add-btn {
    position: fixed;
    bottom: 40px;
    right: 40px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #6d6d6d;
    color: white;
    font-size: 2rem;
    border: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    z-index: 100;
    font-weight: 100;
}

.add-btn:hover {
    background-color: var(--note-pink);
    transform: rotate(90deg);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(5px);
    z-index: 200001;
    /* Above EVERYTHING (Sidebar is 100k, Notes 2k) */
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 40px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid #eee;
    font-family: 'Montserrat', sans-serif;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h2 {
    margin: 0 0 20px 0;
    color: #444;
    font-weight: 300;
    text-align: center;
    letter-spacing: 1px;
}

/* Overlay Screen "Magic" - Blue Theme */
.overlay-screen {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: linear-gradient(135deg, #f0f8ff 0%, #e6f7ff 100%);
    /* AliceBlue gradients */
    padding: 30px;
    border-radius: 25px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2), 0 0 0 5px rgba(255, 255, 255, 0.5);
    border: 3px solid #a8d8ea;
    /* Pastel Blue */
    z-index: 20;
    width: 80%;
    max-width: 350px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.overlay-screen.pop-in {
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    pointer-events: all;
    opacity: 1;
}

@keyframes popIn {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }

    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

.overlay-screen h3 {
    margin: 0 0 10px 0;
    color: #5d9cec;
    font-family: 'Montserrat', sans-serif;
    /* Clearer font */
    font-weight: 700;
    text-transform: uppercase;
    font-size: 1.8rem;
    letter-spacing: 1px;
    text-shadow: 2px 2px 0px rgba(168, 216, 234, 0.5);
}

.overlay-screen p {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 20px;
}

.overlay-screen button {
    background: linear-gradient(to right, #4facfe 0%, #00f2fe 100%);
    /* Blue/Cyan Gradient */
    color: white;
    box-shadow: 0 4px 15px rgba(79, 172, 254, 0.4);
    font-weight: bold;
    font-size: 1.1rem;
    padding: 12px 30px;
    border-radius: 50px;
    border: none;
    transition: transform 0.2s;
}

.overlay-screen button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(79, 172, 254, 0.6);
}



.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #888;
    margin-bottom: 5px;
    letter-spacing: 1px;
}

textarea {
    width: 100%;
    height: 120px;
    border: 1px solid #eee;
    background: #fafafa;
    font-family: 'Caveat', cursive;
    font-size: 1.5rem;
    line-height: 1.5;
    padding: 15px;
    resize: none;
    box-sizing: border-box;
    color: #555;
    outline: none;
}

textarea:focus {
    background: #fff;
    border-color: #ddd;
}

input[type="text"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #eee;
    font-family: 'Montserrat', sans-serif;
    box-sizing: border-box;
}

.form-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 25px;
}

button {
    font-family: 'Montserrat', sans-serif;
    padding: 10px 30px;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: 0.2s;
}

button.save {
    background: #444;
    color: white;
}

button.cancel {
    background: transparent;
    color: #999;
    border: 1px solid #eee;
}

button:hover {
    opacity: 0.8;
}

/* Control Arrays */
.options-grid {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.radio-option {
    border: 1px solid #eee;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 0.8rem;
    border-radius: 4px;
    transition: all 0.2s;
    background: #fff;
    color: #666;
}

.radio-option:hover {
    background: #f9f9f9;
}

.radio-option.selected {
    background: #444;
    color: white;
    border-color: #444;
}

.color-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 5px;
}

.color-option {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.selected {
    border-color: #666;
    transform: scale(1.15);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* Theme Classes with !important to override component defaults */
.note.color-yellow {
    background-color: var(--note-cream) !important;
}

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

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

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

.note.color-lavender {
    background-color: var(--note-lavender) !important;
}

.note.color-peach {
    background-color: var(--note-peach) !important;
}

.note.color-mint {
    background-color: var(--note-mint) !important;
}

.note.color-salmon {
    background-color: #ffb7b2 !important;
}

.note.color-gray {
    background-color: #e0e0e0 !important;
}

.note.color-lilac {
    background-color: #dcd0ff !important;
}

/* New Colors */
.note.color-white {
    background-color: var(--note-white) !important;
}

.note.color-rose {
    background-color: var(--note-rose) !important;
}

.note.color-sky {
    background-color: var(--note-sky) !important;
}

.note.color-teal {
    background-color: var(--note-teal) !important;
}

.note.color-orange {
    background-color: var(--note-orange) !important;
}

.note.color-gold {
    background-color: var(--note-gold) !important;
}

.note.color-indigo {
    background-color: var(--note-indigo) !important;
}

.note.color-brown {
    background-color: var(--note-brown) !important;
}

.note.color-lime {
    background-color: var(--note-lime) !important;
}

.note.color-blush {
    background-color: var(--note-blush) !important;
}

.note.color-silver {
    background-color: var(--note-silver) !important;
}

.note.color-slate {
    background-color: var(--note-slate) !important;
}

/* Tape variations for new colors */
.color-salmon::before,
.color-gray::before,
.color-lilac::before {
    background-color: rgba(255, 255, 255, 0.3);
}

/* Fonts */
.font-caveat {
    font-family: 'Caveat', cursive;
}

.font-dancing {
    font-family: 'Dancing Script', cursive;
}

.font-patrick {
    font-family: 'Patrick Hand', cursive;
}

.font-indie {
    font-family: 'Indie Flower', cursive;
}

.font-shadows {
    font-family: 'Shadows Into Light', cursive;
}

/* Decorations */
.flower-deco {
    position: fixed;
    width: 200px;
    height: 200px;
    opacity: 0.1;
    pointer-events: none;
    z-index: 0;
}

.flower-1 {
    bottom: -20px;
    left: -20px;
    transform: rotate(10deg);
}

.flower-2 {
    top: -20px;
    right: -20px;
    transform: rotate(-10deg);
}

/* FABs (Floating Action Buttons) */
.fab-btn {
    position: fixed;
    right: 40px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s, box-shadow 0.2s;
    z-index: 3000;
}

.fab-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
}

.fab-btn img {
    width: 35px;
    height: 35px;
    object-fit: contain;
    pointer-events: none;
}

.play-btn {
    bottom: 90px;
    background: #fff;
}

.add-btn {
    bottom: 20px;
    background: #fff;
    font-size: 2.5rem;
    color: #555;
    padding-bottom: 5px;
}

.dog-btn {
    bottom: 160px;
    background: #fff;
}

.countdown-btn {
    bottom: 230px;
    background: #fff;
}

/* SIZES */
.note.size-small {
    width: 200px;
    min-height: 200px;
    font-size: 1.2rem;
    padding: 40px 15px 15px;
}

.note.size-large {
    width: 340px;
    min-height: 340px;
    font-size: 1.6rem;
    padding: 60px 25px 25px;
}

.game-content {
    background: #fff;
    padding: 20px;
    max-width: 800px;
    /* Wider for sidebar */
    width: 95%;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    position: relative;
    border: 1px solid #eee;
}

/* Washi Tape/Sticker effect */
.game-content::before {
    content: '';
    position: absolute;
    top: -15px;
    width: 120px;
    height: 35px;
    background-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transform: rotate(-2deg);
    backdrop-filter: blur(2px);
    border-left: 2px dashed rgba(0, 0, 0, 0.1);
    border-right: 2px dashed rgba(0, 0, 0, 0.1);
}

.game-header {
    display: flex;
    justify-content: space-between;
    width: 100%;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.game-header h2 {
    margin: 0;
    font-size: 3rem;
    /* Much bigger */
    color: #e56b6f;
    /* Accent color */
    font-weight: 700;
    font-family: 'Dancing Script', cursive;
    text-shadow: 2px 2px 0px rgba(229, 107, 111, 0.2);
    /* Soft shadow */
    transform: rotate(-2deg);
    /* Playful tilt */
    letter-spacing: 1px;
}

.close-game {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #ccc;
    transition: color 0.2s;
}

.close-game:hover {
    color: #555;
    background: transparent;
}

/* New Layout */
.game-layout {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    width: 100%;
}

.game-main {
    flex: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    /* Ensure it fills available space */
}

#gameCanvas {
    background-color: var(--bg-paper);
    border-radius: 12px;
    width: 100%;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.03);
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23dccfc6' fill-opacity='0.4'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    border: 2px solid #f0e6e6;
}

/* Sidebar Styles */
.app-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 250px;
    background: #fff;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    padding: 20px;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.app-sidebar.open {
    transform: translateX(0);
}

.sidebar-toggle {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1001;
    background: white;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 10px;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.sidebar-header {
    font-family: 'Dancing Script', cursive;
    font-size: 2rem;
    color: #4a4a4a;
    margin-bottom: 30px;
    text-align: center;
    border-bottom: 2px dashed #eee;
    padding-bottom: 10px;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    flex-grow: 1;
}

.sidebar-menu li {
    margin-bottom: 10px;
}

.sidebar-menu a {
    display: block;
    padding: 10px 15px;
    text-decoration: none;
    color: #666;
    font-family: 'Montserrat', sans-serif;
    border-radius: 8px;
    transition: background 0.2s;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background: #f7f4ed;
    color: #444;
    font-weight: 600;
}

.new-wall-btn {
    width: 100%;
    margin-top: 20px;
    padding: 10px;
    border: 2px dashed #ccc;
    background: transparent;
    color: #888;
    cursor: pointer;
    border-radius: 8px;
    font-family: 'Montserrat', sans-serif;
    transition: all 0.2s;
}

.new-wall-btn:hover {
    border-color: #aaa;
    color: #666;
    background: #f9f9f9;
}

/* Quote Styles */
.note.quote {
    /* Restore background and shadow */
    /* Default color if none selected, but specific colors should override */
    background-color: #fffbf0;

    /* Slightly different cream */
    box-shadow: 2px 5px 15px rgba(0, 0, 0, 0.1);
    border: 1px solid #e0e0e0;
    /* Subtle border instead of double */

    /* Wider dimensions - Defaults, overridable by resize */
    width: 350px;
    min-height: 180px;

    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: calc(20px * var(--scale-factor, 1));
}

.note.quote::before {
    display: none;
    /* No tape for quotes */
}

.note.quote .note-content {
    font-size: calc(0.9rem * var(--scale-factor, 1));
    /* Smaller text */
    font-style: normal;
    font-family: 'Montserrat', sans-serif;
    /* Clean font */
    color: #666;
    overflow: hidden;
    line-height: 1.4;
}

.note.quote .note-content::before {
    content: '“';
    font-size: calc(3rem * var(--scale-factor, 1));
    color: #e0e0e0;
    position: absolute;
    top: 5px;
    left: 10px;
    font-family: serif;
    pointer-events: none;
    /* Fix click blocking */
}

.note.quote .note-content::after {
    content: '”';
    font-size: calc(3rem * var(--scale-factor, 1));
    color: #e0e0e0;
    position: absolute;
    bottom: -15px;
    right: 10px;
    font-family: serif;
    pointer-events: none;
    /* Fix click blocking */
}

/* Archive Actions */
.note-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    left: auto;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 50;
}

.note:hover .note-actions {
    opacity: 1;
}

.action-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: #888;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.action-btn:hover {
    background: transparent;
    color: #444;
    transform: scale(1.1);
}

/* Archived View */
.archived-header {
    width: 100%;
    text-align: center;
    margin-bottom: 20px;
    color: #888;
}

/* Existing Sidebar override from game */
.game-sidebar {

    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-width: 200px;
}

.hud-box {
    background: #fff8f8;
    border: 2px solid #ffecec;
    border-radius: 12px;
    padding: 15px;
    text-align: center;
}

.hud-box h3 {
    margin: 0 0 5px 0;
    font-size: 1rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.score-display {
    font-size: 2.5rem;
    font-weight: bold;
    color: #e56b6f;
    font-family: 'Patrick Hand', cursive;
}

.level-display {
    font-size: 2rem;
    font-weight: bold;
    color: #6d597a;
    font-family: 'Patrick Hand', cursive;
}

.legend-box {
    background: #fff;
    border: 1px dashed #ddd;
    border-radius: 12px;
    padding: 15px;
}

.legend-box h4 {
    margin: 0 0 10px 0;
    text-align: center;
    color: #666;
    font-size: 0.9rem;
}

.legend-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    padding: 5px;
    border-bottom: 1px solid #f9f9f9;
}

.legend-item:last-child {
    border-bottom: none;
}

.legend-item img {
    width: 30px;
    height: 30px;
    object-fit: contain;
}

.legend-item span {
    font-weight: 600;
    color: #555;
    font-size: 0.9rem;
}

.game-instructions {
    margin-top: 15px;
    color: #999;
    font-size: 0.8rem;
    text-align: center;
}

/* Responsive Game */
@media (max-width: 768px) {
    .game-layout {
        flex-direction: column-reverse;
    }

    .game-sidebar {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .hud-box,
    .legend-box {
        flex: 1;
    }
}

@media (max-width: 480px) {

    /* Fullscreen Modal Fix */
    .modal-content.game-content {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        margin: 0 !important;
        max-width: 100% !important;
        max-height: 100% !important;
        border: none !important;
        border-radius: 0 !important;
        display: flex;
        flex-direction: column;
        padding: 0 !important;
    }

    /* Header: Fixed Height, Easy Access */
    .game-header {
        height: 60px;
        padding: 0 10px !important;
        background: #f4f4f4;
        border-bottom: 2px solid #333 !important;
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-shrink: 0;
    }

    .game-header h2 {
        font-size: 1.4rem !important;
        /* Larger text */
        margin: 0;
    }

    /* Buttons in header larger */
    .game-header button img {
        width: 32px !important;
        height: 32px !important;
    }

    .game-header button {
        padding: 8px !important;
    }

    /* Stats Bar */
    .game-layout {
        display: flex;
        flex-direction: column;
        flex: 1;
        overflow: hidden;
    }

    .game-sidebar {
        order: -1;
        flex-direction: row !important;
        justify-content: space-evenly;
        padding: 8px 0;
        background: #eee;
        border-bottom: 2px solid #333;
        flex-shrink: 0;
        width: 100%;
        margin: 0;
    }

    .hud-box {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .hud-box h3 {
        font-size: 0.7rem;
        margin-bottom: 2px;
    }

    /* Main Game Canvas Area */
    .game-main {
        flex: 1;
        background: #111;
        display: flex;
        align-items: center;
        justify-content: center;
        position: relative;
        width: 100%;
        overflow: hidden;
    }

    #gameCanvas {
        width: 100% !important;
        height: auto !important;
        max-height: 100%;
        object-fit: contain;
    }

    .header-legend {
        display: none !important;
    }

    .game-controls-container {
        display: flex !important;
        background: #ddd;
        padding: 10px;
        justify-content: space-around;
        flex-shrink: 0;
    }
}

/* Image Buttons in Notes */
.icon-btn-img {
    width: 20px;
    height: 20px;
    object-fit: contain;
    filter: opacity(0.6);
    transition: filter 0.2s;
}

.action-btn:hover .icon-btn-img {
    filter: opacity(1);
}

/* Game Controls */
.game-controls-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    margin-top: 20px;
}

.control-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    transition: transform 0.1s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.control-btn:active {
    transform: scale(0.9);
}

.control-btn img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    filter: drop-shadow(0 4px 0 #ddd);
}

#gameModal {
    z-index: 3000;
    /* Ensure on top of sidebar (2000) and notes */
}

/* Pixel Art / Grayscale Game Theme */
.game-content {
    border: 4px solid #333 !important;
    box-shadow: 8px 8px 0px #999 !important;
    background-color: #f4f4f4 !important;
    border-radius: 4px !important;
    /* Sharp corners */
}

.game-content::before {
    display: none;
    /* Remove stickers/tape */
}

.game-header {
    border-bottom: 4px solid #333 !important;
    padding-bottom: 5px;
    align-items: flex-end;
    /* Align bottom */
}

.game-header h2 {
    color: #333 !important;
    font-family: 'VT323', monospace !important;
    text-shadow: 2px 2px 0px #ccc !important;
    font-size: 3.5rem !important;
    margin-right: 20px;
    transform: none !important;
    /* No rotation */
}

#gameCanvas {
    border: 4px solid #333 !important;
    background-color: #fff !important;
    border-radius: 4px !important;
    background-image: none !important;
    /* Clean bg */
}

/* HUD Pixel Style */
.hud-box {
    background: #fff !important;
    border: 2px solid #333 !important;
    box-shadow: 4px 4px 0px #ccc !important;
    border-radius: 4px !important;
}

.hud-box h3 {
    color: #666 !important;
    font-family: 'VT323', monospace !important;
    font-size: 1.4rem !important;
}

.score-display,
.level-display {
    color: #333 !important;
    font-family: 'VT323', monospace !important;
    font-size: 3rem !important;
    text-shadow: none !important;
}

/* Header Legend integration styling */
.header-legend {
    display: flex;
    gap: 15px;
    margin-left: auto;
    /* Push to right */
    margin-right: 20px;
}

.legend-mini-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-family: 'VT323', monospace;
    font-size: 1.2rem;
    color: #555;
    background: #fff;
    padding: 2px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.legend-mini-item img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

/* Overlays (Pixel Style) */
.overlay-screen {
    background: rgba(255, 255, 255, 0.95) !important;
    border: 4px solid #333;
    box-shadow: 10px 10px 0px #000;
    color: #333;
    font-family: 'VT323', monospace !important;
}

.overlay-screen h3 {
    font-size: 3rem !important;
    text-transform: uppercase;
    color: #333;
    text-shadow: 2px 2px 0px #ccc;
}

.overlay-screen button {
    font-family: 'VT323', monospace !important;
    font-size: 1.5rem !important;
    background: #333 !important;
    color: #fff !important;
    border: none;
    box-shadow: 4px 4px 0px #999;
}

.overlay-screen button:hover {
    transform: translateY(2px);
    box-shadow: 2px 2px 0px #999;
}

/* Controls Explanation (Small) */
.controls-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-top: 15px;
    opacity: 0.7;
}

.controls-hint img {
    width: 30px;
    height: 30px;
    filter: grayscale(100%);
}

.controls-hint span {
    font-family: 'VT323', monospace;
    font-size: 1.2rem;
    color: #666;
}

/* Pause Button */
.pause-btn {
    background: #fff;
    border: 2px solid #333;
    cursor: pointer;
    padding: 5px;
    height: 40px;
    width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 2px 2px 0px #ccc;
    transition: all 0.1s;
}

.pause-btn:active {
    box-shadow: none;
    transform: translate(2px, 2px);
}

.pause-btn img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

/* Pixel Animation */
@keyframes blink {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}


/* Resize Handles */
/* Resize Handles */
/* Resize Handles */
/* Resize Overlay */
#resize-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.1);
    /* Very light dimming to keep game visible */
    z-index: 200000;
    display: none;
    /* Use flexbox to center content but shift it up */
    display: none;
    /* Flex override in JS usually? No, it's block. */
    /* We can't use flex here easily if it toggles to block. 
       Let's stick to absolute centering on children or pseudo-elements. 
       Wait, .overlay-screen is the container. 
       The box inside (h3, p, buttons) is inline? No, text.
       Actually, `index.php` shows:
       <div id="levelCompleteScreen" class="overlay-screen">
           <h3>...</h3>
       </div>
       So `.overlay-screen` IS the box? 
       No, `style.css` 1550 sets width 100% height 100%. 
       Where is the box style? 
       I need to find `.overlay-screen` sizing logic. 
       Ah, I see lines 1813-1817 in previous `view_file` (mobile media query) setting width 90%.
       But on desktop? 
       It seems `.overlay-screen` is BOTH the dimmer AND the box in the current CSS?
       If `width: 100%; height: 100%; background: rgba(0,0,0,0.5)`, it fills screen.
       Then the CONTENT inside (h3, p) floats?
       If so, where are they positioned? 
       Wait, I might have missed the centering styles.
       Let's use `view_file` to find where `translate(-50%, -50%)` is.
    */
}

.note.isolated-mode {
    z-index: 200001 !important;
    /* Ensure it's above the overlay */
}

/* Resize Handles */
.resize-handle {
    position: absolute;
    width: 15px;
    height: 15px;
    background: #fff;
    border: 2px solid #555;
    border-radius: 50%;
    z-index: 200002;
    /* Above note */
    display: none;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
}

.note.isolated-mode .resize-handle {
    display: block;
    /* Only show in isolated mode */
    pointer-events: auto;
}

/* Increase hit area for handles */
.resize-handle::after {
    content: '';
    position: absolute;
    top: -20px;
    left: -20px;
    right: -20px;
    bottom: -20px;
    /* Even bigger hit area */
    z-index: 10001;
    cursor: inherit;
}



.resize-handle.n {
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    cursor: n-resize;
}

.resize-handle.s {
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    cursor: s-resize;
}

.resize-handle.w {
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    cursor: w-resize;
}

.resize-handle.e {
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    cursor: e-resize;
}

.resize-handle.nw {
    top: -8px;
    left: -8px;
    cursor: nw-resize;
}

.resize-handle.ne {
    top: -8px;
    right: -8px;
    cursor: ne-resize;
}

/* Sidebar Adjustments */
.sidebar-header {
    margin-top: 60px;
    /* Push down below the toggle button */
    padding: 0 10px;
}

.sidebar-toggle {
    z-index: 10001 !important;
    /* Ensure toggle is above sidebar */
    background: rgba(255, 255, 255, 0.9);
    border-radius: 5px;
    padding: 5px 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.resize-handle.sw {
    bottom: -8px;
    left: -8px;
    cursor: sw-resize;
}

.resize-handle.se {
    bottom: -8px;
    right: -8px;
    cursor: se-resize;
}


/* Isolated Resize Mode */
#resize-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    /* Dim background */
    z-index: 4000;
    /* Below isolated note, above everything else */
    display: none;
    cursor: not-allowed;
}

.note.isolated-mode {
    z-index: 5000 !important;
    /* Topmost */
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.4), 0 10px 20px rgba(0, 0, 0, 0.5) !important;
    transition: all 0.3s ease;
}

.note.isolated-mode .resize-handle {
    display: block;
    /* Show handles only in this mode */
    border-color: #ffde59;
    /* Highlight handles */
    background: #fff;
    width: 20px;
    height: 20px;
}

#levelCompleteScreen {
    border: 4px double #333;
    /* Double border for retro feel */
    box-shadow: 0 0 0 4px #fff, 0 0 0 8px #333;
    /* Shift UP to avoid covering Pachu */
    margin-top: -150px !important;
    /* Assuming it's centered by flexbox or similar, this might help */
}

/* FORCE SIDEBAR Z-INDEX TO MAX */
.app-sidebar.open,
.app-sidebar {
    z-index: 200004 !important;
}

.sidebar-toggle {
    z-index: 200005 !important;
    color: #333 !important;
    background: #fff !important;
    border: 1px solid #eee !important;
    cursor: pointer !important;
    border-radius: 5px;
    padding: 5px 12px;
}

@media screen and (max-width: 768px) {
    .board {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 30px;
        height: auto !important;
        /* Allow growing */
        padding-bottom: 150px;
        /* Space for FABs */
    }

    .note {
        position: relative !important;
        /* Disable absolute positioning */
        top: auto !important;
        left: auto !important;
        transform: none !important;
        /* Remove rotation for clean vertical list */
        width: 90% !important;
        /* Full width */
        max-width: 350px;
        margin: 0 !important;
    }

    /* Override resized dimensions to fit screen, but respect height if reasonable */
    .note.wide,
    .note.tall {
        width: 90% !important;
    }

    /* Allow editing but disable dragging logic visual cues */
    .note {
        cursor: default !important;
    }

    /* Ensure Resize Overlay still covers if used */
    #resize-overlay {
        position: fixed;
    }

}

@media screen and (max-width: 600px) {
    .game-header {
        flex-direction: column;
        align-items: center;
        gap: 5px;
        padding-bottom: 5px;
        position: relative;
        /* Allow absolute positioning of controls */
        padding-top: 10px;
    }

    .game-controls {
        position: absolute;
        top: 5px;
        right: 10px;
        gap: 5px !important;
    }

    .game-controls button {
        transform: scale(0.8);
        /* Make buttons slightly smaller */
    }

    .game-header h2 {
        font-size: 1.4rem !important;
        margin: 0;
        width: 100%;
        text-align: center;
        padding-right: 80px;
        /* Make space for controls */
        padding-left: 10px;
    }

    .header-legend {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 5px;
    }

    .legend-mini-item {
        font-size: 0.8rem;
        padding: 1px 4px;
    }

    .legend-mini-item img {
        width: 16px;
        height: 16px;
    }

    /* HUD Optimizations */
    /* HUD Optimizations */
    /* HUD Optimizations */
    .game-layout {
        display: flex;
        flex-direction: column !important;
        /* HUD (Sidebar) Bottom */
        height: auto !important;
        /* Let content dictate height */
        min-height: 0 !important;
        gap: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .game-sidebar {
        flex: 0 0 auto !important;
        /* Do not grow */
        height: auto !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        width: 100%;
        justify-content: space-between;
        gap: 2px;
        margin: 0 !important;
        padding: 2px !important;
        align-items: center !important;
        /* Center boxes vertically, don't stretch */
        background: transparent;
    }

    .hud-box {
        flex: 1;
        /* Distribute space equally */
        min-width: 0;
        /* Allow shrinking */
        margin-bottom: 0;
        padding: 2px 0;
        /* Very tight padding */
        height: auto !important;
        /* Force fit content */
        display: flex;
        flex-direction: column;
        justify-content: center;
        border-width: 1px;
        /* Even thinner */
        background: rgba(255, 255, 255, 0.8);
    }

    /* Make the content inside very compact */
    .hud-box h3 {
        font-size: 0.5rem !important;
        /* Tiny labels */
        margin-bottom: 0px;
        line-height: 1;
        padding-top: 2px;
    }

    .score-display,
    .level-display {
        font-size: 1rem !important;
        line-height: 1.1;
        padding-bottom: 2px;
    }

    /* Move Legend below game? User suggested it.
       For now, let's keep it top but VERY compact. */
    .header-legend {
        display: flex;
        justify-content: center;
        width: 100%;
        gap: 4px !important;
        margin-top: 2px;
        margin-bottom: 2px;
        order: 3;
        /* If we used flex col on header, this works. */
    }

    .legend-mini-item {
        font-size: 0.75rem !important;
        padding: 0 3px !important;
        border-width: 1px;
    }

    /* Overlay Optimizations */
    .overlay-screen {
        width: 90% !important;
        padding: 15px !important;
        min-width: auto !important;
    }

    .overlay-screen h3 {
        font-size: 1.5rem !important;
        margin-bottom: 10px;
    }

    .overlay-screen button {
        font-size: 1rem !important;
        padding: 8px 15px !important;
    }

    #playerName {
        font-size: 1.2rem !important;
        width: 150px !important;
    }

    /* Popups text adjustments */
    .overlay-screen p {
        font-size: 0.9rem;
    }

    .game-main {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }

    canvas {
        display: block;
        margin: 0 auto;
    }
}

.no-transition {
    transition: none !important;
}

/* Disable Drag Cursor */
.note {
    cursor: default !important;
}

.note button,
.note input,
.note textarea,
.note a,
.note img {
    cursor: pointer;
}