/*
 * Peekopals web app: one chat's magics (Apply magic cards, coin confirm, "Mode active" sheet, the
 * sheets stacked on them, the reaction video and acknowledgement), virtual gifts (wishlist, one gift, the
 * gift bubble) and the memory face-photo sheet. Copies the phone's chat/modes/ and
 * chat/virtualGifts/ composables; colours come from the --md-* roles in web-app.css.
 * See server/src/main/kotlin/htmx/webApp/chat/magics/AGENTS.md and chat/gifts/AGENTS.md.
 */

:root {
    /* the phone's mode colours (Color.kt Red300, CelestialBlue, ForgetMagicGreen) and the text on
       them (OnMagicModeColor), the same in light and dark like the phone, so one block serves both */
    --wa-magic-romantic: #E02544;
    --wa-magic-super-love: #1E88E5;
    --wa-magic-forget: #2E9E5B;
    --wa-on-magic-mode: #FFFFFF;
    /* the phone's companion cards: warm = the pal bubble wash, neutral = inverse surface */
    --wa-magic-warm-card: var(--wa-pal-bubble);
    --wa-magic-neutral-card: var(--md-inverse-surface);
    --wa-magic-hairline: color-mix(in srgb, var(--md-outline-variant) 40%, transparent);
}

/* ==================== the chat's magic tint (CharacterAvatarWithStatus potion ring) ==================== */

