/* ===========================================================================
   jekaka — redesign
   Dark, glassy, gradient-driven UI with smooth motion.
   Class names are kept identical to the templates; only the look changes.
   =========================================================================== */

:root {
    --bg: #07080f;
    --bg-2: #0c0e1c;
    --panel: rgba(255, 255, 255, 0.045);
    --panel-strong: rgba(255, 255, 255, 0.07);
    --panel-solid: #11132260;
    --text: #eef1fb;
    --muted: #9aa3c0;
    --line: rgba(255, 255, 255, 0.10);
    --line-strong: rgba(255, 255, 255, 0.18);

    --accent: #7c5cff;
    --accent-2: #4f8bff;
    --accent-3: #22d3ee;
    --accent-soft: rgba(124, 92, 255, 0.16);
    --grad: linear-gradient(135deg, #7c5cff 0%, #4f8bff 50%, #22d3ee 100%);
    --grad-text: linear-gradient(120deg, #b7a6ff 0%, #7cc4ff 45%, #56e0e0 100%);

    --danger: #ff5470;
    --danger-dark: #d62f4d;
    --success: #34d399;

    --radius: 16px;
    --radius-sm: 11px;
    --shadow: 0 18px 50px rgba(4, 6, 16, 0.55);
    --glow: 0 0 0 1px rgba(124, 92, 255, 0.35), 0 14px 40px rgba(79, 139, 255, 0.28);
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(1200px 700px at 12% -8%, rgba(124, 92, 255, 0.20), transparent 60%),
        radial-gradient(1000px 620px at 100% 0%, rgba(34, 211, 238, 0.14), transparent 55%),
        radial-gradient(900px 700px at 50% 120%, rgba(79, 139, 255, 0.16), transparent 60%),
        var(--bg);
    color: var(--text);
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.55;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* Drifting aurora layer behind everything */
.bg-aurora {
    position: fixed;
    inset: -20vmax;
    z-index: -2;
    pointer-events: none;
    background:
        radial-gradient(38vmax 38vmax at 20% 30%, rgba(124, 92, 255, 0.28), transparent 60%),
        radial-gradient(34vmax 34vmax at 80% 20%, rgba(34, 211, 238, 0.20), transparent 60%),
        radial-gradient(40vmax 40vmax at 65% 85%, rgba(79, 139, 255, 0.22), transparent 60%);
    filter: blur(8px);
    animation: aurora-drift 24s var(--ease) infinite alternate;
}

.bg-grid {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: radial-gradient(120% 90% at 50% 0%, #000 35%, transparent 78%);
    -webkit-mask-image: radial-gradient(120% 90% at 50% 0%, #000 35%, transparent 78%);
}

@keyframes aurora-drift {
    0%   { transform: translate3d(0, 0, 0) rotate(0deg) scale(1); }
    50%  { transform: translate3d(3%, 2%, 0) rotate(6deg) scale(1.08); }
    100% { transform: translate3d(-3%, -2%, 0) rotate(-4deg) scale(1.04); }
}

a {
    color: var(--accent-2);
    text-decoration: none;
    overflow-wrap: anywhere;
    transition: color 0.18s ease;
}

a:hover {
    color: var(--accent-3);
}

.skip-link {
    position: fixed;
    top: 8px;
    left: 12px;
    z-index: 1000;
    padding: 10px 14px;
    border-radius: 10px;
    background: var(--text);
    color: var(--bg);
    font-weight: 700;
    transform: translateY(-160%);
}

.skip-link:focus {
    color: var(--bg);
    transform: translateY(0);
}

/* ---------------------------------------------------------------- Top bar */
.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 14px 6vw;
    background: rgba(8, 10, 20, 0.62);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
}

.topbar-main {
    display: contents;
}

.nav-toggle {
    display: none;
}

.brand {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0;
    padding: 2px 4px;
    border-radius: 12px;
    isolation: isolate;
    font-size: 26px;
    font-weight: 900;
    letter-spacing: 0;
    background: var(--grad-text);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    background-size: 200% auto;
    animation: brand-shimmer 6s linear infinite;
    transform-origin: center;
    transition:
        transform 0.32s var(--ease),
        filter 0.32s var(--ease);
}

.brand-logo {
    height: 1.5em;
    width: 1.5em;
    flex: 0 0 auto;
    object-fit: contain;
    /* logo.png is transparent with the "J" glyph occupying ~34% width / ~56%
       height of the image, centered with ~0.32em side padding. Pull the image
       in on the sides so the glyph reads as the first letter of "ekaka". */
    margin: 0 -0.43em 0 -0.43em;
    transform: none;
}

.brand::before,
.brand::after {
    content: "";
    position: absolute;
    pointer-events: none;
}

.brand::before {
    inset: -7px -10px;
    z-index: -1;
    border-radius: 16px;
    background:
        radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.24), transparent 26%),
        linear-gradient(135deg, rgba(124, 92, 255, 0.34), rgba(34, 211, 238, 0.22));
    opacity: 0;
    transform: scale(0.86) rotate(-2deg);
    filter: blur(10px);
    transition:
        opacity 0.32s var(--ease),
        transform 0.32s var(--ease),
        filter 0.32s var(--ease);
}

.brand::after {
    left: 4px;
    right: 4px;
    bottom: -3px;
    height: 3px;
    border-radius: 999px;
    background: linear-gradient(90deg, transparent, #b7a6ff 12%, #56e0e0 50%, #7c5cff 88%, transparent);
    box-shadow: 0 0 14px rgba(34, 211, 238, 0.72);
    opacity: 0;
    transform: scaleX(0.18) translateY(5px);
    transition:
        opacity 0.28s var(--ease),
        transform 0.34s var(--ease);
}

.brand:hover,
.brand:focus-visible {
    transform: translateY(-2px) scale(1.045);
    filter: drop-shadow(0 0 16px rgba(124, 92, 255, 0.34)) drop-shadow(0 0 22px rgba(34, 211, 238, 0.22));
}

.brand:hover::before,
.brand:focus-visible::before {
    opacity: 1;
    transform: scale(1) rotate(0deg);
    filter: blur(7px);
}

.brand:hover::after,
.brand:focus-visible::after {
    opacity: 1;
    transform: scaleX(1) translateY(0);
}

@keyframes brand-shimmer {
    to { background-position: 200% center; }
}

.topbar nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.topbar nav > a {
    position: relative;
    padding: 8px 12px;
    border-radius: 10px;
    color: var(--muted);
    font-weight: 600;
    transition: color 0.2s ease, background 0.2s ease;
}

.topbar nav > a::after {
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 4px;
    height: 2px;
    border-radius: 2px;
    background: var(--grad);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.25s var(--ease);
}

.topbar nav > a:hover {
    color: var(--text);
    background: var(--panel);
}

.topbar nav > a[aria-current="page"] {
    color: var(--text);
    background: var(--accent-soft);
}

.topbar nav > a[aria-current="page"]::after {
    transform: scaleX(1);
}

.topbar nav > a:hover::after {
    transform: scaleX(1);
}

.nav-form {
    margin: 0;
}

.nav-form button {
    min-height: auto;
    padding: 8px 12px;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-weight: 600;
    box-shadow: none;
}

.nav-form button:hover {
    background: var(--panel);
    color: var(--text);
    transform: none;
    box-shadow: none;
}

.user {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel);
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    isolation: isolate;
    transition: border-color 0.24s var(--ease), color 0.24s var(--ease), box-shadow 0.24s var(--ease);
}

.user.is-username-changing {
    overflow: visible;
    border-color: rgba(34, 211, 238, 0.58);
    color: #fff;
    box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.16), 0 12px 28px rgba(34, 211, 238, 0.16);
}

.username-old,
.username-new {
    grid-area: 1 / 1;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    will-change: opacity, transform, filter;
}

.username-old {
    animation: username-old-burst 0.26s ease-in forwards;
}

.username-new {
    opacity: 0;
    animation: username-new-arrive 0.34s var(--ease) 0.22s forwards;
}

.username-spark {
    position: absolute;
    z-index: -1;
    left: 50%;
    top: 50%;
    width: 5px;
    height: 5px;
    border-radius: 999px;
    background: linear-gradient(135deg, #22d3ee, #fff, #7c5cff);
    box-shadow: 0 0 14px rgba(34, 211, 238, 0.55);
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0.45);
    animation: username-spark-burst 0.52s var(--ease) forwards;
}

/* ------------------------------------------------------------------- Page */
.page {
    width: min(1140px, 90vw);
    margin: 42px auto 80px;
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: end;
    margin-bottom: 30px;
    animation: rise-in 0.7s var(--ease) both;
}

h1,
h2 {
    line-height: 1.12;
    margin: 0 0 12px;
    letter-spacing: -0.02em;
}

h1 {
    font-size: clamp(36px, 5.4vw, 62px);
    font-weight: 900;
    overflow-wrap: anywhere;
}

.section-head h1,
.profile-hero h1 {
    background: linear-gradient(180deg, #ffffff 0%, #c4cae6 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

h2 {
    font-size: 25px;
    font-weight: 800;
    overflow-wrap: anywhere;
}

p {
    margin: 0 0 14px;
}

.section-head p {
    color: var(--muted);
    margin: 0;
    font-size: 17px;
}

/* ------------------------------------------------------------------ Grids */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 22px;
}

.cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    align-items: stretch;
}

/* ------------------------------------------------ Surfaces (cards/panels) */
.card,
.panel,
.article,
.comments {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.preview-card {
    position: relative;
    box-shadow: var(--shadow);
    transform: perspective(1000px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(var(--lift, 0px));
    transform-style: preserve-3d;
    transition: transform 0.2s var(--ease), box-shadow 0.35s var(--ease), border-color 0.35s var(--ease);
    will-change: transform;
}

/* gradient hairline that lights up on hover */
.preview-card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: var(--grad);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.35s var(--ease);
    pointer-events: none;
}

.preview-card:hover {
    --lift: -8px;
    border-color: transparent;
    box-shadow: 0 28px 60px rgba(79, 139, 255, 0.22), var(--shadow);
}

.preview-card:hover::before {
    opacity: 1;
}

/* Pinned news: glowing rose-tinted border + badge */
.pinned-card {
    border-color: transparent;
    box-shadow: 0 0 0 1px rgba(255, 107, 166, 0.3),
        0 18px 48px rgba(193, 75, 255, 0.28), var(--shadow);
}

/* keep the gradient hairline (drawn by ::before) always lit and rose-tinted */
.pinned-card::before {
    padding: 1.5px;
    background: linear-gradient(135deg, #ff6ba6, #c14bff 45%, #4f8bff);
    opacity: 1;
}

.pinned-card:hover {
    box-shadow: 0 0 0 1px rgba(255, 107, 166, 0.4),
        0 28px 60px rgba(193, 75, 255, 0.35), var(--shadow);
}

.pinned-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.2px;
    color: #fff;
    border-radius: 999px;
    background: linear-gradient(135deg, #ff6ba6, #c14bff 55%, #4f8bff);
    box-shadow: 0 6px 18px rgba(193, 75, 255, 0.45);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.card-media {
    display: grid;
    place-items: center;
    aspect-ratio: 16 / 10;
    margin: 14px 14px 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background:
        radial-gradient(120% 120% at 0% 0%, rgba(124, 92, 255, 0.22), transparent 55%),
        radial-gradient(120% 120% at 100% 100%, rgba(34, 211, 238, 0.16), transparent 55%),
        #0c0f1f;
}

.cover,
.hero-image {
    display: block;
    width: 100%;
    object-fit: cover;
    background: #0c0f1f;
}

.cover {
    height: 100%;
    object-fit: contain;
    transition: transform 0.5s var(--ease);
}

.preview-card:hover .cover {
    transform: scale(1.05);
}

.hero-image {
    max-height: 480px;
    margin: 20px 0;
    border-radius: var(--radius);
    border: 1px solid var(--line);
}

.card-body,
.panel,
.article,
.comments {
    padding: 24px;
}

.preview-card .card-body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 11px;
    padding: 20px;
}

.preview-card .card-body h2,
.preview-card .card-body p {
    margin-bottom: 0;
}

.preview-card .button {
    align-self: flex-start;
    margin-top: auto;
}

.card-text {
    color: #c3cae0;
    overflow-wrap: anywhere;
}

.cover-placeholder {
    display: grid;
    width: 100%;
    height: 100%;
    place-items: center;
    color: #6f7aa0;
    font-size: 24px;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.article {
    margin-bottom: 22px;
    box-shadow: var(--shadow);
}

.text {
    font-size: 18px;
    color: #d7dcf0;
    white-space: pre-wrap;
}

.meta,
.empty {
    color: var(--muted);
    font-size: 14px;
}

.empty {
    padding: 28px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius);
    text-align: center;
    background: var(--panel);
}

/* ---------------------------------------------------------------- Buttons */
.button,
button {
    --btn-bg: linear-gradient(135deg, #8b5cf6 0%, #4f8bff 48%, #19c6d7 100%);
    --btn-bg-hover: linear-gradient(135deg, #9b7cff 0%, #5f99ff 46%, #32e2ee 100%);
    --btn-shadow: 0 14px 30px rgba(79, 139, 255, 0.30), 0 0 0 1px rgba(255, 255, 255, 0.10) inset;
    --btn-shadow-hover: 0 18px 44px rgba(79, 139, 255, 0.42), 0 0 0 1px rgba(255, 255, 255, 0.18) inset;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 11px 20px;
    border: 0;
    border-radius: 12px;
    background: var(--btn-bg);
    background-size: 180% 180%;
    color: #fff;
    font: inherit;
    font-weight: 800;
    letter-spacing: 0;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    vertical-align: middle;
    overflow: hidden;
    isolation: isolate;
    box-shadow: var(--btn-shadow);
    transform: translateY(0) scale(1);
    transition:
        transform 0.24s var(--ease),
        box-shadow 0.24s var(--ease),
        background 0.24s var(--ease),
        background-position 0.55s var(--ease),
        color 0.2s ease,
        border-color 0.2s ease,
        filter 0.24s var(--ease);
    -webkit-tap-highlight-color: transparent;
}

/* shine sweep */
.button::before,
button:not(.nav-form button)::before {
    content: "";
    position: absolute;
    top: 0;
    left: -120%;
    width: 60%;
    height: 100%;
    z-index: 1;
    background: linear-gradient(105deg, transparent 0%, rgba(255, 255, 255, 0.45) 48%, transparent 100%);
    transform: skewX(-18deg);
    transition: left 0.68s var(--ease);
}

.button:hover,
button:hover {
    color: #fff;
    transform: translateY(-3px) scale(1.015);
    background: var(--btn-bg-hover);
    background-position: 100% 0;
    box-shadow: var(--btn-shadow-hover);
    filter: saturate(1.08);
}

.button:hover::before,
button:not(.nav-form button):hover::before {
    left: 130%;
}

.button:active,
button:active {
    transform: translateY(-1px) scale(0.985);
    box-shadow: 0 8px 20px rgba(79, 139, 255, 0.26), 0 0 0 1px rgba(255, 255, 255, 0.14) inset;
}

.button:focus-visible,
button:focus-visible {
    outline: 0;
    box-shadow:
        var(--btn-shadow-hover),
        0 0 0 3px rgba(7, 8, 15, 0.88),
        0 0 0 6px rgba(34, 211, 238, 0.72);
}

.button:disabled,
button:disabled,
.button[aria-disabled="true"] {
    cursor: not-allowed;
    color: rgba(255, 255, 255, 0.58);
    background: linear-gradient(135deg, rgba(122, 132, 160, 0.34), rgba(69, 78, 104, 0.34));
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
    filter: grayscale(0.25);
    opacity: 0.72;
    transform: none;
}

.button:disabled::before,
button:disabled::before,
.button[aria-disabled="true"]::before {
    display: none;
}

.button:disabled:hover,
button:disabled:hover,
.button[aria-disabled="true"]:hover {
    transform: none;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
}

.button.small {
    min-height: 36px;
    padding: 7px 14px;
    font-size: 14px;
}

.button.secondary {
    --btn-bg: linear-gradient(135deg, rgba(255, 255, 255, 0.105), rgba(255, 255, 255, 0.055));
    --btn-bg-hover: linear-gradient(135deg, rgba(255, 255, 255, 0.17), rgba(124, 92, 255, 0.16));
    --btn-shadow: 0 10px 24px rgba(0, 0, 0, 0.20), 0 0 0 1px rgba(255, 255, 255, 0.13) inset;
    --btn-shadow-hover: 0 16px 34px rgba(0, 0, 0, 0.30), 0 0 0 1px rgba(255, 255, 255, 0.22) inset;
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: var(--text);
    backdrop-filter: blur(12px) saturate(145%);
    -webkit-backdrop-filter: blur(12px) saturate(145%);
}

.button.secondary:hover {
    color: #fff;
    border-color: rgba(124, 92, 255, 0.42);
}

.button.danger,
.admin-row button {
    --btn-bg: linear-gradient(135deg, #ff6b83 0%, #f43f5e 48%, #be123c 100%);
    --btn-bg-hover: linear-gradient(135deg, #ff8398 0%, #ff4b69 48%, #d51a46 100%);
    --btn-shadow: 0 14px 30px rgba(214, 47, 77, 0.32), 0 0 0 1px rgba(255, 255, 255, 0.10) inset;
    --btn-shadow-hover: 0 18px 42px rgba(214, 47, 77, 0.46), 0 0 0 1px rgba(255, 255, 255, 0.16) inset;
}

.button.danger:hover {
    box-shadow: var(--btn-shadow-hover);
}

/* ------------------------------------------------------------------ Forms */
.form {
    display: grid;
    gap: 18px;
}

.form label {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-weight: 700;
    font-size: 14px;
}

input,
textarea {
    min-height: 46px;
    width: 100%;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    padding: 12px 14px;
    background: rgba(8, 10, 22, 0.6);
    color: var(--text);
    font: inherit;
    resize: vertical;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

input::placeholder,
textarea::placeholder {
    color: #6c769a;
}

input:focus,
textarea:focus {
    outline: 0;
    border-color: var(--accent);
    background: rgba(8, 10, 22, 0.85);
    box-shadow: 0 0 0 4px var(--accent-soft);
}

input[type="file"] {
    min-height: 48px;
    padding: 10px 12px;
    cursor: pointer;
}

input[type="file"]::file-selector-button {
    margin-right: 12px;
    padding: 7px 14px;
    border: 0;
    border-radius: 9px;
    background: var(--panel-strong);
    color: var(--text);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.narrow {
    max-width: 460px;
    margin: 0 auto;
}

.panel.narrow {
    box-shadow: var(--shadow);
    animation: rise-in 0.6s var(--ease) both;
}

.panel {
    box-shadow: var(--shadow);
}

/* ------------------------------------------------------------------ Flash */
.flash {
    margin-bottom: 22px;
    padding: 15px 18px;
    background: rgba(124, 92, 255, 0.10);
    border: 1px solid rgba(124, 92, 255, 0.32);
    border-left: 3px solid var(--accent);
    border-radius: 12px;
    color: #e6e3ff;
    animation: rise-in 0.4s var(--ease) both;
}

.flash p {
    margin: 0;
}

.flash p + p {
    margin-top: 6px;
}

/* --------------------------------------------------------------- Comments */
.comments {
    box-shadow: var(--shadow);
}

.comment {
    padding: 16px 0;
    border-top: 1px solid var(--line);
}

.comment-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.comment-author {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    color: var(--text);
    font-weight: 800;
}

.comment-author:hover,
.comment-author-name:hover {
    color: var(--accent-3);
}

.comment-author-name {
    color: inherit;
    font-weight: 800;
}

.comment-avatar {
    flex: 0 0 32px;
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    overflow: hidden;
    border: 1px solid var(--line-strong);
    border-radius: 50%;
    background: var(--grad);
    color: #fff;
    font-size: 14px;
    font-weight: 900;
}

.comment-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.inline-form {
    margin: 18px 0 10px;
}

/* ------------------------------------------------------------------ Admin */
.admin-actions {
    display: flex;
    gap: 14px;
    margin-bottom: 22px;
}

.admin-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
    border-top: 1px solid var(--line);
}

.admin-row div,
.admin-row form {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
}

.admin-row button {
    min-height: 34px;
    padding: 6px 12px;
}

.admin-hint {
    margin: 0 0 6px;
    color: var(--muted);
    font-size: 13px;
}

.admin-row-pinned {
    background: linear-gradient(90deg, rgba(255, 107, 166, 0.1), transparent 70%);
    border-left: 3px solid #ff6ba6;
    padding-left: 10px;
}

/* -------------------------------------------------------------------- Dev */
body:has(.dev-site) {
    background:
        radial-gradient(900px 620px at 85% -12%, rgba(211, 255, 77, 0.14), transparent 58%),
        radial-gradient(720px 520px at -8% 16%, rgba(140, 255, 193, 0.10), transparent 54%),
        #020402;
    color: #eaffdf;
}

body:has(.dev-site) .topbar,
body:has(.dev-site) .bg-aurora,
body:has(.dev-site) .bg-grid,
body:has(.dev-site) .bg-particles,
body:has(.dev-site) .scroll-progress {
    display: none;
}

body:has(.dev-site) .skip-link:focus {
    background: #d3ff4d;
    color: #071006;
}

body:has(.dev-site) .flash {
    width: min(1320px, calc(100% - 48px));
    margin: 16px auto;
    border: 1px solid rgba(211, 255, 77, 0.32);
    border-radius: 0;
    background: rgba(7, 16, 6, 0.9);
    color: #eaffdf;
    font-family: "Space Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    box-shadow: 0 16px 42px rgba(0, 0, 0, 0.34);
}

main.page:has(.dev-site) {
    width: 100%;
    min-height: 100dvh;
    margin: 0;
    padding: 0;
}

.dev-site {
    --dev-green: #d3ff4d;
    --dev-green-soft: rgba(211, 255, 77, 0.14);
    --dev-mint: #8cffc1;
    --dev-amber: #ffcf5a;
    --dev-red: #ff5d5d;
    --dev-ink: #020402;
    --dev-panel: rgba(7, 16, 6, 0.82);
    --dev-panel-strong: rgba(13, 27, 10, 0.92);
    --dev-line: rgba(211, 255, 77, 0.22);
    --dev-line-strong: rgba(211, 255, 77, 0.42);
    position: relative;
    min-height: 100dvh;
    overflow: hidden;
    padding: 18px 0 72px;
    isolation: isolate;
    font-family: "Space Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    background:
        linear-gradient(135deg, rgba(211, 255, 77, 0.09), transparent 26%),
        radial-gradient(circle at 70% 9%, rgba(255, 207, 90, 0.12), transparent 32%),
        linear-gradient(180deg, rgba(2, 4, 2, 0.98), rgba(2, 9, 4, 0.96));
}

.dev-site::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -2;
    background:
        linear-gradient(rgba(211, 255, 77, 0.075) 1px, transparent 1px),
        linear-gradient(90deg, rgba(211, 255, 77, 0.045) 1px, transparent 1px);
    background-size: 34px 34px;
    mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0.78) 52%, transparent 100%);
    -webkit-mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0.78) 52%, transparent 100%);
}

.dev-site::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 7px),
        linear-gradient(90deg, rgba(2, 4, 2, 0.18), transparent 22%, transparent 78%, rgba(2, 4, 2, 0.22));
    opacity: 0.75;
}

.dev-site > .dev-sitebar,
.dev-site > .dev-console,
.dev-site > .dev-command-grid,
.dev-site > .dev-lower-grid {
    width: min(1320px, calc(100% - 48px));
    margin-left: auto;
    margin-right: auto;
}

.dev-sitebar {
    position: sticky;
    top: 14px;
    z-index: 25;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    min-height: 64px;
    margin-bottom: 18px;
    border: 1px solid rgba(211, 255, 77, 0.28);
    border-radius: 0;
    padding: 10px;
    background:
        linear-gradient(180deg, rgba(5, 12, 4, 0.94), rgba(2, 7, 3, 0.88)),
        repeating-linear-gradient(90deg, rgba(211, 255, 77, 0.045) 0 1px, transparent 1px 18px);
    box-shadow:
        0 18px 52px rgba(0, 0, 0, 0.44),
        0 0 0 1px rgba(211, 255, 77, 0.08) inset;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.dev-sitebrand {
    display: inline-flex;
    min-width: 0;
    align-items: center;
    gap: 10px;
    color: #f2ffe9;
}

.dev-sitebrand:hover,
.dev-sitebrand:focus-visible {
    color: #fff;
}

.dev-sitebrand-mark {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border: 1px solid var(--dev-line-strong);
    background: var(--dev-green);
    color: #071006;
    font-weight: 900;
    line-height: 1;
    box-shadow: 0 0 24px rgba(211, 255, 77, 0.2);
}

.dev-sitebrand span:last-child {
    display: grid;
    gap: 2px;
}

.dev-sitebrand strong {
    font-size: 15px;
    line-height: 1.1;
    text-transform: uppercase;
}

.dev-sitebrand small {
    color: #a8bf9f;
    font-size: 10px;
    letter-spacing: 0.08em;
    line-height: 1;
    text-transform: uppercase;
}

.dev-sitenav {
    display: flex;
    min-width: 0;
    justify-content: center;
    gap: 6px;
}

.dev-sitenav a,
.dev-site-logout button {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(211, 255, 77, 0.18);
    border-radius: 0;
    padding: 9px 12px;
    color: #dfffd0;
    background: rgba(211, 255, 77, 0.045);
    box-shadow: none;
    font: inherit;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    touch-action: manipulation;
}

.dev-sitenav a:hover,
.dev-sitenav a:focus-visible,
.dev-site-logout button:hover,
.dev-site-logout button:focus-visible {
    border-color: rgba(211, 255, 77, 0.58);
    color: #071006;
    background: var(--dev-green);
    box-shadow: 0 0 22px rgba(211, 255, 77, 0.2);
    transform: none;
}

.dev-site-logout {
    margin: 0;
}

.dev-site-logout button::before {
    display: none;
}

.dev-console,
.dev-command,
.dev-monitor,
.dev-access {
    font-family: "Space Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.dev-console {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 430px);
    gap: 36px;
    min-height: 520px;
    margin-bottom: 22px;
    padding: clamp(24px, 4vw, 52px);
    overflow: hidden;
    isolation: isolate;
    border: 1px solid rgba(211, 255, 77, 0.22);
    border-radius: 0;
    background:
        linear-gradient(90deg, rgba(211, 255, 77, 0.10), transparent 38%),
        radial-gradient(circle at 82% 24%, rgba(140, 255, 193, 0.13), transparent 35%),
        radial-gradient(circle at 18% 86%, rgba(255, 207, 90, 0.11), transparent 34%),
        linear-gradient(180deg, rgba(5, 12, 4, 0.94), rgba(2, 7, 3, 0.82));
    box-shadow:
        0 24px 80px rgba(0, 0, 0, 0.52),
        0 0 0 1px rgba(255, 255, 255, 0.04) inset,
        0 0 62px rgba(211, 255, 77, 0.08);
}

.dev-console::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        linear-gradient(rgba(211, 255, 77, 0.07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(211, 255, 77, 0.045) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: linear-gradient(180deg, #000, transparent 88%);
    -webkit-mask-image: linear-gradient(180deg, #000, transparent 88%);
    animation: dev-grid-pan 16s linear infinite;
}

.dev-console::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(180deg, transparent 0%, rgba(211, 255, 77, 0.12) 50%, transparent 100%);
    height: 34%;
    opacity: 0.68;
    transform: translateY(-120%);
    animation: dev-scan 4.8s var(--ease) infinite;
}

.dev-console-copy {
    display: flex;
    flex-direction: column;
    align-self: center;
    max-width: 770px;
}

.dev-kicker,
.dev-section-label {
    width: fit-content;
    margin: 0 0 18px;
    border: 1px solid rgba(211, 255, 77, 0.38);
    border-radius: 0;
    padding: 7px 11px;
    color: #eaffdf;
    background: rgba(211, 255, 77, 0.07);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    line-height: 1.2;
    text-transform: uppercase;
    box-shadow: 0 0 24px rgba(211, 255, 77, 0.08);
}

.dev-console h1 {
    margin: 0;
    color: #f8fafc;
    font-size: clamp(46px, 8.5vw, 116px);
    font-weight: 700;
    line-height: 0.88;
    letter-spacing: 0;
    text-transform: uppercase;
    text-shadow:
        0 0 20px rgba(211, 255, 77, 0.22),
        0 0 42px rgba(140, 255, 193, 0.12);
}

.dev-console h1::after {
    content: "_";
    color: var(--dev-green);
    text-shadow: 0 0 18px rgba(211, 255, 77, 0.7);
    animation: dev-cursor 1s steps(2, end) infinite;
}

.dev-console-copy > p {
    max-width: 720px;
    margin: 22px 0 0;
    color: #dfffd0;
    font-size: clamp(17px, 2.1vw, 23px);
    line-height: 1.55;
}

.dev-status-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 34px;
}

.dev-status-strip span {
    position: relative;
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(211, 255, 77, 0.22);
    border-radius: 0;
    padding: 10px 13px;
    color: #eaffdf;
    background: rgba(5, 12, 4, 0.66);
}

.dev-status-strip span::before {
    content: "";
    width: 7px;
    height: 7px;
    flex: 0 0 auto;
    border-radius: 999px;
    background: var(--dev-green);
    box-shadow: 0 0 18px rgba(211, 255, 77, 0.75);
    animation: dev-pulse 1.8s ease-in-out infinite;
}

.dev-status-strip b {
    color: #fff;
}

.dev-orbit {
    position: relative;
    align-self: center;
    justify-self: center;
    width: min(32vw, 380px);
    min-width: 300px;
    aspect-ratio: 1;
    border-radius: 999px;
    filter: drop-shadow(0 0 34px rgba(211, 255, 77, 0.14));
}

.dev-orbit-ring,
.dev-orbit-node,
.dev-orbit-core {
    position: absolute;
    display: block;
    border-radius: 999px;
}

.dev-orbit-ring {
    inset: var(--ring-inset, 0);
    border: 1px solid rgba(211, 255, 77, 0.25);
    background:
        linear-gradient(90deg, transparent 49.6%, rgba(211, 255, 77, 0.38) 50%, transparent 50.4%),
        linear-gradient(0deg, transparent 49.6%, rgba(140, 255, 193, 0.26) 50%, transparent 50.4%);
}

.dev-orbit-ring-one {
    --ring-inset: 0;
    animation: dev-spin 15s linear infinite;
}

.dev-orbit-ring-two {
    --ring-inset: 13%;
    border-color: rgba(250, 204, 21, 0.25);
    transform: rotateX(58deg) rotateZ(-18deg);
    animation: dev-spin-reverse 12s linear infinite;
}

.dev-orbit-ring-three {
    --ring-inset: 27%;
    border-color: rgba(211, 255, 77, 0.35);
    animation: dev-spin 8s linear infinite;
}

.dev-orbit-node {
    width: 13px;
    height: 13px;
    background: #fff;
}

.dev-orbit-node-one {
    top: 12%;
    right: 17%;
    box-shadow: 0 0 22px rgba(140, 255, 193, 0.7);
    animation: dev-float 3.5s ease-in-out infinite;
}

.dev-orbit-node-two {
    bottom: 23%;
    left: 8%;
    background: var(--dev-green);
    box-shadow: 0 0 22px rgba(211, 255, 77, 0.78);
    animation: dev-float 4s 0.3s ease-in-out infinite;
}

.dev-orbit-node-three {
    right: 5%;
    bottom: 34%;
    background: var(--dev-amber);
    box-shadow: 0 0 22px rgba(250, 204, 21, 0.8);
    animation: dev-float 3.2s 0.6s ease-in-out infinite;
}

.dev-orbit-core {
    inset: 35%;
    display: grid;
    place-items: center;
    border: 1px solid rgba(211, 255, 77, 0.55);
    color: #eaffdf;
    background:
        radial-gradient(circle at 50% 35%, rgba(211, 255, 77, 0.32), transparent 58%),
        rgba(5, 12, 4, 0.88);
    font-size: clamp(26px, 4vw, 45px);
    font-weight: 700;
    letter-spacing: 0;
    box-shadow:
        0 0 34px rgba(211, 255, 77, 0.24),
        0 0 0 10px rgba(211, 255, 77, 0.04);
    animation: dev-core-breathe 2.8s ease-in-out infinite;
}

.dev-command-grid {
    display: grid;
    grid-template-columns: 1.15fr 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}

.dev-command {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 18px;
    min-height: 138px;
    align-items: end;
    overflow: hidden;
    border: 1px solid rgba(211, 255, 77, 0.2);
    border-radius: 0;
    padding: 22px;
    color: #f2ffe9;
    background:
        linear-gradient(135deg, rgba(7, 16, 6, 0.94), rgba(3, 9, 4, 0.78)),
        radial-gradient(circle at 85% 20%, rgba(211, 255, 77, 0.10), transparent 42%);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.34);
    transform: translateY(0);
    touch-action: manipulation;
    transition:
        transform 0.24s var(--ease),
        border-color 0.24s var(--ease),
        box-shadow 0.24s var(--ease),
        color 0.24s ease;
}

.dev-command::before {
    content: "";
    position: absolute;
    inset: auto -18% -54% -18%;
    height: 82%;
    background: conic-gradient(from 80deg, transparent, rgba(211, 255, 77, 0.18), rgba(255, 207, 90, 0.12), transparent);
    opacity: 0;
    transform: translateY(18px) rotate(0deg);
    transition: opacity 0.24s var(--ease), transform 0.34s var(--ease);
}

.dev-command::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, transparent 0%, rgba(255, 255, 255, 0.18) 46%, transparent 60%);
    opacity: 0;
    transform: translateX(-110%);
    transition: transform 0.55s var(--ease), opacity 0.2s ease;
}

