/* Self-hosted Inter (variable, weights 100-900 in one file per style).
   Same niche as Discord's gg sans; the old stack led with Whitney, a commercial
   font we never shipped, so users actually saw Arial/Helvetica/Roboto.
   The server serves these files immutable for a year (Program.cs): a changed font needs a NEW FILE NAME here
   and in the preload in index.html, or devices keep the old one. The regular file is precached by the worker. */
@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("/fonts/InterVariable.woff2") format("woff2");
}

@font-face {
    font-family: "Inter";
    font-style: italic;
    font-weight: 100 900;
    font-display: swap;
    src: url("/fonts/InterVariable-Italic.woff2") format("woff2");
}

/* The tokens of the default theme (discord-dark). themes.css overrides them per theme. */
:root {
    /* Backgrounds (darkest to lightest) */
    --bg-darkest: #18191c;
    --bg-header: #202225;
    --bg-sidebar: #2f3136;
    --bg-hover: #32353b;
    --bg-primary: #36393f;
    --bg-secondary: #393c43;
    --bg-input: #40444b;
    --bg-muted: #4f545c;
    --bg-tertiary: #2a2c31;
    /* The small bubbles that say one line over the page (the connection dot's bubble, the reason on a message
       row). Dark in every theme, light themes too: the text on it is white. */
    --bg-tooltip: #111;

    /* Text colors (brightest to dimmest) */
    --text-white: #fff;
    --text-primary: #dcddde;
    --text-secondary: #b9bbbe;
    --text-muted: #a3a6aa;
    --text-tertiary: #96989d;
    --text-placeholder: #72767d;

    /* Accent colors (Discord blurple) */
    --accent-primary: #5865f2;
    --accent-hover: #4752c4;
    --accent-light: #dee0fc;
    --accent-focus: #00aff4;
    --accent-tint: hsl(235 85.6% 64.7% / 0.16);
    /* Text and icons on a fill of --accent-primary: a primary button, Send, a selected chip, a badge. A theme
       whose accent is too pale for white sets a dark value here (themes.css; the bar is a contrast of 3:1).
       Not --text-white: that token is the strongest text of a theme, and it is dark in the light themes. */
    --accent-ink: #fff;

    /* Status colors */
    --status-online: #3ba55c;
    --status-online-hover: #2d7d46;
    --status-away: #faa61a;
    --status-away-hover: #fcc24f;
    --status-invisible: #747f8d;

    /* Text/icon colour on the header status chip, whose BACKGROUND is the status
       colour itself. Themes with bright status colours (phosphor/neon greens) flip
       this dark - white on bright green is unreadable. */
    --status-chip-text: var(--text-white);

    /* Semantic colors */
    --color-success: #3ba55c;
    --color-warning: #faa61a;
    --color-danger: #ed4245;

    /* Borders */
    --border-dark: #202225;
    --border-subtle: #040405;

    /* Scene layers (Themes 2.0 canvas layer). The design record of the themes left the tree with the
       Blazor code; css/README.md says how to read it.
       A theme that sets these paints a tiled scene behind the whole chat shell;
       every theme that leaves them `none` renders exactly as it did before, which
       is the acceptance test for the layer. Names and stacking order mirror the
       source theme's own five layers. Do not reorder them: the layers are opaque JPEG
       rectangles painted in order, and the art is drawn so that the seams meet. A
       different order puts the tea house behind the sky. */
    --scene-canvastile: none;
    --scene-headertile: none;
    --scene-header: none;
    --scene-footertile: none;
    --scene-footer: none;

    /* Per-layer background-size list, positionally matched to the images above.
       A single `auto` applies to every slot, which is what non-scene themes want.
       Scene themes emit a real list so the strips scale to fit the viewport. */
    --scene-sizes: auto;

    /* Surface behind the composer band (input row + typing indicator). Transparent:
       the composer sits inside .messages-container, so that panel's wash continues
       behind it uninterrupted, and .chat-container already paints --bg-primary
       beneath everything. An OPAQUE value here is the hazard that named this
       variable - it buries the scene/pattern layers and cuts a hard line across
       the wash. No shipped theme sets it (Tea House briefly did and was reverted:
       the user wanted only the input pill itself coloured); a theme that wants a
       distinct band must match its panel's terminal colour/alpha exactly. */
    --bg-input-band: transparent;

    /* Surface behind the message list. Transparent for the same reason as
       --bg-input-band above: --bg-primary is already painted by .chat-container, so
       this looks identical, but leaving it opaque would bury the scene and pattern
       layers. A scene theme overrides it with a translucent wash for legibility. */
    --bg-canvas-panel: transparent;

    /* --- Pattern layer -------------------------------------------------------
       A tint shown through a mask. The mask carries the SHAPE, the element's
       background-color carries the COLOUR - which is the whole point: an SVG or
       image tile bakes its colour in, so it would need one copy per theme, while a
       mask lets every theme paint the same shape in its own colour.

       Off by default twice over: no mask AND a transparent colour, because
       `mask-image: none` means "no mask", i.e. fully opaque, not "invisible". */
    --canvas-pattern: none;
    --pattern-color: transparent;
    /* Colour a theme wants its DM pattern drawn in. White works on every dark
       theme; light themes override it below.

       HALVED 2026-08-27, and so was every other pattern alpha in the app
       (themes.css and the Tea House generator): the motifs read as decoration
       competing with the text rather than as a whisper that the room is
       different. The ratios between them were right, only the overall level was
       hot - so the whole set was scaled by 0.5 rather than retuned one by one.
       Keep that discipline: change this default and the signature patterns move
       with it, or the DM marker starts out-shouting a theme's own motif. */
    --pattern-tint: hsl(0 0% 100% / 0.0225);

    /* Reusable pattern shapes: discrete organic motifs (waves, raindrops, specks,
       wave-crest arcs), scattered so nothing touches. They are SVG data-URI MASKS,
       not images: only the alpha channel matters, the colour still comes from the
       element's background-color, so one shape serves every theme. Gradients could
       not draw these - repeating-linear-gradient only makes lines and grids, which
       is the rigid look this set replaced. Each tile is seamless simply because no
       motif crosses its edge; mask-size auto uses the SVG's intrinsic width/height,
       so density is tuned by the tile dimensions inside each URI.
       Authoring tool (edit, preview, regenerate): themes/patterns/build.py. */
    --pattern-waves: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='104' height='104'%3E%3Cdefs%3E%3ClinearGradient id='f'%3E%3Cstop offset='0' stop-color='black' stop-opacity='0.25'/%3E%3Cstop offset='0.35' stop-color='black'/%3E%3Cstop offset='0.65' stop-color='black'/%3E%3Cstop offset='1' stop-color='black' stop-opacity='0.25'/%3E%3C/linearGradient%3E%3Cpath id='w' d='M0.0 0.0 L0.9 -0.5 L1.7 -1.0 L2.5 -1.4 L3.3 -1.7 L4.0 -1.9 L4.7 -2.0 L5.4 -2.0 L6.0 -1.9 L6.6 -1.8 L7.2 -1.6 L7.8 -1.4 L8.4 -1.1 L9.0 -0.7 L9.7 -0.2 L10.3 0.3 L11.0 1.0 L11.8 1.8 L12.7 2.4 L13.5 3.0 L14.4 3.4 L15.3 3.8 L16.2 4.0 L17.1 4.1 L18.0 4.1 L18.9 3.9 L19.7 3.7 L20.5 3.3 L21.3 2.8 L22.0 2.3 L22.7 1.6 L23.4 0.9 L24.0 0.0 L24.0 -0.0 L23.1 0.5 L22.3 1.0 L21.5 1.4 L20.7 1.7 L20.0 1.9 L19.3 2.0 L18.6 2.0 L18.0 1.9 L17.4 1.8 L16.8 1.6 L16.2 1.4 L15.6 1.1 L15.0 0.7 L14.3 0.2 L13.7 -0.3 L13.0 -1.0 L12.2 -1.8 L11.3 -2.4 L10.5 -3.0 L9.6 -3.4 L8.7 -3.8 L7.8 -4.0 L6.9 -4.1 L6.0 -4.1 L5.1 -3.9 L4.3 -3.7 L3.5 -3.3 L2.7 -2.8 L2.0 -2.3 L1.3 -1.6 L0.6 -0.9 L0.0 0.0 Z' fill='url(%23f)'/%3E%3C/defs%3E%3Cuse href='%23w' transform='translate(10 34) rotate(-45) scale(1.25)'/%3E%3Cuse href='%23w' transform='translate(48 26) rotate(-41) scale(0.8)'/%3E%3Cuse href='%23w' transform='translate(76 58) rotate(-48) scale(1.0)'/%3E%3Cuse href='%23w' transform='translate(24 82) rotate(-44) scale(0.6)'/%3E%3Cuse href='%23w' transform='translate(62 96) rotate(-46) scale(0.9)'/%3E%3C/svg%3E");
    --pattern-drops: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cg transform='translate(24 30) rotate(15) scale(1.0)'%3E%3Cpath d='M0 -6 C3 -2 5 1 5 3.5 A5 5 0 1 1 -5 3.5 C-5 1 -3 -2 0 -6 Z' fill='black'/%3E%3C/g%3E%3Cg transform='translate(80 19) rotate(-20) scale(0.7)'%3E%3Cpath d='M0 -6 C3 -2 5 1 5 3.5 A5 5 0 1 1 -5 3.5 C-5 1 -3 -2 0 -6 Z' fill='black'/%3E%3C/g%3E%3Cg transform='translate(121 49) rotate(30) scale(1.2)'%3E%3Cpath d='M0 -6 C3 -2 5 1 5 3.5 A5 5 0 1 1 -5 3.5 C-5 1 -3 -2 0 -6 Z' fill='black'/%3E%3C/g%3E%3Cg transform='translate(48 76) rotate(-10) scale(0.85)'%3E%3Cpath d='M0 -6 C3 -2 5 1 5 3.5 A5 5 0 1 1 -5 3.5 C-5 1 -3 -2 0 -6 Z' fill='black'/%3E%3C/g%3E%3Cg transform='translate(102 89) rotate(45) scale(0.6)'%3E%3Cpath d='M0 -6 C3 -2 5 1 5 3.5 A5 5 0 1 1 -5 3.5 C-5 1 -3 -2 0 -6 Z' fill='black'/%3E%3C/g%3E%3Cg transform='translate(22 116) rotate(-35) scale(1.1)'%3E%3Cpath d='M0 -6 C3 -2 5 1 5 3.5 A5 5 0 1 1 -5 3.5 C-5 1 -3 -2 0 -6 Z' fill='black'/%3E%3C/g%3E%3Cg transform='translate(75 127) rotate(10) scale(0.75)'%3E%3Cpath d='M0 -6 C3 -2 5 1 5 3.5 A5 5 0 1 1 -5 3.5 C-5 1 -3 -2 0 -6 Z' fill='black'/%3E%3C/g%3E%3Cg transform='translate(126 116) rotate(-15) scale(0.9)'%3E%3Cpath d='M0 -6 C3 -2 5 1 5 3.5 A5 5 0 1 1 -5 3.5 C-5 1 -3 -2 0 -6 Z' fill='black'/%3E%3C/g%3E%3C/svg%3E");
    --pattern-pebbles: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cdefs%3E%3Cpath id='b' d='M0,-18 C12,-18 22,-8 20,4 C18,16 6,22 -6,19 C-18,16 -24,4 -20,-8 C-16,-18 -10,-18 0,-18 Z'/%3E%3C/defs%3E%3Cuse href='%23b' fill='black' transform='translate(55 60) rotate(10) scale(1.0)'/%3E%3Cuse href='%23b' fill='black' transform='translate(160 40) rotate(-25) scale(0.7)'/%3E%3Cuse href='%23b' fill='black' transform='translate(225 110) rotate(40) scale(1.15)'/%3E%3Cuse href='%23b' fill='black' transform='translate(100 150) rotate(-10) scale(0.85)'/%3E%3Cuse href='%23b' fill='black' transform='translate(195 185) rotate(15) scale(0.6)'/%3E%3Cuse href='%23b' fill='black' transform='translate(50 220) rotate(-35) scale(1.1)'/%3E%3Cuse href='%23b' fill='black' transform='translate(145 235) rotate(5) scale(0.8)'/%3E%3C/svg%3E");
    --pattern-ripples: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cdefs%3E%3Cpath id='r' d='M0,-15 C9,-16 16,-8 15,1 C14,10 6,16 -3,15 C-12,14 -17,6 -16,-3 C-15,-11 -8,-14 0,-15 Z'/%3E%3C/defs%3E%3Cuse href='%23r' fill='none' stroke='black' stroke-width='1.5' transform='translate(72 82) scale(1.0)'/%3E%3Cuse href='%23r' fill='none' stroke='black' stroke-width='1.5' transform='translate(72 82) scale(1.75)'/%3E%3Cuse href='%23r' fill='none' stroke='black' stroke-width='1.5' transform='translate(72 82) scale(2.5)'/%3E%3Cuse href='%23r' fill='none' stroke='black' stroke-width='1.5' transform='translate(185 185) rotate(25) scale(0.9)'/%3E%3Cuse href='%23r' fill='none' stroke='black' stroke-width='1.5' transform='translate(185 185) rotate(25) scale(1.5)'/%3E%3Cuse href='%23r' fill='none' stroke='black' stroke-width='1.5' transform='translate(185 185) rotate(25) scale(2.1)'/%3E%3Cuse href='%23r' fill='none' stroke='black' stroke-width='1.5' transform='translate(185 185) rotate(25) scale(2.7)'/%3E%3Cuse href='%23r' fill='none' stroke='black' stroke-width='1.5' transform='translate(228 55) rotate(-15) scale(0.6)'/%3E%3Cuse href='%23r' fill='none' stroke='black' stroke-width='1.5' transform='translate(228 55) rotate(-15) scale(1.05)'/%3E%3Cuse href='%23r' fill='none' stroke='black' stroke-width='1.5' transform='translate(45 215) rotate(10) scale(0.55)'/%3E%3Cuse href='%23r' fill='none' stroke='black' stroke-width='1.5' transform='translate(45 215) rotate(10) scale(0.95)'/%3E%3Ccircle cx='150' cy='60' r='1.5' fill='black'/%3E%3Ccircle cx='120' cy='200' r='1.5' fill='black'/%3E%3Ccircle cx='240' cy='140' r='1.5' fill='black'/%3E%3C/svg%3E");
    --pattern-specks: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64'%3E%3Ccircle cx='8' cy='10' r='1.4' fill='black'/%3E%3Ccircle cx='28' cy='6' r='1.0' fill='black'/%3E%3Ccircle cx='50' cy='14' r='1.8' fill='black'/%3E%3Ccircle cx='14' cy='34' r='1.0' fill='black'/%3E%3Ccircle cx='40' cy='38' r='1.5' fill='black'/%3E%3Ccircle cx='60' cy='52' r='1.1' fill='black'/%3E%3Ccircle cx='22' cy='56' r='1.6' fill='black'/%3E%3C/svg%3E");
    --pattern-specks-dense: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64'%3E%3Ccircle cx='8' cy='10' r='1.4' fill='black'/%3E%3Ccircle cx='28' cy='6' r='1.0' fill='black'/%3E%3Ccircle cx='50' cy='14' r='1.8' fill='black'/%3E%3Ccircle cx='14' cy='34' r='1.0' fill='black'/%3E%3Ccircle cx='40' cy='38' r='1.5' fill='black'/%3E%3Ccircle cx='60' cy='52' r='1.1' fill='black'/%3E%3Ccircle cx='22' cy='56' r='1.6' fill='black'/%3E%3Ccircle cx='46' cy='60' r='1.2' fill='black'/%3E%3Ccircle cx='58' cy='28' r='1.0' fill='black'/%3E%3Ccircle cx='6' cy='48' r='1.2' fill='black'/%3E%3Ccircle cx='34' cy='22' r='1.1' fill='black'/%3E%3Ccircle cx='52' cy='44' r='1.4' fill='black'/%3E%3C/svg%3E");

    /* --- Glow ----------------------------------------------------------------
       Theme opt-in, `none` by default. Applied to a SMALL fixed set of elements
       (status dots, the send button). Never per-message: a box-shadow on every row
       of a scrolling list repaints every frame for no information gain. */
    --glow-accent: none;
    --glow-status: none;

    /* --- Input pill ring ----------------------------------------------------
       Theme opt-in, `none` by default. A colour or a gradient, drawn as a 1 px
       ring around the input pill (composer.css, .input-box::before). A masked
       pseudo-element paints it, so the pill keeps its size. */
    --input-border: none;

    /* Wash painted over the whole composite. Per-layer tinting is impossible
       (the layers are opaque JPEGs), so legibility tuning happens here. */
    --canvas-scrim: none;
}

