@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@500;600;700&family=Fraunces:ital,opsz,wght@0,9..144,500;0,9..144,600;0,9..144,700;1,9..144,500&family=Nunito:wght@400;600;700&display=swap');

:root {
    --purple-deep: rgb(54, 26, 109);
    --purple-mid: rgb(94, 84, 181);
    --purple-border: rgba(72, 63, 160, 0.5);
    --lavender: rgb(197, 199, 226);
    --cyan: rgb(134, 218, 233);
    --teal: rgb(106, 169, 179);
    --orange: rgb(255, 172, 92);
    --orange-dark: rgb(83, 38, 2);
    --orange-border: rgba(147, 97, 15, 0.5);
    --gradient: linear-gradient(135deg, rgb(41, 68, 162) 0%, rgb(69, 221, 215) 100%);
    --glass: rgba(255, 255, 255, 0.12);
    --glass-border: rgba(255, 255, 255, 0.28);
    --font-body: "Nunito", system-ui, sans-serif;
    --font-display: "Fraunces", "Georgia", serif;
    --font-script: "Caveat", "Segoe Print", cursive;
    --primary-font: var(--font-body);
    --script-font: var(--font-script);
    --radius: 14px;
    --radius-sm: 10px;
    --shadow-chunky: 0 0 0 2px var(--purple-deep);
    --page-padding: clamp(0.75rem, 3vw, 1.25rem);
    --touch-min: 44px;
}

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

html, body {
    margin: 0;
    min-height: 100%;
    height: 100%;
    overflow-x: hidden;
    font-family: var(--font-body);
    color: var(--purple-deep);
    -webkit-text-size-adjust: 100%;
    font-feature-settings: "kern" 1, "liga" 1;
}

img { max-width: 100%; height: auto; display: block; }

/* ===== Typography ===== */
.logo-script,
.app-logo {
    font-family: var(--font-script);
    font-weight: 600;
    letter-spacing: 0.02em;
}

.section-head h2,
.panel-title,
.app-header--with-back .page-title,
.login-card .header,
.g-modal__title,
#prompt-title,
.prompt-grid--topics .prompt-item > h1,
.gallery-list-item .prompt-item__copy > h1 {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.02em;
}

.welcome-eyebrow,
.companion-panel__label {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* ===== Ambient background ===== */
.app-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    background: var(--gradient);
    overflow: hidden;
    pointer-events: none;
}

.app-bg__orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.45;
    animation: orb-float 18s ease-in-out infinite;
}

.app-bg__orb--1 {
    width: min(50vw, 320px);
    height: min(50vw, 320px);
    background: rgba(255, 255, 255, 0.35);
    top: -8%;
    left: -5%;
}

.app-bg__orb--2 {
    width: min(40vw, 260px);
    height: min(40vw, 260px);
    background: rgba(134, 218, 233, 0.5);
    bottom: 10%;
    right: -5%;
    animation-delay: -6s;
}

.app-bg__orb--3 {
    width: min(35vw, 220px);
    height: min(35vw, 220px);
    background: rgba(94, 84, 181, 0.55);
    top: 40%;
    left: 35%;
    animation-delay: -12s;
}

@keyframes orb-float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(12px, -18px) scale(1.06); }
}

/* ===== Design system ===== */
.g-card {
    background: var(--lavender);
    border: 2px solid var(--purple-border);
    border-bottom-width: 4px;
    box-shadow: var(--shadow-chunky);
    border-radius: var(--radius);
}

.g-panel {
    background: rgba(94, 84, 181, 0.55);
    border: 3px solid var(--purple-border);
    box-shadow: var(--shadow-chunky);
    border-radius: var(--radius);
}

.g-shell {
    background: var(--glass);
    border: 2px solid var(--glass-border);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.12);
    border-radius: var(--radius);
    backdrop-filter: blur(8px);
}

.g-btn,
input[type="submit"],
.button {
    background: var(--orange);
    border: 2px solid var(--orange-border);
    border-bottom-width: 4px;
    box-shadow: 0 0 0 2px var(--orange-dark);
    border-radius: var(--radius-sm);
    min-height: var(--touch-min);
    min-width: min(10rem, 42vw);
    padding: 0.65rem 1.35rem;
    font-family: var(--primary-font);
    font-size: 1rem;
    font-weight: 700;
    color: var(--purple-deep);
    cursor: pointer;
    touch-action: manipulation;
    transition: transform 0.12s ease, background 0.12s ease;
}

.g-btn:hover,
input[type="submit"]:hover,
.button:hover { background: rgb(255, 183, 116); }

.g-btn:active,
input[type="submit"]:active,
.button:active {
    transform: translateY(2px);
    background: rgb(179, 97, 31);
}

.g-btn--compact {
    min-width: auto;
    min-height: 2.5rem;
    padding: 0.45rem 0.9rem;
    font-size: 0.85rem;
}

input[type="text"],
input[type="password"] {
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-sm);
    border: 2px solid var(--purple-border);
    border-bottom-width: 4px;
    box-shadow: var(--shadow-chunky);
    background: var(--lavender);
    font-size: 16px;
    max-width: 100%;
    font-family: var(--primary-font);
}

.logo-script {
    line-height: 1;
    margin: 0;
}

.material-symbols-rounded {
    font-family: "Material Symbols Rounded", sans-serif;
    font-weight: normal;
    font-style: normal;
    font-size: 1.25rem;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    direction: ltr;
    -webkit-font-smoothing: antialiased;
    font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24;
}

.back-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--touch-min);
    aspect-ratio: 1;
    border-radius: 50%;
    background: var(--lavender);
    border: 2px solid var(--purple-border);
    border-bottom-width: 4px;
    box-shadow: var(--shadow-chunky);
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--purple-deep);
    touch-action: manipulation;
    flex-shrink: 0;
}

/* ===== Cat mascot ===== */
.g-cat {
    position: relative;
    cursor: pointer;
    user-select: none;
    touch-action: manipulation;
}

.g-cat:focus-visible {
    outline: 3px solid var(--cyan);
    outline-offset: 4px;
    border-radius: 12px;
}

.g-cat__bubble {
    position: absolute;
    z-index: 10;
    max-width: min(11rem, calc(100vw - 1.5rem));
    padding: 0.5rem 0.75rem;
    background: white;
    color: var(--purple-deep);
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.3;
    border-radius: 12px;
    border: 2px solid var(--purple-border);
    box-shadow: var(--shadow-chunky);
    text-align: center;
    pointer-events: none;
}

.g-cat--layered {
    width: 7.5rem;
    height: 8.5rem;
    margin: 0 auto;
}

.g-cat--layered .g-cat__body {
    position: absolute;
    width: 72%;
    left: 50%;
    top: 38%;
    transform: translateX(-50%);
    z-index: 2;
}

