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

@font-face {
    font-family: 'Kinko';
    /* src: url('fonts/KINKEE__.TTF') format('truetype'); */
    src: url('fonts/PabasingSignature-q2x3d.otf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

body {
    cursor: url('media/heart.cur'), default;
    cursor: url('media/heart.cur'), pointer;
    cursor: url('media/heart.cur'), hover;
    cursor: url('media/heart.cur'), active;
    cursor: url('media/heart.cur'), progress;
    cursor: url('media/heart.cur'), grab;
    cursor: url('media/heart.cur'), grabbing;
    cursor: url('media/heart.cur'), help;
    cursor: url('media/heart.cur'), text;
    cursor: url('media/heart.cur'), not-allowed;

    
    font-family: monospace;
    background: #ffc3e0;
    /* background-image: url('media/shatter.jpg'); */
    background-image: url('media/grid.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    min-height: 100vh;
    padding: 15px;
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
}

/* background video */
/* #backgroundVideo {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -1;
    pointer-events: none;
}

/* customizable snowflake styling */
.snowflake {
  color: #fff;
  font-size: 1em;
  font-family: Arial;
  text-shadow: 0 0 1px #000;
}

@-webkit-keyframes snowflakes-fall{0%{top:-10%}100%{top:100%}}@-webkit-keyframes snowflakes-shake{0%{-webkit-transform:translateX(0px);transform:translateX(0px)}50%{-webkit-transform:translateX(80px);transform:translateX(80px)}100%{-webkit-transform:translateX(0px);transform:translateX(0px)}}@keyframes snowflakes-fall{0%{top:-10%}100%{top:100%}}@keyframes snowflakes-shake{0%{transform:translateX(0px)}50%{transform:translateX(80px)}100%{transform:translateX(0px)}}.snowflake{position:fixed;top:-10%;z-index:9999;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default;-webkit-animation-name:snowflakes-fall,snowflakes-shake;-webkit-animation-duration:10s,3s;-webkit-animation-timing-function:linear,ease-in-out;-webkit-animation-iteration-count:infinite,infinite;-webkit-animation-play-state:running,running;animation-name:snowflakes-fall,snowflakes-shake;animation-duration:10s,3s;animation-timing-function:linear,ease-in-out;animation-iteration-count:infinite,infinite;animation-play-state:running,running}.snowflake:nth-of-type(0){left:1%;-webkit-animation-delay:0s,0s;animation-delay:0s,0s}.snowflake:nth-of-type(1){left:10%;-webkit-animation-delay:1s,1s;animation-delay:1s,1s}.snowflake:nth-of-type(2){left:20%;-webkit-animation-delay:6s,.5s;animation-delay:6s,.5s}.snowflake:nth-of-type(3){left:30%;-webkit-animation-delay:4s,2s;animation-delay:4s,2s}.snowflake:nth-of-type(4){left:40%;-webkit-animation-delay:2s,2s;animation-delay:2s,2s}.snowflake:nth-of-type(5){left:50%;-webkit-animation-delay:8s,3s;animation-delay:8s,3s}.snowflake:nth-of-type(6){left:60%;-webkit-animation-delay:6s,2s;animation-delay:6s,2s}.snowflake:nth-of-type(7){left:70%;-webkit-animation-delay:2.5s,1s;animation-delay:2.5s,1s}.snowflake:nth-of-type(8){left:80%;-webkit-animation-delay:1s,0s;animation-delay:1s,0s}.snowflake:nth-of-type(9){left:90%;-webkit-animation-delay:3s,1.5s;animation-delay:3s,1.5s} */


.header {
    text-align: center;
    color: #fff;
    margin-bottom: 15px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.header h1 {
    font-family: 'Kinko', sans-serif;
    font-size: 5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #a855f7 0%, #c084fc 50%, #e879f9 100%);
    background-clip: text;
    margin-bottom: 5px;
}

.decorative-header {
    font-family: 'Kinko', sans-serif;
}

.decorative-header span {
    display: inline-block;
    background: linear-gradient(90deg, 
        #000000 0%, 
        #e53cff 12.5%, 
        #fe71b8 25%, 
        #e879f9 37.5%, 
        #c084fc 50%, 
        #9d38ab 62.5%, 
        #a855f7 75%, 
        #c084fc 87.5%, 
        #d059ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    background-size: 300% 100%;
    animation: twinkleWaveHeader 3s ease-in-out infinite;
    transform-origin: center;
}

/* create wave effect with different delays for each letter */
.decorative-header span:nth-child(1) { animation-delay: 0s; }
.decorative-header span:nth-child(2) { animation-delay: 0.1s; }
.decorative-header span:nth-child(3) { animation-delay: 0.2s; }
.decorative-header span:nth-child(4) { animation-delay: 0.3s; }
.decorative-header span:nth-child(5) { animation-delay: 0.4s; }
.decorative-header span:nth-child(6) { animation-delay: 0.5s; }
.decorative-header span:nth-child(7) { animation-delay: 0.6s; }
.decorative-header span:nth-child(8) { animation-delay: 0.7s; }
.decorative-header span:nth-child(9) { animation-delay: 0.8s; }
.decorative-header span:nth-child(10) { animation-delay: 0.9s; }
.decorative-header span:nth-child(11) { animation-delay: 1.0s; }
.decorative-header span:nth-child(12) { animation-delay: 1.1s; }
.decorative-header span:nth-child(13) { animation-delay: 1.2s; }
.decorative-header span:nth-child(14) { animation-delay: 1.3s; }
.decorative-header span:nth-child(15) { animation-delay: 1.4s; }
.decorative-header span:nth-child(16) { animation-delay: 1.5s; }
.decorative-header span:nth-child(17) { animation-delay: 1.6s; }
.decorative-header span:nth-child(18) { animation-delay: 1.7s; }
.decorative-header span:nth-child(19) { animation-delay: 1.8s; }

@keyframes twinkleWaveHeader {
    0% {
        background-position: -150% 50%;
        opacity: 0.7;
        transform: scale(1);
    }
    25% {
        background-position: -50% 50%;
        opacity: 1;
        transform: scale(1.02);
    }
    50% {
        background-position: 50% 50%;
        opacity: 1;
        transform: scale(1);
    }
    75% {
        background-position: 150% 50%;
        opacity: 1;
        transform: scale(1.02);
    }
    100% {
        background-position: 250% 50%;
        opacity: 0.7;
        transform: scale(1);
    }
}

.header p {
    color: linear-gradient(135deg, #a855f7 0%, #c084fc 50%, #e879f9 100%);;
    font-size: 1rem;
}

.decorative-text {
    display: inline-block;
    text-align: center;
    width: 100%;
}

.decorative-text span {
    display: inline-block;
    background: linear-gradient(90deg, 
        #a855f7 0%, 
        #c084fc 25%, 
        #e879f9 50%, 
        #c084fc 75%, 
        #a855f7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    background-size: 200% 100%;
    animation: twinkleWave 2.5s ease-in-out infinite;
}

/* Create wave effect with different delays for each character */
.decorative-text span:nth-child(1) { animation-delay: 0s; }
.decorative-text span:nth-child(2) { animation-delay: 0.15s; }
.decorative-text span:nth-child(3) { animation-delay: 0.3s; }
.decorative-text span:nth-child(4) { animation-delay: 0.45s; }
.decorative-text span:nth-child(5) { animation-delay: 0.6s; }
.decorative-text span:nth-child(6) { animation-delay: 0.75s; }
.decorative-text span:nth-child(7) { animation-delay: 0.9s; }
.decorative-text span:nth-child(8) { animation-delay: 1.05s; }
.decorative-text span:nth-child(9) { animation-delay: 1.2s; }
.decorative-text span:nth-child(10) { animation-delay: 1.35s; }
.decorative-text span:nth-child(11) { animation-delay: 1.5s; }
.decorative-text span:nth-child(12) { animation-delay: 1.65s; }
.decorative-text span:nth-child(13) { animation-delay: 1.8s; }
.decorative-text span:nth-child(14) { animation-delay: 1.95s; }
.decorative-text span:nth-child(15) { animation-delay: 2.1s; }
.decorative-text span:nth-child(16) { animation-delay: 2.25s; }
.decorative-text span:nth-child(17) { animation-delay: 2.4s; }
.decorative-text span:nth-child(18) { animation-delay: 2.55s; }

@keyframes twinkleWave {
    0% {
        background-position: -100% 50%;
        opacity: 0.6;
    }
    50% {
        background-position: 100% 50%;
        opacity: 1;
    }
    100% {
        background-position: -100% 50%;
        opacity: 0.6;
    }
}

.main-container {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 15px;
    max-width: 1400px;
    margin: 0 auto;
    min-height: calc(100vh - 120px);
}

.drawing-section {
    background: rgba(255, 166, 254, 0.647);
    padding: 18px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.tool-btn {
    padding: 12px 18px;
    border: 2px solid #a855f7;
    color: #c084fc;
    border-radius: 15px;
    cursor: pointer;
    font-size: 1.3rem;
    transition: all 0.3s;
    box-shadow: 0 4px 10px rgba(168, 85, 247, 0.2);
}

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

.tool-btn.active {
    background: rgba(255, 166, 254, 0.647);
    color: #fff;
}

.color-picker {
    display: flex;
    gap: 10px;
    align-items: center;
}

.color-btn {
    width: 45px;
    height: 45px;
    border: 3px solid #2a1a3d;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
}

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

.custom-color-btn {
    font-size: 1.2rem;
    background: #ffffff;
    border: 3px solid #2a1a3d;
}

.custom-color-btn:hover {
    transform: scale(1.15);
}

.custom-color-btn.active {
    border-color: #efdeff;
}

/* Color Picker Modal */
.color-picker-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.color-picker-content {
    background: rgba(255, 166, 254, 0.95);
    border: 3px solid #a855f7;
    border-radius: 25px;
    padding: 25px;
    box-shadow: 
        0 0 30px rgba(168, 85, 247, 0.5),
        0 10px 40px rgba(0, 0, 0, 0.5);
    max-width: 400px;
    width: 90%;
}

.color-picker-content h3 {
    color: #a855f7;
    font-size: 1.5rem;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 800;
}

.color-preview-container {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    justify-content: center;
}

.color-preview {
    width: 80px;
    height: 80px;
    border: 4px solid #a855f7;
    border-radius: 15px;
    background: #000000;
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.4);
}

.color-hex-display {
    background: #2a1a3d;
    padding: 12px 20px;
    border-radius: 15px;
    border: 2px solid #a855f7;
}

.color-hex-display span {
    color: #e879f9;
    font-size: 1.2rem;
    font-weight: 700;
    font-family: monospace;
}

.rgb-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 25px;
}

.rgb-slider {
    display: flex;
    align-items: center;
    gap: 15px;
}

.rgb-slider label {
    color: #c084fc;
    font-weight: 600;
    min-width: 60px;
    font-size: 1rem;
}

.rgb-slider label span {
    color: #e879f9;
    font-weight: 700;
    min-width: 35px;
    display: inline-block;
}

.rgb-slider input[type="range"] {
    flex: 1;
    height: 8px;
    accent-color: #a855f7;
    background: #2a1a3d;
    border-radius: 5px;
}

.color-picker-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.color-picker-buttons .btn {
    flex: 1;
    min-width: 120px;
}

.brush-size {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #c084fc;
    font-weight: 600;
}

.brush-size input {
    width: 120px;
    accent-color: #a855f7;
}

.brush-size span {
    color: #e879f9;
    font-size: 1.1rem;
    min-width: 30px;
}


.canvas-container {
    overflow: visible;
    background: #fff;
    display: inline-block;
    flex-shrink: 0;
    margin: 0 auto;
    width: 650px;
    height: 650px;
    position: relative;
}

.draggable-image {
    position: absolute;
    cursor: move;
    border: 2px solid #a855f7;
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.4);
    user-select: none;
    z-index: 10;
}

.draggable-image.selected {
    border-color: #e879f9;
    box-shadow: 0 0 0 2px rgba(232, 121, 249, 0.5), 0 4px 15px rgba(168, 85, 247, 0.6);
}

.draggable-image img {
    display: block;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.resize-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #a855f7;
    border: 2px solid white;
    border-radius: 50%;
    cursor: nwse-resize;
    z-index: 11;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.resize-handle.bottom-right {
    bottom: -6px;
    right: -6px;
    cursor: nwse-resize;
}

.resize-handle.bottom-left {
    bottom: -6px;
    left: -6px;
    cursor: nesw-resize;
}

.resize-handle.top-right {
    top: -6px;
    right: -6px;
    cursor: nesw-resize;
}

.resize-handle.top-left {
    top: -6px;
    left: -6px;
    cursor: nwse-resize;
}

.delete-handle {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    background: #ff6b6b;
    border: 2px solid white;
    border-radius: 50%;
    cursor: pointer;
    z-index: 12;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: white;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.delete-handle:hover {
    background: #ff5252;
    transform: scale(1.1);
}

#drawingCanvas {
    display: block;
    cursor: crosshair;
    background: white;
    touch-action: none; /* Prevent scrolling while drawing */
    -webkit-touch-callout: none; /* Disable iOS callout */
    -webkit-user-select: none; /* Disable selection */
    user-select: none;
}

.controls {
    margin-top: 12px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 15px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.btn-primary {
    background: rgba(252, 76, 250, 0.647);
    color: white;
}

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

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    transform: translateY(-2px) scale(1.05);
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px) scale(1.05);
}

/* Undo/Redo buttons in toolbar - styled as tool buttons */
#undoBtn:disabled,
#redoBtn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    background: #ffffff;
    pointer-events: none;
}

.billboard-section {
    background: rgba(255, 166, 254, 0.647);
    border: 3px solid #a855f7;
    padding: 18px;
    box-shadow: 
        0 0 20px rgba(84, 23, 141, 0.3),
        0 10px 40px rgba(0, 0, 0, 0.5),
        inset 0 0 20px rgba(168, 85, 247, 0.1);
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

.billboard-section::-webkit-scrollbar {
    width: 10px;
}

.billboard-section::-webkit-scrollbar-track {
    background: #ff9cea;
}

.billboard-section::-webkit-scrollbar-thumb {
    background: #a855f7;
    border-radius: 10px;
}

.billboard-title {
    font-size: 1.5rem;
    font-weight: 800;
    background: rgba(182, 44, 168, 0.647);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 15px;
    text-align: center;
    flex-shrink: 0;
}

.messages-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    flex: 1;
    min-height: 0; /* Allows flex child to shrink below content size */
}

.message-card {
    border: 2px solid #e860f2;
    border-radius: 15px;
    padding: 12px;
    background: rgba(255, 166, 254, 0.647);
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(246, 190, 255, 0.3);
    flex-shrink: 0;
}

.message-image {
    width: 100%;
    border-radius: 12px;
    margin-bottom: 8px;
    border: 2px solid #e860f2;
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.3);
}

.message-info {
    font-size: 0.95rem;
    color: #c084fc;
    font-weight: 600;
}

.message-info strong {
    color: #e879f9;
}

.loading {
    text-align: center;
    padding: 20px;
    color: #c084fc;
    font-size: 1.1rem;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: #a855f7;
    font-size: 1.1rem;
    font-weight: 600;
}

input[type="text"] {
    padding: 12px 16px;
    border: 2px solid #2a1a3d;
    border-radius: 15px;
    font-size: 1rem;
    width: 220px;
    background: #2a1a3d;
    color: #c084fc;
    transition: all 0.3s;
}

input[type="text"]::placeholder {
    color: #9333ea;
}

input[type="text"]:focus {
    outline: none;
    border-color: #a855f7;
    background: #2d1f42;
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.4);
    color: #e879f9;
}

/* Kawaii sparkle animations */
@keyframes sparkle {
    0%, 100% {
        opacity: 0;
        transform: scale(0) rotate(0deg);
    }
    50% {
        opacity: 1;
        transform: scale(1) rotate(180deg);
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-10px) rotate(5deg);
    }
}

.sparkle {
    display: inline-block;
    animation: sparkle 2s ease-in-out infinite;
}


/* Tablet and below */
@media (max-width: 1024px) {
    .main-container {
        grid-template-columns: 1fr;
        height: auto;
        gap: 15px;
    }
    
    .drawing-section {
        height: auto;
    }
    
    .billboard-section {
        height: 400px;
    }
}

/* Mobile devices */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .header {
        margin-bottom: 10px;
    }
    
    .header h1 {
        font-size: 1.8rem;
        margin-bottom: 5px;
    }
    
    .header p {
        font-size: 0.9rem;
    }
    
    .main-container {
        grid-template-columns: 1fr;
        gap: 12px;
        height: auto;
    }
    
    .drawing-section {
        padding: 15px;
        height: auto;
    }
    
    .toolbar {
        gap: 6px;
        margin-bottom: 10px;
    }
    
    .tool-btn {
        padding: 10px 14px;
        font-size: 1.1rem;
        min-height: 44px; /* iOS touch target minimum */
    }
    
    .color-btn {
        width: 40px;
        height: 40px;
        min-width: 44px;
        min-height: 44px;
    }
    
    .brush-size {
        font-size: 0.9rem;
    }
    
    .brush-size input {
        width: 100px;
    }
    
    .canvas-container {
        width: 100%;
        max-width: 100%;
    }
    
    #drawingCanvas {
        width: 100%;
        height: auto;
        max-width: 100%;
    }
    
    .controls {
        margin-top: 10px;
        gap: 6px;
        flex-direction: column;
    }
    
    .controls input[type="text"] {
        width: 100%;
        padding: 12px;
        font-size: 16px; /* Prevents zoom on iOS (must be 16px or larger) */
        -webkit-appearance: none;
        appearance: none;
        border-radius: 15px;
    }
    
    .btn {
        width: 100%;
        padding: 14px 20px;
        font-size: 1rem;
        min-height: 44px; /* iOS touch target minimum */
    }
    
    .billboard-section {
        padding: 15px;
        height: 350px;
        max-height: 50vh;
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    }
    
    .billboard-title {
        font-size: 1.3rem;
        margin-bottom: 12px;
    }
    
    .messages-grid {
        gap: 10px;
    }
    
    .message-card {
        padding: 10px;
    }
    
    .message-image {
        margin-bottom: 6px;
    }
    
    .message-info {
        font-size: 0.85rem;
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    body {
        padding: 8px;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .header p {
        font-size: 0.85rem;
    }
    
    .color-picker-content {
        padding: 20px;
        max-width: 90%;
    }
    
    .color-picker-content h3 {
        font-size: 1.2rem;
        margin-bottom: 15px;
    }
    
    .color-preview {
        width: 60px;
        height: 60px;
    }
    
    .color-hex-display {
        padding: 10px 15px;
    }
    
    .color-hex-display span {
        font-size: 1rem;
    }
    
    .rgb-slider {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .rgb-slider label {
        min-width: auto;
    }
    
    .rgb-slider input[type="range"] {
        width: 100%;
    }
    
    .color-picker-buttons {
        flex-direction: column;
    }
    
    .color-picker-buttons .btn {
        width: 100%;
    }
    
    .drawing-section {
        padding: 12px;
    }
    
    .toolbar {
        gap: 5px;
    }
    
    .tool-btn {
        padding: 8px 12px;
        font-size: 1rem;
    }
    
    .color-btn {
        width: 36px;
        height: 36px;
        min-width: 44px;
        min-height: 44px;
    }
    
    .brush-size {
        font-size: 0.85rem;
    }
    
    .brush-size input {
        width: 80px;
    }
    
    .billboard-section {
        padding: 12px;
        height: 300px;
    }
    
    .billboard-title {
        font-size: 1.1rem;
    }
    
    .message-card {
        padding: 8px;
    }
    
    .message-info {
        font-size: 0.8rem;
    }
}