.wa-thread-page .wa-thread-header-avatar { position: relative; }
.wa-thread-page:has(#wa-chat-active-magic[data-active-magic="romantic"]) .wa-thread-header-avatar .wa-avatar {
    box-shadow: 0 0 0 2px var(--wa-magic-romantic);
}
/* super love's blue wins a stack, as on the phone */
.wa-thread-page:has(#wa-chat-active-magic[data-active-magic="super-love"]) .wa-thread-header-avatar .wa-avatar,
.wa-thread-page:has(#wa-chat-active-magic[data-active-magic="romantic-and-super-love"]) .wa-thread-header-avatar .wa-avatar {
    box-shadow: 0 0 0 2px var(--wa-magic-super-love);
}
/* the potion badges on the avatar's corners: romantic top left, super love bottom left
   (the artwork is ROMANTIC_MODE_POTION_IMAGE_URL / OBSESSION_MODE_POTION_IMAGE_URL in Constants.kt) */
.wa-thread-page:has(#wa-chat-active-magic[data-active-magic="romantic"]) .wa-thread-header-avatar::before,
.wa-thread-page:has(#wa-chat-active-magic[data-active-magic="romantic-and-super-love"]) .wa-thread-header-avatar::before,
.wa-thread-page:has(#wa-chat-active-magic[data-active-magic="super-love"]) .wa-thread-header-avatar::after,
.wa-thread-page:has(#wa-chat-active-magic[data-active-magic="romantic-and-super-love"]) .wa-thread-header-avatar::after {
    content: "";
    position: absolute;
    left: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid var(--md-background);
    background-size: cover;
    background-position: center;
    z-index: 1;
}
.wa-thread-page .wa-thread-header-avatar::before {
    top: 2px;
    background-image: url("https://www.reaptive.in/media/peekopals/mode-potions/romantic_mode.webp");
}
.wa-thread-page .wa-thread-header-avatar::after {
    bottom: 2px;
    background-image: url("https://www.reaptive.in/media/peekopals/mode-potions/obsession_mode.webp");
}

/* ==================== shared pieces ==================== */

.wa-magic-close-button {
    width: 40px;
    height: 40px;
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid var(--wa-magic-hairline);
    background: var(--md-surface-container-high);
    color: var(--md-on-surface);
    cursor: pointer;
}
.wa-magic-close-button:hover { filter: brightness(0.97); }
.wa-magic-wide-button { width: 100%; }
.wa-magic-secondary-button {
    width: 100%;
    background: transparent;
    border-color: var(--md-outline);
    color: var(--md-on-surface);
}
.wa-magic-sheet-title { margin: 0 0 8px; font-size: calc(18px * var(--wa-text-scale, 1)); font-weight: 600; text-align: center; }
.wa-magic-sheet-body { margin: 0 0 20px; color: var(--md-on-surface-variant); text-align: center; line-height: 1.45; }
.wa-magic-centered-sheet { display: flex; flex-direction: column; align-items: center; gap: 0; }
.wa-magic-centered-sheet .wa-magic-wide-button + .wa-magic-wide-button { margin-top: 8px; }
/* "a magic is on" / "a roleplay is on": the pal's round face above the title (RolePlayAndMagicCannotOverlapSheet) */
.wa-magic-overlap-face { margin: 8px 0 16px; }

/* ==================== the Apply magic sheet (ApplyMagicCardsSheet) ==================== */

/* each mode's colour, for its card, pills, dot and confirm */
.wa-magic-card--romantic, .wa-magic-mode-name--romantic, .wa-magic-cards-dot--romantic, .wa-magic-confirm-card--romantic { --wa-magic-mode-color: var(--wa-magic-romantic); }
.wa-magic-card--super-love, .wa-magic-mode-name--super-love, .wa-magic-cards-dot--super-love, .wa-magic-confirm-card--super-love { --wa-magic-mode-color: var(--wa-magic-super-love); }
.wa-magic-card--forget, .wa-magic-mode-name--forget, .wa-magic-cards-dot--forget, .wa-magic-confirm-card--forget { --wa-magic-mode-color: var(--wa-magic-forget); }

.wa-magic-cards-sheet { padding-bottom: 16px; }
/* the Apply magic and Roleplay sheets fill the whole window like the phone: the header clears the
   status bar and the cards (with their dots) sit centred in the height left */
.wa-sheet--full-height:has(.wa-magic-cards-sheet) { height: 100vh; height: 100dvh; }
.wa-sheet--full-height:has(.wa-magic-cards-sheet) .wa-sheet-scroll { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.wa-sheet--full-height .wa-magic-cards-sheet {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding-top: env(safe-area-inset-top, 0px);
}
.wa-sheet--full-height .wa-magic-cards-sheet > .wa-magic-cards-scroller { margin-top: auto; }
.wa-sheet--full-height .wa-magic-cards-sheet > :last-child { margin-bottom: auto; }
/* title on the left, the X (the only way to close this sheet) at the top right */
.wa-magic-cards-header { display: flex; align-items: flex-start; gap: 8px; }
.wa-magic-cards-header .wa-magic-cards-title { flex: 1; }
.wa-magic-cards-close { flex: none; }
.wa-magic-cards-title { margin: 0; font-size: calc(22px * var(--wa-text-scale, 1)); font-weight: 700; line-height: 1.3; }
.wa-magic-cards-subtitle { margin: 4px 0 16px; color: var(--md-on-surface-variant); font-size: calc(14px * var(--wa-text-scale, 1)); line-height: 1.45; }

/* the sideways swipe: runs to the sheet's edges so the next card peeks in */
.wa-magic-cards-scroller {
    position: relative;
    display: flex;
    gap: 12px;
    margin: 0 -24px;
    padding: 0 24px 4px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 24px;
    scrollbar-width: none;
}
.wa-magic-cards-scroller::-webkit-scrollbar { display: none; }

.wa-magic-card {
    --wa-magic-card-surface: var(--md-surface-container-high);
    flex: 0 0 min(292px, calc(100% - 24px));
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    border-radius: 24px;
    border: 1.5px solid var(--wa-magic-mode-color);
    background: var(--wa-magic-card-surface);
    color: var(--md-on-surface);
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.wa-magic-card:hover { --wa-magic-card-surface: var(--md-surface-container-highest); }
.wa-magic-card:focus-visible { outline: none; box-shadow: var(--wa-focus-ring); }

/* the 3:4 picture; its bottom fades into the card so the words below feel attached */
.wa-magic-card-picture { position: relative; display: block; aspect-ratio: 3 / 4; overflow: hidden; }
.wa-magic-card-photo { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 35%; }
.wa-magic-card-round-face-wash {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding-top: 26%;
    box-sizing: border-box;
    background: linear-gradient(
        color-mix(in srgb, var(--wa-magic-mode-color) 45%, transparent),
        color-mix(in srgb, var(--wa-magic-mode-color) 12%, transparent)
    );
}
.wa-magic-card .wa-magic-hero { display: block; }
.wa-magic-card .wa-magic-hero-face { display: block; }
.wa-magic-card-fade {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 150px;
    background: linear-gradient(transparent, var(--wa-magic-card-surface));
}
.wa-magic-card-price-pill,
.wa-magic-card-active-pill {
    position: absolute;
    top: 12px;
    right: 12px;
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 999px;
    white-space: nowrap;
}
/* a block, not flex, so the space after the coin price is kept */
.wa-magic-card-price-pill {
    display: block;
    background: color-mix(in srgb, var(--md-surface-container-highest) 85%, transparent);
    color: var(--md-on-surface);
    font-size: calc(14px * var(--wa-text-scale, 1));
    font-weight: 600;
}
.wa-magic-card-price-pill .wa-coin-price { align-items: center; vertical-align: middle; }
.wa-magic-card-active-pill {
    background: var(--wa-magic-mode-color);
    color: var(--wa-on-magic-mode);
    font-size: calc(12px * var(--wa-text-scale, 1));
    font-weight: 600;
}
.wa-magic-card-name { position: absolute; left: 16px; right: 16px; bottom: 0; }
.wa-magic-card-text-row { display: flex; align-items: center; gap: 4px; padding: 4px 8px 16px 16px; }
.wa-magic-card-description {
    flex: 1;
    min-width: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--md-on-surface-variant);
    font-size: calc(13px * var(--wa-text-scale, 1));
    line-height: 1.4;
}
.wa-magic-card-chevron { flex: none; width: 24px; height: 24px; color: var(--md-on-surface-variant); }

/* the running magic's card: a box holding the card-wide button and the "End early" pill on top of it
   (ApplyMagicCardsSheet's active card), since a button can't hold another button */
/* the card is a size container so the End early pill can sit just above the name on the 3:4 photo */
.wa-magic-card--running { position: relative; cursor: default; container-type: inline-size; }
.wa-magic-card-open-button {
    display: flex;
    flex-direction: column;
    flex: 1;
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.wa-magic-card-open-button:focus-visible { outline: none; }
.wa-magic-card--running:has(.wa-magic-card-open-button:focus-visible) { box-shadow: var(--wa-focus-ring); }
/* a white button centred just above the mode name, in the mode colour's text, the same in both themes */
.wa-magic-card-end-early-button {
    position: absolute;
    /* photo height (3:4 of the card width) minus the name row and a 12px gap and the pill itself */
    top: calc(100cqw * 4 / 3 - 88px);
    left: 50%;
    transform: translateX(-50%);
    min-height: 36px;
    padding: 6px 16px;
    border: 0;
    /* the app's button shape (12px rounded corners), like the phone's MaterialTheme.shapes.large */
    border-radius: 12px;
    background: var(--wa-on-magic-mode);
    color: var(--wa-magic-mode-color);
    font: inherit;
    font-size: calc(13px * var(--wa-text-scale, 1));
    font-weight: 700;
    white-space: nowrap;
    box-shadow: var(--wa-shadow);
    cursor: pointer;
}
/* a 48px tap area around the smaller pill */
.wa-magic-card-end-early-button::after { content: ""; position: absolute; inset: -6px; }
.wa-magic-card-end-early-button:hover { filter: brightness(0.96); }
.wa-magic-card-end-early-button:focus-visible { outline: none; box-shadow: var(--wa-focus-ring); }
.wa-magic-card-end-early-button.htmx-request,
.wa-magic-card-open-button.htmx-request { opacity: 0.7; cursor: progress; }

/* "End Romantic early?" (the confirm the running card opens) */
.wa-magic-end-early-title { margin-top: 16px; }
.wa-magic-end-early-body { margin-bottom: 8px; }

/* the mode name in bold behind a dot of its colour */
.wa-magic-mode-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.wa-magic-mode-dot { flex: none; width: 12px; height: 12px; border-radius: 50%; background: var(--wa-magic-mode-color); }
.wa-magic-mode-name-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: calc(22px * var(--wa-text-scale, 1));
    font-weight: 700;
    line-height: 1.3;
}

/* page dots in the card colours; the current one is a wider pill */
.wa-magic-cards-dots { display: flex; justify-content: center; align-items: center; gap: 4px; margin-top: 16px; }
.wa-magic-cards-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--wa-magic-mode-color) 35%, transparent);
    transition: width 200ms ease, background-color 200ms ease;
}
.wa-magic-cards-dot.is-selected { width: 24px; background: var(--wa-magic-mode-color); }
@media (prefers-reduced-motion: reduce) {
    .wa-magic-cards-dot { transition: none; }
}

/* ==================== the coin confirm (ApplyMagicConfirmSheet) ==================== */

.wa-magic-confirm,
.wa-magic-confirm-form { display: flex; flex-direction: column; align-items: center; width: 100%; }
.wa-magic-confirm { padding: 8px 0 16px; }
.wa-magic-confirm-card {
    width: 100%;
    box-sizing: border-box;
    margin-top: 24px;
    padding: 24px;
    border-radius: 16px;
    border: 1px solid var(--wa-magic-mode-color);
    background: color-mix(in srgb, var(--wa-magic-mode-color) 12%, var(--wa-magic-warm-card));
    box-shadow: var(--wa-shadow);
}
.wa-magic-confirm-magic-row { display: flex; align-items: center; gap: 12px; }
.wa-magic-confirm-thumbnail {
    flex: none;
    width: 56px;
    height: 56px;
    box-sizing: border-box;
    border-radius: 12px;
    border: 1.5px solid var(--wa-magic-mode-color);
    object-fit: cover;
    object-position: top;
}
.wa-magic-confirm-magic-text { flex: 1; min-width: 0; }
.wa-magic-confirm-description {
    margin: 4px 0 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--md-on-surface-variant);
    font-size: calc(13px * var(--wa-text-scale, 1));
    line-height: 1.4;
}
.wa-magic-confirm-question { margin: 24px 0 8px; font-size: calc(16px * var(--wa-text-scale, 1)); font-weight: 500; text-align: center; }
.wa-magic-confirm-cost { margin: 8px 0 0; font-size: calc(16px * var(--wa-text-scale, 1)); text-align: center; }
.wa-magic-confirm-cost .wa-coin-price { align-items: center; vertical-align: bottom; }
.wa-magic-confirm-cannot-undo { margin: 8px 0 0; color: var(--md-on-surface-variant); font-size: calc(13px * var(--wa-text-scale, 1)); text-align: center; line-height: 1.4; }
.wa-magic-forget-slider { display: block; width: 100%; min-height: 32px; margin: 0; accent-color: var(--wa-magic-mode-color); }
.wa-magic-forget-range-labels { display: flex; justify-content: space-between; color: var(--md-on-surface-variant); font-size: calc(14px * var(--wa-text-scale, 1)); }
.wa-magic-confirm-yes { margin-top: 24px; }
.wa-magic-confirm-no { margin-top: 8px; }

/* ==================== the round magic face (cards sheet fallback) and the acknowledgement's text ==================== */

.wa-magic-hero-title { margin: 0; font-size: calc(24px * var(--wa-text-scale, 1)); font-weight: 700; line-height: 1.25; }
.wa-magic-hero-description { margin: 0; color: var(--md-on-surface-variant); font-size: calc(15px * var(--wa-text-scale, 1)); line-height: 1.45; }

/* the pal's face for the magic, ringed in its accent, with the potion as a badge on the bottom right */
.wa-magic-hero { --wa-magic-hero-ring: var(--md-secondary); position: relative; width: 120px; height: 120px; }
.wa-magic-hero--romantic { --wa-magic-hero-ring: var(--wa-magic-romantic); }
.wa-magic-hero--super-love { --wa-magic-hero-ring: var(--wa-magic-super-love); }
.wa-magic-hero--forget { --wa-magic-hero-ring: var(--wa-magic-forget); }
.wa-magic-hero-face {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 0 0 2px var(--wa-magic-hero-ring);
}
.wa-magic-hero-emblem {
    position: absolute;
    right: -12px;
    bottom: -12px;
    width: 52px;
    height: 52px;
    box-sizing: border-box;
    border-radius: 50%;
    object-fit: cover;
    /* the accent ring, then a card-coloured halo that gaps it from the face it overlaps */
    border: 2px solid var(--wa-magic-hero-ring);
    box-shadow: 0 0 0 4px var(--md-inverse-on-surface);
}

/* ==================== one tall card on a full-window sheet (chat/WebAppTallPictureCardSheet.kt) ====================
   The phone's ChatTallPortraitPictureSheetLayout: the X at the top right, then the card and its text
   as wide as the Apply magic sheet's cards, centred in the height left. Used by the "Mode active"
   sheet, the live game / roleplay info sheet and a game's "How to play" sheet. */
.wa-tall-picture-sheet { --wa-magic-mode-color: var(--md-primary); display: flex; flex-direction: column; padding-bottom: 16px; }
.wa-tall-picture-sheet-top-row { display: flex; justify-content: flex-end; margin-bottom: 16px; }
.wa-tall-picture-sheet-content { display: flex; flex-direction: column; width: min(292px, calc(100% - 24px)); margin: 0 auto; }
.wa-sheet--full-height:has(.wa-tall-picture-sheet) { height: 100vh; height: 100dvh; }
.wa-sheet--full-height:has(.wa-tall-picture-sheet) .wa-sheet-scroll { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.wa-sheet--full-height .wa-tall-picture-sheet { flex: 1; padding-top: env(safe-area-inset-top, 0px); }
.wa-sheet--full-height .wa-tall-picture-sheet-content { margin: auto; }
/* the card's picture part, without the description row: border, fade, pill top right, title with a dot */
.wa-tall-picture-card {
    --wa-magic-card-surface: var(--md-surface-container-high);
    position: relative;
    overflow: hidden;
    aspect-ratio: 3 / 4;
    border-radius: 24px;
    border: 1.5px solid var(--wa-magic-mode-color);
    background: var(--wa-magic-card-surface);
    color: var(--md-on-surface);
}
/* see-through, no border, like the magic cards' price pill */
.wa-tall-picture-card-pill {
    position: absolute;
    top: 12px;
    right: 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: calc(100% - 24px);
    box-sizing: border-box;
    padding: 4px 12px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--md-surface-container-highest) 85%, transparent);
    color: var(--md-on-surface);
    font-size: calc(12px * var(--wa-text-scale, 1));
    font-weight: 600;
    line-height: 16px;
    white-space: nowrap;
}
.wa-tall-picture-card-pill .wa-icon svg { width: 16px; height: 16px; }
.wa-tall-picture-card-title { position: absolute; left: 16px; right: 16px; bottom: 16px; margin: 0; }
.wa-tall-picture-card-title .wa-magic-mode-name-text {
    white-space: normal;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
}