.g-cat--layered .g-cat__head {
    position: absolute;
    width: 64%;
    left: 50%;
    top: 4%;
    transform: translateX(-50%);
    z-index: 3;
    animation: cat-head-sway 10s ease-in-out infinite;
}

.g-cat--layered .g-cat__tail {
    position: absolute;
    width: 48%;
    left: 18%;
    top: 32%;
    z-index: 1;
    transform-origin: bottom right;
    animation: cat-tail-sway 5s ease-in-out infinite;
}

.g-cat--layered .g-cat__bubble {
    top: -0.5rem;
    left: 50%;
    right: auto;
    transform: translateX(-50%) translateY(-100%);
}

.g-cat--layered.g-cat--bubble-below .g-cat__bubble {
    top: auto;
    bottom: -0.2rem;
    transform: translateX(-50%) translateY(calc(100% + 0.25rem));
}

.g-cat--layered.g-cat--lg {
    width: 6.5rem;
    height: 7.25rem;
}

.g-cat--layered.g-cat--sm {
    width: 5.5rem;
    height: 6.25rem;
}

/* Sleeping gallery cat (hub sidebar) — closed eyes, gentle tail only */
.g-cat--sleeping .g-cat__head {
    animation: none;
}

.g-cat--sleeping .g-cat__tail {
    animation: cat-tail-sway 7s ease-in-out infinite;
}

.companion-panel .g-cat--sleeping.g-cat--lg {
    width: 6.25rem;
    height: 7rem;
}

.g-cat--peek {
    width: min(280px, 70vw);
    height: min(200px, 42vw);
    margin: 0 auto;
}

.g-cat--peek.g-cat--lg {
    width: min(320px, 88vw);
    height: min(230px, 52vw);
}

.g-cat--peek .g-cat__head-peek {
    position: absolute;
    width: 42%;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
    z-index: 3;
    animation: cat-head-sway 8s ease-in-out infinite;
}

.g-cat--peek .g-cat__tail-peek {
    position: absolute;
    width: 28%;
    left: 50%;
    top: 52%;
    transform: translateX(-50%);
    z-index: 0;
    transform-origin: top center;
    animation: cat-tail-peek 7s ease-in-out infinite;
}

.g-cat--peek .g-cat__paw {
    position: absolute;
    width: 18%;
    top: 38%;
    z-index: 4;
}

.g-cat--peek .g-cat__paw--left {
    left: 18%;
    transform: scaleX(-1);
}

.g-cat--peek .g-cat__paw--right {
    right: 18%;
}

.g-cat--peek .g-cat__bubble {
    top: -8%;
    left: 50%;
    right: auto;
    transform: translateX(-50%) translateY(-100%);
}

.g-cat--peek.g-cat--bubble-below .g-cat__bubble {
    top: auto;
    bottom: 6%;
    transform: translateX(-50%) translateY(calc(100% + 0.35rem));
}

.g-cat--blink .g-cat__head-peek {
    animation: none;
    opacity: 0.85;
}

.g-cat--celebrate {
    animation: cat-celebrate 0.85s ease;
}

.g-cat--celebrate .g-cat__head,
.g-cat--celebrate .g-cat__head-peek {
    animation: none;
}

@keyframes cat-head-sway {
    0%, 100% { transform: translateX(-50%) rotate(-6deg); }
    50% { transform: translateX(-50%) rotate(6deg); }
}

@keyframes cat-tail-sway {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(-12deg); }
}

@keyframes cat-tail-peek {
    0%, 100% { transform: translateX(-50%) rotate(35deg); }
    50% { transform: translateX(-50%) rotate(-30deg); }
}

@keyframes cat-celebrate {
    0%, 100% { transform: scale(1); }
    40% { transform: scale(1.08) rotate(-3deg); }
    70% { transform: scale(1.05) rotate(3deg); }
}

/* ===== App chrome ===== */
.app {
    position: relative;
    z-index: 1;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    padding: max(var(--page-padding), env(safe-area-inset-top)) var(--page-padding) var(--page-padding);
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-shrink: 0;
}

.app-header--with-back {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 0.75rem;
}

.app-header--with-back .page-title {
    grid-column: 2;
    margin: 0;
    font-size: clamp(1.25rem, 4vw, 1.65rem);
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.app-logo {
    font-size: clamp(2rem, 7vw, 2.75rem);
    color: white;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.3rem 0.75rem 0.3rem 0.35rem;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-radius: 999px;
    color: white;
    font-size: 0.85rem;
    font-weight: 700;
    max-width: 11rem;
    cursor: pointer;
    font-family: var(--primary-font);
    touch-action: manipulation;
    transition: background 0.15s ease, transform 0.12s ease;
}

.user-chip:hover {
    background: rgba(255, 255, 255, 0.28);
}

.user-chip:active {
    transform: scale(0.98);
}

.user-chip__avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.65rem;
    height: 1.65rem;
    border-radius: 50%;
    background: var(--lavender);
    color: var(--purple-deep);
    font-size: 0.8rem;
    font-weight: 800;
    flex-shrink: 0;
}

.user-chip__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.section-head {
    margin-bottom: 1rem;
}

.section-head h2 {
    margin: 0 0 0.25rem;
    font-size: 1.2rem;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.section-head p {
    margin: 0;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.88);
}

/* ===== Welcome ===== */
.page-welcome {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100dvh;
    padding: var(--page-padding);
}