.dev-command:hover,
.dev-command:focus-visible {
    color: #fff;
    border-color: rgba(211, 255, 77, 0.55);
    box-shadow:
        0 22px 56px rgba(0, 0, 0, 0.42),
        0 0 34px rgba(211, 255, 77, 0.12);
    transform: translateY(-5px);
}

.dev-command:hover::before,
.dev-command:focus-visible::before {
    opacity: 1;
    transform: translateY(0) rotate(8deg);
}

.dev-command:hover::after,
.dev-command:focus-visible::after {
    opacity: 1;
    transform: translateX(120%);
}

.dev-command:focus-visible,
.dev-links a:focus-visible {
    outline: 0;
    box-shadow:
        0 0 0 3px rgba(7, 8, 15, 0.92),
        0 0 0 6px rgba(211, 255, 77, 0.72),
        0 18px 48px rgba(0, 0, 0, 0.36);
}

.dev-command-primary {
    border-color: rgba(211, 255, 77, 0.34);
    background:
        linear-gradient(135deg, rgba(211, 255, 77, 0.18), rgba(5, 12, 4, 0.88) 48%),
        radial-gradient(circle at 88% 18%, rgba(255, 207, 90, 0.14), transparent 38%);
}

.dev-command-index {
    position: relative;
    z-index: 1;
    color: rgba(211, 255, 77, 0.74);
    font-size: 14px;
    font-weight: 700;
}

.dev-command-body {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 8px;
}

.dev-command-body strong {
    font-size: clamp(19px, 2vw, 27px);
    line-height: 1.08;
}

.dev-command-body small {
    max-width: 28ch;
    color: #cfeac1;
    font-size: 13px;
    line-height: 1.45;
}

.dev-lower-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.38fr) minmax(280px, 0.62fr);
    gap: 14px;
}

.dev-monitor,
.dev-access {
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(211, 255, 77, 0.2);
    border-radius: 0;
    padding: 24px;
    background:
        linear-gradient(145deg, rgba(7, 16, 6, 0.84), rgba(4, 10, 4, 0.68)),
        radial-gradient(circle at 12% 0%, rgba(211, 255, 77, 0.09), transparent 36%);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.32);
}

.dev-monitor::before,
.dev-access::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 7px);
    opacity: 0.28;
}

.dev-monitor h2,
.dev-access h2 {
    position: relative;
    margin: 0 0 10px;
    color: #f8fafc;
    font-size: clamp(24px, 3vw, 38px);
    letter-spacing: 0;
}

.dev-monitor p,
.dev-access p {
    position: relative;
    max-width: 66ch;
    margin: 0;
    color: #cfeac1;
}

.dev-section-label {
    position: relative;
    margin-bottom: 16px;
    border-color: rgba(255, 207, 90, 0.32);
    color: #fff3bd;
    background: rgba(255, 207, 90, 0.06);
}

.dev-links {
    position: relative;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
    margin-top: 24px;
}

.dev-links a {
    position: relative;
    display: flex;
    min-height: 96px;
    min-width: 0;
    flex-direction: column;
    justify-content: space-between;
    gap: 12px;
    overflow: hidden;
    border: 1px solid rgba(211, 255, 77, 0.2);
    border-radius: 0;
    padding: 14px;
    color: #f8fafc;
    background: rgba(5, 12, 4, 0.68);
    text-decoration: none;
    transform: translateY(0);
    touch-action: manipulation;
    transition:
        transform 0.22s var(--ease),
        border-color 0.22s var(--ease),
        background 0.22s ease,
        color 0.22s ease;
}

.dev-links a::after {
    content: "";
    position: absolute;
    inset: auto 12px 11px;
    height: 2px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--dev-green), var(--dev-mint));
    transform: scaleX(0.22);
    transform-origin: left;
    transition: transform 0.22s var(--ease);
}

.dev-links a:hover,
.dev-links a:focus-visible {
    color: #fff;
    border-color: rgba(211, 255, 77, 0.5);
    background: rgba(211, 255, 77, 0.09);
    transform: translateY(-4px);
}

.dev-links a:hover::after,
.dev-links a:focus-visible::after {
    transform: scaleX(1);
}

.dev-links span {
    color: #fff3bd;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.dev-access {
    display: flex;
    min-height: 100%;
    flex-direction: column;
}

.dev-access-meter {
    position: relative;
    height: 10px;
    margin-top: auto;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.16);
}

.dev-access-meter span {
    position: absolute;
    inset: 0;
    width: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--dev-green), var(--dev-mint), var(--dev-amber));
    transform-origin: left;
    animation: dev-meter 2.6s var(--ease) infinite;
}

@keyframes dev-grid-pan {
    to { background-position: 42px 84px, 84px 42px; }
}