* {
    box-sizing: border-box;
}

/* ==========================================================================
   THE pattern layer. It lives inside the conversation and scrolls with the
   text - chosen over a fixed backdrop after an A/B toggle (2026-08-25): the
   pattern belongs to the conversation surface, not the room behind it. A side
   effect the decision embraced: patterns show only in the message column, not
   behind the sidebar or header.

   Mechanics: masks have no attachment property, so scrolling is structural -
   the ::before spans .messages-flow (the scroll CONTENT) at full height and
   rides natively with it. background-color carries the colour, the mask
   carries the shape, both set per theme/context in themes.css.

   z-index choreography: .messages-flow gets its own stacking context so the
   ::before at -1 paints above the ancestors' backgrounds (the canvas panel
   wash) but below every message. Without the local context, -1 would sink
   beneath the wash and vanish - the buried-layer bug from the pattern layer's
   first landing.

   The context also TRAPS every position:fixed popup a message renders (the
   more-menu and its backdrop, the reaction picker): their
   own z-indexes only rank inside the flow, and the flow as a whole ranks
   against its siblings. z-index 1, not 0, so the flow beats the later
   .message-input-container (z auto) - at 0 the input row painted over the
   bottom of those popups (the "Delete" item, the mobile bottom sheets). Keep
   it below 98 (mobile sidebar backdrop) so drawers, header dropdowns and the
   image lightbox still cover the list. The always-on send button (z 1000) can
   still poke through a mobile sheet while text is typed; accepted.
   ========================================================================== */