.welcome-stage {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: min(26rem, 100%);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.welcome-stack {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.welcome-cat-slot {
    width: min(320px, 88vw);
    min-height: 6.5rem;
    margin-bottom: -3.25rem;
    z-index: 3;
    pointer-events: none;
}

.welcome-cat-slot .g-cat {
    pointer-events: auto;
}

.welcome-cat-slot .g-cat--peek {
    height: min(180px, 42vw);
}

.welcome-cat-slot .g-cat__head-peek {
    width: 64%;
    top: 12%;
}

.welcome-cat-slot .g-cat__paw {
    top: 48%;
    width: 21%;
}

.welcome-cat-slot .g-cat__paw--left {
    left: 6%;
}

.welcome-cat-slot .g-cat__paw--right {
    right: 6%;
}

.welcome-card {
    width: 100%;
    margin: 0 auto;
    padding: clamp(1.5rem, 5vw, 2.25rem);
    padding-top: clamp(2.75rem, 10vw, 3.5rem);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    z-index: 2;
}

.welcome-tail-slot {
    display: flex;
    justify-content: center;
    width: 100%;
    min-height: 4.25rem;
    margin-top: -1.15rem;
    z-index: 1;
}

.welcome-tail-slot .g-cat__tail-peek {
    position: relative;
    left: auto;
    top: auto;
    width: clamp(5.5rem, 28vw, 7.75rem);
    transform-origin: top center;
    animation: cat-tail-welcome 7s ease-in-out infinite;
}

@keyframes cat-tail-welcome {
    0%, 100% { transform: rotate(28deg); }
    50% { transform: rotate(-22deg); }
}

.welcome-eyebrow {
    margin: 0;
    font-size: 0.8rem;
    color: var(--purple-deep);
    opacity: 0.85;
}

.welcome-card .logo-script {
    font-size: clamp(3.25rem, 14vw, 4.5rem);
    color: var(--purple-deep);
}

.welcome-tagline {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.45;
    color: var(--purple-deep);
    opacity: 0.9;
    max-width: 18rem;
}

.welcome-card .g-btn {
    width: 100%;
    margin-top: 0.5rem;
}

/* ===== Login ===== */
.page-login {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100dvh;
    padding: var(--page-padding);
}

.login-stage {
    position: relative;
    z-index: 1;
    width: min(24rem, 100%);
}

.login-card {
    padding: clamp(1.25rem, 4vw, 2rem);
    padding-top: 3.75rem;
    position: relative;
}

.login-cat-slot {
    position: absolute;
    top: -6.25rem;
    left: 50%;
    transform: translateX(-50%);
    width: 7.5rem;
    z-index: 2;
    overflow: visible;
}

.login-card .header {
    margin: 0 0 1rem;
    text-align: center;
    font-size: 1.75rem;
    color: var(--purple-deep);
}

.login-form form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-group label {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--purple-deep);
}

.login-form input[type="submit"] {
    width: 100%;
    margin-top: 0.25rem;
}

.sign-up {
    display: block;
    margin-top: 1rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--purple-deep);
    text-decoration: underline;
    cursor: pointer;
    font-weight: 600;
}

/* ===== Hub (main) ===== */
.page-hub .app-main {
    flex: 1;
    min-height: 0;
}

.page-hub #prompt-container {
    display: grid;
    grid-template-columns: minmax(13rem, 17rem) 1fr;
    gap: 1rem;
    padding: 1rem;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.hub-sidebar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    min-height: 0;
    padding: 0.25rem 0.45rem;
    box-sizing: border-box;
}

.hub-sidebar > .companion-panel,
.hub-sidebar > .account-panel,
.hub-sidebar > .friends-panel {
    width: 92%;
    max-width: 100%;
    margin-inline: auto;
    box-sizing: border-box;
}

.companion-panel {
    padding: 0.5rem 0.65rem 0.85rem;
    min-height: 9rem;
    text-align: center;
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-sm);
    border: 2px dashed rgba(255, 255, 255, 0.35);
    flex-shrink: 0;
    overflow: visible;
}


.companion-panel #hub-cat {
    display: flex;
    justify-content: center;
    margin-top: -0.2rem;
    transform: translateY(-0.25rem);
}

.companion-panel__label {
    margin: 0 0 0.15rem;
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.85);
}

/* Account & friends sidebar */
.panel-title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0 0 0.75rem;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--purple-deep);
}

.panel-title__icon {
    font-size: 1.1rem;
}

.panel-title__badge {
    margin-left: auto;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0;
    padding: 0.2rem 0.5rem;
    background: rgba(94, 84, 181, 0.2);
    border-radius: 999px;
    color: var(--purple-deep);
}

.account-panel {
    padding: 0.75rem 0.7rem;
    flex-shrink: 0;
}

.friends-panel {
    padding: 0.75rem 0.7rem;
    flex-shrink: 0;
    overflow: visible;
}

.hub-sidebar .g-card {
    box-shadow: 0 0 0 1.5px var(--purple-deep);
}

.account-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0;
    margin-bottom: 0.65rem;
    border-bottom: 2px solid rgba(72, 63, 160, 0.15);
}

.account-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--cyan), var(--purple-mid));
    color: white;
    font-size: 1.15rem;
    font-weight: 800;
    flex-shrink: 0;
    box-shadow: var(--shadow-chunky);
}

.account-profile__meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.account-profile__label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: rgba(54, 26, 109, 0.65);
}

.account-profile__username {
    font-size: 1rem;
    font-weight: 800;
    color: var(--purple-deep);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-actions {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.account-action {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 2px solid var(--purple-border);
    border-bottom-width: 3px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.45);
    color: var(--purple-deep);
    font-family: var(--primary-font);
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    touch-action: manipulation;
    transition: background 0.12s ease, transform 0.1s ease;
}

.account-action .material-symbols-rounded {
    font-size: 1.15rem;
    opacity: 0.85;
}

.account-action:hover {
    background: rgba(255, 255, 255, 0.75);
}

.account-action:active {
    transform: translateY(1px);
}

.account-action--danger {
    background: rgba(255, 220, 210, 0.5);
    border-color: rgba(180, 60, 40, 0.35);
    color: rgb(120, 35, 25);
}

.account-action--danger:hover {
    background: rgba(255, 200, 190, 0.75);
}

.friends-panel .panel-title,
.friends-panel .add-friend-row {
    flex-shrink: 0;
}

.add-friend-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.65rem;
}

.add-friend-field {
    position: relative;
    flex: 1 1 6rem;
    min-width: 0;
}

.add-friend-field input[type="text"] {
    width: 100%;
}

.add-friend-row input[type="text"] {
    flex: 1 1 6rem;
    min-width: 0;
}

.friend-suggestions {
    position: absolute;
    z-index: 30;
    left: 0;
    right: 0;
    bottom: calc(100% + 0.3rem);
    top: auto;
    margin: 0;
    padding: 0.3rem;
    list-style: none;
    max-height: 9.5rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: #fffef9;
    border: 2px solid var(--purple-border);
    border-bottom-width: 3px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-chunky), 0 6px 18px rgba(54, 26, 109, 0.18);
}

.friend-suggestions[hidden] {
    display: none;
}

.friend-suggestion {
    padding: 0.45rem 0.55rem;
    border-radius: 6px;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--purple-deep);
    cursor: pointer;
}

.friend-suggestion:hover,
.friend-suggestion[aria-selected="true"] {
    background: var(--lavender);
}

.friend-list {
    max-height: 11rem;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.friend-list::-webkit-scrollbar {
    display: none;
}

.friends-empty {
    margin: 0;
    padding: 0.75rem 0.5rem;
    font-size: 0.82rem;
    line-height: 1.4;
    color: rgba(54, 26, 109, 0.7);
    text-align: center;
}

.friend-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: rgba(255, 255, 255, 0.5);
    border: 2px solid var(--purple-border);
    border-bottom-width: 3px;
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.65rem;
    margin-bottom: 0.4rem;
    font-weight: 600;
    font-size: 0.88rem;
}

.friend-item:last-child {
    margin-bottom: 0;
}