@keyframes dev-scan {
    0% { transform: translateY(-125%); opacity: 0; }
    22% { opacity: 0.66; }
    70% { opacity: 0.46; }
    100% { transform: translateY(300%); opacity: 0; }
}

@keyframes dev-cursor {
    50% { opacity: 0; }
}

@keyframes dev-pulse {
    0%, 100% { transform: scale(1); opacity: 0.72; }
    50% { transform: scale(1.55); opacity: 1; }
}

@keyframes dev-spin {
    to { transform: rotate(360deg); }
}

@keyframes dev-spin-reverse {
    to { transform: rotateX(58deg) rotateZ(-378deg); }
}

@keyframes dev-float {
    0%, 100% { transform: translate3d(0, 0, 0); }
    50% { transform: translate3d(0, -14px, 0); }
}

@keyframes dev-core-breathe {
    0%, 100% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.045); filter: brightness(1.18); }
}

@keyframes dev-meter {
    0%, 100% { transform: scaleX(0.72); filter: hue-rotate(0deg); }
    50% { transform: scaleX(1); filter: hue-rotate(24deg); }
}

@media (max-width: 1040px) {
    .dev-console {
        grid-template-columns: minmax(0, 1fr) minmax(240px, 330px);
        gap: 24px;
    }

    .dev-command-grid,
    .dev-lower-grid {
        grid-template-columns: 1fr;
    }

    .dev-links {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.pinned-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 9px;
    margin-right: 6px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    border-radius: 999px;
    background: linear-gradient(135deg, #ff6ba6, #c14bff 55%, #4f8bff);
    box-shadow: 0 4px 12px rgba(193, 75, 255, 0.4);
}

.answer {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* =====================================================================
   AI chat
   ===================================================================== */
.page:has(.app) {
    width: 100%;
    margin: 0;
    padding: 0;
    flex: 1 1 auto;
    display: flex;
    min-height: 0;
    overflow: hidden;
}

body:has(.app) {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    height: 100dvh;
    overflow: hidden;
}

body:has(.app) .topbar {
    flex: 0 0 auto;
}

.app {
    display: flex;
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
    overflow: hidden;
    background: transparent;
}

/* ---- Sidebar ---- */
.chat-sidebar {
    flex: 0 0 clamp(264px, 24vw, 332px);
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    border-right: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(16, 18, 34, 0.72), rgba(8, 10, 20, 0.55));
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.chat-sidebar-header {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 20px 18px;
    border-bottom: 1px solid var(--line);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    color: var(--text);
}

.sidebar-brand-mark {
    flex: 0 0 44px;
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border-radius: 14px;
    background: var(--grad);
    background-size: 200% 200%;
    color: #fff;
    font-size: 21px;
    line-height: 1;
    box-shadow: 0 10px 26px rgba(124, 92, 255, 0.45);
    animation: gradient-pan 6s ease infinite;
    transition: transform 0.3s var(--ease);
}

.sidebar-brand:hover .sidebar-brand-mark {
    transform: rotate(-8deg) scale(1.06);
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.12;
}

.sidebar-brand-text small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.sidebar-brand-text strong {
    font-size: 22px;
    font-weight: 800;
    background: var(--grad-text);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.new-chat-form {
    margin: 0;
}

.new-chat-btn {
    width: 100%;
    justify-content: center;
    gap: 8px;
    font-weight: 700;
}

.ai-limit {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

.sidebar-chat-list {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-height: 0;
    overflow-y: auto;
    padding: 14px 12px;
    scrollbar-gutter: stable;
}

.sidebar-chat-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
    overflow: hidden;
    padding: 11px 13px;
    border: 1px solid transparent;
    border-radius: 12px;
    color: #c3cae0;
    font-weight: 600;
    line-height: 1.3;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.sidebar-chat-link::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    width: 3px;
    height: 0;
    border-radius: 999px;
    background: var(--grad);
    transform: translateY(-50%);
    transition: height 0.25s var(--ease);
}

.sidebar-chat-link.active::before {
    height: 60%;
}

.chat-link-dot {
    flex: 0 0 8px;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--line-strong);
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.chat-link-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-chat-link:hover {
    background: var(--panel);
    color: var(--text);
    transform: translateX(2px);
}

.sidebar-chat-link.active {
    border-color: rgba(124, 92, 255, 0.45);
    background: var(--accent-soft);
    color: #fff;
}

.sidebar-chat-link.active .chat-link-dot {
    background: var(--accent-3);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.18);
    animation: dot-pulse 2.2s ease-in-out infinite;
}

/* ---- Chat column ---- */
.chat {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    background:
        radial-gradient(1100px 600px at 80% -12%, rgba(124, 92, 255, 0.09), transparent 60%),
        transparent;
}

.chat-header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 84px;
    padding: 14px clamp(18px, 3vw, 34px);
    border-bottom: 1px solid var(--line);
    background: rgba(9, 11, 22, 0.5);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.chat-heading {
    display: flex;
    align-items: center;
    gap: 13px;
    min-width: 0;
}

.chat-avatar {
    position: relative;
    flex: 0 0 46px;
    display: grid;
    width: 46px;
    height: 46px;
    place-items: center;
    border-radius: 14px;
    background: var(--grad);
    background-size: 200% 200%;
    color: #fff;
    font-size: 14px;
    font-weight: 900;
    letter-spacing: 0.04em;
    box-shadow: 0 10px 26px rgba(79, 139, 255, 0.42);
    animation: gradient-pan 6s ease infinite, avatar-glow 3.4s ease-in-out infinite;
}

.chat-avatar::after {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: inherit;
    background: var(--grad);
    opacity: 0.55;
    filter: blur(10px);
    z-index: -1;
    animation: avatar-halo 3.4s ease-in-out infinite;
}

.chat-title-block {
    min-width: 0;
}

.chat-title-block span {
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.12em;
    line-height: 1.1;
    text-transform: uppercase;
}

.chat-title-block h2 {
    max-width: 36vw;
    margin: 3px 0 0;
    overflow: hidden;
    color: var(--text);
    font-size: 20px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 9px;
    min-width: 0;
}

.rename-form {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.rename-form label {
    display: block;
    min-width: 0;
    width: clamp(170px, 24vw, 320px);
}

.rename-form label span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.rename-form input {
    min-height: 42px;
    font-weight: 600;
}

.delete-chat-form {
    flex: 0 0 auto;
    margin: 0;
}

.icon-button {
    display: grid;
    place-items: center;
    width: 42px;
    min-width: 42px;
    height: 42px;
    padding: 0;
    font-size: 16px;
    line-height: 1;
}

/* ---- Messages ---- */
.messages {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 28px clamp(18px, 6vw, 96px);
    scroll-behavior: smooth;
    scrollbar-gutter: stable;
}

.messages::-webkit-scrollbar,
.sidebar-chat-list::-webkit-scrollbar {
    width: 10px;
}

.messages::-webkit-scrollbar-thumb,
.sidebar-chat-list::-webkit-scrollbar-thumb {
    border: 3px solid transparent;
    border-radius: 999px;
    background: rgba(124, 92, 255, 0.4);
    background-clip: content-box;
}

.message-row {
    display: flex;
    width: 100%;
    min-width: 0;
}

.message-row.is-new {
    animation: message-in 0.32s var(--ease) both;
}

.message-row.is-new.from-user {
    animation-name: message-in-right;
}

.message-row.is-new.from-ai {
    animation-name: message-in-left;
}

.message-row.user,
.message-row.from-user {
    max-width: none;
    overflow: visible;
    justify-content: flex-end;
    white-space: normal;
}

.message-row.ai,
.message-row.from-ai {
    justify-content: flex-start;
    align-items: flex-start;
    gap: 10px;
}

.message-bubble {
    position: relative;
    min-width: 0;
    max-width: min(760px, 78%);
    padding: 14px 17px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--panel-strong);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 14px 34px rgba(4, 6, 16, 0.42);
    line-height: 1.55;
    transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease);
}

.message-row:not(.is-pending) .message-bubble:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 44px rgba(4, 6, 16, 0.5);
}

.message-row.ai .message-bubble,
.message-row.from-ai .message-bubble {
    border-top-left-radius: 6px;
}

.message-row.is-pending .message-bubble {
    color: var(--muted);
    overflow: hidden;
    border-color: rgba(124, 92, 255, 0.3);
}

.message-row.is-pending .message-bubble::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        100deg,
        transparent 20%,
        rgba(124, 92, 255, 0.12) 45%,
        rgba(34, 211, 238, 0.1) 55%,
        transparent 80%
    );
    background-size: 220% 100%;
    animation: bubble-shimmer 1.6s linear infinite;
    pointer-events: none;
}

.message-row.user .message-bubble,
.message-row.from-user .message-bubble {
    border-color: transparent;
    border-top-right-radius: 6px;
    background: var(--grad);
    color: #fff;
    box-shadow: 0 16px 36px rgba(79, 139, 255, 0.34);
}

.message-author {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.message-row.ai .message-author::before,
.message-row.from-ai .message-author::before {
    content: "";
    flex: 0 0 7px;
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: var(--grad);
}

.message-row.user .message-author,
.message-row.from-user .message-author {
    color: rgba(255, 255, 255, 0.85);
}

.message-text {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
    word-break: break-word;
}

.message-text.is-typing::after {
    content: "";
    display: inline-block;
    width: 3px;
    height: 1.08em;
    margin-left: 3px;
    vertical-align: text-bottom;
    background: linear-gradient(180deg, var(--accent-3), var(--accent-2));
    border-radius: 999px;
    box-shadow: 0 0 14px rgba(34, 211, 238, 0.65);
    animation: caret-blink 0.82s steps(1) infinite, caret-rise 1.6s ease-in-out infinite;
}

.message-row.is-answering .message-bubble {
    border-color: rgba(34, 211, 238, 0.32);
    box-shadow: 0 18px 46px rgba(4, 6, 16, 0.5), 0 0 34px rgba(34, 211, 238, 0.12);
}

.message-bubble.is-streaming {
    overflow: hidden;
}

.message-bubble.is-streaming::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(115deg, transparent 10%, rgba(34, 211, 238, 0.08) 35%, transparent 62%),
        radial-gradient(circle at 18% 10%, rgba(124, 92, 255, 0.16), transparent 28%);
    background-size: 220% 100%, 100% 100%;
    mix-blend-mode: screen;
    animation: answer-stream-sheen 2.2s linear infinite;
}

.typed-char {
    display: inline;
    animation: typed-char-in 0.24s var(--ease) both;
}

.typing-indicator {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-width: 54px;
    min-height: 20px;
    vertical-align: middle;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--grad);
    opacity: 0.5;
    animation: typing-dot 1s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.16s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.32s;
}

.message-status {
    margin-top: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

/* ---- AI message avatar (✦) ---- */
.msg-avatar {
    position: relative;
    flex: 0 0 36px;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    margin-top: 2px;
    border-radius: 12px;
    background: var(--grad);
    background-size: 200% 200%;
    color: #fff;
    box-shadow: 0 8px 20px rgba(79, 139, 255, 0.34);
    animation: gradient-pan 6s ease infinite;
    transition: box-shadow 0.45s var(--ease), transform 0.45s var(--ease);
}

.msg-avatar-mark {
    font-size: 15px;
    font-weight: 900;
    line-height: 1;
    filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.45));
}

.msg-avatar-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.msg-avatar.is-thinking {
    animation: gradient-pan 3s ease infinite, msg-avatar-think 1.8s ease-in-out infinite;
}

.msg-avatar.is-thinking .msg-avatar-mark {
    animation: msg-avatar-spin 2.6s linear infinite;
}

.msg-avatar-spark {
    position: absolute;
    left: 50%;
    top: 50%;
    width: var(--sz, 4px);
    height: var(--sz, 4px);
    margin: calc(var(--sz, 4px) / -2) 0 0 calc(var(--sz, 4px) / -2);
    border-radius: 999px;
    background: radial-gradient(circle, #e6f9ff, rgba(34, 211, 238, 0.7) 60%, transparent 72%);
    box-shadow: 0 0 8px rgba(34, 211, 238, 0.7);
    opacity: 0;
    animation: avatar-spark var(--d, 2s) ease-out var(--delay, 0s) infinite;
    pointer-events: none;
}

/* ---- Thinking phrase shimmer ---- */
.thinking-text {
    display: inline-block;
    font-weight: 700;
    background: linear-gradient(
        100deg,
        var(--muted) 0%,
        #ffffff 22%,
        var(--accent-3) 42%,
        var(--muted) 62%
    );
    background-size: 220% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    animation: thinking-shimmer 2.2s linear infinite;
}

.thinking-text.is-swap {
    animation: thinking-shimmer 2.2s linear infinite, thinking-swap 0.4s var(--ease);
}

/* ---- Welcome / empty ---- */
.ai-empty {
    margin: auto;
    color: var(--muted);
}

.ai-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    max-width: 560px;
    padding: 30px;
    text-align: center;
    animation: rise-in 0.5s var(--ease) both;
}

.ai-welcome-mark {
    display: grid;
    width: 68px;
    height: 68px;
    place-items: center;
    border-radius: 20px;
    background: var(--grad);
    background-size: 200% 200%;
    color: #fff;
    font-size: 31px;
    box-shadow: 0 18px 44px rgba(124, 92, 255, 0.5);
    animation: gradient-pan 6s ease infinite, mark-float 4.5s ease-in-out infinite;
}

.ai-welcome h3 {
    margin: 0;
    color: var(--text);
    font-size: 27px;
    line-height: 1.15;
}

.ai-welcome p {
    margin: 0;
    max-width: 420px;
    font-size: 15px;
}

.ai-suggestions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 6px;
}

.ai-chip {
    padding: 10px 16px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: var(--panel);
    color: var(--text);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    animation: chip-in 0.45s var(--ease) both;
}

.ai-chip:nth-child(1) { animation-delay: 0.12s; }
.ai-chip:nth-child(2) { animation-delay: 0.2s; }
.ai-chip:nth-child(3) { animation-delay: 0.28s; }

.ai-chip:hover {
    border-color: rgba(124, 92, 255, 0.5);
    background: var(--accent-soft);
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(124, 92, 255, 0.25);
}

.ai-chip:active {
    transform: translateY(0) scale(0.97);
}

/* ---- Composer ---- */
.chat-input {
    flex: 0 0 auto;
    position: relative;
    display: block;
    padding: 16px clamp(18px, 6vw, 96px) 22px;
    border-top: 1px solid var(--line);
    background: rgba(9, 11, 22, 0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.chat-link-offer {
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 0 clamp(18px, 6vw, 96px) 0;
    padding: 12px 16px;
    border: 1px solid var(--line-strong);
    border-radius: 16px;
    background: rgba(17, 19, 34, 0.72);
    color: var(--muted);
    font-size: 0.92rem;
}

.chat-link-offer[hidden] {
    display: none;
}

.jtokens-link-offer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
}

.composer-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 14px;
    border: 1px solid var(--line-strong);
    border-radius: 20px;
    background: rgba(17, 19, 34, 0.72);
    box-shadow: 0 16px 40px rgba(4, 6, 16, 0.45);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.composer-box:focus-within {
    border-color: rgba(124, 92, 255, 0.55);
    box-shadow: var(--glow);
}

.prompt-shell {
    position: relative;
    min-height: 30px;
}

.prompt-animated-text {
    position: absolute;
    inset: 0;
    z-index: 0;
    min-height: 30px;
    max-height: 200px;
    overflow: hidden;
    padding: 4px 6px;
    color: var(--text);
    font: inherit;
    line-height: 1.5;
    overflow-wrap: anywhere;
    pointer-events: none;
    white-space: pre-wrap;
    word-break: break-word;
}

.prompt-typed-char {
    display: inline-block;
    color: #fff;
    text-shadow: 0 0 16px rgba(34, 211, 238, 0.58);
    animation: prompt-char-in 0.22s var(--ease) both;
}

.chat-input textarea {
    position: relative;
    z-index: 1;
    width: 100%;
    min-height: 30px;
    max-height: 200px;
    min-width: 0;
    overflow-y: auto;
    resize: none;
    border: 0;
    padding: 4px 6px;
    background: transparent;
    box-shadow: none;
    color: transparent;
    caret-color: var(--accent-3);
    line-height: 1.5;
}

.chat-input textarea::placeholder {
    color: #6c769a;
}

.chat-input textarea:focus {
    border: 0;
    outline: none;
    box-shadow: none;
}

.composer-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.token-usage {
    flex: 1 1 auto;
    display: flex;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.2;
    white-space: nowrap;
}

.token-usage span {
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.token-usage strong {
    color: var(--text);
    font-size: 13px;
    transition: color 0.2s ease;
}

.token-usage strong.is-bumped {
    animation: usage-bump 0.5s var(--ease);
}

.token-usage small {
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-input .send-button {
    position: relative;
    flex: 0 0 auto;
    min-height: 44px;
    border-radius: 13px;
    padding-inline: 22px;
    overflow: hidden;
    transition: transform 0.18s var(--ease), box-shadow 0.2s var(--ease);
}

.chat-input .send-button::after {
    content: "";
    position: absolute;
    top: 0;
    left: -120%;
    width: 60%;
    height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.45), transparent);
    transform: skewX(-18deg);
    transition: left 0.55s var(--ease);
}

.chat-input .send-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(79, 139, 255, 0.4);
}

.chat-input .send-button:hover:not(:disabled)::after {
    left: 140%;
}

.chat-input .send-button:active:not(:disabled) {
    transform: translateY(0) scale(0.97);
}

.chat-input[data-sending="true"] .send-button {
    opacity: 0.78;
    pointer-events: none;
}

.chat-input[data-sending="true"] .send-icon {
    animation: send-pulse 0.9s ease-in-out infinite;
}

.chat-input textarea:disabled {
    color: var(--muted);
    opacity: 1;
}

.chat-status {
    position: absolute;
    left: clamp(18px, 6vw, 96px);
    bottom: calc(100% + 4px);
    max-width: min(560px, calc(100% - 36px));
    margin: 0;
    overflow: hidden;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-status.is-error {
    color: var(--danger);
}

.send-icon {
    display: none;
}

/* =====================================================================
   Profile
   ===================================================================== */
.profile-page {
    display: grid;
    gap: 22px;
}

.profile-hero,
.profile-card,
.profile-stat {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

/* ---- Hero ---- */
.profile-hero {
    position: relative;
    display: flex;
    align-items: center;
    gap: clamp(18px, 3.5vw, 38px);
    min-height: 250px;
    padding: clamp(26px, 4vw, 46px);
    overflow: hidden;
    box-shadow: var(--shadow);
    background:
        radial-gradient(130% 160% at 0% 0%, rgba(124, 92, 255, 0.30), transparent 52%),
        radial-gradient(120% 150% at 100% 100%, rgba(34, 211, 238, 0.20), transparent 54%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015));
    animation: rise-in 0.7s var(--ease) both;
}

/* sheen sweep across the hero */
.profile-hero::after {
    content: "";
    position: absolute;
    top: -60%;
    left: -30%;
    width: 50%;
    height: 220%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.07), transparent);
    transform: translateX(0) rotate(8deg);
    animation: hero-sheen 7s var(--ease) infinite;
    pointer-events: none;
}

@keyframes hero-sheen {
    0%, 58% { transform: translateX(0) rotate(8deg); opacity: 0; }
    66% { opacity: 1; }
    100% { transform: translateX(380%) rotate(8deg); opacity: 0; }
}