.messages-flow {
    position: relative;
    z-index: 1;
}

.messages-flow::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    /* Not a scroll anchor. With inset: 0 this layer is partly visible at every scroll position
       and has no children, so Chrome picked it as the anchor of .messages before any message
       row. It never moves, so every adjustment was 0: anchoring never ran in the list, and each
       image that loaded above the view slid the text down (the CLS 1.24 on history paging,
       2026-10-23). Any other absolutely positioned layer that spans the flow needs the same. */
    overflow-anchor: none;
    background-color: var(--pattern-color);
    -webkit-mask-image: var(--canvas-pattern);
    mask-image: var(--canvas-pattern);
}

html, body {
    margin: 0;
    padding: 0;
    font-family: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
    background: var(--bg-primary);
    /* Gradient themes make --bg-primary an image, and the shorthand above then
       resets background-color to transparent. iOS paints the PWA status-bar
       strip, overscroll, and Safari's chrome tint from the root COLOR, not the
       image - without a real one those surfaces fall back to white. Solid
       themes fall through to --bg-primary; gradient themes must define
       --bg-canvas (their top gradient stop) in themes.css. The inline script in
       index.html reads this computed color into <meta name="theme-color">. */
    background-color: var(--bg-canvas, var(--bg-primary));
    color: var(--text-primary);
    height: 100%;
    overflow: hidden;
}