.friend-item__avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    background: var(--lavender);
    color: var(--purple-deep);
    font-size: 0.75rem;
    font-weight: 800;
    flex-shrink: 0;
}

.friend-item__name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.friend-item__remove {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    padding: 0;
    margin: 0;
    margin-left: auto;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    box-shadow: none;
    min-width: 0;
    min-height: 0;
    color: rgba(54, 26, 109, 0.5);
    font-size: 1.2rem;
    cursor: pointer;
    touch-action: manipulation;
    transition: background 0.12s ease, color 0.12s ease, transform 0.1s ease;
}

.friend-item__remove:hover {
    background: rgba(255, 255, 255, 0.75);
    color: rgb(120, 35, 25);
}

.friend-item__remove:active {
    transform: translateY(1px);
}

/* Toast notifications */
.g-toast-root {
    position: fixed;
    left: 50%;
    bottom: 0;
    z-index: 9999;
    pointer-events: none;
    max-width: min(22rem, calc(100vw - 2rem));
    transform: translateX(-50%) translateY(calc(100% + 5rem));
    opacity: 0;
    visibility: hidden;
    transition:
        transform 0.4s cubic-bezier(0.34, 1.2, 0.64, 1),
        opacity 0.25s ease,
        visibility 0.4s;
}

.g-toast-root--visible {
    bottom: max(1rem, env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    visibility: visible;
}

/* Keep toasts above the canvas composer, not over the text field */
.page-canvas .g-toast-root--visible {
    bottom: max(7.25rem, calc(env(safe-area-inset-bottom, 0px) + 6.75rem));
}

.g-toast {
    padding: 0.75rem 1.1rem;
    background: var(--lavender);
    border: 2px solid var(--purple-border);
    border-bottom-width: 4px;
    box-shadow: var(--shadow-chunky), 0 8px 24px rgba(0, 0, 0, 0.15);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--purple-deep);
    text-align: center;
}

.g-toast-root--success .g-toast {
    border-color: rgba(59, 137, 132, 0.5);
    background: rgb(210, 245, 240);
}

.g-toast-root--error .g-toast {
    border-color: rgba(180, 60, 40, 0.45);
    background: rgb(255, 228, 220);
}

.hub-main {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.hub-main .section-head {
    flex-shrink: 0;
    padding: 0.35rem 0.75rem 0 1.15rem;
}

.prompt-hub {
    flex: 1;
    min-height: 0;
    padding: 0.45rem 0.75rem 0.65rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    overflow: hidden;
}

.prompt-hub__group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
}

.prompt-hub__group--topics {
    flex: 1;
    min-height: 0;
}

.prompt-hub__group--topics .prompt-grid--topics {
    flex: 1;
    min-height: 0;
}

.prompt-hub__group--browse {
    flex-shrink: 0;
    padding-top: 0.65rem;
    border-top: 2px dashed rgba(255, 255, 255, 0.28);
}

.prompt-hub__label {
    margin: 0;
    font-family: var(--font-display);
    font-size: 0.88rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.prompt-hub__hint {
    margin: -0.15rem 0 0;
    font-size: 0.8rem;
    line-height: 1.35;
    color: rgba(255, 255, 255, 0.82);
}

.prompt-grid {
    display: grid;
    gap: 0.65rem;
    min-width: 0;
}

.prompt-grid--topics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
}

.prompt-grid--browse {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    gap: 0.5rem;
    align-content: start;
}

.prompt-grid .prompt-item {
    cursor: pointer;
    touch-action: manipulation;
    transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}

.prompt-grid--topics .prompt-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-height: 0;
    height: 100%;
    padding: 0.45rem 0.4rem;
    background: var(--lavender);
}

.prompt-item--browse {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.65rem;
    min-height: 4.35rem;
    max-height: 5.25rem;
    padding: 0.6rem 0.75rem;
    text-align: left;
    background: rgba(255, 255, 255, 0.92);
    border-color: rgba(106, 169, 179, 0.55);
}

.prompt-item--browse.global {
    border-left: 4px solid var(--cyan);
}

.prompt-item--browse.friends {
    border-left: 4px solid var(--orange);
}

.prompt-item__copy {
    flex: 1;
    min-width: 0;
}

.prompt-item__copy > h1 {
    margin: 0 0 0.15rem;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
    text-align: left;
    text-wrap: balance;
}

.prompt-item__desc {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.3;
    color: rgba(54, 26, 109, 0.72);
}

.prompt-item__chevron {
    flex-shrink: 0;
    font-size: 1.35rem;
    color: rgba(54, 26, 109, 0.45);
}

.prompt-item-icon {
    font-size: clamp(2.05rem, 6.5vw, 3rem);
    line-height: 1;
    color: rgba(54, 26, 109, 0.9);
}

.prompt-item--browse .prompt-item-icon {
    font-size: 1.85rem;
    width: 2.5rem;
    text-align: center;
    flex-shrink: 0;
}

.prompt-grid--topics .prompt-item > h1 {
    margin: 0;
    font-size: clamp(0.78rem, 2.1vw, 1rem);
    font-weight: 700;
    text-align: center;
    text-wrap: balance;
    line-height: 1.2;
}

/* ===== Gallery list pages (global / friends) ===== */
.page-list .app > .gallery-page {
    flex: 1;
    min-height: 0;
}

.page-list .gallery-page .section-head {
    padding: 0.5rem 0.85rem 0 1.1rem;
}

.gallery-page__start {
    margin-top: 0.55rem;
}

.gallery-list-wrap {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 0.5rem 0.8rem 0.75rem;
    overflow: hidden;
}

.gallery-list {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border: none;
    background: transparent;
    box-shadow: none;
    padding: 0;
}

.gallery-list-item {
    width: calc(100% - 0.65rem);
    max-width: 100%;
    margin-inline: auto;
    box-sizing: border-box;
    font: inherit;
    text-align: left;
    border: 2px solid var(--purple-border);
    border-bottom-width: 4px;
    box-shadow: var(--shadow-chunky);
    min-height: 4.75rem;
    max-height: none;
    height: auto;
    padding: 0.6rem 0.65rem;
    gap: 0.55rem;
}

.gallery-list-item.global {
    border-left: 4px solid var(--cyan);
}

.gallery-list-item.friends {
    border-left: 4px solid var(--orange);
}