/* ==================== the "Mode active" sheet (ModeActiveStatusSheetContent) ==================== */

/* the X at the top right, then a tall card per magic (the shared .wa-tall-picture-sheet below) */
.wa-magic-status-section--romantic { --wa-magic-mode-color: var(--wa-magic-romantic); }
.wa-magic-status-section--super-love { --wa-magic-mode-color: var(--wa-magic-super-love); }
.wa-magic-status-section { display: flex; flex-direction: column; }
.wa-magic-status-divider { height: 1px; margin: 24px 0; background: var(--md-outline-variant); }
.wa-magic-status-ran-out-text { margin: 0; color: var(--md-on-surface-variant); text-align: center; }
.wa-magic-status-picture-photo { object-position: center; }
/* the phone's TALL_PORTRAIT_CARD_PHOTO_ALIGNMENT keeps her face a bit above the middle */
.wa-magic-status-picture-photo--tall { object-position: 50% 35%; }
/* no photo: her round face (or the emblem) a bit above centre on a wash of the magic's colour */
.wa-magic-status-picture-wash {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom,
        color-mix(in srgb, var(--wa-magic-mode-color) 45%, transparent),
        color-mix(in srgb, var(--wa-magic-mode-color) 12%, transparent));
}
.wa-magic-status-picture-wash .wa-magic-hero {
    position: absolute;
    left: 50%;
    top: calc((100% - 120px) * 0.3);
    transform: translateX(-50%);
}
.wa-magic-status-picture-wash .wa-magic-hero-face { display: block; }
/* inside the card's top right pill: the emblem and the magic's short name */
.wa-magic-status-name-chip { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.wa-magic-status-name-chip-emblem {
    flex: none;
    width: 24px;
    height: 24px;
    box-sizing: border-box;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--wa-magic-mode-color);
}
.wa-magic-status-description {
    margin: 12px 0 0;
    padding: 0 4px;
    color: var(--md-on-surface-variant);
    font-size: calc(14px * var(--wa-text-scale, 1));
    line-height: 1.43;
}