.profile-hero-orbs span {
    position: absolute;
    border-radius: 50%;
    filter: blur(46px);
    opacity: 0.55;
    pointer-events: none;
}

.profile-hero-orbs span:nth-child(1) {
    width: 220px;
    height: 220px;
    top: -70px;
    right: 12%;
    background: radial-gradient(circle, rgba(124, 92, 255, 0.85), transparent 70%);
    animation: orb-float 9s ease-in-out infinite;
}

.profile-hero-orbs span:nth-child(2) {
    width: 180px;
    height: 180px;
    bottom: -60px;
    right: 30%;
    background: radial-gradient(circle, rgba(34, 211, 238, 0.7), transparent 70%);
    animation: orb-float 11s ease-in-out infinite reverse;
}

.profile-hero-orbs span:nth-child(3) {
    width: 160px;
    height: 160px;
    top: 28%;
    right: 4%;
    background: radial-gradient(circle, rgba(79, 139, 255, 0.75), transparent 70%);
    animation: orb-float 13s ease-in-out infinite;
}

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

/* ---- Avatar with rotating gradient ring ---- */
.profile-avatar-wrap {
    position: relative;
    z-index: 1;
    flex: 0 0 clamp(96px, 13vw, 142px);
    width: clamp(96px, 13vw, 142px);
    height: clamp(96px, 13vw, 142px);
}

.profile-avatar-ring {
    position: absolute;
    inset: -7px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, #7c5cff, #4f8bff, #22d3ee, #7c5cff);
    animation: spin 6s linear infinite;
    filter: drop-shadow(0 0 18px rgba(124, 92, 255, 0.55));
}

.profile-avatar-ring::after {
    content: "";
    position: absolute;
    inset: 5px;
    border-radius: 50%;
    background: #0b0d1a;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.profile-avatar {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 50%;
    background: var(--grad);
    color: #fff;
    font-size: clamp(40px, 7vw, 66px);
    font-weight: 900;
    line-height: 1;
    box-shadow: inset 0 2px 12px rgba(255, 255, 255, 0.28), 0 14px 34px rgba(79, 139, 255, 0.42);
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-status-dot {
    position: absolute;
    z-index: 2;
    right: 7px;
    bottom: 7px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--success);
    border: 3px solid #0b0d1a;
    animation: status-pulse 2s ease-in-out infinite;
}

@keyframes status-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.55); }
    50% { box-shadow: 0 0 0 8px rgba(52, 211, 153, 0); }
}

.profile-hero-text {
    position: relative;
    z-index: 1;
    min-width: 0;
}

.profile-kicker {
    margin-bottom: 8px;
    color: var(--accent-3);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.profile-hero h1 {
    margin-bottom: 18px;
}

.profile-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.profile-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    padding: 6px 14px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: var(--panel-strong);
    color: #c3cae0;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.15;
    transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.profile-badge:hover {
    transform: translateY(-2px);
}

.profile-badge.success {
    border-color: rgba(52, 211, 153, 0.4);
    background: rgba(52, 211, 153, 0.12);
    color: #6ee7b7;
}

.profile-badge.warning {
    border-color: rgba(251, 191, 36, 0.4);
    background: rgba(251, 191, 36, 0.12);
    color: #fcd34d;
}

.profile-badge.admin {
    border-color: rgba(124, 92, 255, 0.45);
    background: var(--accent-soft);
    color: #b7a6ff;
    box-shadow: 0 0 16px rgba(124, 92, 255, 0.25);
}

.profile-badge.danger {
    border-color: rgba(248, 113, 113, 0.45);
    background: rgba(248, 113, 113, 0.14);
    color: #fca5a5;
}

.profile-badge.beta {
    border-color: rgba(88, 101, 242, 0.5);
    background: rgba(88, 101, 242, 0.15);
    color: #b6c0ff;
    box-shadow: 0 0 16px rgba(88, 101, 242, 0.25);
}

/* ---- Account trust warnings ---- */
.account-warning {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin: 0.75rem 0;
    padding: 0.85rem 1.1rem;
    border-radius: 14px;
    border: 1px solid rgba(248, 113, 113, 0.5);
    background: rgba(248, 113, 113, 0.14);
    color: #fecaca;
    box-shadow: 0 0 22px rgba(248, 113, 113, 0.22);
}

.account-warning strong {
    font-size: 1.02rem;
    color: #fecaca;
}

.account-warning span {
    font-size: 0.88rem;
    opacity: 0.9;
}

.account-warning-dead {
    border-color: rgba(148, 163, 184, 0.5);
    background: rgba(100, 116, 139, 0.18);
    color: #cbd5e1;
    box-shadow: 0 0 22px rgba(100, 116, 139, 0.2);
}

.account-warning-dead strong {
    color: #e2e8f0;
}

/* ---- Stats strip ---- */
.profile-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.profile-stat {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    padding: 18px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s var(--ease), border-color 0.3s var(--ease);
}

.profile-stat::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: var(--grad);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.3s var(--ease);
    pointer-events: none;
}

.profile-stat:hover {
    transform: translateY(-5px);
    border-color: transparent;
}

.profile-stat:hover::before {
    opacity: 1;
}

.profile-stat-icon {
    flex: 0 0 46px;
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 13px;
    background: var(--accent-soft);
    color: #b7a6ff;
}

.profile-stat-icon svg {
    width: 24px;
    height: 24px;
}

.profile-stat > div {
    min-width: 0;
}

.profile-stat-label {
    margin: 0 0 3px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.profile-stat-value {
    margin: 0;
    color: var(--text);
    font-size: 16px;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---- Layout & cards ---- */
.profile-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 0.58fr);
    gap: 22px;
    align-items: stretch;
}

.profile-card {
    min-width: 0;
    padding: 24px;
    box-shadow: var(--shadow);
}

.profile-info-card,
.profile-actions-card,
.profile-jtokens-card,
.profile-roblox-card {
    display: grid;
    gap: 20px;
}

.profile-jtokens-card,
.profile-roblox-card {
    grid-column: 1 / -1;
    overflow: hidden;
}

.profile-details {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 0;
}

.profile-details div {
    position: relative;
    min-width: 0;
    padding: 16px 16px 16px 20px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(8, 10, 22, 0.45);
    transition: transform 0.25s var(--ease), background 0.25s var(--ease);
}

.profile-details div::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--grad);
    transform: scaleY(0);
    transform-origin: top;
    transition: transform 0.25s var(--ease);
}

.profile-details div:hover {
    transform: translateY(-3px);
    background: rgba(124, 92, 255, 0.08);
}

.profile-details div:hover::before {
    transform: scaleY(1);
}

.profile-details dt {
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.profile-details dd {
    margin: 0;
    color: var(--text);
    font-weight: 700;
    overflow-wrap: anywhere;
}

.profile-actions {
    display: grid;
    gap: 11px;
}

.profile-actions .button {
    width: 100%;
    justify-content: flex-start;
    gap: 10px;
}

.jtokens-meter {
    position: relative;
    height: 12px;
    overflow: hidden;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: rgba(8, 10, 22, 0.55);
}

.jtokens-meter-bar {
    width: min(var(--jtokens-used), 100%);
    height: 100%;
    border-radius: inherit;
    background: var(--grad);
    box-shadow: 0 0 18px rgba(34, 211, 238, 0.35);
}

.jtokens-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}

.jtokens-grid div {
    min-width: 0;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(8, 10, 22, 0.45);
}

/* =====================================================================
   Search directory
   ===================================================================== */
.search-page {
    display: grid;
    gap: 30px;
}

.search-hero,
.search-section,
.search-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: var(--shadow);
}

.search-hero {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1.1fr);
    gap: clamp(24px, 4vw, 48px);
    align-items: end;
    padding: clamp(24px, 4vw, 42px);
    overflow: hidden;
    background:
        linear-gradient(135deg, rgba(124, 92, 255, 0.22), transparent 46%),
        linear-gradient(315deg, rgba(34, 211, 238, 0.16), transparent 48%),
        rgba(255, 255, 255, 0.045);
}

.search-hero-copy {
    min-width: 0;
}

.search-hero h1 {
    max-width: 660px;
    margin-bottom: 14px;
    background: linear-gradient(180deg, #ffffff 0%, #c4cae6 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.search-hero p:not(.profile-kicker) {
    max-width: 520px;
    color: var(--muted);
    font-size: 17px;
}

.search-form {
    display: grid;
    gap: 10px;
    min-width: 0;
}

.search-form label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.search-input-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    min-width: 0;
    padding: 8px;
    border: 1px solid var(--line-strong);
    border-radius: 18px;
    background: rgba(8, 10, 22, 0.56);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.search-input-row:focus-within {
    border-color: rgba(34, 211, 238, 0.54);
    background: rgba(8, 10, 22, 0.82);
    box-shadow: var(--glow);
}

.search-input-icon {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    color: var(--accent-3);
}

.search-input-icon svg {
    width: 22px;
    height: 22px;
}

.search-input-row input {
    min-height: 44px;
    border: 0;
    padding-inline: 2px;
    background: transparent;
    box-shadow: none;
    font-weight: 700;
}

.search-input-row input:focus {
    border: 0;
    background: transparent;
    box-shadow: none;
}

.search-input-row button {
    min-height: 44px;
    border-radius: 12px;
    padding-inline: 22px;
}

.search-section {
    display: grid;
    gap: 20px;
    padding: clamp(20px, 3vw, 28px);
}

.search-section-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
}

.search-section-head h2 {
    margin-bottom: 0;
}

.search-count {
    display: grid;
    min-width: 44px;
    height: 44px;
    place-items: center;
    border: 1px solid rgba(34, 211, 238, 0.38);
    border-radius: 14px;
    background: rgba(34, 211, 238, 0.10);
    color: #9ff3ff;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
}

.search-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.search-card {
    position: relative;
    display: grid;
    gap: 16px;
    min-width: 0;
    padding: 18px;
    overflow: hidden;
    transition: transform 0.28s var(--ease), border-color 0.28s var(--ease), box-shadow 0.28s var(--ease);
}

.search-card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: var(--grad);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.28s var(--ease);
    pointer-events: none;
}

.search-card:hover {
    transform: translateY(-5px);
    border-color: transparent;
    box-shadow: 0 22px 52px rgba(79, 139, 255, 0.20), var(--shadow);
}

.search-card:hover::before {
    opacity: 1;
}

.search-card-main {
    display: flex;
    align-items: center;
    gap: 13px;
    min-width: 0;
    color: var(--text);
}

.search-card-main:hover {
    color: var(--text);
}

.search-avatar {
    flex: 0 0 58px;
    display: grid;
    width: 58px;
    height: 58px;
    place-items: center;
    overflow: hidden;
    border: 1px solid var(--line-strong);
    border-radius: 18px;
    background: var(--grad);
    color: #fff;
    font-size: 24px;
    font-weight: 900;
    box-shadow: 0 12px 30px rgba(79, 139, 255, 0.30);
}

.search-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.search-user-info {
    display: grid;
    min-width: 0;
    gap: 3px;
}

.search-username {
    overflow: hidden;
    font-size: 19px;
    font-weight: 900;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-user-meta {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.search-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 32px;
}

.search-card-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin: 0;
}

.search-card-stats div {
    min-width: 0;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(8, 10, 22, 0.42);
}

.search-card-stats dt {
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.search-card-stats dd {
    margin: 0;
    overflow: hidden;
    color: var(--text);
    font-size: 14px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.jtokens-grid span {
    display: block;
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.jtokens-grid strong {
    display: block;
    color: var(--text);
    font-size: 15px;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.jtokens-note {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    overflow-wrap: anywhere;
}

.btn-icon {
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
}

/* ------------------------------------------------------------- Roblox link */
.roblox-link-box {
    display: grid;
    gap: 18px;
}

.roblox-shop {
    display: grid;
    gap: 14px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.roblox-shop-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.roblox-shop-head h3,
.roblox-shop-item h4 {
    margin: 0;
}

.roblox-shop-items {
    display: grid;
    gap: 12px;
}

.roblox-shop-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(8, 10, 22, 0.44);
}

.roblox-shop-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 10px;
}

.roblox-shop-price,
.roblox-shop-owned {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 800;
    white-space: nowrap;
}

.roblox-shop-price {
    border: 1px solid rgba(34, 211, 238, 0.28);
    color: #eafcff;
    background: rgba(34, 211, 238, 0.10);
}

.roblox-shop-owned {
    border: 1px solid rgba(74, 222, 128, 0.30);
    color: #d9ffe5;
    background: rgba(74, 222, 128, 0.12);
}

.roblox-shop-remove {
    border-color: rgba(248, 113, 113, 0.28);
    color: #ffd6d6;
    background: rgba(248, 113, 113, 0.10);
}

.roblox-shop-remove:hover,
.roblox-shop-remove:focus-visible {
    border-color: rgba(248, 113, 113, 0.44);
    background: rgba(248, 113, 113, 0.16);
}

/* ------------------------------------------------------------- Roblox store */
.roblox-store-page {
    --shop-rose: #f43f5e;
    --shop-cyan: #22d3ee;
    --shop-amber: #facc15;
    --shop-violet: #7c5cff;
    display: grid;
    gap: 26px;
}

.page:has(.roblox-store-page) {
    width: min(1320px, 92vw);
}

.roblox-store-hero {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 430px);
    gap: 28px;
    align-items: center;
    min-height: 420px;
    padding: 34px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 18px;
    background:
        linear-gradient(135deg, rgba(124, 92, 255, 0.28), rgba(34, 211, 238, 0.08) 44%, rgba(244, 63, 94, 0.18)),
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px 36px),
        rgba(8, 10, 22, 0.76);
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.10);
    isolation: isolate;
}

.roblox-store-hero::before,
.roblox-store-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
}

.roblox-store-hero::before {
    background:
        linear-gradient(120deg, transparent 0 28%, rgba(255, 255, 255, 0.11) 29%, transparent 31% 100%),
        linear-gradient(60deg, transparent 0 58%, rgba(250, 204, 21, 0.12) 59%, transparent 61% 100%);
    transform: translateX(-20%);
    animation: store-scan 8s var(--ease) infinite;
}

.roblox-store-hero::after {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: inherit;
    box-shadow: inset 0 0 70px rgba(34, 211, 238, 0.10);
}

.roblox-store-hero-copy {
    max-width: 670px;
}

.roblox-store-kicker {
    margin: 0 0 10px;
    color: #a7f3d0;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

.roblox-store-hero h1 {
    margin: 0 0 16px;
    font-size: 58px;
    letter-spacing: 0;
    background: linear-gradient(180deg, #ffffff 0%, #dbeafe 54%, #67e8f9 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.roblox-store-lead {
    max-width: 620px;
    color: #cbd5e1;
    font-size: 18px;
}

.roblox-store-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 26px;
}

.roblox-store-showcase {
    display: grid;
    place-items: center;
    min-height: 330px;
}

.roblox-store-stage {
    position: relative;
    width: min(100%, 390px);
    aspect-ratio: 1.18;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 20px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0.025)),
        repeating-linear-gradient(0deg, rgba(34, 211, 238, 0.09) 0 1px, transparent 1px 16px);
    box-shadow: inset 0 0 42px rgba(124, 92, 255, 0.18), 0 24px 58px rgba(2, 6, 23, 0.48);
    overflow: hidden;
}

.roblox-store-stage::before {
    content: "";
    position: absolute;
    inset: 13%;
    border: 1px solid rgba(250, 204, 21, 0.24);
    transform: rotate(10deg);
    animation: store-frame-float 6s var(--ease) infinite alternate;
}

.roblox-store-carpet {
    width: 94%;
    max-width: 360px;
    transform-origin: 50% 58%;
    animation: store-carpet-float 4.6s var(--ease) infinite;
}

.carpet-spark {
    transform-origin: center;
    animation: store-spark 2.8s ease-in-out infinite;
}

.spark-b {
    animation-delay: 0.45s;
}

.spark-c {
    animation-delay: 0.9s;
}

.roblox-store-status-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.roblox-store-status,
.roblox-store-benefit {
    border: 1px solid var(--line);
    background: rgba(8, 10, 22, 0.58);
    box-shadow: 0 18px 44px rgba(2, 6, 23, 0.28);
}

.roblox-store-status {
    display: grid;
    gap: 6px;
    min-height: 96px;
    padding: 18px;
    border-radius: 14px;
}

.roblox-store-status-label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.roblox-store-status strong {
    color: var(--text);
    font-size: 24px;
    line-height: 1.1;
}

.roblox-store-section {
    display: grid;
    gap: 18px;
}

.roblox-store-section-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
}

.roblox-store-section-head h2 {
    margin: 0;
    font-size: 34px;
    letter-spacing: 0;
}

.roblox-store-toast {
    min-height: 38px;
    margin: 0;
    padding: 9px 14px;
    border: 1px solid transparent;
    border-radius: 999px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 800;
    text-align: right;
}

.roblox-store-toast:not(:empty) {
    border-color: rgba(34, 211, 238, 0.28);
    color: #dffcff;
    background: rgba(34, 211, 238, 0.10);
    animation: store-toast-in 0.24s var(--ease) both;
}

.roblox-store-toast[data-tone="error"]:not(:empty) {
    border-color: rgba(248, 113, 113, 0.35);
    color: #fee2e2;
    background: rgba(248, 113, 113, 0.12);
}

.roblox-store-toast[data-tone="success"]:not(:empty) {
    border-color: rgba(74, 222, 128, 0.30);
    color: #dcfce7;
    background: rgba(74, 222, 128, 0.12);
}

.roblox-store-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
}

.roblox-store-card {
    position: relative;
    display: grid;
    grid-template-rows: 146px minmax(104px, auto) auto;
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 16px;
    background:
        radial-gradient(130% 80% at 50% -12%, rgba(124, 92, 255, 0.18), transparent 58%),
        linear-gradient(180deg, rgba(17, 20, 42, 0.78), rgba(8, 10, 22, 0.84));
    box-shadow: 0 18px 44px rgba(2, 6, 23, 0.28);
    transform-style: preserve-3d;
    transition:
        border-color 0.26s var(--ease),
        box-shadow 0.26s var(--ease),
        transform 0.26s var(--ease),
        background 0.26s var(--ease);
}

/* Glowing gradient edge, revealed on hover */
.roblox-store-card::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 4;
    padding: 1px;
    border-radius: inherit;
    background: linear-gradient(150deg, rgba(34, 211, 238, 0.55), rgba(124, 92, 255, 0.30) 46%, rgba(244, 63, 94, 0.20) 78%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.26s var(--ease);
    pointer-events: none;
}

.roblox-store-card:hover {
    border-color: rgba(34, 211, 238, 0.32);
    box-shadow:
        0 28px 70px rgba(2, 6, 23, 0.46),
        0 0 38px -10px rgba(34, 211, 238, 0.30);
    transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(-5px);
}

.roblox-store-card:hover::after {
    opacity: 1;
}

.roblox-store-card[aria-busy="true"]::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 5;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.10), transparent);
    transform: translateX(-100%);
    animation: store-loading 0.9s ease-in-out infinite;
    pointer-events: none;
}