.gallery-list-item .prompt-item__copy > h1 {
    font-size: clamp(0.92rem, 2.5vw, 1.05rem);
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.gallery-list-item:focus-visible {
    outline: 3px solid var(--cyan);
    outline-offset: 3px;
}

.gallery-empty {
    margin: auto;
    max-width: 18rem;
    padding: 1.75rem 1.25rem;
    text-align: center;
    color: var(--purple-deep);
}

.gallery-empty__icon {
    font-size: 2.5rem;
    line-height: 1;
    margin-bottom: 0.5rem;
    opacity: 0.85;
}

.page-list--global .gallery-empty__icon {
    color: rgba(54, 26, 109, 0.75);
}

.page-list--friends .gallery-empty__icon {
    color: rgba(83, 38, 2, 0.65);
}

.gallery-empty__title {
    margin: 0 0 0.35rem;
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
}

.gallery-empty__text {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.45;
    opacity: 0.88;
}

/* ===== Canvas — opening night gallery ===== */
.page-canvas::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: radial-gradient(ellipse 85% 65% at 50% 28%, transparent 35%, rgba(28, 12, 58, 0.5) 100%);
}

.page-canvas .canvas-app {
    position: relative;
    z-index: 1;
    padding-bottom: 0;
    gap: 0.35rem;
}

.canvas-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Nav + admission stamps */
.canvas-nav {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.35rem;
    flex-shrink: 0;
}

.canvas-stamps {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.4rem 0.55rem;
}

.canvas-stamp {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.3rem 0.7rem 0.35rem;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--purple-deep);
    background: #fff9e8;
    border: 2px dashed rgba(147, 97, 15, 0.45);
    border-radius: 3px;
    box-shadow: 0 2px 0 rgba(83, 38, 2, 0.25);
    transform: rotate(-2deg);
}

.canvas-stamp--count {
    transform: rotate(1.5deg);
    background: #f4f0ff;
    border-color: rgba(72, 63, 160, 0.4);
    box-shadow: 0 2px 0 rgba(54, 26, 109, 0.2);
}

.canvas-stamp--friends {
    background: #fff0dc;
    border-color: rgba(147, 97, 15, 0.55);
}

.canvas-stamp .material-symbols-rounded {
    font-size: 0.95rem;
}

.canvas-stamp__sep {
    opacity: 0.45;
    font-weight: 400;
}

/* Stage: placard + cat */
.canvas-stage {
    flex-shrink: 0;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: end;
    gap: 0.35rem 0.5rem;
    margin-bottom: 0.45rem;
}

.canvas-placard {
    position: relative;
    margin: 0.35rem 0 0;
    padding: 0.85rem 1rem 0.9rem;
    background: #fffef7;
    border: 2px solid rgba(83, 38, 2, 0.2);
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 14px rgba(54, 26, 109, 0.15);
}

.canvas-placard__pin {
    position: absolute;
    top: -0.45rem;
    left: 50%;
    width: 0.65rem;
    height: 0.65rem;
    margin-left: -0.325rem;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #e8e8e8, #888 55%, #444);
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.35);
}

.canvas-placard__series {
    margin: 0 0 0.2rem;
    font-family: var(--font-script);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--orange-dark);
    line-height: 1.1;
}

.canvas-placard__title {
    margin: 0;
    font-family: var(--font-display);
    font-size: clamp(1.05rem, 3.6vw, 1.45rem);
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.02em;
    color: var(--purple-deep);
    overflow-wrap: anywhere;
}

.canvas-placard__tease {
    margin: 0.45rem 0 0;
    font-size: 0.82rem;
    line-height: 1.4;
    color: rgba(54, 26, 109, 0.75);
}

.canvas-cat-seat {
    position: relative;
    width: 4.75rem;
    flex-shrink: 0;
    align-self: end;
    margin-bottom: -0.15rem;
}

.canvas-cat-seat__cushion {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 4.25rem;
    height: 1.1rem;
    margin-left: -2.125rem;
    border-radius: 50% 50% 45% 45%;
    background: linear-gradient(180deg, #c97b4a 0%, #8b4a28 100%);
    box-shadow: 0 3px 0 rgba(54, 26, 109, 0.35);
    transform: rotate(2deg);
}

.canvas-cat-seat__cat {
    position: relative;
    z-index: 1;
    width: 4.5rem;
    margin: 0 auto;
    transform: translateY(-0.15rem);
}

/* Gallery wall */
.canvas-gallery {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    margin-bottom: 0.35rem;
}

.gallery-wall {
    flex: 1;
    min-height: 0;
    position: relative;
    overflow: hidden;
    border-radius: 6px;
    border: 3px solid #5c4033;
    border-bottom-width: 6px;
    background:
        linear-gradient(180deg, rgba(255, 248, 230, 0.08) 0%, transparent 40%),
        repeating-linear-gradient(
            92deg,
            #6b4f3a 0px,
            #7a5c45 3px,
            #5e4534 6px,
            #6f5240 9px
        );
    box-shadow:
        inset 0 0 80px rgba(0, 0, 0, 0.35),
        0 8px 24px rgba(0, 0, 0, 0.2);
}

.gallery-wall__glow {
    position: absolute;
    top: -20%;
    left: 50%;
    width: 85%;
    height: 55%;
    margin-left: -42.5%;
    background: radial-gradient(ellipse at center, rgba(255, 240, 200, 0.35) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.gallery-wall__lights {
    position: absolute;
    top: 0.35rem;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-evenly;
    padding: 0 0.75rem;
    pointer-events: none;
    z-index: 2;
}

.gallery-wall__lights span {
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    background: #ffe9a8;
    box-shadow: 0 0 8px 2px rgba(255, 220, 120, 0.85);
    animation: gallery-twinkle 2.8s ease-in-out infinite;
}

.gallery-wall__lights span:nth-child(2) { animation-delay: -0.4s; }
.gallery-wall__lights span:nth-child(3) { animation-delay: -1.1s; }
.gallery-wall__lights span:nth-child(4) { animation-delay: -1.8s; }
.gallery-wall__lights span:nth-child(5) { animation-delay: -2.3s; }

@keyframes gallery-twinkle {
    0%, 100% { opacity: 0.55; transform: scale(0.9); }
    50% { opacity: 1; transform: scale(1.05); }
}

.gallery-wall__pieces,
#answer-container {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.gallery-wall__still {
    position: absolute;
    inset: 0;
    z-index: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 1.5rem;
    text-align: center;
    pointer-events: none;
}

.gallery-wall__still[hidden] {
    display: none;
}

.gallery-wall__still-icon {
    font-size: 2.5rem;
    color: rgba(255, 232, 200, 0.55);
}

.gallery-wall__still-title {
    margin: 0;
    font-family: var(--font-script);
    font-size: 1.65rem;
    color: rgba(255, 245, 220, 0.9);
}

.gallery-wall__still-text {
    margin: 0;
    max-width: 14rem;
    font-size: 0.82rem;
    line-height: 1.45;
    color: rgba(255, 235, 200, 0.65);
}

.gallery-wall__chalk {
    position: absolute;
    bottom: 0.4rem;
    left: 0;
    right: 0;
    margin: 0;
    text-align: center;
    font-family: var(--font-script);
    font-size: 1rem;
    color: rgba(255, 248, 220, 0.55);
    pointer-events: none;
    z-index: 2;
}

#answer-container > .answer-stack {
    position: absolute;
    transform: translateX(-50%);
    pointer-events: auto;
    touch-action: none;
    cursor: grab;
    animation: bob-animation 4s ease-in-out infinite, small-rotate-animation 8s ease-in-out infinite;
}

#answer-container > .answer-stack.is-dragging,
#answer-container > .answer-stack:has(.answer-item.is-reply-target) {
    animation: none;
}

