/* draw-it — bubblegum theme. Two typefaces only: Fredoka (everything) and Caveat (handwritten bits). */

:root {
    --ground: #FFF1F6;
    --surface: #FFFFFF;
    --paper: #FFFAFC;
    --paper-dots: #FBD7E6;
    --ink: #3B0B2A;
    --ink-soft: #7A2E57;
    --hand: #A3245F;
    --pink: #FF4F9A;
    --pink-soft: #FFD3E6;
    --pink-faint: #FFE3EF;
    --tape: #FFC2DC;
    --deep: #C2187A;
    --deeper: #8F0F59;
    --shadow: 0 2px 0 var(--pink-soft), 0 18px 40px -18px rgba(194, 24, 122, 0.35);

    --font: 'Fredoka', ui-rounded, system-ui, sans-serif;
    --font-hand: 'Caveat', 'Bradley Hand', cursive;

    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html {
    -webkit-text-size-adjust: 100%;
    background: var(--ground);
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--ground);
    color: var(--ink);
    font-family: var(--font);
    font-weight: 400;
    font-size: 16px;
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
}

a { color: var(--deep); }
a:hover { color: var(--deeper); }

button, input { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; opacity: 0.4; }

:focus-visible {
    outline: 3px solid var(--deep);
    outline-offset: 3px;
}

.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.icon {
    width: 22px;
    height: 22px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.hand {
    font-family: var(--font-hand);
    font-weight: 700;
}

/* Page shell ------------------------------------------------------------ */

.page {
    position: relative;
    max-width: 520px;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0 auto;
    padding: calc(16px + var(--safe-top)) 20px 0;
    display: flex;
    flex-direction: column;
}

.page__grow { flex-grow: 1; min-height: 20px; }

.blob {
    position: absolute;
    pointer-events: none;
    fill: var(--pink-soft);
    z-index: 0;
}
.page > * { position: relative; z-index: 1; }
.page > .blob { position: absolute; z-index: 0; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 6px;
}

.wordmark {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--ink);
    text-decoration: none;
    font-weight: 700;
    font-size: 26px;
    letter-spacing: -0.5px;
}
.wordmark svg { width: 30px; height: 30px; }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--surface);
    border: 2px solid var(--pink-soft);
    border-radius: 999px;
    padding: 6px 12px 6px 8px;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
}
.chip .icon { width: 18px; height: 18px; stroke: #E0457B; }

.greeting {
    margin: 0;
    font-size: 25px;
    color: var(--hand);
    transform: rotate(-2deg);
    transform-origin: left;
}

.title {
    margin: 4px 0 0;
    font-weight: 600;
    font-size: 32px;
    line-height: 1.1;
    letter-spacing: -0.5px;
    overflow-wrap: anywhere;
}

/* Cards and paper -------------------------------------------------------- */

.card {
    position: relative;
    background: var(--surface);
    border-radius: 30px;
    padding: 14px;
    box-shadow: var(--shadow);
}

.card--tape::before {
    content: "";
    position: absolute;
    top: -10px;
    left: 50%;
    width: 86px;
    height: 22px;
    background: var(--tape);
    opacity: 0.85;
    border-radius: 3px;
    transform: translateX(-50%) rotate(-3deg);
}

.paper {
    position: relative;
    background-color: var(--paper);
    background-image: radial-gradient(var(--paper-dots) 1.2px, transparent 1.2px);
    background-size: 18px 18px;
    border-radius: 20px;
    overflow: hidden;
}

.doodle-view {
    width: 100%;
    aspect-ratio: 10 / 9;
    display: flex;
    align-items: center;
    justify-content: center;
}
.doodle-view canvas { display: block; }

.card__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 12px 6px 2px;
}
.card__from { font-size: 22px; color: var(--ink-soft); line-height: 1.1; }
.card__caption { margin: 2px 6px 0; font-size: 26px; line-height: 1.1; color: var(--ink); }

.badge {
    flex: none;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: var(--deeper);
    background: var(--pink-faint);
    padding: 4px 10px;
    border-radius: 999px;
}