/* "Active · 6 days left" with an hourglass, over a thin bar of the time still left */
.wa-magic-status-time-left { margin-top: 20px; padding: 0 4px; }
.wa-magic-status-time-left-label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    color: var(--md-on-surface);
    font-size: calc(14px * var(--wa-text-scale, 1));
    font-weight: 600;
    line-height: 20px;
}
.wa-magic-status-time-left-icon { flex: none; display: inline-flex; color: var(--wa-magic-mode-color); }
.wa-magic-status-time-left-icon svg { width: 16px; height: 16px; }
.wa-magic-status-time-left-track {
    display: block;
    height: 4px;
    margin-top: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--md-surface-container-highest);
}
.wa-magic-status-time-left-fill { display: block; height: 100%; border-radius: 999px; background: var(--wa-magic-mode-color); }

/* what ending early does, then "End early {coin} 4" with the coin before the price */
.wa-magic-status-end-early-note {
    margin: 24px 0 0;
    padding: 0 4px;
    color: var(--md-on-surface-variant);
    font-size: calc(12px * var(--wa-text-scale, 1));
    line-height: 1.33;
    text-align: center;
}
.wa-magic-status-end-early-button { margin-top: 12px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.wa-magic-status-end-early-price .wa-coin-price { align-items: center; vertical-align: middle; }

/* ==================== the "Why did you stop?" survey after "Keep chats" ==================== */

.wa-magic-survey-options { display: grid; gap: 8px; margin: 16px 0 8px; }
.wa-magic-survey-option {
    width: 100%;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid var(--md-outline-variant);
    background: var(--md-surface-container-low);
    color: var(--md-on-surface);
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.wa-magic-survey-option:hover { background: var(--md-surface-container); }

/* ==================== after a magic: reaction video ==================== */

.wa-magic-reaction-video {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000000;
}
.wa-magic-reaction-video-player { width: 100%; height: 100%; object-fit: contain; }
/* the phone's player controls, top right: mute toggle then close, white on the video */
.wa-magic-reaction-video-controls {
    position: absolute;
    top: max(16px, env(safe-area-inset-top));
    right: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.wa-magic-reaction-video-close,
.wa-magic-reaction-video-mute {
    background: rgba(0, 0, 0, 0.45);
    border-color: rgba(255, 255, 255, 0.4);
    color: #FFFFFF;
}
.wa-magic-reaction-video-mute {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.4);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.wa-magic-reaction-video-sound-off { display: none; }
.wa-magic-reaction-video-mute.is-muted .wa-magic-reaction-video-sound-on { display: none; }
.wa-magic-reaction-video-mute.is-muted .wa-magic-reaction-video-sound-off { display: inline-flex; }

/* ==================== virtual gifts: the message box icon ==================== */

.wa-composer-tool--gift { width: 40px; }

/* ==================== the wishlist sheet (VirtualGiftsBottomSheet) ==================== */

/* no drag handle: the sheet can't be swiped away, the X closes it (as on the phone) */
#wa-virtual-gifts-sheet .wa-sheet-scroll,
#wa-virtual-gift-detail-sheet .wa-sheet-scroll { padding: 16px 16px 24px; }
.wa-gift-sheet-heading {
    position: sticky;
    top: -16px;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin: -16px -16px 20px;
    padding: 16px 56px 0;
    background: var(--md-background);
}
.wa-gift-sheet-title { margin: 0; font-size: calc(22px * var(--wa-text-scale, 1)); font-weight: 700; line-height: 1.25; text-align: center; }
.wa-gift-sheet-close { position: absolute; top: 16px; right: 16px; }

/* the pal's face in a yellow ring with a background-coloured gap */
.wa-gift-ringed-face {
    width: 64px;
    height: 64px;
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 2px;
    border-radius: 50%;
    background: var(--md-secondary);
    color: var(--md-on-secondary);
}
.wa-gift-ringed-face-image {
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    border-radius: 50%;
    border: 2px solid var(--md-background);
    object-fit: cover;
}

/* a fixed grid of identical cards, three to a row; a short last row is centred */
.wa-gift-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.wa-gift-card {
    flex: 0 0 calc((100% - 24px) / 3);
    min-width: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    padding: 8px 8px 12px;
    border-radius: 20px;
    border: 1px solid var(--md-outline-variant);
    background: var(--md-surface-container-low);
    color: var(--md-on-surface);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: transform 120ms ease;
}
.wa-gift-card:active { transform: scale(0.96); }
.wa-gift-card-photo-holder { position: relative; }
.wa-gift-photo {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 12px;
    background: var(--md-surface-container-highest);
    color: var(--md-on-surface-variant);
}
.wa-gift-photo-image { width: 100%; height: 100%; object-fit: cover; }
.wa-gift-photo-glyph svg { width: 40px; height: 40px; }
.wa-gift-card--given .wa-gift-photo { opacity: 0.4; }
.wa-gift-given-check {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--md-secondary);
    color: var(--md-on-secondary);
}
.wa-gift-given-check svg { width: 14px; height: 14px; }
/* the name in small text, always two lines tall so the cards in a row line up */
.wa-gift-card-name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.8em;
    margin: 12px 4px 8px;
    font-size: calc(13px * var(--wa-text-scale, 1));
    font-weight: 600;
    line-height: 1.4;
}
.wa-gift-card-bottom-line { display: flex; align-items: center; min-height: 24px; margin: 0 4px; }
.wa-gift-price { flex: 1; display: inline-flex; align-items: center; gap: 4px; font-size: calc(16px * var(--wa-text-scale, 1)); font-weight: 700; }
.wa-gift-price .wa-coin { width: 16px; height: 16px; }
.wa-gift-card-arrow {
    width: 24px;
    height: 24px;
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--md-secondary);
    color: var(--md-on-secondary);
}
.wa-gift-card-arrow svg { width: 16px; height: 16px; }
.wa-gift-given-line { display: inline-flex; align-items: center; gap: 4px; color: var(--md-on-surface-variant); font-size: calc(14px * var(--wa-text-scale, 1)); font-weight: 600; }
.wa-gift-given-line svg { width: 16px; height: 16px; }