#answer-container > .answer-stack.is-dragging {
    z-index: 50;
    cursor: grabbing;
    user-select: none;
}

#answer-container > .answer-stack::before,
#answer-container > .answer-stack::after {
    content: "";
    position: absolute;
    top: -0.35rem;
    width: 1.1rem;
    height: 0.55rem;
    background: rgba(255, 248, 200, 0.75);
    border: 1px solid rgba(200, 180, 120, 0.5);
    opacity: 0.9;
    z-index: 10;
    pointer-events: none;
}

#answer-container > .answer-stack::before {
    left: 12%;
    transform: rotate(-18deg);
}

#answer-container > .answer-stack::after {
    right: 12%;
    transform: rotate(14deg);
}

#answer-container .answer-item.piece.g-card {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    max-width: min(14rem, 44vw);
    padding: 0.45rem 0.45rem 0.55rem;
    border: none;
    border-bottom-width: 0;
    border-radius: 2px;
    background: #fffef9;
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.12),
        0 6px 16px rgba(0, 0, 0, 0.18);
    cursor: pointer;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

#answer-container .piece--lavender { --piece-accent: var(--lavender); }
#answer-container .piece--mint { --piece-accent: rgb(180, 235, 220); }
#answer-container .piece--peach { --piece-accent: rgb(255, 210, 175); }
#answer-container .piece--butter { --piece-accent: rgb(255, 240, 170); }
#answer-container .piece--rose { --piece-accent: rgb(255, 200, 210); }

.answer-card__head {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
    padding-bottom: 0.15rem;
    border-bottom: 1px dashed rgba(72, 63, 160, 0.15);
}

.answer-avatar {
    flex-shrink: 0;
    width: 1.55rem;
    height: 1.55rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.58rem;
    font-weight: 800;
    background: var(--piece-accent, var(--lavender));
    border: 2px solid rgba(54, 26, 109, 0.15);
    color: var(--purple-deep);
}

#answer-container .answer-parent {
    position: relative;
    z-index: 3;
}

.answer-author {
    font-family: var(--font-script);
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--purple-deep);
}

.answer-text { font-size: 0.95rem; line-height: 1.35; }

.reply-count {
    display: block;
    margin-top: 0.2rem;
    padding: 0.15rem 0.5rem;
    font-size: 0.75rem;
    font-family: var(--font-script);
    font-weight: 600;
    color: var(--purple-deep);
    background: var(--piece-accent, var(--lavender));
    border: 1px dashed rgba(54, 26, 109, 0.25);
    border-radius: 3px;
    cursor: pointer;
    align-self: center;
    transform: rotate(-1deg);
}

.answer-thread {
    position: relative;
    width: 100%;
    margin-top: 0;
}

.answer-stack:not(.is-expanded) .answer-thread {
    position: absolute;
    top: 0;
    left: 50%;
    width: min(14rem, 44vw);
    transform: translateX(-50%);
    z-index: 1;
    pointer-events: none;
}

.answer-stack:not(.is-expanded) .answer-thread .answer-reply {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    visibility: hidden;
    max-width: min(13rem, 40vw);
    padding: 0.6rem 0.75rem;
    pointer-events: none;
}

.answer-stack:not(.is-expanded) .answer-thread .answer-reply:nth-last-child(1) {
    opacity: 0.45;
    visibility: visible;
    transform: translateX(-50%) translateY(5px) scale(0.97);
    z-index: 2;
}

.answer-stack:not(.is-expanded) .answer-thread .answer-reply:nth-last-child(2) {
    opacity: 0.25;
    visibility: visible;
    transform: translateX(-50%) translateY(9px) scale(0.95);
    z-index: 1;
}

.answer-stack.is-expanded .answer-thread {
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    pointer-events: auto;
    margin-top: 0.45rem;
    padding-top: 0.35rem;
    border-top: 2px dashed rgba(255, 248, 220, 0.35);
}

.answer-stack.is-expanded .answer-thread .answer-reply {
    position: relative;
    top: auto !important;
    left: auto !important;
    opacity: 1;
    visibility: visible;
    transform: none;
    max-width: min(13rem, 40vw);
    margin: 0 auto 0.45rem;
    padding: 0.6rem 0.75rem;
    pointer-events: auto;
}

.answer-stack.is-expanded .answer-thread .answer-reply:last-child {
    margin-bottom: 0;
}

#answer-container .answer-reply {
    max-width: min(13rem, 40vw);
    padding: 0.6rem 0.75rem;
    font-size: 0.88rem;
}

.answer-item.is-reply-target {
    background: #fff9e0 !important;
    box-shadow:
        0 0 0 3px var(--orange),
        0 8px 22px rgba(255, 172, 92, 0.45) !important;
}

/* Guestbook desk */
.canvas-desk {
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    margin-top: auto;
    padding: 0.55rem 0.65rem max(var(--page-padding), env(safe-area-inset-bottom));
    z-index: 40;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    background: transparent;
    border: none;
    box-shadow: none;
}

.canvas-desk__sign {
    margin: 0;
    text-align: center;
    font-family: var(--font-script);
    font-size: 1.35rem;
    color: rgba(255, 255, 255, 0.92);
    text-shadow: 0 1px 2px rgba(28, 12, 58, 0.25);
}

.canvas-desk .reply-indicator,
.reply-indicator--desk {
    width: 100%;
    max-width: 36rem;
    margin: 0 auto;
}

.canvas-desk__row {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    max-width: 40rem;
    margin: 0 auto;
    width: 100%;
}

.desk-palette {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex-shrink: 0;
}

.desk-tool.composer-tool {
    width: 2.65rem;
    height: 2.65rem;
}

.desk-guestbook {
    flex: 1;
    min-width: 0;
    position: relative;
    min-height: var(--touch-min);
    max-height: 28vh;
    padding: 0;
    background: #fffef7 !important;
    border-color: rgba(83, 38, 2, 0.35) !important;
    box-shadow: inset 0 2px 8px rgba(83, 38, 2, 0.08), 0 2px 0 rgba(0, 0, 0, 0.15) !important;
}

.desk-guestbook #text-input {
    width: 100%;
    min-height: var(--touch-min);
    padding: 0.7rem 3rem 0.7rem 0.85rem;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    resize: none;
    font-size: 16px;
    line-height: 1.35;
    outline: none;
    font-family: var(--font-body);
    color: var(--purple-deep);
}