.empty {
    text-align: center;
    padding: 28px 18px;
    color: var(--ink-soft);
}
.empty .hand { font-size: 28px; color: var(--hand); display: block; }

.note-card {
    background: var(--pink-soft);
    border-radius: 20px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.note-card .icon { width: 26px; height: 26px; stroke: var(--deeper); stroke-width: 2.1; }
.eyebrow {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--deeper);
}
.note-card__text { font-size: 24px; line-height: 1.05; }

/* "the theme was …" under a drawing */
.card__prompt {
    margin: 12px 4px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--pink-soft);
    border-radius: 16px;
    padding: 8px 12px;
}
.card__prompt[hidden] { display: none; }
.card__prompt .icon { width: 22px; height: 22px; flex: none; stroke: var(--deeper); stroke-width: 2.1; }
.card__prompt > span { display: flex; flex-direction: column; min-width: 0; }
.card__prompt .hand { font-size: 22px; line-height: 1.05; color: var(--ink); }
.tile__prompt {
    display: flex;
    align-items: flex-start;
    gap: 4px;
    margin-top: 3px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.25;
    color: var(--hand);
}
.tile__prompt .icon { width: 13px; height: 13px; flex: none; margin-top: 1px; stroke: currentColor; stroke-width: 2.2; }

/* Buttons ------------------------------------------------------------------ */

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 58px;
    padding: 0 24px;
    border: 0;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 600;
    font-size: 20px;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn--primary {
    background: var(--deep);
    color: #FFFFFF;
    box-shadow: 0 6px 0 var(--deeper);
}
.btn--primary:hover { color: #FFFFFF; }
.btn--primary:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--deeper); }
.btn--primary .icon { stroke: #FFFFFF; }
.btn--light {
    background: #FFFFFF;
    color: var(--ink);
    box-shadow: 0 6px 0 var(--deep);
}
.btn--light:hover { color: var(--ink); }
.btn--light:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--deep); }
.btn--link {
    height: 52px;
    background: transparent;
    color: var(--ink);
    font-size: 17px;
    text-decoration: underline;
    text-underline-offset: 4px;
}
.btn--link:hover { color: var(--ink); }

.icon-btn {
    width: 48px;
    height: 48px;
    flex: none;
    border-radius: 999px;
    background: var(--surface);
    border: 2px solid var(--pink-soft);
    color: var(--ink);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    padding: 0;
}
.icon-btn .icon { width: 20px; height: 20px; stroke-width: 2.5; }

/* Reactions ---------------------------------------------------------------- */

.reactions {
    display: flex;
    gap: 8px;
    padding-top: 16px;
}
.reaction {
    flex: 1 1 0;
    min-width: 0;
    height: 48px;
    padding: 0 8px;
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink-soft);
    border: 2px solid var(--pink-soft);
    font-weight: 600;
    font-size: 20px;
    line-height: 1;
    transition: transform 0.15s ease, background 0.15s ease;
}
.reaction[aria-pressed="true"] {
    background: var(--pink);
    border-color: var(--pink);
    color: var(--ink);
}
.reaction.pop { animation: pop 0.35s ease; }
@keyframes pop {
    40% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

.feedback {
    margin: 12px 0 0;
    text-align: center;
    font-size: 15px;
    color: var(--ink-soft);
}

/* Tab bar ------------------------------------------------------------------ */

.tabbar {
    position: sticky;
    bottom: calc(14px + var(--safe-bottom));
    margin: 0 0 calc(14px + var(--safe-bottom));
    height: 68px;
    background: var(--surface);
    border-radius: 28px;
    display: flex;
    align-items: center;
    justify-content: space-around;
    box-shadow: 0 10px 30px -14px rgba(194, 24, 122, 0.45);
    z-index: 5;
}
.tabbar__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 64px;
    min-height: 48px;
    color: var(--ink-soft);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
}
.tabbar__item[aria-current="page"] { color: var(--deep); font-weight: 600; }
.tabbar__item .icon { width: 24px; height: 24px; stroke-width: 2.2; }
.tabbar__fab {
    width: 62px;
    height: 62px;
    margin-top: -30px;
    border-radius: 999px;
    background: var(--pink);
    border: 5px solid var(--ground);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink);
}
.tabbar__fab:hover { color: var(--ink); }
.tabbar__fab .icon { width: 26px; height: 26px; stroke-width: 2.6; }