.roblox-store-card-media {
    position: relative;
    display: grid;
    place-items: center;
    overflow: hidden;
    background:
        radial-gradient(78% 92% at 50% 32%, rgba(34, 211, 238, 0.24), transparent 70%),
        linear-gradient(155deg, rgba(34, 211, 238, 0.12), rgba(124, 92, 255, 0.20) 50%, rgba(244, 63, 94, 0.12)),
        repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.06) 0 1px, transparent 1px 18px);
}

/* Blend the stage into the card body */
.roblox-store-card-media::after {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 46px;
    background: linear-gradient(to top, rgba(8, 10, 22, 0.72), transparent);
    pointer-events: none;
}

.roblox-store-card-rings {
    position: absolute;
    width: 104px;
    height: 104px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    transform: rotate(45deg);
    animation: store-rings 8s linear infinite;
}

.roblox-store-card-rings::before,
.roblox-store-card-rings::after {
    content: "";
    position: absolute;
    inset: 18px;
    border: inherit;
}

.roblox-store-card-rings::after {
    inset: 36px;
}

.roblox-store-mini-carpet {
    position: relative;
    z-index: 1;
    width: 70%;
    opacity: 0.55;
    filter: drop-shadow(0 14px 12px rgba(2, 6, 23, 0.36));
    transform-origin: center;
    animation: store-mini-float 4.2s var(--ease) infinite;
}

.roblox-store-card-image {
    position: absolute;
    z-index: 2;
    width: min(82%, 150px);
    max-height: 108px;
    object-fit: contain;
    filter: drop-shadow(0 14px 14px rgba(2, 6, 23, 0.48));
    transition: transform 0.3s var(--ease), filter 0.3s var(--ease);
}

.roblox-store-card:hover .roblox-store-card-image {
    transform: translateY(-5px) scale(1.06);
    filter: drop-shadow(0 20px 22px rgba(2, 6, 23, 0.55));
}

.roblox-store-card:hover .roblox-store-mini-carpet {
    opacity: 0.72;
}

.roblox-store-card-body {
    display: grid;
    align-content: start;
    gap: 8px;
    padding: 14px 14px 0;
}

.roblox-store-card-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.roblox-store-card h3 {
    margin: 0;
    min-width: 0;
    font-size: 17px;
    line-height: 1.2;
    letter-spacing: 0;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.roblox-store-card p {
    margin: 0;
    color: #b7c0d8;
    font-size: 13px;
    line-height: 1.38;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.roblox-store-owned-badge,
.roblox-store-price {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 30px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
}

.roblox-store-owned-badge {
    border: 1px solid rgba(74, 222, 128, 0.36);
    color: #dcfce7;
    background: rgba(74, 222, 128, 0.12);
}

.roblox-store-badge-icon {
    width: 13px;
    height: 13px;
    flex: none;
    color: #86efac;
}

.roblox-store-card-foot {
    display: grid;
    gap: 8px;
    padding: 14px;
}

.roblox-store-price {
    width: 100%;
    border: 1px solid rgba(250, 204, 21, 0.34);
    color: #fde68a;
    background:
        linear-gradient(180deg, rgba(250, 204, 21, 0.16), rgba(202, 138, 4, 0.10));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.10);
}

.roblox-store-coin {
    width: 16px;
    height: 16px;
    flex: none;
    color: #facc15;
    filter: drop-shadow(0 1px 4px rgba(250, 204, 21, 0.35));
}

.roblox-store-price-value {
    color: #fef3c7;
    letter-spacing: 0.2px;
}

.roblox-store-price-unit {
    color: rgba(253, 230, 138, 0.78);
    font-weight: 800;
}

.roblox-store-buy,
.roblox-store-remove {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding-inline: 10px;
    font-size: 13px;
}

.roblox-store-buy[disabled] {
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.07);
    color: rgba(226, 232, 240, 0.58);
    box-shadow: none;
    cursor: not-allowed;
}

.roblox-store-remove {
    border: 1px solid rgba(248, 113, 113, 0.34);
    background: rgba(248, 113, 113, 0.10);
    color: #fecaca;
    box-shadow: none;
}

.roblox-store-remove:hover,
.roblox-store-remove:focus-visible {
    border-color: rgba(248, 113, 113, 0.62);
    background: rgba(248, 113, 113, 0.18);
    box-shadow: 0 14px 32px rgba(127, 29, 29, 0.24);
}

.roblox-store-card.is-owned {
    border-color: rgba(74, 222, 128, 0.26);
    background:
        radial-gradient(130% 80% at 50% -12%, rgba(74, 222, 128, 0.16), transparent 58%),
        linear-gradient(180deg, rgba(14, 30, 24, 0.78), rgba(8, 14, 14, 0.84));
}

.roblox-store-card.is-owned .roblox-store-card-media {
    background:
        radial-gradient(78% 92% at 50% 32%, rgba(74, 222, 128, 0.22), transparent 70%),
        linear-gradient(155deg, rgba(34, 211, 238, 0.10), rgba(74, 222, 128, 0.16) 50%, rgba(124, 92, 255, 0.10)),
        repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.06) 0 1px, transparent 1px 18px);
}

.roblox-store-card.is-owned:hover {
    border-color: rgba(74, 222, 128, 0.42);
    box-shadow:
        0 28px 70px rgba(2, 6, 23, 0.46),
        0 0 38px -10px rgba(74, 222, 128, 0.30);
}

.roblox-store-card.is-purchased {
    animation: store-card-success 0.62s var(--ease) both;
}

.roblox-store-card.is-removed {
    animation: store-card-remove 0.62s var(--ease) both;
}

.roblox-store-benefits {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.roblox-store-benefit {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 18px;
    border-radius: 14px;
}

.roblox-store-benefit span {
    display: grid;
    place-items: center;
    flex: 0 0 46px;
    width: 46px;
    height: 46px;
    border: 1px solid rgba(34, 211, 238, 0.28);
    border-radius: 13px;
    color: #a5f3fc;
    background: rgba(34, 211, 238, 0.10);
}

.roblox-store-benefit svg {
    width: 24px;
    height: 24px;
}

.roblox-store-benefit h3 {
    margin: 0 0 4px;
    font-size: 17px;
    letter-spacing: 0;
}

.roblox-store-benefit p {
    margin: 0;
    color: var(--muted);
}

@keyframes store-scan {
    0%, 18% { transform: translateX(-48%); opacity: 0; }
    42%     { opacity: 1; }
    70%     { opacity: 0.5; }
    100%    { transform: translateX(64%); opacity: 0; }
}

@keyframes store-frame-float {
    from { transform: rotate(8deg) scale(0.96); }
    to   { transform: rotate(14deg) scale(1.04); }
}

@keyframes store-carpet-float {
    0%, 100% { transform: translateY(0) rotate(-2deg); }
    50%      { transform: translateY(-16px) rotate(2deg); }
}

@keyframes store-mini-float {
    0%, 100% { transform: translateY(0) rotate(-2deg); }
    50%      { transform: translateY(-9px) rotate(2deg); }
}

@keyframes store-spark {
    0%, 100% { opacity: 0.42; transform: scale(0.82); }
    50%      { opacity: 1; transform: scale(1.28); }
}

@keyframes store-rings {
    to { transform: rotate(405deg); }
}

@keyframes store-toast-in {
    from { opacity: 0; transform: translateY(6px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes store-loading {
    to { transform: translateX(100%); }
}

@keyframes store-card-success {
    0%   { box-shadow: 0 18px 44px rgba(2, 6, 23, 0.28); }
    42%  { box-shadow: 0 0 0 5px rgba(74, 222, 128, 0.22), 0 26px 64px rgba(34, 197, 94, 0.22); }
    100% { box-shadow: 0 18px 44px rgba(2, 6, 23, 0.28); }
}

@keyframes store-card-remove {
    0%   { filter: saturate(1); }
    36%  { filter: saturate(1.45) brightness(1.15); box-shadow: 0 0 0 5px rgba(248, 113, 113, 0.22), 0 24px 58px rgba(127, 29, 29, 0.24); }
    100% { filter: saturate(1); }
}

/* =====================================================================
   Settings
   ===================================================================== */
.settings-page {
    display: grid;
    gap: 22px;
}

.settings-head {
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    padding: 28px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background:
        radial-gradient(120% 160% at 0% 0%, rgba(124, 92, 255, 0.22), transparent 50%),
        radial-gradient(110% 140% at 100% 100%, rgba(34, 211, 238, 0.14), transparent 52%),
        var(--panel);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    animation: rise-in 0.6s var(--ease) both;
}

/* slow drifting sheen across the header */
.settings-head::before {
    content: "";
    position: absolute;
    inset: -40% -10%;
    background: conic-gradient(from 0deg, transparent 0deg, rgba(124, 92, 255, 0.10) 70deg, transparent 140deg, rgba(34, 211, 238, 0.08) 220deg, transparent 300deg);
    animation: settings-head-spin 18s linear infinite;
    pointer-events: none;
}

.settings-head-text,
.settings-back {
    position: relative;
    z-index: 1;
}

.settings-head h1 {
    margin-bottom: 10px;
}

.settings-title {
    background: var(--grad-text);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    background-size: 200% auto;
    animation: gradient-pan 6s var(--ease) infinite alternate;
}

.settings-username {
    font-weight: 800;
    color: var(--text);
}

.settings-back {
    transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.settings-back:hover .btn-icon {
    transform: translateX(-3px);
}

.settings-back .btn-icon {
    transition: transform 0.25s var(--ease);
}

.settings-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 0.64fr);
    gap: 22px;
    align-items: start;
}

.settings-card {
    display: grid;
    gap: 18px;
    transition: transform 0.3s var(--ease), box-shadow 0.35s var(--ease), border-color 0.35s var(--ease);
    animation: settings-card-in 0.6s var(--ease) both;
    animation-delay: calc(var(--i, 0) * 90ms);
}

.settings-card:hover {
    transform: translateY(-4px);
    border-color: var(--line-strong);
    box-shadow: 0 26px 60px rgba(79, 139, 255, 0.20), var(--shadow);
}

/* card header with animated icon badge */
.settings-card-head {
    display: flex;
    align-items: center;
    gap: 14px;
}

.settings-card-icon {
    display: grid;
    flex: 0 0 46px;
    width: 46px;
    height: 46px;
    place-items: center;
    border: 1px solid var(--line-strong);
    border-radius: 13px;
    background: var(--accent-soft);
    color: #c9bcff;
    box-shadow: inset 0 0 16px rgba(124, 92, 255, 0.18);
    transition: transform 0.35s var(--ease), background 0.35s var(--ease), color 0.35s var(--ease);
}

.settings-card-icon svg {
    width: 24px;
    height: 24px;
    transition: transform 0.4s var(--ease);
}

.settings-card:hover .settings-card-icon {
    transform: rotate(-6deg) scale(1.08);
    background: rgba(124, 92, 255, 0.26);
    color: #fff;
}

.settings-card:hover .settings-card-icon svg {
    transform: scale(1.06);
}

.settings-card-icon.danger {
    border-color: rgba(248, 113, 113, 0.4);
    background: rgba(248, 113, 113, 0.12);
    color: #fca5a5;
    box-shadow: inset 0 0 16px rgba(248, 113, 113, 0.16);
}

.settings-card:hover .settings-card-icon.danger {
    background: rgba(248, 113, 113, 0.24);
    color: #fff;
}

.settings-avatar-card {
    grid-column: 1 / -1;
}

.settings-avatar-row {
    display: flex;
    align-items: center;
    gap: 18px;
    min-width: 0;
}

.settings-avatar-preview {
    position: relative;
    flex: 0 0 96px;
    display: grid;
    width: 96px;
    height: 96px;
    place-items: center;
    overflow: hidden;
    border: 3px solid rgba(255, 255, 255, 0.14);
    border-radius: 50%;
    background: var(--grad);
    color: #fff;
    font-size: 40px;
    font-weight: 900;
    box-shadow: 0 14px 34px rgba(79, 139, 255, 0.34);
    transition: transform 0.3s var(--ease), box-shadow 0.35s var(--ease);
}

/* rotating conic ring around the avatar */
.settings-avatar-preview::before {
    content: "";
    position: absolute;
    inset: -7px;
    z-index: -1;
    border-radius: 50%;
    background: conic-gradient(from 0deg, var(--accent), var(--accent-2), var(--accent-3), var(--accent));
    filter: blur(2px);
    opacity: 0.55;
    animation: settings-ring-spin 6s linear infinite;
}

.settings-avatar-card:hover .settings-avatar-preview {
    transform: scale(1.05);
    box-shadow: 0 18px 44px rgba(124, 92, 255, 0.5);
}

.settings-avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.settings-avatar-letter {
    animation: settings-letter-float 4s var(--ease) infinite alternate;
}

.settings-avatar-preview.is-popping {
    animation: settings-avatar-pop 0.55s var(--ease);
}

.settings-avatar-meta {
    min-width: 0;
}

.settings-avatar-form,
.settings-avatar-delete-form {
    margin: 0;
}

/* drag & drop upload zone */
.settings-dropzone {
    position: relative;
    display: grid;
    justify-items: center;
    gap: 6px;
    padding: 22px 18px;
    overflow: hidden;
    border: 1.5px dashed var(--line-strong);
    border-radius: 14px;
    background: rgba(8, 10, 22, 0.4);
    text-align: center;
    cursor: pointer;
    transition: border-color 0.3s var(--ease), background 0.3s var(--ease), transform 0.3s var(--ease);
}

.settings-dropzone::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(180px circle at 50% 0%, rgba(124, 92, 255, 0.18), transparent 70%);
    opacity: 0;
    transition: opacity 0.35s var(--ease);
    pointer-events: none;
}

.settings-dropzone:hover {
    border-color: var(--accent);
    background: rgba(124, 92, 255, 0.07);
    transform: translateY(-2px);
}

.settings-dropzone:hover::after {
    opacity: 1;
}

.settings-dropzone.is-dragover {
    border-color: var(--accent-3);
    border-style: solid;
    background: rgba(34, 211, 238, 0.12);
    transform: scale(1.02);
    animation: settings-drop-pulse 1s var(--ease) infinite;
}

.settings-dropzone-icon {
    width: 30px;
    height: 30px;
    color: var(--accent-2);
    transition: transform 0.35s var(--ease);
}

.settings-dropzone:hover .settings-dropzone-icon {
    transform: translateY(-4px) scale(1.12);
    color: #fff;
}

.settings-dropzone-text {
    font-weight: 800;
    color: var(--text);
}

.settings-dropzone-hint {
    font-size: 13px;
    color: var(--muted);
    overflow-wrap: anywhere;
}

.settings-dropzone input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: 0;
    opacity: 0;
    cursor: pointer;
}

/* submit button loading state */
.settings-submit.is-loading,
.settings-danger-btn.is-loading {
    pointer-events: none;
    opacity: 0.85;
}

.settings-submit.is-loading .btn-icon {
    animation: spin 0.8s linear infinite;
}

.settings-roblox-card {
    grid-column: 1 / -1;
}

.settings-session-card {
    align-self: start;
}

.settings-danger-card:hover {
    border-color: rgba(248, 113, 113, 0.38);
    box-shadow: 0 26px 60px rgba(248, 113, 113, 0.16), var(--shadow);
}

.settings-danger-btn:hover {
    animation: settings-wiggle 0.45s var(--ease);
}

.settings-danger-btn.is-armed {
    animation: settings-arm-pulse 0.9s var(--ease) infinite;
}

.settings-status {
    margin: 0;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    font-weight: 700;
    transition: background 0.3s var(--ease), color 0.3s var(--ease), border-color 0.3s var(--ease);
}

.settings-status.success {
    border-color: rgba(52, 211, 153, 0.36);
    background: rgba(52, 211, 153, 0.10);
    color: #6ee7b7;
}

.settings-status.warning {
    border-color: rgba(251, 191, 36, 0.36);
    background: rgba(251, 191, 36, 0.10);
    color: #fcd34d;
    animation: settings-status-glow 2.4s var(--ease) infinite;
}

.settings-status.is-flash {
    animation: settings-status-flash 0.7s var(--ease);
}

.settings-logout-form {
    margin: 0;
}

/* clickable Roblox code copy feedback */
.settings-roblox-card .roblox-code {
    transition: transform 0.25s var(--ease), color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.settings-roblox-card .roblox-code:hover {
    transform: scale(1.03);
}

.settings-roblox-card .roblox-code.is-copied {
    color: #6ee7b7;
    animation: settings-copied 0.9s var(--ease);
}

/* ---- Settings keyframes ---- */
@keyframes settings-head-spin {
    to { transform: rotate(360deg); }
}

@keyframes settings-card-in {
    from { opacity: 0; transform: translateY(22px) scale(0.985); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes settings-ring-spin {
    to { transform: rotate(360deg); }
}

@keyframes settings-letter-float {
    from { transform: translateY(-2px); }
    to   { transform: translateY(2px); }
}

@keyframes settings-avatar-pop {
    0%   { transform: scale(0.7) rotate(-8deg); opacity: 0.4; }
    55%  { transform: scale(1.12) rotate(3deg); }
    100% { transform: scale(1) rotate(0); opacity: 1; }
}

@keyframes settings-drop-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(34, 211, 238, 0.35); }
    50%      { box-shadow: 0 0 0 8px rgba(34, 211, 238, 0); }
}

@keyframes settings-wiggle {
    0%, 100% { transform: translateY(-2px) translateX(0); }
    25%      { transform: translateY(-2px) translateX(-4px); }
    75%      { transform: translateY(-2px) translateX(4px); }
}

@keyframes settings-arm-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(248, 113, 113, 0.5); }
    50%      { box-shadow: 0 0 0 10px rgba(248, 113, 113, 0); }
}

@keyframes settings-status-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0); }
    50%      { box-shadow: 0 0 18px 0 rgba(251, 191, 36, 0.18); }
}

@keyframes settings-status-flash {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.03); box-shadow: 0 0 22px rgba(52, 211, 153, 0.4); }
    100% { transform: scale(1); }
}

@keyframes settings-copied {
    0%   { transform: scale(1); }
    35%  { transform: scale(1.12); }
    100% { transform: scale(1); }
}

.studio-roblox-link {
    margin-bottom: 22px;
    box-shadow: var(--shadow);
}

.studio-roblox-link .roblox-link-box {
    padding-top: 0;
    border-top: 0;
}

.roblox-link-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.roblox-code-card {
    display: grid;
    gap: 8px;
    margin-top: 16px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(8, 10, 22, 0.5);
}

.roblox-code {
    width: fit-content;
    padding: 12px 18px;
    border: 1px dashed rgba(124, 92, 255, 0.55);
    border-radius: 10px;
    background: rgba(124, 92, 255, 0.10);
    color: #fff;
    font-family: "Courier New", monospace;
    font-size: 32px;
    font-weight: 800;
    letter-spacing: 6px;
    animation: code-glow 2.2s ease-in-out infinite;
}

@keyframes code-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(124, 92, 255, 0); }
    50%      { box-shadow: 0 0 26px 2px rgba(124, 92, 255, 0.35); }
}

/* =====================================================================
   Keyframes & motion
   ===================================================================== */