.desk-guestbook__pin {
    position: absolute;
    right: 0.4rem;
    bottom: 0.4rem;
    width: var(--touch-min);
    height: var(--touch-min);
    border: none;
    border-radius: 50%;
    background: var(--orange);
    color: var(--orange-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 0 var(--orange-dark);
    transition: transform 0.12s ease;
}

.desk-guestbook__pin:active {
    transform: scale(0.94) rotate(-8deg);
}

.composer-toolbar {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    max-width: 36rem;
    margin: 0 auto;
    width: 100%;
}

.composer-tool {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    font-size: 1.35rem;
    touch-action: manipulation;
    transition: background 0.15s ease, transform 0.12s ease;
}

.composer-tool:hover {
    background: rgba(255, 255, 255, 0.3);
}

.composer-tool:active {
    transform: scale(0.96);
}

.media-modal {
    width: min(28rem, 94vw);
    max-height: min(92dvh, 640px);
    display: flex;
    flex-direction: column;
}

.media-modal__body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.media-modal__actions {
    flex-wrap: wrap;
}

.media-modal__hint {
    margin: 0;
    font-size: 0.85rem;
    text-align: center;
    opacity: 0.85;
}

.media-stage {
    background: rgba(255, 255, 255, 0.5);
    border-radius: var(--radius-sm);
    border: 2px solid var(--purple-border);
    overflow: hidden;
}

.media-stage--camera {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
}

.draw-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
}

.draw-swatch {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    border: 2px solid var(--purple-border);
    cursor: pointer;
    padding: 0;
}

.draw-swatch--active {
    box-shadow: 0 0 0 2px var(--purple-deep);
}

.draw-brush {
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.45rem;
    border-radius: var(--radius-sm);
    border: 2px solid var(--purple-border);
    background: var(--lavender);
    color: var(--purple-deep);
    font-weight: 800;
    cursor: pointer;
}

.draw-brush--active {
    background: var(--cyan);
    border-color: var(--teal);
}

.draw-canvas {
    display: block;
    width: 100%;
    touch-action: none;
    cursor: crosshair;
    background: #fff;
}

.draw-canvas--shake {
    animation: draw-shake 0.35s ease;
}

@keyframes draw-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

.camera-preview {
    width: 100%;
    max-height: min(50dvh, 360px);
    object-fit: cover;
    border-radius: var(--radius-sm);
    background: #111;
    transform: scaleX(-1);
}

#answer-container > .answer-item--media {
    max-width: min(16rem, 52vw);
}

.answer-body {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.answer-image {
    display: block;
    width: 100%;
    max-height: 10rem;
    object-fit: cover;
    border-radius: 0.35rem;
    border: 1px solid rgba(72, 63, 160, 0.2);
}

.answer-item.is-reply-target .answer-image {
    max-height: 14rem;
}

.answer-item.is-reply-target.answer-item--media {
    max-width: min(18rem, 90vw);
}

.reply-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 700;
    align-self: center;
}

#cancel-reply {
    width: 1.75rem;
    height: 1.75rem;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.45);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

#text-field:not(.desk-guestbook),
.canvas-composer {
    position: relative;
    width: 100%;
    max-width: 36rem;
    margin: 0 auto;
    min-height: var(--touch-min);
    max-height: 28vh;
    padding: 0;
}

#text-field.text-field--reply:not(.desk-guestbook),
.canvas-composer.text-field--reply {
    margin-bottom: 0;
    box-shadow: var(--shadow-chunky), 0 0 0 2px var(--teal);
}

.desk-guestbook.text-field--reply {
    box-shadow: inset 0 2px 8px rgba(83, 38, 2, 0.08), 0 0 0 3px var(--orange) !important;
}

#text-input {
    width: 100%;
    min-height: var(--touch-min);
    padding: 0.75rem 3.25rem 0.75rem 0.85rem;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    resize: none;
    font-size: 16px;
    line-height: 1.35;
    outline: none;
    font-family: var(--primary-font);
}

#submit-button:not(.desk-guestbook__pin) {
    position: absolute;
    right: 0.45rem;
    bottom: 0.45rem;
    width: var(--touch-min);
    height: var(--touch-min);
    border-radius: 50%;
    border: 2px solid var(--orange-border);
    border-bottom-width: 4px;
    box-shadow: 0 0 0 2px var(--orange-dark);
    background: var(--orange);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.4rem;
    color: var(--purple-deep);
}

@keyframes bob-animation {
    0%, 100% { transform: translate(-50%, 0); }
    50% { transform: translate(-50%, 8%); }
}

@keyframes small-rotate-animation {
    0%, 100% { rotate: -4deg; }
    50% { rotate: 4deg; }
}

@media (hover: hover) {
    .prompt-grid--topics .prompt-item:hover {
        background: rgba(255, 255, 255, 0.95);
        box-shadow: var(--shadow-chunky), 0 4px 12px rgba(0, 0, 0, 0.08);
    }

    .prompt-item--browse:hover {
        background: white;
        box-shadow: var(--shadow-chunky), 0 4px 14px rgba(0, 0, 0, 0.1);
        transform: translateX(3px);
    }

    .gallery-list-item:hover {
        background: white;
        box-shadow: var(--shadow-chunky), 0 4px 14px rgba(0, 0, 0, 0.1);
        transform: translateX(3px);
    }
    .answer-item:hover { padding: 0.9rem; }
}