/* ==================== one gift (VirtualGiftDetailBottomSheet) ==================== */

.wa-gift-detail-top-row { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-bottom: 20px; }
.wa-gift-detail-top-row .wa-coin-pill { margin-right: auto; }
.wa-gift-detail-body { display: flex; flex-direction: column; align-items: center; }
.wa-gift-detail-photo-holder { position: relative; display: flex; justify-content: center; margin-bottom: 36px; }
.wa-gift-photo--detail { width: 200px; border-radius: 24px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18); }
.wa-gift-detail-body--given .wa-gift-photo--detail { opacity: 0.5; box-shadow: none; }
.wa-gift-detail-pill {
    position: absolute;
    left: 50%;
    bottom: -16px;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    border-radius: 999px;
    border: 1px solid var(--md-outline-variant);
    background: var(--md-background);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    white-space: nowrap;
}
.wa-gift-detail-pill--given {
    border-color: var(--md-secondary);
    background: var(--md-secondary);
    color: var(--md-on-secondary);
    font-size: calc(14px * var(--wa-text-scale, 1));
    font-weight: 600;
}
.wa-gift-detail-pill--given svg { width: 20px; height: 20px; }
.wa-gift-detail-name { margin: 0 0 20px; font-size: calc(22px * var(--wa-text-scale, 1)); font-weight: 600; text-align: center; line-height: 1.3; }
/* her note: a card with her ringed face centred on its top edge, half outside */
.wa-gift-note { position: relative; width: 100%; display: flex; flex-direction: column; align-items: center; }
.wa-gift-note .wa-gift-ringed-face { position: relative; z-index: 1; margin-bottom: -32px; }
.wa-gift-note-text {
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 44px 16px 16px;
    border-radius: 20px;
    border: 1px solid var(--md-outline-variant);
    background: var(--md-surface-container-low);
    line-height: 1.45;
}
.wa-gift-detail-footer {
    position: sticky;
    bottom: -24px;
    margin: 12px -16px -24px;
    padding: 12px 16px 24px;
    background: var(--md-background);
}
.wa-gift-send-button { width: 100%; }