@keyframes rise-in {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes message-in {
    from { opacity: 0; transform: translateY(10px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes typing-dot {
    0%, 80%, 100% { opacity: 0.32; transform: translateY(0); }
    40%           { opacity: 0.9; transform: translateY(-4px); }
}

@keyframes send-pulse {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-2px); }
}

@keyframes message-in-right {
    from { opacity: 0; transform: translateY(10px) translateX(16px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) translateX(0) scale(1); }
}

@keyframes message-in-left {
    from { opacity: 0; transform: translateY(10px) translateX(-16px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) translateX(0) scale(1); }
}

@keyframes gradient-pan {
    0%, 100% { background-position: 0% 50%; }
    50%      { background-position: 100% 50%; }
}

@keyframes avatar-glow {
    0%, 100% { box-shadow: 0 10px 26px rgba(79, 139, 255, 0.42); }
    50%      { box-shadow: 0 12px 34px rgba(124, 92, 255, 0.6); }
}

@keyframes avatar-halo {
    0%, 100% { opacity: 0.4; transform: scale(0.96); }
    50%      { opacity: 0.7; transform: scale(1.05); }
}

@keyframes mark-float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-7px); }
}

@keyframes dot-pulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.18); }
    50%      { box-shadow: 0 0 0 5px rgba(34, 211, 238, 0.05); }
}

@keyframes bubble-shimmer {
    from { background-position: 120% 0; }
    to   { background-position: -120% 0; }
}

@keyframes caret-blink {
    0%, 49%   { opacity: 1; }
    50%, 100% { opacity: 0; }
}

@keyframes caret-rise {
    0%, 100% { transform: translateY(0) scaleY(1); }
    50%      { transform: translateY(-1px) scaleY(1.08); }
}

@keyframes answer-stream-sheen {
    from { background-position: 130% 0, 0 0; }
    to   { background-position: -130% 0, 0 0; }
}

@keyframes typed-char-in {
    from {
        opacity: 0;
        filter: blur(3px);
        text-shadow: 0 0 14px rgba(34, 211, 238, 0.5);
    }
    to {
        opacity: 1;
        filter: blur(0);
        text-shadow: 0 0 0 rgba(34, 211, 238, 0);
    }
}

@keyframes msg-avatar-think {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 8px 20px rgba(79, 139, 255, 0.34), 0 0 0 0 rgba(34, 211, 238, 0);
    }
    50% {
        transform: scale(1.06);
        box-shadow: 0 10px 28px rgba(124, 92, 255, 0.55), 0 0 26px 4px rgba(34, 211, 238, 0.35);
    }
}

@keyframes msg-avatar-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

@keyframes avatar-spark {
    0%   { transform: translate(0, 0) scale(0.3); opacity: 0; }
    18%  { opacity: 1; }
    100% { transform: translate(var(--x, 0), var(--y, 0)) scale(0.85); opacity: 0; }
}

@keyframes thinking-shimmer {
    from { background-position: 120% 0; }
    to   { background-position: -120% 0; }
}

@keyframes thinking-swap {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes prompt-char-in {
    from {
        opacity: 0;
        filter: blur(4px);
        transform: translateY(5px) scale(0.86);
    }
    70% {
        opacity: 1;
        filter: blur(0);
        transform: translateY(-1px) scale(1.04);
    }
    to {
        opacity: 1;
        filter: blur(0);
        transform: translateY(0) scale(1);
    }
}

@keyframes chip-in {
    from { opacity: 0; transform: translateY(10px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes usage-bump {
    0%   { transform: scale(1); color: var(--accent-3); }
    40%  { transform: scale(1.18); color: var(--accent-3); }
    100% { transform: scale(1); }
}

@keyframes username-old-burst {
    0%   { opacity: 1; filter: blur(0); transform: scale(1) rotate(0); }
    65%  { opacity: 0.7; filter: blur(1px); transform: scale(1.16) rotate(-2deg); }
    100% { opacity: 0; filter: blur(8px); transform: scale(0.42) rotate(5deg); }
}

@keyframes username-new-arrive {
    0%   { opacity: 0; filter: blur(7px); transform: translateY(6px) scale(0.88); }
    72%  { opacity: 1; filter: blur(0); transform: translateY(-1px) scale(1.06); }
    100% { opacity: 1; filter: blur(0); transform: translateY(0) scale(1); }
}

@keyframes username-spark-burst {
    0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.35); }
    22%  { opacity: 1; }
    100% { opacity: 0; transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) scale(1.05); }
}

/* Scroll reveal (driven by base.html observer) */
[data-reveal] {
    opacity: 0;
    transform: translateY(26px);
    transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
    will-change: opacity, transform;
}

[data-reveal].in-view {
    opacity: 1;
    transform: translateY(0);
}

/* =====================================================================
   jekakaAI — design & motion enhancements
   ===================================================================== */

/* Ambient, slowly drifting glow inside the chat column */
.chat {
    position: relative;
    isolation: isolate;
}

.chat::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(42vmax 30vmax at 18% 8%, rgba(124, 92, 255, 0.16), transparent 60%),
        radial-gradient(38vmax 30vmax at 88% 14%, rgba(34, 211, 238, 0.12), transparent 60%),
        radial-gradient(46vmax 34vmax at 60% 110%, rgba(79, 139, 255, 0.14), transparent 62%);
    background-size: 180% 180%;
    animation: chat-aura 26s var(--ease) infinite alternate;
}

@keyframes chat-aura {
    0%   { background-position: 0% 0%; }
    50%  { background-position: 60% 40%; }
    100% { background-position: 100% 80%; }
}

/* Keep foreground above the ambient glow */
.chat-header,
.messages,
.chat-input {
    position: relative;
    z-index: 1;
}

/* Online indicator on the header avatar */
.chat-avatar::before {
    content: "";
    position: absolute;
    right: -2px;
    bottom: -2px;
    width: 13px;
    height: 13px;
    border-radius: 999px;
    background: var(--success);
    border: 2.5px solid #0c1020;
    box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.55);
    animation: status-online 2.4s ease-out infinite;
    z-index: 2;
}

@keyframes status-online {
    0%   { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.55); }
    70%  { box-shadow: 0 0 0 7px rgba(52, 211, 153, 0); }
    100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

/* New-chat button: animated gradient skin + sheen */
.new-chat-btn {
    position: relative;
    overflow: hidden;
    background: var(--grad);
    background-size: 200% 200%;
    border: 0;
    color: #fff;
    box-shadow: 0 12px 28px rgba(124, 92, 255, 0.32);
    animation: gradient-pan 7s ease infinite;
    transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.new-chat-btn::after {
    content: "";
    position: absolute;
    top: 0;
    left: -120%;
    width: 55%;
    height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.5), transparent);
    transform: skewX(-18deg);
    transition: left 0.6s var(--ease);
}

.new-chat-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 16px 36px rgba(124, 92, 255, 0.45);
}

.new-chat-btn:hover:not(:disabled)::after {
    left: 150%;
}

/* Animated accent edge on AI message bubbles */
.message-row.from-ai .message-bubble::before {
    content: "";
    position: absolute;
    left: 0;
    top: 12px;
    bottom: 12px;
    width: 3px;
    border-radius: 999px;
    background: var(--grad);
    background-size: 100% 200%;
    opacity: 0.85;
    animation: gradient-pan 5s ease infinite;
}

/* Composer: calm gradient halo that ignites on focus */
.composer-box {
    position: relative;
}

.composer-box::before {
    content: "";
    position: absolute;
    inset: -2px;
    z-index: -1;
    border-radius: inherit;
    background: linear-gradient(135deg, var(--accent), var(--accent-2), var(--accent-3));
    opacity: 0;
    filter: blur(11px);
    transition: opacity 0.35s var(--ease);
}

.composer-box:focus-within::before {
    opacity: 0.55;
    animation: halo-breathe 2.8s ease-in-out infinite;
}

@keyframes halo-breathe {
    0%, 100% { opacity: 0.42; filter: blur(10px); }
    50%      { opacity: 0.62; filter: blur(14px); }
}

/* Send button — visible icon chip + breathing gradient */
.chat-input .send-button {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    background-size: 180% 180%;
    animation: gradient-pan 6s ease infinite;
}

.send-icon {
    display: inline-grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    font-size: 14px;
    line-height: 1;
    transition: transform 0.22s var(--ease);
}

.chat-input .send-button:hover:not(:disabled) .send-icon {
    transform: translateY(-3px) scale(1.08);
}

/* Welcome mark: emanating gradient rings */
.ai-welcome-mark {
    position: relative;
}

.ai-welcome-mark::before,
.ai-welcome-mark::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    border: 1.5px solid rgba(124, 92, 255, 0.5);
    animation: mark-ring 3s var(--ease) infinite;
}

.ai-welcome-mark::after {
    animation-delay: 1.5s;
}

@keyframes mark-ring {
    0%   { transform: scale(1); opacity: 0.7; }
    100% { transform: scale(1.85); opacity: 0; }
}

/* Suggestion chips: light sweep on hover */
.ai-chip {
    position: relative;
    overflow: hidden;
}

.ai-chip::before {
    content: "";
    position: absolute;
    top: 0;
    left: -130%;
    width: 60%;
    height: 100%;
    background: linear-gradient(100deg, transparent, rgba(124, 92, 255, 0.28), transparent);
    transform: skewX(-18deg);
    transition: left 0.6s var(--ease);
}

.ai-chip:hover::before {
    left: 160%;
}

/* Sidebar active chat: soft animated glow */
.sidebar-chat-link.active {
    box-shadow: inset 0 0 0 1px rgba(124, 92, 255, 0.25), 0 8px 22px rgba(124, 92, 255, 0.18);
    animation: active-chat-glow 3.6s ease-in-out infinite;
}

@keyframes active-chat-glow {
    0%, 100% { box-shadow: inset 0 0 0 1px rgba(124, 92, 255, 0.25), 0 8px 22px rgba(124, 92, 255, 0.16); }
    50%      { box-shadow: inset 0 0 0 1px rgba(124, 92, 255, 0.4), 0 10px 28px rgba(124, 92, 255, 0.3); }
}

/* =====================================================================
   Flash toast on AI page
   ===================================================================== */
@keyframes flash-toast-out {
    to { opacity: 0; transform: translateX(-50%) translateY(-10px) scale(0.94); }
}

.page:has(.app) .flash {
    position: fixed;
    top: 16px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: max-content;
    max-width: min(320px, calc(100vw - 32px));
    margin: 0;
    padding: 10px 18px;
    font-size: 13px;
    line-height: 1.4;
    text-align: center;
    z-index: 300;
    box-shadow: 0 12px 32px rgba(4, 6, 16, 0.55), 0 0 0 1px rgba(124, 92, 255, 0.22);
    animation: flash-toast-in 0.32s var(--ease) both, flash-toast-out 0.4s 4s var(--ease) forwards;
}

.page:has(.app) .flash p {
    margin: 0;
}