/* ===== Desktop: fit viewport, no page scroll ===== */
@media (min-width: 901px) {
    html,
    body.page-hub,
    body.page-list,
    body.page-canvas {
        height: 100dvh;
        overflow: hidden;
    }

    .page-hub .app,
    .page-list .app,
    .page-canvas .canvas-app {
        height: 100dvh;
        max-height: 100dvh;
        overflow: hidden;
    }

    .page-hub .app-main,
    .page-list .app-main,
    .page-canvas .canvas-app {
        flex: 1;
        min-height: 0;
        overflow: hidden;
    }

    .page-list .gallery-page {
        height: 100%;
        max-height: 100%;
    }

    .page-hub .app-header,
    .page-list .app-header,
    .page-canvas .canvas-nav {
        margin-bottom: 0.4rem;
    }

    .page-canvas .canvas-stage {
        margin-bottom: 0.4rem;
    }

    .page-canvas .canvas-placard__title {
        font-size: clamp(1rem, 2vw, 1.35rem);
    }

    .page-hub #prompt-container {
        flex: 1;
        min-height: 0;
        height: 100%;
        overflow: hidden;
        grid-template-columns: minmax(12.5rem, 16rem) 1fr;
        grid-template-rows: 1fr;
        align-items: stretch;
        padding: 0.75rem;
        gap: 0.75rem;
    }

    .page-hub .hub-main,
    .page-hub .hub-sidebar {
        height: 100%;
        max-height: 100%;
        min-height: 0;
    }

    .hub-sidebar {
        overflow: hidden;
        align-self: stretch;
    }

    .companion-panel {
        padding: 0.4rem 0.5rem 0.7rem;
        min-height: 8.5rem;
    }

    .companion-panel #hub-cat {
        margin-top: -0.25rem;
        transform: translateY(-0.3rem);
    }

    .g-cat--layered.g-cat--lg,
    .g-cat--sleeping.g-cat--lg {
        width: 5.75rem;
        height: 6.5rem;
    }

    .companion-panel .g-cat--sleeping.g-cat--lg {
        width: 5.5rem;
        height: 6.25rem;
    }

    .account-panel {
        padding: 0.6rem;
    }

    .friends-panel {
        padding: 0.6rem;
        flex: 1 1 0;
        min-height: 0;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        align-self: stretch;
        width: 92%;
    }

    .account-profile {
        padding: 0.35rem 0;
        margin-bottom: 0.45rem;
    }

    .panel-title {
        margin-bottom: 0.45rem;
        font-size: 0.72rem;
    }

    .account-action {
        padding: 0.45rem 0.6rem;
        font-size: 0.82rem;
    }

    .friend-list {
        flex: 1 1 auto;
        min-height: 0;
        max-height: none;
        overflow-y: auto;
    }

    .add-friend-row {
        flex-direction: column;
        flex-wrap: nowrap;
    }

    .add-friend-field,
    .add-friend-row input[type="text"],
    .add-friend-row input[type="submit"] {
        width: 100%;
        flex: none;
        box-sizing: border-box;
    }

    .add-friend-row .g-btn,
    .add-friend-row input[type="submit"] {
        min-width: 0;
    }

    .hub-main {
        min-height: 0;
    }

    .hub-main .section-head {
        margin-bottom: 0.5rem;
        padding-left: 1rem;
    }

    .hub-main .section-head h2 {
        font-size: 1.05rem;
    }

    .hub-main .section-head p {
        font-size: 0.8rem;
    }

    .prompt-hub {
        padding: 0.35rem 0.5rem 0.45rem;
        gap: 0.55rem;
    }

    .prompt-grid--topics {
        gap: 0.5rem;
    }

    .prompt-grid--topics .prompt-item-icon {
        font-size: clamp(1.45rem, 2.4vw, 2rem);
    }

    .prompt-grid--topics .prompt-item > h1 {
        font-size: clamp(0.72rem, 1.1vw, 0.9rem);
    }

    .prompt-item--browse .prompt-item__copy > h1 {
        font-size: 0.92rem;
    }

    .page-list .app {
        min-width: 0;
    }

    .page-canvas .canvas-gallery {
        flex: 1;
        min-height: 0;
        overflow: hidden;
        margin-bottom: 0.25rem;
    }

    .page-canvas .gallery-wall {
        min-height: 9rem;
    }

    .page-canvas .canvas-desk {
        flex-shrink: 0;
    }
}

/* ===== Responsive (mobile / tablet) ===== */
@media (max-width: 900px) {
    .page-hub #prompt-container {
        grid-template-columns: 1fr;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .hub-sidebar { order: 2; }
    .hub-main { order: 1; }

    .friend-list {
        max-height: min(10rem, 28vh);
    }

    .prompt-hub {
        min-height: 0;
        overflow: auto;
        -webkit-overflow-scrolling: touch;
    }

    .prompt-hub__group--topics {
        min-height: min(42vh, 18rem);
    }

    .companion-panel #hub-cat {
        margin-top: 0;
        transform: translateY(-0.05rem);
    }

    .g-cat--layered.g-cat--lg,
    .g-cat--sleeping.g-cat--lg { width: 6.25rem; height: 7rem; }

    .companion-panel .g-cat--sleeping.g-cat--lg {
        width: 5.75rem;
        height: 6.5rem;
    }

}

@media (max-width: 480px) {
    .prompt-grid--topics { gap: 0.5rem; }
    .prompt-item--browse .prompt-item__copy > h1 { font-size: 0.92rem; }
}

/* ===== Modal ===== */
body.g-modal-open {
    overflow: hidden;
}

.g-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--page-padding);
    background: rgba(20, 24, 60, 0.55);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.g-modal-overlay--visible {
    opacity: 1;
}

.g-modal-overlay--closing {
    opacity: 0;
}

.g-modal {
    width: min(26rem, 100%);
    padding: 1.25rem;
    transform: translateY(12px) scale(0.98);
    transition: transform 0.22s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.g-modal-overlay--visible .g-modal {
    transform: translateY(0) scale(1);
}

.g-modal-overlay--closing .g-modal {
    transform: translateY(8px) scale(0.98);
}

.g-modal__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.g-modal__title {
    margin: 0;
    font-size: 1.35rem;
    color: var(--purple-deep);
}

.g-modal__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 50%;
    background: rgba(94, 84, 181, 0.15);
    color: var(--purple-deep);
    cursor: pointer;
    flex-shrink: 0;
}

.g-modal__visibility {
    margin: 0 0 0.75rem;
    padding: 0.55rem 0.65rem;
    border: 2px dashed var(--purple-border);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.55);
}

.g-modal__visibility-label {
    margin: 0 0 0.4rem;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgba(54, 26, 109, 0.75);
}

.g-modal__visibility-option {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0.25rem 0;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
}

.g-modal__hint {
    margin: 0 0 0.75rem;
    font-size: 0.88rem;
    line-height: 1.4;
    color: rgba(54, 26, 109, 0.8);
}

.g-modal__input {
    width: 100%;
    min-height: 5.5rem;
    padding: 0.75rem;
    border: 2px solid var(--purple-border);
    border-bottom-width: 4px;
    box-shadow: var(--shadow-chunky);
    border-radius: var(--radius-sm);
    background: white;
    font-family: var(--primary-font);
    font-size: 16px;
    line-height: 1.4;
    resize: vertical;
}

.g-modal__input--error {
    border-color: rgba(180, 60, 40, 0.65);
    background: rgb(255, 245, 242);
}

.g-modal__counter {
    margin: 0.35rem 0 0.85rem;
    font-size: 0.75rem;
    text-align: right;
    color: rgba(54, 26, 109, 0.6);
    font-weight: 700;
}

.g-modal__actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.g-btn--ghost {
    background: rgba(255, 255, 255, 0.55);
    border-color: var(--purple-border);
    box-shadow: 0 0 0 1.5px var(--purple-deep);
    color: var(--purple-deep);
}

.g-btn--ghost:hover {
    background: rgba(255, 255, 255, 0.85);
}