/* ==================== the gift bubble (VirtualGiftChatBubbleBody) ==================== */

/* a button: a tap opens the gift's one-gift sheet */
.wa-gift-bubble {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 160px;
    margin: 0;
    padding: 4px 0 0;
    border: 0;
    border-radius: 12px;
    background: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
    transition: transform 120ms ease;
}
.wa-gift-bubble:active { transform: scale(0.97); }
.wa-gift-bubble:focus-visible { outline: none; box-shadow: var(--wa-focus-ring); }
.wa-gift-bubble-photo-holder { position: relative; display: block; margin-bottom: 20px; }
.wa-gift-photo--bubble { width: 160px; border-radius: 12px; }
.wa-gift-gifted-pill {
    position: absolute;
    left: 50%;
    bottom: -12px;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--md-secondary);
    color: var(--md-on-secondary);
    font-size: calc(12px * var(--wa-text-scale, 1));
    font-weight: 600;
    white-space: nowrap;
}
.wa-gift-gifted-pill svg { width: 16px; height: 16px; }
.wa-gift-bubble-name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
    font-size: calc(14px * var(--wa-text-scale, 1));
    font-weight: 600;
    text-align: center;
}

/* ==================== the gift card under her gift ask (VirtualGiftAskedForCardInChatBubble) ==================== */
/* as wide as her bubble, framed like a wishlist card; the square photo fills it */