/* The start spinner (SH-51): a first load, or a load after a sign-out, has nothing stored to paint and waits for the
   server with an empty page. Fixed over the page, so the first mount neither moves nor waits for it; main.js removes
   it. The spinner class and the 400 ms appear animation come from css/timeline.css, which every page loads. */
.start-loading { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; opacity: 0; animation: loading-tail-appear 150ms ease-out 400ms forwards; }
.start-loading .loading-spinner { width: 24px; height: 24px; border-width: 3px; }

/* The start-failure screen (SH-41): shown by main.js when the app cannot start at all. */
#start-error {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    animation: fadeIn 0.3s ease-out;
}

#start-error.show {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* The one spinner: the login button, the history pill and the GIF tiles. A keyframe name is global, so the
   files in css/ do not define their own. */
@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes bounceIn {
    0% { transform: scale(0.8); opacity: 0; }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); opacity: 1; }
}

#start-error .error-modal-content {
    background: var(--bg-sidebar, #2f3136);
    border-radius: 12px;
    padding: 2.5rem;
    max-width: 420px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: bounceIn 0.4s ease-out;
}

#start-error .error-illustration {
    margin-bottom: 1rem;
}

#start-error .error-ascii {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.2;
    color: #faa61a;
    margin: 0;
    display: inline-block;
    text-align: left;
}

