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

body {
    font-family: system-ui, -apple-system, sans-serif;
    background: #f4ecd8;
    background-image:
        repeating-linear-gradient(45deg, transparent 0 80px, rgba(139, 90, 43, 0.04) 80px 81px),
        repeating-linear-gradient(-45deg, transparent 0 80px, rgba(139, 90, 43, 0.04) 80px 81px);
    color: #2a2a2a;
    min-height: 100dvh;
}

.app {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

.app__header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px dashed rgba(139, 90, 43, 0.25);
}

.app__header h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #1f1f1f;
}

.status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.9rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid transparent;
    background: white;
}

.status::before {
    content: "";
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    flex-shrink: 0;
}

.status--waiting {
    color: #6b7280;
    border-color: #e5e7eb;
}

.status--waiting::before {
    background: #9ca3af;
    animation: pulse 1.5s ease-in-out infinite;
}

.status--connected {
    color: #15803d;
    border-color: #bbf7d0;
}

.status--connected::before {
    background: #22c55e;
}

.status--error {
    color: #b91c1c;
    border-color: #fecaca;
}

.status--error::before {
    background: #ef4444;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.35;
    }
}

.empty {
    text-align: center;
    color: rgba(50, 30, 10, 0.55);
    font-style: italic;
    padding: 4rem 1rem;
    font-size: 1.05rem;
}

/* Post-it board */

.board {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 2rem 1.75rem;
    padding: 1rem 0.5rem;
}

.postit {
    --bg: #fff39a;
    --shadow: rgba(0, 0, 0, 0.18);
    background: var(--bg);
    background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.4) 0%, rgba(0, 0, 0, 0.04) 100%);
    padding: 1.4rem 1.1rem 1.4rem;
    min-height: 200px;
    box-shadow:
        0 1px 1px rgba(0, 0, 0, 0.1),
        0 6px 16px var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    position: relative;
    transform: rotate(var(--tilt, 0deg));
    font-family: "Caveat", "Bradley Hand", "Comic Sans MS", system-ui, cursive;
}

.postit::before {
    content: "";
    position: absolute;
    top: -10px;
    left: 50%;
    width: 60px;
    height: 22px;
    background: rgba(255, 255, 255, 0.5);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    transform: translateX(-50%) rotate(-2deg);
    pointer-events: none;
}

.postit:hover {
    transform: rotate(0deg) scale(1.03);
    box-shadow:
        0 2px 4px rgba(0, 0, 0, 0.12),
        0 12px 28px rgba(0, 0, 0, 0.22);
    z-index: 2;
}

/* Vary the tilt + tint per card so the board looks organic */
.postit:nth-child(5n + 1) {
    --tilt: -2.2deg;
    --bg: #fff39a;
}

.postit:nth-child(5n + 2) {
    --tilt: 1.8deg;
    --bg: #fbb6c0;
}

.postit:nth-child(5n + 3) {
    --tilt: -0.6deg;
    --bg: #b6e3ff;
}

.postit:nth-child(5n + 4) {
    --tilt: 2.6deg;
    --bg: #c8f5b6;
}

.postit:nth-child(5n + 5) {
    --tilt: -1.4deg;
    --bg: #ffd8a8;
}

.postit__head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
    font-size: 0.95rem;
    color: rgba(0, 0, 0, 0.55);
    border-bottom: 1px dashed rgba(0, 0, 0, 0.15);
    padding-bottom: 0.4rem;
}

.postit__name {
    font-weight: 700;
    color: rgba(0, 0, 0, 0.78);
    font-size: 1.1rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.postit__time {
    flex-shrink: 0;
    font-size: 0.85rem;
}

.postit__body {
    font-size: 1.35rem;
    line-height: 1.35;
    color: #1f1f1f;
    flex: 1;
    word-break: break-word;
    white-space: pre-wrap;
}