/* Draw page ---------------------------------------------------------------- */

.draw-page {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    overscroll-behavior: none;
}
.draw {
    max-width: 560px;
    height: 100%;
    margin: 0 auto;
    padding: calc(12px + var(--safe-top)) 16px calc(14px + var(--safe-bottom));
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.draw__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.draw__head h1 { margin: 0; font-weight: 600; font-size: 20px; text-align: center; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.draw__head-actions { display: flex; gap: 6px; }

.draw__canvas {
    flex: 1 1 auto;
    min-height: 220px;
    border-radius: 28px;
    box-shadow: var(--shadow);
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}
.draw__canvas .canvas-container { position: absolute !important; inset: 0; }
.draw__hint {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    font-size: 28px;
    color: #C9A4B8;
    transition: opacity 0.2s ease;
}
.draw__canvas.has-ink .draw__hint { opacity: 0; }
.draw__canvas.erasing { cursor: cell; }

.toolrow { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pill-group {
    display: flex;
    gap: 4px;
    background: var(--surface);
    border-radius: 999px;
    padding: 4px;
}
.tool {
    width: 44px;
    height: 44px;
    border-radius: 999px;
    border: 0;
    background: transparent;
    color: var(--ink-soft);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.tool[aria-pressed="true"] { background: var(--ink); color: #FFFFFF; }
.tool--size[aria-pressed="true"] { background: var(--pink-faint); }
.size-dot {
    display: block;
    border-radius: 999px;
    background: var(--brush, var(--pink));
}

.palette { display: flex; justify-content: space-between; gap: 4px; }
.swatch {
    width: 40px;
    height: 40px;
    flex: none;
    border-radius: 999px;
    border: 3px solid #FFFFFF;
    box-shadow: 0 0 0 1px #F5B8D2;
    padding: 0;
    transition: transform 0.12s ease;
}
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--ink); transform: scale(1.06); }

.caption-input {
    width: 100%;
    height: 48px;
    border-radius: 16px;
    border: 2px solid var(--pink-soft);
    background: var(--surface);
    padding: 0 16px;
    font-family: var(--font-hand);
    font-weight: 700;
    font-size: 22px;
    color: var(--ink);
}
.caption-input::placeholder { color: #B98AA3; }
.caption-input:focus { outline: none; border-color: var(--pink); }

.draw__send { flex: none; height: 56px; margin-bottom: 5px; }

/* Sent page ---------------------------------------------------------------- */

.sent-page { background: var(--pink); }
html:has(.sent-page) { background: var(--pink); }
.sent {
    text-align: center;
    align-items: center;
    padding-bottom: calc(20px + var(--safe-bottom));
}
.sent__confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.polaroid {
    width: 220px;
    background: #FFFFFF;
    padding: 12px 12px 6px;
    border-radius: 8px;
    transform: rotate(-4deg);
    box-shadow: 0 24px 40px -20px rgba(59, 11, 42, 0.55);
    animation: drop-in 0.6s cubic-bezier(.2, 1.4, .4, 1) both;
}
.polaroid .paper { aspect-ratio: 1; border-radius: 4px; display: flex; align-items: center; justify-content: center; background-size: 12px 12px; background-image: radial-gradient(var(--paper-dots) 1px, transparent 1px); }
.polaroid img { width: 88%; height: 88%; object-fit: contain; }
.polaroid__caption { font-size: 22px; color: var(--ink-soft); padding-top: 4px; min-height: 30px; }
@keyframes drop-in {
    from { opacity: 0; transform: translateY(-40px) rotate(6deg); }
    to { opacity: 1; transform: translateY(0) rotate(-4deg); }
}
.sent h1 { margin: 36px 0 0; font-weight: 700; font-size: 40px; line-height: 1.05; letter-spacing: -0.5px; }
.sent p { margin: 10px auto 0; font-size: 18px; line-height: 1.45; max-width: 300px; }
.streak-dark {
    margin-top: 20px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--ink);
    color: #FFFFFF;
    border-radius: 999px;
    padding: 10px 16px 10px 12px;
    font-weight: 500;
    font-size: 15px;
}
.streak-dark .icon { width: 20px; height: 20px; stroke: #FF9CC8; }
.sent__actions { width: 100%; display: flex; flex-direction: column; gap: 10px; }

/* Diary -------------------------------------------------------------------- */

.segmented {
    margin-top: 16px;
    display: flex;
    gap: 4px;
    background: var(--surface);
    border-radius: 999px;
    padding: 4px;
}
.segmented a {
    flex: 1 1 0;
    min-width: 0;
    height: 44px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    color: var(--ink-soft);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.segmented a[aria-current="page"] { background: var(--ink); color: #FFFFFF; font-weight: 600; }

.month {
    margin: 22px 0 10px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-soft);
}
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 700px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.tile {
    display: block;
    width: 100%;
    text-align: left;
    background: var(--surface);
    border: 0;
    border-radius: 22px;
    padding: 8px;
    box-shadow: 0 2px 0 var(--pink-soft);
    color: var(--ink);
}
.tile .paper { aspect-ratio: 1; border-radius: 16px; background-size: 12px 12px; background-image: radial-gradient(var(--paper-dots) 1px, transparent 1px); display: flex; align-items: center; justify-content: center; }
.tile img, .tile canvas { width: 82%; height: 82%; object-fit: contain; }
.tile__star {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 26px;
    height: 26px;
    border-radius: 999px;
    background: var(--pink);
    color: var(--ink);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}
.tile__text { padding: 8px 6px 4px; }
.tile__caption { font-size: 21px; line-height: 1.05; overflow-wrap: anywhere; }
.tile__meta { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }

.diary-foot { text-align: center; padding: 26px 0 8px; }
.diary-foot a,
.diary-foot button { color: var(--ink-soft); font: inherit; font-size: 15px; display: inline-block; padding: 12px; background: none; border: 0; text-decoration: underline; cursor: pointer; }
.diary-foot form { margin: 0; }

.viewer {
    width: min(92vw, 480px);
    border: 0;
    padding: 14px;
    border-radius: 30px;
    background: var(--surface);
    color: var(--ink);
    box-shadow: 0 30px 60px -20px rgba(59, 11, 42, 0.5);
}
.viewer::backdrop { background: rgba(59, 11, 42, 0.45); }
.viewer__actions { display: flex; gap: 8px; padding-top: 12px; }
.viewer__actions .reaction { flex: 1 1 0; }

/* Login -------------------------------------------------------------------- */

.login-art { position: absolute; top: 0; left: 0; width: 100%; height: 380px; pointer-events: none; }
.login { max-width: 440px; padding-bottom: calc(24px + var(--safe-bottom)); }
.login__brand { text-align: center; margin-top: 270px; }
.login__brand h1 { margin: 0; font-weight: 700; font-size: 48px; letter-spacing: -1px; line-height: 1; }
.login__brand p { margin: 6px 0 0; font-size: 27px; color: var(--hand); }
.form {
    margin-top: 26px;
    background: var(--surface);
    border-radius: 28px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: 0 18px 40px -22px rgba(194, 24, 122, 0.45);
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 15px; font-weight: 600; }
.field input {
    height: 52px;
    border-radius: 16px;
    border: 2px solid var(--pink-soft);
    background: #FFF8FB;
    padding: 0 16px;
    font-size: 17px;
}
.field input:focus { outline: none; border-color: var(--pink); }
.alert {
    margin: 0;
    background: var(--pink-faint);
    color: var(--deeper);
    border-radius: 14px;
    padding: 10px 14px;
    font-size: 15px;
    font-weight: 500;
}
.login__foot { margin: 0; text-align: center; font-size: 14px; color: var(--ink-soft); }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