#start-error .error-title {
    color: #ed4245;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 0.75rem 0;
}

#start-error .error-message {
    color: #dcddde;
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0 0 1.5rem 0;
}

#start-error .error-actions {
    margin-bottom: 1rem;
}

#start-error .reload {
    display: inline-block;
    background: #5865f2;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: background-color 0.15s ease, transform 0.15s ease;
}

#start-error .reload:hover {
    background: #4752c4;
    transform: translateY(-1px);
}

#start-error .error-hint {
    color: #72767d;
    font-size: 0.8rem;
    margin: 0;
    font-style: italic;
}

/* ==========================================================================
   Global rules: the hidden attribute, the layout wrappers, emoji images in text, the page column, and the touch
   and phone overrides.
   ========================================================================== */

/* The hidden attribute wins over every display rule of the files in css/. */
[hidden] { display: none !important; }

/* Wrappers that the JavaScript needs and the Blazor markup did not have. display: contents keeps the children
   in the parent's layout, so the rules in css/ see the sibling structure they were written for. */
.header-title, .status-menu, .composer, .more-menu-layer, .quick-reactions { display: contents; }

/* Emoji images in text (MR-16, MR-38): the four sizes the old server renderer wrote as inline styles, on the slot that
   render/text.js puts around every emoji image (its only maker). The slot is an inline block with hidden overflow, so
   its baseline is its bottom edge whatever the image's state (CSS 2.1, 10.8.1), and the same vertical-align puts that
   edge where a bare image's sat. An inline grid took the image's own baseline instead, and a failed image has one
   inside its box (the alt text's), which lifted the glyph about a line's ascent above the text. */