.wa-gift-asked-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
    margin-top: 8px;
    padding: 8px 8px 12px;
    border-radius: 20px;
    border: 1px solid var(--md-outline-variant);
    background: var(--md-surface-container-low);
    color: var(--md-on-surface);
    font: inherit;
    cursor: pointer;
    transition: transform 120ms ease;
}
/* like the phone's fillMaxWidth, the card widens her bubble to its full width even under a short line */
.wa-thread-page .wa-message:has(.wa-gift-asked-card) { width: min(280px, 82%); }
.wa-gift-asked-card:active { transform: scale(0.97); }
.wa-gift-asked-card:focus-visible { outline: none; box-shadow: var(--wa-focus-ring); }
.wa-gift-asked-card-photo-holder { position: relative; display: block; width: 100%; margin-bottom: 28px; }
.wa-gift-photo--asked-card { width: 100%; border-radius: 12px; }
.wa-gift-asked-card--given .wa-gift-photo--asked-card { opacity: 0.4; }
.wa-gift-asked-card .wa-gift-given-check { top: 4px; right: 4px; }
.wa-gift-asked-card-name {
    display: -webkit-box;
    width: 100%;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: calc(14px * var(--wa-text-scale, 1));
    font-weight: 600;
    line-height: 1.35;
    text-align: center;
}
@media (prefers-reduced-motion: reduce) {
    .wa-gift-asked-card, .wa-gift-bubble { transition: none; }
    .wa-gift-asked-card:active, .wa-gift-bubble:active { transform: none; }
}

/* ==================== the memory face-photo sheet (MemoryPhotoNeedsFacePhotoBottomSheet) ==================== */

.wa-face-photo-sheet { display: flex; flex-direction: column; align-items: center; padding-bottom: 16px; }
.wa-face-photo-sheet-badge {
    width: 64px;
    height: 64px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    border-radius: 50%;
    background: var(--md-surface-container-highest);
    color: var(--md-on-surface);
}
.wa-face-photo-sheet-badge svg { width: 28px; height: 28px; }
.wa-face-photo-sheet .wa-magic-sheet-title { font-size: calc(20px * var(--wa-text-scale, 1)); }
.wa-face-photo-sheet .wa-magic-wide-button + .wa-magic-wide-button { margin-top: 4px; }

/* the roleplay scene card shows its whole persona title (up to two lines) and its whole line (up to four) */
.wa-magic-mode-name--roleplay-scene .wa-magic-mode-name-text {
    white-space: normal;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}
.wa-magic-card--roleplay-scene .wa-magic-card-description { -webkit-line-clamp: 4; }