@keyframes flash-toast-in {
    from { opacity: 0; transform: translateX(-50%) translateY(-10px) scale(0.95); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

@media (max-width: 720px) {
    .page:has(.app) .flash {
        top: 10px;
        max-width: calc(100vw - 32px);
    }
}

/* =====================================================================
   Chat item — per-pill delete button & deletion animation
   ===================================================================== */
.chat-item {
    position: relative;
    border-radius: 12px;
}

.chat-item-delete-form {
    display: none;
    margin: 0;
}

.chat-item-delete-btn {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    min-height: 22px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid rgba(255, 84, 112, 0.28);
    background: rgba(255, 84, 112, 0.10);
    color: var(--danger);
    font: 16px/1 inherit;
    cursor: pointer;
    box-shadow: none;
    transition:
        background 0.18s ease,
        border-color 0.18s ease,
        box-shadow 0.18s ease,
        transform 0.18s var(--ease),
        opacity 0.14s ease;
}

.chat-item-delete-btn::before {
    content: none;
}

.chat-item-delete-btn:hover {
    background: rgba(255, 84, 112, 0.30);
    border-color: rgba(255, 84, 112, 0.75);
    box-shadow: 0 0 0 4px rgba(255, 84, 112, 0.16), 0 0 20px rgba(255, 84, 112, 0.40);
    transform: scale(1.22) translateY(0);
}

.chat-item-delete-btn:active {
    transform: scale(0.88);
}

/* ---- Deletion keyframes ---- */
@keyframes delete-flash {
    0%   {
        box-shadow: none;
        border-color: transparent;
        background: var(--panel);
    }
    28%  {
        box-shadow:
            0 0 0 3px rgba(255, 84, 112, 0.80),
            0 0 0 7px rgba(255, 84, 112, 0.38),
            0 0 32px rgba(255, 84, 112, 0.60);
        border-color: rgba(255, 84, 112, 1);
        background: rgba(255, 84, 112, 0.26);
        filter: brightness(1.95) saturate(1.5);
    }
    60%  {
        box-shadow:
            0 0 0 9px rgba(255, 84, 112, 0.22),
            0 0 0 18px rgba(255, 84, 112, 0.08),
            0 0 52px rgba(255, 84, 112, 0.22);
        filter: brightness(1.35);
    }
    100% {
        box-shadow:
            0 0 0 18px rgba(255, 84, 112, 0),
            0 0 0 34px rgba(255, 84, 112, 0);
        filter: brightness(1.05);
    }
}

@keyframes delete-implode {
    0%   { opacity: 1; transform: scale(1) rotate(0deg); filter: brightness(1.1) blur(0px); }
    12%  { transform: scale(1.07) rotate(-2.5deg); filter: brightness(1.8) blur(0px); }
    38%  { opacity: 0.65; transform: scale(0.70) rotate(3deg); filter: brightness(0.65) blur(2px); }
    100% { opacity: 0; transform: scale(0.12) rotate(-8deg); filter: brightness(0) blur(16px) saturate(0); }
}

.chat-item.is-deleting .sidebar-chat-link {
    animation:
        delete-flash 0.32s var(--ease) both,
        delete-implode 0.46s 0.26s var(--ease) both;
    pointer-events: none;
}

.chat-item.is-deleting .chat-item-delete-btn {
    opacity: 0;
    transform: scale(0);
    pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }

    .bg-aurora,
    .brand,
    .brand::before,
    .brand::after,
    .code-glow,
    .messages,
    .chat,
    .chat::before,
    .chat-avatar,
    .chat-avatar::after,
    .chat-avatar::before,
    .new-chat-btn,
    .message-row.from-ai .message-bubble::before,
    .composer-box:focus-within::before,
    .chat-input .send-button,
    .sidebar-brand-mark,
    .ai-welcome-mark,
    .ai-welcome-mark::before,
    .ai-welcome-mark::after,
    .sidebar-chat-link.active,
    .sidebar-chat-link.active .chat-link-dot,
    .message-row.is-pending .message-bubble::after,
    .message-text.is-typing::after,
    .message-bubble.is-streaming::after,
    .msg-avatar,
    .msg-avatar.is-thinking,
    .msg-avatar.is-thinking .msg-avatar-mark,
    .msg-avatar-spark,
    .thinking-text,
    .typed-char,
    .prompt-typed-char,
    .username-old,
    .username-new,
    .username-spark {
        animation: none !important;
        scroll-behavior: auto;
    }

    *,
    [data-reveal] {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }

    [data-reveal] {
        opacity: 1;
        transform: none;
    }

    .message-row.is-new,
    .typing-indicator span,
    .chat-input[data-sending="true"] .send-icon,
    .chat-item.is-deleting .sidebar-chat-link,
    .chat-item.is-deleting .chat-item-delete-btn {
        animation: none;
    }
}

/* =====================================================================
   Responsive
   ===================================================================== */
@media (max-width: 720px) {
    .topbar {
        display: block;
        padding: max(8px, env(safe-area-inset-top)) 12px 8px;
        overflow: visible;
        background: rgba(7, 9, 18, 0.88);
        border-bottom-color: rgba(255, 255, 255, 0.12);
        box-shadow: 0 10px 28px rgba(2, 4, 12, 0.28);
    }

    .topbar-main {
        display: flex;
        min-height: 48px;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
    }

    .brand {
        display: inline-flex;
        width: auto;
        align-items: center;
        margin: 0;
        padding: 4px;
        font-size: 23px;
    }

    .brand-logo {
        height: 1.5em;
        width: 1.5em;
        flex-basis: auto;
    }

    .nav-toggle {
        position: relative;
        display: grid;
        width: 48px;
        min-width: 48px;
        height: 48px;
        min-height: 48px;
        place-items: center;
        padding: 0;
        border: 1px solid var(--line-strong);
        border-radius: 14px;
        background: linear-gradient(145deg, rgba(124, 92, 255, 0.18), rgba(79, 139, 255, 0.08));
        color: var(--text);
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
        cursor: pointer;
        touch-action: manipulation;
        transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    }

    .nav-toggle:hover,
    .nav-toggle:active,
    .nav-toggle[aria-expanded="true"] {
        background: var(--accent-soft);
        border-color: rgba(124, 92, 255, 0.55);
        box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.12);
        transform: none;
    }

    .nav-toggle:focus-visible {
        outline: 3px solid rgba(86, 224, 224, 0.75);
        outline-offset: 2px;
    }

    .nav-toggle-icon {
        display: grid;
        width: 22px;
        gap: 5px;
    }

    .nav-toggle-icon i {
        display: block;
        width: 100%;
        height: 2px;
        border-radius: 999px;
        background: currentColor;
        transform-origin: center;
        transition: transform 0.22s var(--ease), opacity 0.16s ease;
    }

    .nav-toggle[aria-expanded="true"] .nav-toggle-icon i:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    .nav-toggle[aria-expanded="true"] .nav-toggle-icon i:nth-child(2) {
        opacity: 0;
    }

    .nav-toggle[aria-expanded="true"] .nav-toggle-icon i:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    .topbar nav {
        position: absolute;
        top: calc(100% + 8px);
        left: 12px;
        right: 12px;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        max-height: min(72dvh, 560px);
        overflow-y: auto;
        overscroll-behavior: contain;
        padding: 12px;
        border: 1px solid var(--line-strong);
        border-radius: 20px;
        background: rgba(13, 15, 29, 0.97);
        box-shadow: 0 24px 64px rgba(2, 4, 12, 0.72), inset 0 1px 0 rgba(255, 255, 255, 0.06);
        backdrop-filter: blur(24px) saturate(150%);
        -webkit-backdrop-filter: blur(24px) saturate(150%);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transform: translateY(-8px) scale(0.98);
        transform-origin: top right;
        transition: opacity 0.18s ease, transform 0.22s var(--ease), visibility 0.22s;
    }

    .topbar.is-menu-open nav {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translateY(0) scale(1);
    }

    .topbar nav > a,
    .topbar nav .user {
        min-width: 0;
        min-height: 48px;
        display: inline-flex;
        align-items: center;
        justify-content: flex-start;
        border: 1px solid transparent;
        border-radius: 13px;
        padding: 10px 12px;
        background: rgba(255, 255, 255, 0.045);
        color: var(--text);
        font-size: 14px;
        line-height: 1.25;
        touch-action: manipulation;
        overflow-wrap: normal;
    }

    .topbar nav > a::after {
        display: none;
    }

    .topbar nav .user {
        grid-column: 1 / -1;
        max-width: none;
        justify-content: center;
        min-height: 44px;
        color: var(--muted);
        border-color: var(--line);
        background: rgba(255, 255, 255, 0.025);
    }

    .topbar nav .button.small {
        min-height: 48px;
        padding: 10px 12px;
    }

    .topbar nav > a[aria-current="page"] {
        border-color: rgba(124, 92, 255, 0.38);
        background: linear-gradient(135deg, rgba(124, 92, 255, 0.22), rgba(79, 139, 255, 0.12));
        box-shadow: inset 3px 0 0 var(--accent);
    }

    .topbar .nav-form {
        grid-column: 1 / -1;
    }

    .topbar .nav-form button {
        width: 100%;
        min-height: 48px;
        border: 1px solid rgba(255, 84, 112, 0.22);
        border-radius: 13px;
        color: #ff9bae;
        background: rgba(255, 84, 112, 0.08);
    }

    .topbar .nav-form button:hover,
    .topbar .nav-form button:active {
        color: #ffc3ce;
        background: rgba(255, 84, 112, 0.14);
    }

    .page {
        width: 100%;
        margin: 0 auto 40px;
        padding: 20px 14px 0;
    }

    .section-head {
        display: block;
        margin-bottom: 20px;
    }

    h1 {
        font-size: clamp(30px, 11vw, 44px);
    }

    h2 {
        font-size: 21px;
    }

    .grid,
    .cards-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .card-body,
    .panel,
    .article,
    .comments {
        padding: 18px;
    }

    .card-media {
        aspect-ratio: 16 / 10;
        margin: 12px 12px 0;
    }

    .hero-image {
        max-height: 360px;
    }

    .text {
        font-size: 16px;
        overflow-wrap: anywhere;
    }

    .button,
    button {
        width: 100%;
        min-height: 46px;
    }

    .button.small,
    .nav-form button {
        width: auto;
    }

    .narrow {
        max-width: none;
    }

    .profile-hero {
        align-items: flex-start;
        flex-direction: column;
        min-height: 0;
        padding: 22px;
    }

    .profile-avatar-wrap {
        width: 84px;
        height: 84px;
        flex-basis: 84px;
    }

    .profile-avatar {
        font-size: 36px;
    }

    .profile-stats {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .profile-stat {
        padding: 14px;
    }

    .profile-layout,
    .profile-details {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .profile-info-card,
    .profile-jtokens-card {
        grid-column: auto;
        grid-row: auto;
    }

    .profile-card {
        padding: 18px;
    }

    .profile-actions .button {
        justify-content: center;
    }

    .search-page {
        gap: 18px;
    }

    .search-hero {
        grid-template-columns: 1fr;
        align-items: stretch;
        gap: 20px;
        padding: 22px;
    }

    .search-hero p:not(.profile-kicker) {
        font-size: 16px;
    }

    .search-input-row {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .search-input-row button {
        grid-column: 1 / -1;
        width: 100%;
    }

    .search-section {
        padding: 18px;
    }

    .search-section-head {
        align-items: flex-start;
    }

    .search-grid,
    .search-card-stats {
        grid-template-columns: 1fr;
    }

    .settings-head {
        display: grid;
        align-items: start;
        padding: 22px;
    }

    .settings-layout {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .settings-avatar-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .settings-avatar-preview {
        width: 84px;
        height: 84px;
        flex-basis: 84px;
        font-size: 36px;
    }

    .settings-avatar-card,
    .settings-roblox-card {
        grid-column: auto;
    }

    .roblox-link-head {
        display: block;
    }

    .roblox-code {
        width: 100%;
        font-size: clamp(24px, 9vw, 32px);
        text-align: center;
        letter-spacing: 4px;
    }

    .admin-actions {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
        margin-bottom: 16px;
    }

    .admin-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }

    .admin-row div,
    .admin-row form {
        width: 100%;
        align-items: stretch;
    }

    .admin-row div {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .admin-row a {
        display: inline-flex;
        min-height: 38px;
        align-items: center;
        justify-content: center;
        border: 1px solid var(--line-strong);
        border-radius: 10px;
        padding: 7px 12px;
        color: var(--text);
        font-weight: 700;
        background: var(--panel);
    }

    .admin-row button {
        width: 100%;
        min-height: 38px;
    }

    main.page:has(.dev-site) {
        width: 100%;
        margin: 0;
        padding: 0;
        overscroll-behavior-x: contain;
    }

    .dev-site {
        padding: 10px 0 56px;
    }

    .dev-site > .dev-sitebar,
    .dev-site > .dev-console,
    .dev-site > .dev-command-grid,
    .dev-site > .dev-lower-grid {
        width: min(100% - 20px, 720px);
    }

    .dev-sitebar {
        top: 8px;
        grid-template-columns: 1fr auto;
        gap: 8px;
        min-height: 0;
        margin-bottom: 10px;
        padding: 8px;
    }

    .dev-sitebrand-mark {
        width: 38px;
        height: 38px;
    }

    .dev-sitebrand strong {
        font-size: 13px;
    }

    .dev-sitenav {
        grid-column: 1 / -1;
        justify-content: stretch;
        overflow-x: auto;
        padding-bottom: 2px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .dev-sitenav::-webkit-scrollbar {
        display: none;
    }

    .dev-sitenav a {
        flex: 1 0 auto;
        min-height: 40px;
        padding-inline: 10px;
    }

    .dev-site-logout button {
        width: auto;
        min-height: 38px;
        padding-inline: 12px;
    }

    .dev-console {
        grid-template-columns: 1fr;
        gap: 16px;
        min-height: auto;
        margin-bottom: 12px;
        padding: 18px;
        border-radius: 0;
        background:
            radial-gradient(circle at 88% 10%, rgba(211, 255, 77, 0.12), transparent 38%),
            linear-gradient(180deg, rgba(5, 12, 4, 0.94), rgba(2, 7, 3, 0.82));
    }

    .dev-console::before {
        background-size: 32px 32px;
    }

    .dev-console::after {
        height: 24%;
        opacity: 0.5;
    }

    .dev-console-copy {
        align-self: stretch;
    }

    .dev-kicker,
    .dev-section-label {
        max-width: 100%;
        margin-bottom: 14px;
        padding: 6px 9px;
        font-size: 10px;
        white-space: normal;
    }

    .dev-console h1 {
        font-size: clamp(40px, 14vw, 64px);
        line-height: 0.96;
        overflow-wrap: normal;
    }

    .dev-console-copy > p {
        margin-top: 16px;
        font-size: 16px;
        line-height: 1.5;
    }

    .dev-status-strip {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        margin-top: 18px;
    }

    .dev-status-strip span {
        min-height: 44px;
        justify-content: flex-start;
        padding: 9px 10px;
        font-size: 12px;
        overflow-wrap: anywhere;
    }

    .dev-status-strip span:first-child {
        grid-column: 1 / -1;
    }

    .dev-orbit {
        width: min(70vw, 220px);
        min-width: 0;
        margin: -2px auto 0;
        opacity: 0.92;
    }

    .dev-orbit-node {
        width: 10px;
        height: 10px;
    }

    .dev-orbit-core {
        font-size: clamp(22px, 8vw, 34px);
        box-shadow:
            0 0 24px rgba(211, 255, 77, 0.24),
            0 0 0 7px rgba(211, 255, 77, 0.04);
    }

    .dev-command-grid,
    .dev-lower-grid {
        grid-template-columns: 1fr;
        gap: 10px;
        margin-bottom: 10px;
    }

    .dev-links {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        margin-top: 18px;
    }

    .dev-command {
        min-height: 96px;
        grid-template-columns: 36px minmax(0, 1fr);
        gap: 12px;
        align-items: center;
        padding: 16px;
    }

    .dev-command-index {
        display: grid;
        width: 36px;
        height: 36px;
        place-items: center;
        border: 1px solid rgba(211, 255, 77, 0.26);
        border-radius: 0;
        background: rgba(211, 255, 77, 0.08);
        font-size: 12px;
    }

    .dev-command-body {
        gap: 5px;
    }

    .dev-command-body strong {
        font-size: 18px;
    }

    .dev-command-body small {
        max-width: none;
        font-size: 12px;
    }

    .dev-monitor,
    .dev-access {
        padding: 18px;
    }

    .dev-monitor h2,
    .dev-access h2 {
        font-size: 24px;
    }

    .dev-monitor p,
    .dev-access p {
        font-size: 14px;
        line-height: 1.55;
    }

    .dev-links a {
        min-height: 78px;
        padding: 12px;
        font-size: 13px;
    }

    .dev-links span {
        font-size: 10px;
    }

    .dev-access {
        min-height: 172px;
    }

    .dev-access-meter {
        margin-top: 22px;
    }

    /* --- AI chat mobile --- */
    .page:has(.app) {
        margin: 0;
        padding: 0;
    }

    body:has(.app) .topbar {
        display: none;
    }

    .app {
        flex-direction: column;
        height: 100dvh;
    }

    .chat-sidebar {
        flex: 0 0 auto;
        width: 100%;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .chat-sidebar-header {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 10px;
        padding: max(12px, env(safe-area-inset-top)) 14px 10px;
        border-bottom: 0;
    }

    .sidebar-brand {
        flex: 1 1 auto;
        gap: 10px;
    }

    .sidebar-brand-mark {
        flex-basis: 36px;
        width: 36px;
        height: 36px;
        border-radius: 11px;
        font-size: 17px;
    }

    .sidebar-brand-text small {
        display: none;
    }

    .sidebar-brand-text strong {
        font-size: 19px;
    }

    .new-chat-btn {
        width: auto;
        min-height: 36px;
        padding: 7px 14px;
        font-size: 13px;
    }

    .ai-limit {
        display: none;
    }

    .sidebar-chat-list {
        flex: 0 0 auto;
        flex-direction: row;
        gap: 8px;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 0 14px 12px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .sidebar-chat-list::-webkit-scrollbar {
        display: none;
    }

    .chat-item {
        flex: 0 0 auto;
        width: min(58vw, 230px);
        border-radius: 999px;
    }

    .chat-item-delete-form {
        display: block;
        position: absolute;
        right: 8px;
        top: calc(50% - 11px);
        z-index: 3;
    }

    .sidebar-chat-link {
        max-width: none;
        width: 100%;
        padding: 9px 38px 9px 13px;
        border: 1px solid var(--line);
        border-radius: 999px;
        background: var(--panel);
        font-size: 13px;
        line-height: 1.25;
    }

    .sidebar-chat-link:hover {
        transform: none;
    }

    .chat-header {
        display: flex;
        align-items: center;
        gap: 10px;
        min-height: 0;
        padding: 10px 14px;
    }

    .chat-heading {
        gap: 8px;
    }

    .chat-avatar {
        flex-basis: 34px;
        width: 34px;
        height: 34px;
        border-radius: 10px;
        font-size: 11px;
    }

    .chat-title-block span {
        display: none;
    }

    .chat-title-block h2 {
        max-width: 100%;
        margin: 0;
        font-size: 17px;
        font-weight: 750;
    }

    .chat-actions {
        display: none;
    }

    .messages {
        flex: 1 1 auto;
        gap: 16px;
        padding: 18px 14px 12px;
    }

    .message-bubble {
        max-width: 86%;
        padding: 12px 15px;
        font-size: 15px;
    }

    .message-status {
        display: none;
    }

    .message-author {
        display: none;
    }

    .ai-welcome {
        gap: 12px;
        padding: 18px 8px;
    }

    .ai-welcome-mark {
        width: 58px;
        height: 58px;
        font-size: 26px;
    }

    .ai-welcome h3 {
        font-size: 22px;
    }

    .chat-input {
        padding: 10px 12px max(12px, env(safe-area-inset-bottom));
    }

    .composer-box {
        gap: 8px;
        padding: 10px 12px;
        border-radius: 18px;
    }

    .chat-input textarea {
        max-height: 140px;
        font-size: 16px;
    }

    .composer-bar {
        gap: 10px;
    }

    .token-usage {
        font-size: 10px;
    }

    .token-usage small {
        display: none;
    }

    .chat-input .send-button {
        min-height: 40px;
        padding-inline: 0;
        width: 44px;
        min-width: 44px;
        border-radius: 50%;
        font-size: 18px;
    }

    .chat-status {
        left: 14px;
        bottom: calc(100% + 6px);
        max-width: calc(100% - 28px);
        font-size: 12px;
    }

    .send-label {
        display: none;
    }

    .send-icon {
        display: inline;
    }

    .roblox-shop-item,
    .roblox-shop-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .roblox-shop-actions .button {
        width: 100%;
    }

    .roblox-shop-price,
    .roblox-shop-owned {
        justify-content: center;
    }
}

@media (max-width: 420px) {
    .page {
        padding-inline: 10px;
    }

    main.page:has(.dev-site) {
        width: 100%;
        padding: 0;
        margin: 0;
    }

    .dev-site {
        padding-top: 8px;
    }

    .dev-site > .dev-sitebar,
    .dev-site > .dev-console,
    .dev-site > .dev-command-grid,
    .dev-site > .dev-lower-grid {
        width: min(100% - 16px, 420px);
    }

    .dev-sitebrand small {
        display: none;
    }

    .dev-sitenav a {
        min-height: 38px;
        font-size: 11px;
    }

    .dev-console {
        gap: 12px;
        padding: 14px;
    }

    .dev-console h1 {
        font-size: clamp(34px, 13.5vw, 50px);
    }

    .dev-console-copy > p {
        font-size: 14px;
    }

    .dev-status-strip,
    .dev-links {
        grid-template-columns: 1fr;
    }

    .dev-status-strip span:first-child {
        grid-column: auto;
    }

    .dev-orbit {
        width: min(62vw, 176px);
    }

    .dev-command {
        min-height: 88px;
        grid-template-columns: 32px minmax(0, 1fr);
        padding: 14px;
    }

    .dev-command-index {
        width: 32px;
        height: 32px;
        font-size: 11px;
    }

    .dev-command-body strong {
        font-size: 16px;
    }

    .dev-command-body small {
        font-size: 11px;
        line-height: 1.35;
    }

    .dev-monitor,
    .dev-access {
        padding: 14px;
    }

    .dev-links a {
        min-height: 58px;
    }

    .roblox-store-grid {
        grid-template-columns: 1fr;
    }

    .card-body,
    .panel,
    .article,
    .comments {
        padding: 15px;
    }

    .admin-row div {
        grid-template-columns: 1fr;
    }

    .sidebar-brand-text strong {
        font-size: 17px;
    }

    .chat-item {
        width: min(66vw, 220px);
    }

    .message-bubble {
        max-width: 90%;
    }
}

/* =====================================================================
   Interactive flourishes (progress, particles, spotlight, ripple)
   Added on top of the base design — purely additive, motion-safe.
   ===================================================================== */

/* ---- Reading progress bar ---- */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 60;
    pointer-events: none;
}

.scroll-progress span {
    display: block;
    height: 100%;
    background: var(--grad);
    background-size: 200% 100%;
    transform: scaleX(0);
    transform-origin: left center;
    box-shadow: 0 0 12px rgba(124, 92, 255, 0.6), 0 0 4px rgba(34, 211, 238, 0.5);
    animation: gradient-pan 6s ease infinite;
    transition: transform 0.12s linear;
}

/* ---- Condensed top bar on scroll ---- */
.topbar.is-scrolled {
    padding-top: 9px;
    padding-bottom: 9px;
    background: rgba(7, 9, 18, 0.82);
    box-shadow: 0 12px 34px rgba(4, 6, 16, 0.5);
    border-bottom-color: var(--line-strong);
}

/* ---- Floating particle field ---- */
.bg-particles {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.bg-particles span {
    position: absolute;
    bottom: -12px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, rgba(196, 210, 255, 0.95), rgba(124, 92, 255, 0.25) 70%, transparent);
    box-shadow: 0 0 8px rgba(124, 92, 255, 0.35);
    opacity: 0;
    will-change: transform, opacity;
    animation: particle-rise linear infinite;
}

@keyframes particle-rise {
    0%   { transform: translate3d(0, 0, 0); opacity: 0; }
    12%  { opacity: var(--o, 0.4); }
    88%  { opacity: var(--o, 0.4); }
    100% { transform: translate3d(var(--drift, 24px), -112vh, 0); opacity: 0; }
}

/* ---- Cursor-following spotlight on cards & stats ---- */
.preview-card,
.profile-stat,
.profile-card,
.search-card {
    position: relative;
}

.preview-card::after,
.profile-stat::after,
.profile-card::after,
.search-card::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    border-radius: inherit;
    background: radial-gradient(
        240px circle at var(--mx, 50%) var(--my, 50%),
        rgba(124, 92, 255, 0.20),
        rgba(34, 211, 238, 0.08) 38%,
        transparent 62%
    );
    opacity: 0;
    transition: opacity 0.3s var(--ease);
    pointer-events: none;
}

.preview-card:hover::after,
.profile-stat:hover::after,
.profile-card:hover::after,
.search-card:hover::after {
    opacity: 1;
}

/* Keep card content above the spotlight layer */
.preview-card .card-media,
.preview-card .card-body,
.profile-stat > *,
.profile-card > *,
.search-card > * {
    position: relative;
    z-index: 1;
}

/* ---- Button ripple ---- */
.btn-ripple {
    position: absolute;
    z-index: 2;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0) 70%);
    transform: scale(0);
    opacity: 0.6;
    pointer-events: none;
    animation: btn-ripple 0.6s var(--ease) forwards;
}

@keyframes btn-ripple {
    to { transform: scale(2.4); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .scroll-progress span,
    .bg-particles span,
    .btn-ripple {
        animation: none !important;
    }

    .bg-particles {
        display: none;
    }
}

@media (max-width: 900px) {
    .roblox-store-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .roblox-store-hero {
        grid-template-columns: 1fr;
        min-height: 0;
        padding: 26px;
    }

    .roblox-store-showcase {
        min-height: 260px;
    }

    .roblox-store-stage {
        max-width: 340px;
    }

    .roblox-store-status-grid,
    .roblox-store-benefits {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1180px) and (min-width: 901px) {
    .roblox-store-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .roblox-store-page {
        gap: 18px;
    }

    .roblox-store-hero {
        padding: 22px;
        border-radius: 14px;
    }

    .roblox-store-hero h1 {
        font-size: 38px;
    }

    .roblox-store-lead {
        font-size: 16px;
    }

    .roblox-store-hero-actions,
    .roblox-store-section-head,
    .roblox-store-card-foot {
        align-items: stretch;
        flex-direction: column;
    }

    .roblox-store-section-head {
        gap: 12px;
    }

    .roblox-store-section-head h2 {
        font-size: 28px;
    }

    .roblox-store-toast {
        width: 100%;
        min-height: 0;
        text-align: left;
    }

    .roblox-store-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .roblox-store-card {
        grid-template-rows: 128px minmax(104px, auto) auto;
        border-radius: 14px;
    }

    .roblox-store-card-body,
    .roblox-store-card-foot {
        padding: 16px;
    }

    .roblox-store-card-body {
        padding-bottom: 0;
    }

    .roblox-store-card-title-row {
        flex-direction: column;
    }

    .roblox-store-buy,
    .roblox-store-remove,
    .roblox-store-card-foot .button {
        width: 100%;
        min-width: 0;
    }

    .roblox-store-price {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .roblox-store-hero::before,
    .roblox-store-stage::before,
    .roblox-store-carpet,
    .roblox-store-mini-carpet,
    .roblox-store-card-rings,
    .roblox-store-card[aria-busy="true"]::before,
    .carpet-spark,
    .roblox-store-card.is-purchased,
    .roblox-store-card.is-removed,
    .roblox-store-toast:not(:empty) {
        animation: none !important;
    }

    .roblox-store-card:hover {
        transform: none;
    }

    .roblox-store-card:hover .roblox-store-card-image {
        transform: none;
    }
}

/* ------------------------------------------------ AI account action modal */
.account-modal {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 22px;
}

.account-modal-backdrop {
    position: absolute;
    inset: 0;
    background: radial-gradient(120% 120% at 50% 0%, rgba(124, 92, 255, 0.22), rgba(4, 6, 16, 0.78) 60%);
    backdrop-filter: blur(8px) saturate(120%);
    -webkit-backdrop-filter: blur(8px) saturate(120%);
    opacity: 0;
    transition: opacity 240ms var(--ease);
}

.account-modal.is-open .account-modal-backdrop {
    opacity: 1;
}

.account-modal-dialog {
    position: relative;
    width: min(420px, 100%);
    padding: 30px 28px 26px;
    border-radius: var(--radius);
    border: 1px solid var(--line-strong);
    background: linear-gradient(160deg, rgba(22, 25, 48, 0.92), rgba(12, 14, 28, 0.92));
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    box-shadow: var(--glow), var(--shadow);
    text-align: center;
    opacity: 0;
    transform: translateY(14px) scale(0.96);
    transition: opacity 260ms var(--ease), transform 260ms var(--ease);
    overflow: hidden;
}

.account-modal.is-open .account-modal-dialog {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.account-modal-glow {
    position: absolute;
    inset: -40% 30% auto 30%;
    height: 180px;
    background: var(--grad);
    filter: blur(60px);
    opacity: 0.45;
    pointer-events: none;
}

.account-modal-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    margin: 0 auto 16px;
    border-radius: 18px;
    color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: 0 12px 30px rgba(124, 92, 255, 0.45);
}

.account-modal-title {
    position: relative;
    margin: 0 0 8px;
    font-size: 21px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.account-modal-desc {
    position: relative;
    margin: 0 auto;
    max-width: 32ch;
    color: var(--text);
    line-height: 1.55;
}

.account-modal-list {
    position: relative;
    list-style: none;
    margin: 16px 0 0;
    padding: 0;
    display: grid;
    gap: 8px;
    text-align: left;
}

.account-modal-list li {
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: var(--panel-strong);
    color: var(--text);
    font-size: 14px;
    line-height: 1.45;
}

.account-modal-note {
    position: relative;
    margin: 14px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.account-modal-actions {
    position: relative;
    display: flex;
    gap: 12px;
    margin-top: 22px;
}

.account-modal-actions .button {
    flex: 1;
    justify-content: center;
}

.account-modal-decline {
    background: var(--panel-strong);
    border: 1px solid var(--line-strong);
    color: var(--text);
    box-shadow: none;
}

.account-modal-decline:hover {
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
}

@media (prefers-reduced-motion: reduce) {
    .account-modal-backdrop,
    .account-modal-dialog {
        transition: none;
    }

    .account-modal-dialog {
        transform: none;
    }
}

/* Keep the mobile app bar safe-area aware after the global scrolled state. */
@media (max-width: 720px) {
    .topbar.is-scrolled {
        padding-top: max(8px, env(safe-area-inset-top));
        padding-bottom: 8px;
    }
}

@media (max-width: 340px) {
    .topbar nav {
        grid-template-columns: 1fr;
    }

    .topbar nav .user,
    .topbar .nav-form {
        grid-column: 1;
    }
}

/* ------------------------------------------------------ QGram OAuth buttons */
.qgram-auth {
    display: grid;
    gap: 12px;
    margin-top: 22px;
}

.qgram-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--muted);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.qgram-divider::before,
.qgram-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line-strong);
}

.qgram-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 46px;
    padding: 11px 20px;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(120deg, #7c3aed 0%, #ec4899 50%, #3b82f6 100%);
    background-size: 200% 200%;
    color: #fff;
    font: inherit;
    font-weight: 700;
    letter-spacing: 0.01em;
    text-decoration: none;
    cursor: pointer;
    overflow: hidden;
    box-shadow: 0 10px 26px rgba(124, 58, 237, 0.34);
    transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), background-position 0.6s var(--ease);
}

.qgram-button:hover {
    transform: translateY(-2px);
    background-position: 100% 0;
    box-shadow: 0 16px 40px rgba(236, 72, 153, 0.45);
}

.qgram-button:active {
    transform: translateY(0);
}

.qgram-button.ghost {
    background: var(--panel-strong);
    border: 1px solid var(--line-strong);
    box-shadow: none;
    color: var(--text);
}

.qgram-button.ghost:hover {
    background: rgba(124, 58, 237, 0.14);
    border-color: rgba(236, 72, 153, 0.5);
    box-shadow: 0 12px 30px rgba(124, 58, 237, 0.28);
}

.qgram-button-logo {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    object-fit: cover;
    flex: 0 0 auto;
}

.qgram-card-icon {
    overflow: hidden;
    padding: 0;
    background: linear-gradient(135deg, #7c3aed, #ec4899, #3b82f6);
}

.qgram-card-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

.settings-qgram-card .qgram-button {
    margin-top: 6px;
}

.qgram-change-form,
.qgram-cancel-form,
.qgram-visibility-form {
    margin-top: 12px;
}

.qgram-visibility-form .settings-status {
    margin-bottom: 10px;
}

/* Verified badge (галочка подтверждённого аккаунта) */
.verified-badge {
    display: inline-block;
    width: 1em;
    height: 1em;
    margin-left: 0.28em;
    vertical-align: -0.14em;
    flex: 0 0 auto;
    object-fit: contain;
}

.qgram-verified-badge {
    display: inline-block;
    width: 1em;
    height: 1em;
    margin-left: 0.28em;
    vertical-align: -0.14em;
    flex: 0 0 auto;
    object-fit: contain;
}

.author-name,
.comment-author-name,
.search-username {
    display: inline-flex;
    align-items: center;
}

.profile-name {
    display: inline-flex;
    align-items: center;
    gap: 0;
}

.profile-name .verified-badge {
    width: 0.62em;
    height: 0.62em;
    margin-left: 0.22em;
}

.profile-name .qgram-verified-badge {
    width: 0.62em;
    height: 0.62em;
    margin-left: 0.22em;
}

.profile-badge .qgram-verified-badge {
    width: 1em;
    height: 1em;
    margin-right: 0.32em;
    vertical-align: -0.18em;
}

.admin-user-search {
    margin-bottom: 14px;
}

.admin-load-more {
    margin-top: 14px;
    text-align: center;
}

/* --- Rich text editor & rendered post formatting -------------------- */
.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.field-label {
    font-weight: 600;
}
.rte {
    border: 1px solid var(--line, rgba(255, 255, 255, 0.10));
    border-radius: var(--radius-sm, 11px);
    overflow: hidden;
    background: var(--panel, rgba(255, 255, 255, 0.045));
    color: var(--text, #eef1fb);
}
.rte-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    padding: 6px 8px;
    border-bottom: 1px solid var(--line, rgba(255, 255, 255, 0.10));
    background: rgba(255, 255, 255, 0.04);
}
.rte-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid transparent;
    border-radius: 7px;
    background: transparent;
    color: var(--text, #eef1fb);
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.rte-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--line-strong, rgba(255, 255, 255, 0.18));
}
.rte-sep {
    width: 1px;
    align-self: stretch;
    margin: 2px 4px;
    background: var(--line, rgba(255, 255, 255, 0.10));
}
.rte-color {
    position: relative;
    overflow: hidden;
}
.rte-color input[type="color"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}
.rte-color-swatch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 5px;
    color: #fff;
    font-weight: 700;
}
.rte-rainbow {
    font-weight: 700;
    background: linear-gradient(90deg, #ff004c, #ff8a00, #ffe600, #29d957, #00c2ff, #8a2be2);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.rte-editor {
    min-height: 220px;
    padding: 12px 14px;
    outline: none;
    line-height: 1.55;
    color: var(--text, #eef1fb);
    word-break: break-word;
}
.rte-editor.is-empty::before {
    content: attr(data-placeholder);
    color: var(--muted, #9aa3c0);
    pointer-events: none;
}
.rte-editor a,
.rich-text a {
    color: var(--accent, #7c5cff);
    text-decoration: underline;
}

/* Animated multicolor ("переливающийся") text */
.grad-text {
    background: linear-gradient(90deg, #ff004c, #ff8a00, #ffe600, #29d957, #00c2ff, #8a2be2, #ff004c);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    animation: grad-text-flow 4s linear infinite;
}
@keyframes grad-text-flow {
    to { background-position: 200% center; }
}
@media (prefers-reduced-motion: reduce) {
    .grad-text { animation: none; }
}

/* --- Индикатор «онлайн» --- */
.search-avatar.is-online {
    border-color: var(--success);
    box-shadow: 0 12px 30px rgba(79, 139, 255, 0.30), 0 0 0 2px rgba(52, 211, 153, 0.55);
}

.online-label {
    color: #6ee7b7;
    font-weight: 700;
}

.online-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.22);
    vertical-align: middle;
}

.online-text {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #6ee7b7;
    font-weight: 700;
}

.profile-badge.online {
    border-color: rgba(52, 211, 153, 0.45);
    background: rgba(52, 211, 153, 0.14);
    color: #6ee7b7;
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.profile-badge.online .online-dot {
    animation: status-pulse 2s ease-in-out infinite;
}

/* ===================== Two-factor (TOTP) ===================== */
.settings-2fa-card .settings-card-icon {
    color: var(--accent-3);
}

.settings-status-icon {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    vertical-align: -3px;
    margin-right: 4px;
}

/* ---- Setup page ---- */
.totp-page {
    position: relative;
    max-width: 1040px;
    margin: 0 auto;
    padding: 8px 0 24px;
}

.totp-aurora {
    position: absolute;
    inset: -10% -20% auto -20%;
    height: 460px;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(60% 70% at 25% 25%, rgba(124, 92, 255, 0.28), transparent 70%),
        radial-gradient(55% 65% at 80% 20%, rgba(34, 211, 238, 0.22), transparent 72%);
    filter: blur(14px);
    opacity: 0.85;
    animation: totp-aurora 16s ease-in-out infinite alternate;
}

@keyframes totp-aurora {
    from { transform: translate3d(-2%, -2%, 0) scale(1); }
    to { transform: translate3d(3%, 2%, 0) scale(1.08); }
}

.totp-hero {
    position: relative;
    z-index: 1;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.totp-back {
    align-self: flex-start;
    margin-bottom: 6px;
}

.totp-shield {
    position: relative;
    width: 96px;
    height: 96px;
    display: grid;
    place-items: center;
    margin-top: 6px;
    color: var(--accent-3);
    animation: totp-float 5s ease-in-out infinite;
}

@keyframes totp-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-7px); }
}

.totp-shield-icon {
    width: 52px;
    height: 52px;
    filter: drop-shadow(0 6px 16px rgba(34, 211, 238, 0.45));
    position: relative;
    z-index: 2;
}

.totp-shield-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1px solid rgba(124, 92, 255, 0.5);
    animation: totp-ring 2.8s ease-out infinite;
}

.totp-shield-ring--2 { animation-delay: 1.4s; }

@keyframes totp-ring {
    0% { transform: scale(0.6); opacity: 0.7; }
    100% { transform: scale(1.5); opacity: 0; }
}

.totp-kicker { margin: 8px 0 0; }

.totp-title {
    margin: 0;
    font-size: clamp(1.9rem, 4vw, 2.6rem);
    background: var(--grad-text);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.totp-lead {
    max-width: 580px;
    margin: 0 auto;
    color: var(--muted);
    line-height: 1.55;
}

.totp-grid {
    position: relative;
    z-index: 1;
    margin-top: 30px;
    display: grid;
    grid-template-columns: 1fr 0.95fr;
    grid-template-areas:
        "steps qr"
        "confirm confirm";
    gap: 20px;
    align-items: start;
}

.totp-steps {
    grid-area: steps;
    list-style: none;
    margin: 0;
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.totp-step {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    opacity: 0;
    transform: translateY(10px);
    animation: totp-rise 0.55s var(--ease) forwards;
    animation-delay: calc(var(--s) * 110ms + 120ms);
}

@keyframes totp-rise {
    to { opacity: 1; transform: none; }
}

.totp-step-num {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-weight: 700;
    color: #fff;
    background: var(--grad);
    box-shadow: 0 8px 20px rgba(79, 139, 255, 0.35);
}

.totp-step-body h3 {
    margin: 4px 0 4px;
    font-size: 1.02rem;
}

.totp-step-body .meta { margin: 0; }

.totp-qr-card {
    grid-area: qr;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    padding: 24px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.totp-qr-frame {
    position: relative;
    width: 244px;
    height: 244px;
    padding: 12px;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 18px 44px rgba(4, 6, 16, 0.5), 0 0 0 1px rgba(124, 92, 255, 0.25);
    overflow: hidden;
}

.totp-qr-img {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 8px;
}

.totp-qr-scan {
    position: absolute;
    left: 12px;
    right: 12px;
    top: 12px;
    height: 26px;
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(124, 92, 255, 0), rgba(34, 211, 238, 0.55));
    box-shadow: 0 0 18px rgba(34, 211, 238, 0.6);
    mix-blend-mode: screen;
    animation: totp-scan 2.6s ease-in-out infinite;
    pointer-events: none;
}

@keyframes totp-scan {
    0%, 100% { transform: translateY(0); opacity: 0.2; }
    50% { transform: translateY(190px); opacity: 0.95; }
}

.totp-qr-corner {
    position: absolute;
    width: 22px;
    height: 22px;
    border: 2px solid var(--accent);
    z-index: 2;
}

.totp-qr-corner--tl { top: 4px; left: 4px; border-right: 0; border-bottom: 0; border-top-left-radius: 8px; }
.totp-qr-corner--tr { top: 4px; right: 4px; border-left: 0; border-bottom: 0; border-top-right-radius: 8px; }
.totp-qr-corner--bl { bottom: 4px; left: 4px; border-right: 0; border-top: 0; border-bottom-left-radius: 8px; }
.totp-qr-corner--br { bottom: 4px; right: 4px; border-left: 0; border-top: 0; border-bottom-right-radius: 8px; }

.totp-key {
    width: 100%;
    text-align: center;
}

.totp-key-label {
    margin: 0 0 8px;
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

.totp-key-code {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 1px dashed var(--line-strong);
    background: var(--panel-strong);
    color: var(--text);
    font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 1.02rem;
    letter-spacing: 0.16em;
    cursor: pointer;
    transition: border-color 0.2s var(--ease), background 0.2s var(--ease), transform 0.12s var(--ease);
}

.totp-key-code:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.totp-key-code:active { transform: scale(0.99); }

.totp-key-copy, .totp-key-done {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}

.totp-key-done { display: none; color: var(--success); }
.totp-key-code.is-copied { border-color: var(--success); color: var(--success); }
.totp-key-code.is-copied .totp-key-copy { display: none; }
.totp-key-code.is-copied .totp-key-done { display: block; animation: totp-pop 0.3s var(--ease); }

@keyframes totp-pop {
    0% { transform: scale(0.4); }
    60% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.totp-key-hint { margin: 8px 0 0; }

/* ---- Confirm / OTP ---- */
.totp-confirm {
    grid-area: confirm;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 26px 24px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.totp-confirm-label {
    margin: 0;
    font-weight: 600;
    font-size: 1.05rem;
}

.totp-otp {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.totp-otp-cell {
    width: 54px;
    height: 66px;
    text-align: center;
    font-size: 1.7rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text);
    background: var(--panel-strong);
    border: 1.5px solid var(--line-strong);
    border-radius: 14px;
    transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease), transform 0.14s var(--ease), background 0.18s var(--ease);
}

.totp-otp-cell:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
    transform: translateY(-2px);
}

.totp-otp-cell.is-filled {
    border-color: var(--accent-2);
    background: var(--accent-soft);
}

.totp-otp.is-complete .totp-otp-cell {
    border-color: var(--success);
    box-shadow: 0 0 0 1px rgba(52, 211, 153, 0.4);
}

.totp-otp.is-shake {
    animation: totp-shake 0.4s var(--ease);
}

@keyframes totp-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(7px); }
    60% { transform: translateX(-5px); }
    80% { transform: translateX(3px); }
}

.totp-submit {
    min-width: 240px;
    justify-content: center;
}

.totp-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.totp-submit.is-loading {
    pointer-events: none;
    opacity: 0.85;
}

.totp-submit.is-loading .btn-icon {
    animation: spin 0.8s linear infinite;
}

.totp-note {
    margin: 0;
    text-align: center;
    max-width: 460px;
}

/* ---- Login challenge ---- */
.totp-challenge {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.totp-challenge-shield {
    width: 68px;
    height: 68px;
    display: grid;
    place-items: center;
    color: var(--accent-3);
    margin-bottom: 4px;
    animation: totp-float 5s ease-in-out infinite;
}

.totp-challenge-shield svg { width: 48px; height: 48px; filter: drop-shadow(0 6px 16px rgba(34, 211, 238, 0.4)); }

.totp-challenge-lead { max-width: 380px; }

.totp-challenge .totp-confirm {
    background: none;
    border: 0;
    box-shadow: none;
    padding: 8px 0 0;
    width: 100%;
}

.totp-challenge-alt { margin-top: 4px; }

@media (max-width: 760px) {
    .totp-grid {
        grid-template-columns: 1fr;
        grid-template-areas:
            "qr"
            "steps"
            "confirm";
    }
    .totp-otp-cell { width: 44px; height: 56px; font-size: 1.4rem; border-radius: 12px; }
}

@media (prefers-reduced-motion: reduce) {
    .totp-aurora, .totp-shield, .totp-shield-ring, .totp-qr-scan,
    .totp-challenge-shield, .totp-step { animation: none !important; }
    .totp-step { opacity: 1; transform: none; }
}

/* --- Likes & subscriptions ------------------------------------------- */
.card-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: auto;
}
.card-actions .button {
    flex: 1 1 auto;
}
.article-actions {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}
.comment-actions {
    margin-top: 8px;
}

.like-button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 13px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel);
    color: var(--muted);
    font: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.18s var(--ease), border-color 0.18s var(--ease),
        background 0.18s var(--ease), transform 0.12s var(--ease);
}
.like-button:hover {
    color: var(--text);
    border-color: var(--line-strong);
}
.like-button:active {
    transform: scale(0.94);
}
.like-button:disabled {
    opacity: 0.6;
    cursor: progress;
}
.like-button .like-icon {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    transition: fill 0.18s var(--ease), stroke 0.18s var(--ease),
        transform 0.18s var(--ease);
}
.like-button.is-liked {
    color: var(--danger);
    border-color: rgba(255, 84, 112, 0.45);
    background: rgba(255, 84, 112, 0.12);
}
.like-button.is-liked .like-icon {
    fill: var(--danger);
    stroke: var(--danger);
    transform: scale(1.08);
}
.like-button.is-static {
    cursor: pointer;
}
.like-count {
    min-width: 0.7em;
    text-align: left;
    font-variant-numeric: tabular-nums;
}

.profile-follow {
    margin-top: 18px;
}
.follow-button.is-following {
    background: var(--panel-strong);
    border: 1px solid var(--line-strong);
    color: var(--text);
    box-shadow: none;
}
.follow-button.is-following:hover [data-follow-label]::after {
    content: " ✕";
}