.emoji-slot { --emoji-size: 1.2em; display: inline-block; position: relative; width: var(--emoji-size); height: var(--emoji-size); overflow: hidden; vertical-align: -0.2em; }
.emoji-slot-inline { --emoji-size: 1em; vertical-align: -0.15em; }
.emoji-slot-big { --emoji-size: 3em; vertical-align: -0.4em; }
.emoji-slot-pill { --emoji-size: 18px; vertical-align: -3px; }
img.emoji { display: block; width: 100%; height: 100%; object-fit: contain; }

/* The device's own emoji in place of an image that is still on its way (MR-15): text.js sets data-glyph and adds
   .loaded at the image's load. The glyph stays hidden for the first second. A stored image answers long before that,
   so a stored row never flashes the device's font (the iPhone's cold open answered every stored image within 0.7 s,
   performance-notes.md), and a slow link or no network shows the emoji instead of an empty box. The image stays hidden
   until it has loaded, so neither a broken picture nor its alt text paints over the glyph. At 0.75 of the box, the
   glyph fits inside it in every emoji font. */
.emoji-slot[data-glyph]:not(.loaded) > img { visibility: hidden; }
.emoji-slot[data-glyph]:not(.loaded)::before {
  content: attr(data-glyph);
  position: absolute; inset: 0; overflow: hidden;
  font-size: calc(var(--emoji-size) * 0.75); line-height: 1.333; text-align: center;
  visibility: hidden; animation: emoji-glyph 0s 1s forwards;
}
@keyframes emoji-glyph { to { visibility: visible; } }

/* The notice strip sits above the frame, so the frame takes the rest of the window (SH-20). */
body { display: flex; flex-direction: column; min-height: 100vh; min-height: 100svh; }
#app { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* Controls that show on hover on desktop are always visible on a touch screen (GEN-16, SH-24, PK-21, MR-30). */
@media (hover: none) {
  .room-settings, .gif-fav-btn, .gif-message-fav, .gif-message-uploader { opacity: 1 !important; visibility: visible !important; }
}

/* Every text field is 16 px on a phone, so the page never zooms when a field gets focus (GEN-15). !important: the
   files in css/ load later and size these fields in rem at the same specificity, so a plain rule here lost the
   tie and the fields stayed under 16 px. */
@media (max-width: 600px) {
  .emoji-search input, .gif-search input, .gif-lib-filter, .gif-tags-input, .edit-input { font-size: 16px !important; }
}
