:root {
            --bg-start: #e8edf3;
            --bg-end: #fbfcfe;
            --ink: #17212b;
            --muted: #6d7682;
            --soft: #f5f7fa;
            --card: rgba(255, 255, 255, .82);
            --line: rgba(30, 41, 59, .10);
            --brand: #1f2937;
            --brand-2: #64748b;
            --brand-dark: #111827;
            --warn-bg: #fff7ed;
            --warn: #9a5a18;
            --danger-bg: #fff0ed;
            --danger: #c94735;
            --ok: #157e55;
            --shadow: 0 24px 70px rgba(15, 23, 42, .08), 0 8px 24px rgba(15, 23, 42, .05);
            --radius-xl: 26px;
            --radius-lg: 20px;
            --radius-md: 15px;
            --radius-pill: 999px;
            --page-pad: clamp(12px, 3vw, 28px);
            --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
            --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
        }

        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
            -webkit-tap-highlight-color: transparent;
        }

        html {
            min-width: 320px;
            background: var(--bg-end);
            scroll-behavior: smooth;
        }

        body {
            min-height: 100vh;
            min-height: 100svh;
            font-family: var(--font);
            color: var(--ink);
            background:
                radial-gradient(ellipse at 50% -12%, rgba(255, 255, 255, .96) 0%, rgba(226, 232, 240, .50) 34%, transparent 62%),
                radial-gradient(circle at 16% 4%, rgba(148, 163, 184, .28), transparent 34%),
                radial-gradient(circle at 88% 2%, rgba(100, 116, 139, .14), transparent 32%),
                linear-gradient(145deg, #e6ebf2 0%, #f8fafc 48%, #eef2f7 100%);
            padding: calc(var(--page-pad) + env(safe-area-inset-top)) var(--page-pad) calc(38px + env(safe-area-inset-bottom));
            overflow-x: hidden;
        }

        button,
        select,
        textarea,
        input {
            font: inherit;
        }

        button {
            border: 0;
            cursor: pointer;
        }

        button:disabled {
            cursor: not-allowed;
            opacity: .62;
        }

        button:focus-visible,
        select:focus-visible,
        textarea:focus-visible,
        input:focus-visible {
            outline: 3px solid rgba(34, 101, 143, .24);
            outline-offset: 2px;
        }

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

        .container {
            width: min(100%, 1060px);
            margin: 0 auto;
        }

        .hero {
            position: relative;
            display: grid;
            gap: 12px;
            padding: clamp(2px, 1vw, 8px) 0 clamp(24px, 4vw, 36px);
            text-align: center;
        }

        .hero::before {
            content: "";
            position: absolute;
            left: 50%;
            top: -18px;
            width: min(620px, 94vw);
            height: 158px;
            transform: translateX(-50%);
            border-radius: 999px;
            background: radial-gradient(ellipse at center, rgba(255,255,255,.82) 0%, rgba(226,232,240,.44) 42%, transparent 72%);
            filter: blur(2px);
            pointer-events: none;
            z-index: -1;
        }

        .hero h1 {
            display: grid;
            justify-items: center;
            gap: 6px;
            line-height: 1.05;
            font-weight: 900;
            margin-top: -4px;
            margin-bottom: 10px;
            filter: drop-shadow(0 18px 22px rgba(15, 23, 42, .10));
        }

        .hero h1 .brand-line,
        .hero h1 .title-line {
            display: block;
            background:
                linear-gradient(180deg, rgba(255,255,255,.34), rgba(255,255,255,0) 36%),
                linear-gradient(118deg, #030712 0%, #111827 24%, #4b5563 46%, #1f2937 70%, #050812 100%);
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
            text-shadow: 0 1px 0 rgba(255,255,255,.28), 0 16px 30px rgba(15, 23, 42, .18);
        }

        .hero h1 .brand-line {
            font-size: clamp(1.35rem, 5vw, 2.1rem);
            letter-spacing: -.035em;
        }

        .hero h1 .title-line {
            font-size: clamp(1.82rem, 6.6vw, 3rem);
            letter-spacing: -.055em;
            white-space: nowrap;
        }

        .hero-subtitle {
            color: #395b70;
            font-size: clamp(.88rem, 2.7vw, 1rem);
            line-height: 1.7;
        }

        .hero-pills {
            display: flex;
            justify-content: center;
            flex-wrap: wrap;
            gap: 8px;
            margin-top: 6px;
        }

        .pill {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            max-width: 100%;
            min-height: 34px;
            padding: 7px 13px;
            border-radius: var(--radius-pill);
            border: 1px solid rgba(255, 255, 255, .7);
            background: rgba(255, 255, 255, .7);
            color: #475569;
            font-size: .78rem;
            font-weight: 700;
            box-shadow: 0 4px 16px rgba(15, 23, 42, .05);
        }

        .pill.warn {
            background: var(--warn-bg);
            color: var(--warn);
            border-color: rgba(169, 90, 22, .13);
        }

        .hero-actions {
            display: flex;
            justify-content: center;
            flex-wrap: wrap;
            gap: 9px;
            margin-top: 2px;
        }

        .hero-action {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            min-height: 38px;
            padding: 8px 15px;
            border-radius: var(--radius-pill);
            background: linear-gradient(135deg, rgba(255, 255, 255, .94), rgba(239, 249, 246, .90));
            color: #1f2937;
            border: 1px solid rgba(15, 23, 42, .12);
            font-size: .8rem;
            font-weight: 850;
            text-decoration: none;
            box-shadow: 0 14px 32px rgba(15, 23, 42, .08);
            transition: transform .16s ease, box-shadow .16s ease;
        }

        .hero-action:active {
            transform: scale(.97);
        }

        .hero-action:hover {
            box-shadow: 0 16px 38px rgba(15, 23, 42, .12);
        }

        .hero-action-soft {
            background: linear-gradient(135deg, rgba(31, 41, 55, .94), rgba(17, 24, 39, .90));
            color: #fff;
            border: 1px solid rgba(255, 255, 255, .18);
            box-shadow: 0 14px 32px rgba(15, 23, 42, .14);
        }

        .hero-action-soft:hover {
            box-shadow: 0 16px 38px rgba(15, 23, 42, .18);
        }

        .grid {
            display: grid;
            grid-template-columns: minmax(0, 1fr);
            gap: clamp(12px, 2vw, 18px);
        }

        @media (min-width: 900px) {
            .grid.top-grid {
                grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr);
                align-items: start;
            }
        }

        .card {
            min-width: 0;
            background: var(--card);
            border: 1px solid rgba(255, 255, 255, .76);
            border-radius: var(--radius-xl);
            box-shadow: var(--shadow);
            backdrop-filter: blur(18px);
            -webkit-backdrop-filter: blur(18px);
            padding: clamp(16px, 3.8vw, 24px);
        }

        .card-title {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-bottom: 15px;
            color: var(--brand-dark);
            font-size: clamp(1.08rem, 3.7vw, 1.28rem);
            line-height: 1.25;
            font-weight: 850;
        }

        .card-title .icon {
            display: inline-grid;
            place-items: center;
            width: 34px;
            height: 34px;
            flex: 0 0 auto;
            border-radius: 13px;
            background: linear-gradient(145deg, rgba(15, 23, 42, .07), rgba(148, 163, 184, .08));
        }


        .stacked-info {
            display: grid;
            gap: 16px;
            margin-bottom: 16px;
        }

        .info-layout,
        .site-status-grid {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 12px;
        }

        .compact-stat {
            align-content: start;
        }

        .compact-value {
            font-size: clamp(1.2rem, 4vw, 1.58rem);
        }

        .warn-note {
            margin-top: 12px;
            background: rgba(255, 247, 237, .78);
            border-color: rgba(169, 90, 22, .16);
            color: #7c4a18;
        }

        .site-info-card .model-header {
            margin-top: 14px;
        }

        .copy-panel {
            display: grid;
            gap: 12px;
        }

        .copy-item {
            min-width: 0;
            display: grid;
            grid-template-columns: minmax(0, 1fr);
            gap: 10px;
            padding: 13px;
            border: 1px solid var(--line);
            border-radius: var(--radius-lg);
            background: rgba(248, 251, 254, .9);
        }

        .copy-head {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
        }

        .copy-label {
            color: #334155;
            font-size: .8rem;
            font-weight: 850;
            letter-spacing: .01em;
        }

        .copy-tip {
            color: var(--muted);
            font-size: .72rem;
            white-space: nowrap;
        }

        .copy-value-wrap {
            min-width: 0;
            display: grid;
            grid-template-columns: minmax(0, 1fr) auto;
            gap: 9px;
            align-items: stretch;
        }

        .copy-value {
            min-width: 0;
            width: 100%;
            display: block;
            padding: 11px 13px;
            border-radius: 16px;
            border: 1px solid rgba(74, 111, 137, .14);
            background: #fff;
            color: #103248;
            font-family: var(--mono);
            font-size: clamp(.74rem, 2.7vw, .84rem);
            line-height: 1.45;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .copy-value.is-revealed {
            white-space: normal;
            overflow-wrap: anywhere;
            word-break: break-word;
        }

        .balance-content {
            min-width: 0;
            display: grid;
            grid-template-columns: minmax(0, 1fr) auto;
            gap: 12px;
            align-items: center;
        }

        .balance-value {
            color: #123348;
            font-size: clamp(1.38rem, 4.8vw, 1.86rem);
            line-height: 1.1;
            font-weight: 900;
            letter-spacing: -.035em;
        }

        .balance-detail {
            margin-top: 6px;
            color: var(--muted);
            font-size: .74rem;
            line-height: 1.55;
        }

        .balance-item.is-error .balance-value {
            color: var(--danger);
        }

        .balance-item.is-ok .balance-value {
            color: var(--ok);
        }

        .btn-row {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
        }

        .btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 7px;
            min-height: 42px;
            padding: 10px 15px;
            border-radius: var(--radius-pill);
            font-size: .82rem;
            font-weight: 850;
            transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
            user-select: none;
            white-space: nowrap;
        }

        .btn:active {
            transform: scale(.97);
        }

        .btn-primary {
            color: #fff;
            background: linear-gradient(135deg, #1f2937, #475569);
            box-shadow: 0 12px 28px rgba(15, 23, 42, .16);
        }

        .btn-soft {
            color: #334155;
            background: #f3f6f9;
            border: 1px solid rgba(15, 23, 42, .10);
        }

        .btn-ghost {
            color: #4d6376;
            background: #f4f7fa;
            border: 1px solid rgba(81, 107, 130, .13);
        }

        .btn-danger {
            color: #fff;
            background: linear-gradient(135deg, #d94c4c, #b83232);
            border: 1px solid rgba(184, 50, 50, .22);
            box-shadow: 0 10px 22px rgba(217, 76, 76, .18);
        }

        .btn-danger:hover {
            filter: brightness(.98);
            box-shadow: 0 12px 26px rgba(217, 76, 76, .22);
        }

        .note {
            margin-top: 12px;
            padding: 11px 13px;
            border-radius: 17px;
            background: var(--warn-bg);
            color: var(--warn);
            font-size: .76rem;
            line-height: 1.65;
        }

        .model-header {
            min-width: 0;
            display: grid;
            grid-template-columns: minmax(0, 1fr) auto;
            gap: 10px;
            align-items: stretch;
        }

        .model-selector {
            min-width: 0;
            width: 100%;
            min-height: 46px;
            padding: 0 44px 0 15px;
            border-radius: var(--radius-pill);
            border: 1px solid rgba(74, 111, 137, .22);
            background: #fff;
            color: #14364d;
            font-family: var(--mono);
            font-size: .84rem;
            font-weight: 750;
        }

        .model-filter {
            display: grid;
            grid-template-columns: minmax(0, 1fr) auto;
            gap: 10px;
            margin-top: 12px;
            align-items: stretch;
        }

        .model-search {
            min-width: 0;
            width: 100%;
            min-height: 42px;
            padding: 0 14px;
            border-radius: var(--radius-pill);
            border: 1px solid rgba(74, 111, 137, .18);
            background: rgba(255, 255, 255, .86);
            color: #1f3347;
            font-family: var(--mono);
            font-size: .8rem;
            outline: none;
        }

        .model-search::placeholder {
            color: #8a99a8;
        }

        .model-count {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            min-width: max-content;
            min-height: 42px;
            padding: 0 13px;
            border-radius: var(--radius-pill);
            background: #f3f6f9;
            border: 1px solid rgba(15, 23, 42, .08);
            color: #66788a;
            font-size: .75rem;
            font-weight: 800;
            white-space: nowrap;
            word-break: keep-all;
        }

        .model-tag-list {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            margin-top: 13px;
            min-width: 0;
        }

        .model-tag {
            max-width: 100%;
            padding: 6px 10px;
            border-radius: var(--radius-pill);
            background: #eef6fb;
            color: #245a76;
            font-family: var(--mono);
            font-size: .72rem;
            font-weight: 700;
            overflow-wrap: anywhere;
        }

        .model-tag.is-active {
            color: #fff;
            background: linear-gradient(135deg, #1f2937, #475569);
        }

        .model-tools {
            display: flex;
            justify-content: center;
            margin-top: 10px;
        }

        .model-desc {
            margin-top: 12px;
            color: #5d7487;
            font-size: .75rem;
            line-height: 1.7;
        }

        .chat-card,
        .image-card {
            margin-top: clamp(12px, 2vw, 18px);
        }

        .chat-toolbar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            flex-wrap: wrap;
            gap: 10px;
            margin-bottom: 12px;
        }

        .current-model {
            min-width: 0;
            display: inline-flex;
            align-items: center;
            gap: 6px;
            max-width: 100%;
            padding: 7px 12px;
            border-radius: var(--radius-pill);
            background: #eef5fc;
            color: #315a72;
            font-size: .78rem;
            font-weight: 750;
        }

        .current-model strong {
            min-width: 0;
            max-width: min(58vw, 460px);
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            font-family: var(--mono);
            color: #153d55;
        }

        .chat-container {
            height: clamp(320px, 52vh, 560px);
            overflow-y: auto;
            overscroll-behavior: auto;
            -webkit-overflow-scrolling: touch;
            touch-action: pan-y;
            display: flex;
            flex-direction: column;
            gap: 12px;
            padding: clamp(10px, 2.8vw, 16px);
            border: 1px solid rgba(73, 105, 131, .13);
            border-radius: 22px;
            background: rgba(244, 248, 252, .88);
            scroll-behavior: smooth;
        }

        .chat-container::-webkit-scrollbar {
            width: 8px;
        }

        .chat-container::-webkit-scrollbar-thumb {
            background: rgba(61, 95, 121, .22);
            border-radius: var(--radius-pill);
        }

        .message {
            max-width: min(86%, 720px);
            padding: 12px 15px;
            border-radius: 18px;
            font-size: clamp(.86rem, 2.8vw, .94rem);
            line-height: 1.65;
            white-space: pre-wrap;
            overflow-wrap: anywhere;
            word-break: break-word;
        }

        .user-msg {
            align-self: flex-end;
            color: #fff;
            background: linear-gradient(135deg, #24678f, #2186ad);
            border-bottom-right-radius: 7px;
        }

        .assistant-msg {
            align-self: flex-start;
            color: #203447;
            background: #fff;
            border: 1px solid rgba(78, 105, 127, .13);
            border-bottom-left-radius: 7px;
        }

        .error-msg {
            align-self: center;
            max-width: 96%;
            color: var(--danger);
            background: var(--danger-bg);
            text-align: center;
            font-size: .78rem;
        }

        .loading-indicator {
            align-self: flex-start;
            display: inline-flex;
            align-items: center;
            gap: 10px;
            padding: 10px 14px;
            border-radius: var(--radius-pill);
            background: #eaf2f8;
            color: #44667c;
            font-size: .8rem;
            font-weight: 700;
        }

        .loading-dots {
            position: relative;
            display: inline-block;
            width: 34px;
            height: 10px;
            flex: 0 0 34px;
        }

        .loading-dots::before,
        .loading-dots::after,
        .loading-dots span {
            content: "";
            position: absolute;
            top: 1px;
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: var(--brand-2);
            animation: dotPulse 1s infinite ease-in-out;
        }

        .loading-dots::before {
            left: 0;
            animation-delay: 0s;
        }

        .loading-dots span {
            left: 13px;
            animation-delay: .14s;
            opacity: .65;
        }

        .loading-dots::after {
            left: 26px;
            animation-delay: .28s;
            opacity: .38;
        }

        @keyframes dotPulse {
            0%, 100% { opacity: .35; transform: translateY(0); }
            50% { opacity: 1; transform: translateY(-2px); }
        }

        .chat-input-area {
            display: grid;
            grid-template-columns: minmax(0, 1fr) auto;
            gap: 10px;
            align-items: end;
            margin-top: 12px;
        }

        .chat-input {
            min-width: 0;
            width: 100%;
            min-height: 48px;
            max-height: 150px;
            resize: none;
            padding: 13px 15px;
            border: 1px solid rgba(74, 111, 137, .22);
            border-radius: 20px;
            background: #fff;
            color: #193346;
            font-size: .94rem;
            line-height: 1.5;
            overflow-x: hidden;
            overflow-wrap: anywhere;
            word-break: break-word;
        }

        .chat-input::placeholder {
            color: #91a0ad;
        }

        .footer-tip {
            display: grid;
            justify-items: center;
            gap: 2px;
            margin-top: 12px;
            text-align: center;
            color: #6f8191;
            font-size: .72rem;
            line-height: 1.65;
        }

        .footer-tip span {
            max-width: 100%;
            overflow-wrap: anywhere;
        }

        .image-panel {
            display: grid;
            gap: 12px;
        }

        .image-mode-tabs {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
        }

        .image-mode-tabs .btn.is-active {
            color: #fff;
            background: linear-gradient(135deg, #1f2937, #475569);
            box-shadow: 0 12px 28px rgba(15, 23, 42, .14);
        }

        .image-tools {
            display: grid;
            grid-template-columns: minmax(0, 1fr) auto auto;
            gap: 10px;
            align-items: stretch;
        }

        .image-selector {
            min-width: 0;
            width: 100%;
            min-height: 44px;
            padding: 0 40px 0 14px;
            border-radius: var(--radius-pill);
            border: 1px solid rgba(74, 111, 137, .22);
            background: #fff;
            color: #14364d;
            font-family: var(--mono);
            font-size: .82rem;
            font-weight: 750;
        }

        .image-upload {
            display: grid;
            justify-items: center;
            gap: 8px;
            padding: 12px;
            border: 1px dashed rgba(74, 111, 137, .26);
            border-radius: var(--radius-lg);
            background: rgba(248, 251, 254, .86);
        }

        .image-upload.is-hidden {
            display: none;
        }

        .file-input {
            width: 100%;
            justify-self: stretch;
            color: #425b6d;
            font-size: .82rem;
        }

        .image-preview {
            display: none;
            width: min(220px, 100%);
            border-radius: 18px;
            border: 1px solid rgba(74, 111, 137, .16);
            background: #fff;
        }

        .image-preview.is-visible {
            display: block;
        }

        .image-result {
            min-height: 180px;
            display: grid;
            place-items: center;
            padding: clamp(12px, 3vw, 18px);
            border: 1px solid rgba(73, 105, 131, .13);
            border-radius: 22px;
            background: rgba(244, 248, 252, .88);
            overflow: hidden;
        }

        .image-empty,
        .image-status {
            color: #6f8191;
            text-align: center;
            font-size: .82rem;
            line-height: 1.7;
        }

        .image-status.is-loading {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
            color: #42657b;
            font-weight: 750;
        }

        .image-spinner {
            width: 20px;
            height: 20px;
            flex: 0 0 20px;
            border-radius: 50%;
            border: 3px solid rgba(66, 101, 123, .18);
            border-top-color: #42657b;
            animation: imageSpin .8s linear infinite;
        }

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

        .image-panel .footer-tip {
            justify-items: start;
            text-align: left;
        }

        .image-panel .footer-tip span {
            width: 100%;
        }

        .generated-image {
            width: min(100%, 620px);
            max-height: 72vh;
            object-fit: contain;
            border-radius: 22px;
            background: #fff;
            box-shadow: 0 18px 50px rgba(15, 23, 42, .12);
        }

        .image-actions {
            display: none;
            justify-content: center;
            flex-wrap: wrap;
            gap: 8px;
        }

        .image-actions.is-visible {
            display: flex;
        }

        footer {
            margin-top: 22px;
            color: #6e8191;
            text-align: center;
            font-size: .72rem;
            line-height: 1.8;
        }

        .site-footer {
            display: grid;
            justify-items: center;
            gap: 6px;
            padding: 4px 8px 0;
        }

        .footer-main,
        .footer-copy {
            max-width: 100%;
            overflow-wrap: anywhere;
        }

        .footer-main {
            display: grid;
            justify-items: center;
            gap: 2px;
        }

        .footer-copy {
            color: #7d8d9b;
        }

        .footer-link {
            color: #334155;
            font-weight: 800;
            text-decoration: none;
            border-bottom: 1px solid rgba(34, 101, 143, .22);
        }

        .footer-link:hover {
            color: #111827;
            border-bottom-color: rgba(28, 139, 180, .42);
        }

        .toast-msg {
            position: fixed;
            left: 50%;
            bottom: calc(18px + env(safe-area-inset-bottom));
            z-index: 1000;
            max-width: min(92vw, 520px);
            transform: translate(-50%, 10px);
            padding: 10px 16px;
            border-radius: var(--radius-pill);
            background: rgba(18, 35, 48, .92);
            color: #fff;
            font-size: .82rem;
            line-height: 1.45;
            text-align: center;
            box-shadow: 0 16px 40px rgba(16, 35, 48, .20);
            opacity: 0;
            pointer-events: none;
            transition: opacity .2s ease, transform .2s ease;
            white-space: nowrap;
            word-break: keep-all;
        }

        .toast-msg.show {
            opacity: 1;
            transform: translate(-50%, 0);
        }

        .dialog-mask {
            position: fixed;
            inset: 0;
            display: none;
            place-items: center;
            padding: 18px;
            background: rgba(15, 23, 42, .36);
            backdrop-filter: blur(10px);
            z-index: 100;
        }

        .dialog-mask.is-visible {
            display: grid;
        }

        .dialog-card {
            width: min(100%, 390px);
            padding: 20px;
            border-radius: 24px;
            border: 1px solid rgba(255, 255, 255, .72);
            background: rgba(255, 255, 255, .94);
            box-shadow: 0 28px 80px rgba(15, 23, 42, .22);
        }

        .dialog-title {
            display: flex;
            align-items: center;
            gap: 9px;
            color: var(--brand-dark);
            font-size: 1rem;
            font-weight: 900;
            line-height: 1.35;
        }

        .dialog-message {
            margin-top: 10px;
            color: #526577;
            font-size: .86rem;
            line-height: 1.75;
            overflow-wrap: anywhere;
        }

        .dialog-actions {
            display: flex;
            justify-content: flex-end;
            margin-top: 16px;
        }

        @media (max-width: 700px) {
            .card {
                border-radius: 22px;
            }

            .copy-value-wrap,
            .model-header,
            .balance-content,
            .image-tools,
            .chat-input-area {
                grid-template-columns: minmax(0, 1fr);
            }

            .model-filter {
                grid-template-columns: minmax(0, 1fr) max-content;
                gap: 8px;
            }

            .model-count {
                min-width: max-content;
                padding-inline: 10px;
                font-size: .72rem;
            }

            .copy-value {
                white-space: normal;
                overflow-wrap: anywhere;
            }

            .btn-row,
            .copy-value-wrap .btn,
            .model-header .btn,
            .image-tools .btn,
            .chat-input-area .btn {
                width: 100%;
            }

            .btn-row .btn {
                flex: 1 1 130px;
            }

            .chat-toolbar {
                align-items: stretch;
            }

            .current-model,
            .chat-toolbar .btn {
                width: 100%;
            }

            .chat-container {
                height: clamp(330px, 58vh, 540px);
                border-radius: 19px;
            }

            .message {
                max-width: 94%;
            }
        }

        @media (max-width: 420px) {
            :root {
                --page-pad: 10px;
            }

            .hero h1 {
                gap: 5px;
                margin-top: -2px;
                margin-bottom: 12px;
            }

            .hero h1 .brand-line {
                font-size: clamp(1.08rem, 6.4vw, 1.42rem);
            }

            .hero h1 .title-line {
                font-size: clamp(1.42rem, 8.4vw, 1.92rem);
                letter-spacing: -.07em;
            }

            .card {
                padding: 14px;
            }

            .copy-item {
                padding: 11px;
            }

            .copy-head {
                align-items: flex-start;
                flex-direction: column;
                gap: 3px;
            }

            .copy-tip {
                white-space: normal;
            }

            .btn {
                min-height: 43px;
                padding-inline: 13px;
            }
        }

        @media (max-height: 620px) and (orientation: landscape) {
            body {
                padding-top: 10px;
            }

            .hero {
                padding-bottom: 10px;
            }

            .hero h1 {
                font-size: 1.8rem;
            }

            .chat-container {
                height: 245px;
            }
        }


        .footer-button {
            appearance: none;
            border: 0;
            background: transparent;
            padding: 0;
            font: inherit;
            cursor: pointer;
        }

        .privacy-card {
            max-width: min(92vw, 620px);
            text-align: left;
        }

        .privacy-content {
            color: #506174;
            font-size: .86rem;
            line-height: 1.85;
        }

        .privacy-content h2,
        .privacy-content h3 {
            margin: 0 0 10px;
            color: #17384f;
            line-height: 1.35;
        }

        .privacy-content h2 {
            font-size: 1.08rem;
            text-align: center;
        }

        .privacy-content h3 {
            margin-top: 16px;
            font-size: .92rem;
        }

        .privacy-content p {
            margin: 0 0 10px;
        }

        .privacy-content ul {
            margin: 0 0 10px;
            padding-left: 1.25em;
        }

        .privacy-content li {
            margin: 3px 0;
        }

        .privacy-card {
            display: flex;
            flex-direction: column;
            width: min(100%, 620px);
            max-height: min(82vh, 720px);
            padding: 0;
            overflow: hidden;
        }

        .privacy-card .privacy-content {
            flex: 1 1 auto;
            min-height: 0;
            padding: 22px 22px 12px;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
        }

        .privacy-card .dialog-btn {
            flex: 0 0 auto;
            width: calc(100% - 44px);
            margin: 10px 22px 20px;
        }

        @media (max-width: 700px) {
            .dialog-mask {
                align-items: stretch;
                padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
            }

            .privacy-card {
                width: 100%;
                max-width: none;
                max-height: calc(100vh - max(24px, env(safe-area-inset-top)) - max(24px, env(safe-area-inset-bottom)));
                border-radius: 22px;
            }

            .privacy-card .privacy-content {
                padding: 18px 16px 10px;
                font-size: .82rem;
                line-height: 1.78;
            }

            .privacy-card .dialog-btn {
                width: calc(100% - 32px);
                margin: 8px 16px 16px;
            }
        }

/* 2026-05-05 confirmed refinements */
.copy-subtip{margin-top:8px;color:#6f8191;font-size:.72rem;line-height:1.5;text-align:center}.field-hint{display:none;margin:8px 0 10px;padding:8px 11px;border:1px solid rgba(217,76,76,.18);border-radius:13px;background:rgba(255,244,244,.86);color:#b64242;font-size:.78rem;font-weight:900;line-height:1.45;text-align:center;justify-content:center}.field-hint.is-visible{display:flex!important;align-items:center;justify-content:center}.chat-input.is-invalid{border-color:rgba(217,76,76,.55)!important;box-shadow:0 0 0 3px rgba(217,76,76,.10)!important}.chat-field-hint{margin-top:8px;margin-bottom:4px}.image-panel>.footer-tip{justify-items:center;text-align:center}#imagePromptHint.field-hint.is-visible{display:flex!important;justify-content:center;text-align:center;min-height:34px;position:relative;z-index:2}#imageDialog.dialog-mask{padding:max(12px,env(safe-area-inset-top)) 12px max(12px,env(safe-area-inset-bottom));z-index:130}#imageDialog .dialog-card{width:min(calc(100vw - 32px),320px);padding:15px 16px;border-radius:18px;box-shadow:0 18px 52px rgba(15,23,42,.18)}#imageDialog .dialog-title{gap:7px;font-size:.9rem;line-height:1.3}#imageDialog .dialog-message{margin-top:8px;font-size:.8rem;line-height:1.55}#imageDialog .dialog-actions{margin-top:12px}#imageDialog .dialog-actions .btn{min-height:34px;padding-inline:14px;font-size:.78rem}@media(max-width:420px){#imageDialog .dialog-card{width:min(calc(100vw - 28px),300px);padding:13px 14px;border-radius:16px}.field-hint{font-size:.74rem;padding:7px 10px;border-radius:12px}}

/* Result state lock: keep current image stable until user clears it */
.image-mode-tabs button:disabled,.image-tools button:disabled,.image-selector:disabled,.image-upload.is-locked,.image-panel textarea:disabled{opacity:.58;cursor:not-allowed}.image-upload.is-locked{pointer-events:none;filter:saturate(.75)}.image-panel textarea:disabled{background:rgba(246,250,253,.9);color:#7c8f9f}

/* Running task lock: freeze mode/upload/model controls while image task is processing */
.image-mode-tabs button.is-locked,.image-mode-tabs button:disabled,.image-tools button:disabled,.image-selector:disabled,.file-input:disabled{pointer-events:none}.image-upload.is-locked .file-input,.image-upload.is-locked .image-preview{opacity:.55}.image-mode-tabs button.is-locked{filter:saturate(.75)}

/* Softer image error dialog */
#imageDialog .dialog-card{border:1px solid rgba(190,216,236,.88);background:linear-gradient(180deg,#ffffff,#f7fbff)}#imageDialog .dialog-title{color:#244a64;font-weight:950}#imageDialog .dialog-icon{display:inline-grid;place-items:center;width:28px;height:28px;border-radius:11px;background:rgba(45,143,213,.10);font-size:1rem}#imageDialog .dialog-message{color:#405b70;font-weight:800;text-align:left}#imageDialog .dialog-help{margin-top:8px;padding:9px 10px;border-radius:13px;background:rgba(45,143,213,.07);color:#6d8294;font-size:.74rem;line-height:1.55;text-align:left}#imageDialog .dialog-actions .btn{width:100%}

/* Smaller mobile dialogs */
@media(max-width:520px){#imageDialog.dialog-mask{padding:10px}#imageDialog .dialog-card{width:min(calc(100vw - 48px),286px)!important;padding:12px 13px!important;border-radius:16px!important}#imageDialog .dialog-title{font-size:.82rem!important;gap:6px!important}#imageDialog .dialog-icon{width:24px!important;height:24px!important;border-radius:9px!important;font-size:.9rem!important}#imageDialog .dialog-message{font-size:.74rem!important;line-height:1.5!important;margin-top:7px!important}#imageDialog .dialog-help{font-size:.68rem!important;line-height:1.45!important;padding:7px 8px!important;border-radius:11px!important;margin-top:7px!important}#imageDialog .dialog-actions{margin-top:10px!important}#imageDialog .dialog-actions .btn{min-height:31px!important;font-size:.72rem!important;padding:0 12px!important}}@media(max-width:360px){#imageDialog .dialog-card{width:min(calc(100vw - 42px),270px)!important;padding:11px 12px!important}}

/* Ultra compact image dialog on phones */
@media(max-width:520px){#imageDialog .dialog-card{width:min(calc(100vw - 88px),248px)!important;padding:10px 11px!important;border-radius:15px!important}#imageDialog .dialog-title{font-size:.78rem!important;line-height:1.25!important}#imageDialog .dialog-icon{width:21px!important;height:21px!important;border-radius:8px!important;font-size:.78rem!important}#imageDialog .dialog-message{font-size:.7rem!important;line-height:1.42!important;margin-top:6px!important}#imageDialog .dialog-help{font-size:.64rem!important;line-height:1.38!important;padding:6px 7px!important;margin-top:6px!important;border-radius:10px!important}#imageDialog .dialog-actions{margin-top:8px!important}#imageDialog .dialog-actions .btn{min-height:28px!important;font-size:.68rem!important}}@media(max-width:360px){#imageDialog .dialog-card{width:min(calc(100vw - 72px),238px)!important}}

/* Compact content-fit image dialog: no oversized long card */
#imageDialog .dialog-card{width:max-content!important;max-width:min(250px,calc(100vw - 96px))!important;min-width:0!important;padding:9px 10px!important;border-radius:14px!important}#imageDialog .dialog-title{font-size:.76rem!important;line-height:1.22!important;white-space:nowrap!important}#imageDialog .dialog-icon{width:20px!important;height:20px!important;border-radius:8px!important;font-size:.75rem!important;flex:0 0 auto!important}#imageDialog .dialog-message{font-size:.68rem!important;line-height:1.38!important;margin-top:5px!important;max-width:220px!important}#imageDialog .dialog-help{font-size:.62rem!important;line-height:1.34!important;padding:5px 6px!important;margin-top:5px!important;border-radius:9px!important;max-width:220px!important}#imageDialog .dialog-actions{margin-top:7px!important}#imageDialog .dialog-actions .btn{min-height:26px!important;font-size:.66rem!important;padding:0 10px!important}
@media(max-width:520px){#imageDialog .dialog-card{max-width:min(236px,calc(100vw - 88px))!important;padding:8px 9px!important}#imageDialog .dialog-message,#imageDialog .dialog-help{max-width:210px!important}}

/* Image inline hints and draft clear button */
.image-mode-tabs{align-items:center}.image-clear-draft{min-height:36px;white-space:nowrap}.image-upload-tip.is-error{color:#b64242!important;background:rgba(255,244,244,.9);border:1px solid rgba(217,76,76,.18);border-radius:12px;padding:7px 10px}.toast-msg{max-width:min(92vw,360px);white-space:normal;line-height:1.42;text-align:center}.toast-msg.show{display:flex;align-items:center;justify-content:center}@media(max-width:520px){.image-mode-tabs{display:grid!important;grid-template-columns:1fr 1fr!important;gap:8px!important}.image-clear-draft{grid-column:1/3;width:100%;min-height:34px;font-size:.74rem!important}.toast-msg{max-width:280px!important;padding:9px 12px!important}.toast-msg::first-line{white-space:nowrap}}

/* Three image mode buttons in one row; independent prompt boxes */
#imageGeneratePromptInput.is-hidden,#imageEditPromptInput.is-hidden{display:none!important}.image-mode-tabs{display:grid!important;grid-template-columns:1fr 1fr auto!important;gap:8px!important}.image-clear-draft{padding-inline:12px!important;min-height:36px!important;font-size:.76rem!important}@media(max-width:520px){.image-mode-tabs{grid-template-columns:1fr 1fr auto!important;gap:6px!important}.image-mode-tabs .btn{min-width:0!important;padding-inline:8px!important;font-size:.72rem!important}.image-clear-draft{grid-column:auto!important;width:auto!important;padding-inline:8px!important;min-height:32px!important;font-size:.68rem!important}.image-status{white-space:normal;line-height:1.55}.image-status br.mobile-break{display:block}}


/* Custom destructive confirm dialog */
.confirm-dialog .confirm-card{max-width:390px;transform:translateY(10px) scale(.97);transition:transform .22s ease,opacity .2s ease}.confirm-dialog.is-visible .confirm-card{transform:translateY(0) scale(1)}.confirm-dialog .dialog-icon{background:rgba(217,76,76,.12);color:#c94735}.confirm-dialog .dialog-message{font-weight:700;color:#263747}.confirm-dialog .dialog-help{color:#7a5d35;background:#fff8eb;border-color:rgba(209,148,42,.18)}.confirm-actions{display:grid;grid-template-columns:1fr 1fr;gap:10px}.confirm-actions .btn{width:100%;justify-content:center}@media(max-width:520px){.confirm-dialog .confirm-card{max-width:calc(100vw - 30px)}.confirm-actions{gap:8px}}

/* Compact confirm dialog on mobile */
.confirm-dialog .dialog-card{min-height:0!important;padding:18px!important}.confirm-dialog .dialog-title{margin-bottom:8px!important}.confirm-dialog .dialog-message{margin:0 0 7px!important;line-height:1.55!important}.confirm-dialog .dialog-help{margin:0!important;padding:9px 10px!important;line-height:1.5!important}.confirm-dialog .dialog-actions{margin-top:12px!important}.confirm-dialog .dialog-icon{width:30px!important;height:30px!important}@media(max-width:520px){.confirm-dialog{align-items:center!important;padding:16px!important}.confirm-dialog .confirm-card{width:min(330px,calc(100vw - 36px))!important;max-width:min(330px,calc(100vw - 36px))!important;padding:15px!important;border-radius:20px!important}.confirm-dialog .dialog-title{font-size:.92rem!important;gap:8px!important}.confirm-dialog .dialog-icon{width:28px!important;height:28px!important;font-size:.9rem!important}.confirm-dialog .dialog-message{font-size:.82rem!important}.confirm-dialog .dialog-help{font-size:.72rem!important;border-radius:13px!important;padding:8px 9px!important}.confirm-actions{margin-top:10px!important}.confirm-actions .btn{height:34px!important;font-size:.74rem!important}}

/* Global responsive hardening pass */
html,body{max-width:100%;overflow-x:hidden}img,video,canvas,svg{max-width:100%;height:auto}button,select,textarea,input{max-width:100%;min-width:0}.shell,.card,.api-card,.image-card,.chat-card,.image-panel,.image-tools,.chat-input-area,.model-picker,.model-header,.image-mode-tabs,.image-actions,.dialog-card{min-width:0;max-width:100%}.card,.image-result,.chat-container,.message,.footer-tip,.field-hint{overflow-wrap:anywhere;word-break:break-word}.api-value,.model-tag,.current-model,.footer-main span{min-width:0;max-width:100%;overflow:hidden;text-overflow:ellipsis}.image-tools{grid-template-columns:minmax(0,1fr) auto auto}.image-actions{flex-wrap:wrap}.image-actions .btn{flex:1 1 140px}.dialog-mask{max-width:100vw;overflow:hidden}.dialog-card{max-height:calc(100vh - 32px);overflow:auto;-webkit-overflow-scrolling:touch}.privacy-card{width:min(100%,620px)}
@media(max-width:760px){.shell{width:100%}.hero-actions,.copy-group,.model-header,.api-actions,.image-tools,.chat-input-area{grid-template-columns:minmax(0,1fr)!important}.hero-actions .btn,.copy-group .btn,.api-actions .btn,.image-tools .btn,.chat-input-area .btn{width:100%;justify-content:center}.model-header{gap:8px}.model-search,.model-selector,.image-selector{width:100%}.chat-container{height:clamp(330px,58vh,540px)}.message{max-width:94%}.generated-image{max-width:100%;max-height:62vh;object-fit:contain}.image-result{min-height:150px}.site-footer{padding-left:4px;padding-right:4px}.footer-main{display:flex;flex-direction:column;gap:4px}.footer-copy{line-height:1.7}.dialog-card{max-height:calc(100dvh - 28px)}}
@media(max-width:520px){.image-tools{display:grid!important;grid-template-columns:1fr 1fr!important}.image-tools .image-selector{grid-column:1/3}.image-tools #imageSubmitBtn{grid-column:1/3}.image-actions{display:grid!important;grid-template-columns:1fr 1fr!important}.image-actions .btn{width:100%;min-width:0}.chat-input-area{gap:8px}.chat-input-area .btn{min-height:40px}.model-tag-list{max-height:180px;overflow:auto;-webkit-overflow-scrolling:touch}.privacy-card{width:calc(100vw - 24px)!important;max-width:none!important}.privacy-content{max-height:calc(100dvh - 150px);overflow:auto;-webkit-overflow-scrolling:touch}.confirm-dialog .dialog-card{max-height:calc(100dvh - 32px)}}
@media(max-width:380px){.btn{padding-inline:10px}.image-mode-tabs{gap:5px!important}.image-mode-tabs .btn{font-size:.66rem!important;padding-inline:5px!important}.image-tools{gap:6px!important}.message{max-width:97%;font-size:.8rem}.card{padding:13px!important;border-radius:20px!important}.card-title{font-size:.9rem}.toast-msg{max-width:calc(100vw - 28px)!important}}

/* Privacy delete controls */
.privacy-delete-box{margin-top:16px;padding:14px;border:1px solid rgba(74,111,137,.14);border-radius:18px;background:#f8fbfe}.privacy-delete-box h3{margin-top:0}.privacy-delete-actions{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin-top:10px}.privacy-delete-actions .btn{width:100%;justify-content:center}.privacy-delete-status{display:none;margin-top:10px;padding:9px 10px;border-radius:13px;background:#edf8f1;color:#2f7a45;font-weight:800;font-size:.78rem;line-height:1.55;text-align:center}.privacy-delete-status.is-visible{display:block}.privacy-delete-status.is-error{background:#fff7ed;color:#9a5b18}@media(max-width:560px){.privacy-delete-actions{grid-template-columns:1fr}.privacy-delete-box{padding:11px;border-radius:16px}.privacy-delete-status{text-align:left}}

/* Image toolbar record deletion entry */
.image-delete-records{white-space:nowrap}.image-tools{grid-template-columns:minmax(0,1fr) auto auto auto!important}@media(max-width:760px){.image-tools{grid-template-columns:1fr 1fr!important}.image-tools .image-selector{grid-column:1/3}.image-tools #imageSubmitBtn{grid-column:1/3}.image-tools #refreshImageModelsBtn,.image-tools #privacyDeleteOpenBtn{width:100%;min-width:0}}@media(max-width:380px){.image-tools #refreshImageModelsBtn,.image-tools #privacyDeleteOpenBtn{font-size:.68rem!important;padding-inline:6px!important}}

/* Single privacy delete entry */
.privacy-delete-actions.is-single{grid-template-columns:1fr}.privacy-delete-actions.is-single .btn{min-height:40px}.privacy-delete-box.is-highlight{animation:privacyPulse 1.25s ease}@keyframes privacyPulse{0%,100%{box-shadow:none}35%{box-shadow:0 0 0 4px rgba(217,76,76,.12),0 12px 28px rgba(217,76,76,.12)}}


/* Confirm dialog must sit above privacy modal */
.confirm-dialog{z-index:180!important}.confirm-dialog .confirm-card{z-index:181!important}.privacy-delete-box p{overflow-wrap:anywhere}

/* Privacy delete result text layout */
.privacy-delete-status{white-space:pre-line;text-align:left!important;padding:10px 12px!important;border-left:4px solid rgba(217,76,76,.36);font-weight:800}.privacy-delete-status:not(.is-error){border-left-color:rgba(47,122,69,.36)}@media(max-width:560px){.privacy-delete-status{font-size:.73rem!important;line-height:1.6!important}}

/* Confirm icon: remove square badge and center glyph */
.confirm-dialog .dialog-icon{background:transparent!important;box-shadow:none!important;border-radius:0!important;width:auto!important;height:auto!important;min-width:0!important;display:inline-flex!important;align-items:center!important;justify-content:center!important;line-height:1!important;padding:0!important;color:#c94735!important;transform:none!important}.confirm-dialog .dialog-title{align-items:center!important}

/* Privacy delete status attention */
.privacy-delete-status.is-highlight{animation:privacyStatusPulse 1.35s ease}@keyframes privacyStatusPulse{0%,100%{transform:none;box-shadow:none}35%{transform:translateY(-1px);box-shadow:0 0 0 4px rgba(217,76,76,.12),0 12px 26px rgba(217,76,76,.12)}}

/* Chat toolbar privacy shortcut */
.chat-toolbar-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap;justify-content:flex-end}.chat-toolbar-actions .btn{min-height:34px;padding-inline:12px;font-size:.76rem}@media(max-width:700px){.chat-toolbar-actions{display:grid;grid-template-columns:1fr 1fr;width:100%;gap:8px}.chat-toolbar-actions .btn{width:100%;justify-content:center}.current-model{width:100%}}

/* Formal footer */
.site-footer{margin-top:24px!important;padding:16px 18px!important;border:1px solid rgba(210,225,238,.76);border-radius:22px;background:rgba(255,255,255,.72);box-shadow:0 10px 28px rgba(20,50,80,.055);display:grid!important;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:12px;text-align:left!important}.footer-brand{display:grid;gap:3px;min-width:0}.footer-brand strong{color:#26465d;font-size:.84rem;letter-spacing:.01em}.footer-brand span{color:#7a8b99;font-size:.72rem}.footer-meta{display:flex;align-items:center;gap:14px;color:#8a98a5;font-size:.72rem;white-space:nowrap}.footer-nav{display:flex;align-items:center;gap:8px}.footer-link{display:inline-flex!important;align-items:center;justify-content:center;min-height:28px;padding:0 10px!important;border:1px solid rgba(74,111,137,.12)!important;border-radius:999px!important;background:#f7fbff!important;color:#456176!important;text-decoration:none!important;font-size:.72rem;font-weight:900}.footer-link:hover{background:#edf6fc!important;color:#17384f!important;border-color:rgba(45,143,213,.24)!important}.footer-button{appearance:none;font:inherit;cursor:pointer}@media(max-width:700px){.site-footer{grid-template-columns:1fr;text-align:center!important;justify-items:center;padding:14px!important;border-radius:19px}.footer-brand{justify-items:center}.footer-meta{flex-direction:column;gap:8px;white-space:normal}.footer-nav{justify-content:center;flex-wrap:wrap}.footer-link{min-height:30px}}

/* Keep footer meta links in one row */
.footer-meta{flex-direction:row!important;flex-wrap:wrap!important;justify-content:center!important}.footer-nav{flex-wrap:nowrap!important}.footer-meta>span{white-space:nowrap}@media(max-width:700px){.footer-meta{flex-direction:row!important;gap:8px!important}.footer-nav{gap:6px!important}.footer-link{padding-inline:8px!important;font-size:.7rem!important}}

/* Footer links: plain text, no pills */
.site-footer .footer-link{display:inline!important;min-height:0!important;padding:0!important;border:0!important;border-radius:0!important;background:transparent!important;color:#456176!important;text-decoration:none!important;border-bottom:1px solid rgba(69,97,118,.22)!important;font-size:.72rem!important;line-height:1.6!important}.site-footer .footer-link:hover{background:transparent!important;color:#17384f!important;border-bottom-color:rgba(45,143,213,.45)!important}.site-footer .footer-button{appearance:none!important;background:transparent!important;border-left:0!important;border-right:0!important;border-top:0!important;cursor:pointer!important}

/* Footer unified layout across PC and mobile */
.site-footer{grid-template-columns:1fr!important;justify-items:center!important;text-align:center!important}.footer-brand{justify-items:center!important}.footer-meta{justify-content:center!important}.footer-nav{justify-content:center!important}

/* Model list preview/expanded scroll areas */
.model-tag-list {
  max-height: 170px;
  overflow: auto;
  padding-right: 4px;
  -webkit-overflow-scrolling: touch;
  transition: max-height .32s ease;
}
.model-tag-list.is-expanded {
  max-height: 360px;
}

/* Safety lock for record/result actions while image task is running */
#clearImageBtn:disabled,
#privacyDeleteOpenBtn:disabled,
#chatPrivacyOpenBtn:disabled {
  cursor: not-allowed;
  opacity: .54;
  filter: grayscale(.18);
}

@media(max-width:520px){
  .model-tag-list{max-height:190px;overflow:auto;-webkit-overflow-scrolling:touch}
  .model-tag-list.is-expanded{max-height:300px}
}

/* Compact model selector placeholder on mobile */
@media(max-width:520px){
  .model-selector{
    font-size:.72rem!important;
    line-height:1.15!important;
    padding-inline:9px!important;
  }
}
@media(max-width:380px){
  .model-selector{
    font-size:.68rem!important;
    padding-inline:7px!important;
  }
}

/* Center compact model selector text */
.model-selector{
  text-align:center;
  text-align-last:center;
}
.model-selector option{
  text-align:center;
}

/* Long failure placeholder in model selector */
@media(max-width:520px){
  .model-selector{
    font-size:.62rem!important;
    letter-spacing:-.02em;
  }
}
@media(max-width:380px){
  .model-selector{
    font-size:.58rem!important;
  }
}

/* Restore compact failure placeholder in model selector */
@media(max-width:520px){
  .model-selector{
    font-size:.72rem!important;
    letter-spacing:0;
  }
}
@media(max-width:380px){
  .model-selector{
    font-size:.68rem!important;
  }
}

/* Theme switcher */
.theme-switcher{display:inline-flex;justify-content:center;align-items:center;gap:4px;margin:8px auto 0;padding:4px;border:1px solid rgba(74,111,137,.16);border-radius:999px;background:rgba(255,255,255,.62);box-shadow:0 8px 22px rgba(20,50,80,.06)}
.theme-option{min-height:28px;padding:0 10px;border-radius:999px;background:transparent;color:#607286;font-size:.72rem;font-weight:900}.theme-option.is-active{background:#24384a;color:#fff}
html[data-theme="dark"]{--bg-start:#111827;--bg-end:#0b1118;--ink:#e8eef5;--muted:#a4b0bd;--soft:#111a24;--card:rgba(17,27,38,.86);--line:rgba(218,232,246,.12);--brand:#dce8f5;--brand-2:#94a7ba;--brand-dark:#f5f8fb;--warn-bg:rgba(255,177,94,.13);--warn:#ffd194;--danger-bg:rgba(217,76,76,.14);--danger:#ff9b8d;--ok:#7ce1ae;--shadow:0 24px 72px rgba(0,0,0,.34),0 8px 26px rgba(0,0,0,.2)}
html[data-theme="dark"],html[data-theme="dark"] body{background:#0b1118}html[data-theme="dark"] body{background:radial-gradient(ellipse at 50% -12%,rgba(80,112,142,.22) 0%,rgba(29,43,58,.32) 34%,transparent 62%),radial-gradient(circle at 16% 4%,rgba(72,101,128,.22),transparent 34%),radial-gradient(circle at 88% 2%,rgba(59,79,103,.18),transparent 32%),linear-gradient(145deg,#0b1118 0%,#111827 48%,#0d141d 100%)}
html[data-theme="dark"] .hero::before{background:radial-gradient(ellipse at center,rgba(80,112,142,.25) 0%,rgba(29,43,58,.20) 42%,transparent 72%)}
html[data-theme="dark"] .hero h1 .brand-line,html[data-theme="dark"] .hero h1 .title-line{background:linear-gradient(180deg,rgba(255,255,255,.18),rgba(255,255,255,0) 36%),linear-gradient(118deg,#f8fbff 0%,#d7e4f1 28%,#9fb2c5 58%,#f2f7ff 100%);-webkit-background-clip:text;background-clip:text;color:transparent;text-shadow:0 18px 34px rgba(0,0,0,.28)}
html[data-theme="dark"] .hero-subtitle{color:#b7c4d0}html[data-theme="dark"] .pill,html[data-theme="dark"] .card,html[data-theme="dark"] .copy-item,html[data-theme="dark"] .balance-item,html[data-theme="dark"] .model-selector,html[data-theme="dark"] .model-search,html[data-theme="dark"] .model-count,html[data-theme="dark"] .model-tag,html[data-theme="dark"] .image-panel,html[data-theme="dark"] .chat-container,html[data-theme="dark"] .chat-input,html[data-theme="dark"] .image-result,html[data-theme="dark"] .site-footer,html[data-theme="dark"] .dialog-card,html[data-theme="dark"] .privacy-delete-box{background:rgba(17,27,38,.82)!important;border-color:rgba(218,232,246,.12)!important;color:var(--ink)!important}
html[data-theme="dark"] .copy-value,html[data-theme="dark"] .balance-value,html[data-theme="dark"] .card-title,html[data-theme="dark"] .current-model,html[data-theme="dark"] .footer-brand strong,html[data-theme="dark"] .model-selector,html[data-theme="dark"] .model-search{color:#e8eef5!important}
html[data-theme="dark"] .copy-tip,html[data-theme="dark"] .copy-subtip,html[data-theme="dark"] .balance-detail,html[data-theme="dark"] .model-desc,html[data-theme="dark"] .footer-brand span,html[data-theme="dark"] .footer-meta,html[data-theme="dark"] .message,html[data-theme="dark"] .image-empty,html[data-theme="dark"] .footer-tip span{color:#a4b0bd!important}
html[data-theme="dark"] .btn-soft,html[data-theme="dark"] .btn-ghost,html[data-theme="dark"] .hero-action{background:rgba(232,238,245,.08)!important;color:#e8eef5!important;border-color:rgba(218,232,246,.14)!important}html[data-theme="dark"] .btn-primary,html[data-theme="dark"] .hero-action-soft,html[data-theme="dark"] .theme-option.is-active{background:linear-gradient(135deg,#e8eef5,#aebed0)!important;color:#101821!important}html[data-theme="dark"] .btn-danger{background:rgba(217,76,76,.18)!important;color:#ffb1a8!important;border-color:rgba(217,76,76,.22)!important}
html[data-theme="dark"] .field-hint{background:rgba(217,76,76,.13)!important;color:#ffb1a8!important;border-color:rgba(217,76,76,.22)!important}html[data-theme="dark"] .theme-switcher{background:rgba(17,27,38,.72);border-color:rgba(218,232,246,.12)}html[data-theme="dark"] .theme-option{color:#a4b0bd}
@media(max-width:520px){.theme-switcher{margin-top:6px}.theme-option{min-height:27px;padding:0 9px;font-size:.68rem}}

/* Dark mode form and chat bubble fixes */
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] option{
  background:#111b26!important;
  color:#e8eef5!important;
  border-color:rgba(218,232,246,.16)!important;
  caret-color:#e8eef5;
}
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder{
  color:#7f92a4!important;
}
html[data-theme="dark"] .message{
  border:1px solid rgba(218,232,246,.12)!important;
}
html[data-theme="dark"] .assistant-msg,
html[data-theme="dark"] .message.assistant-msg{
  background:rgba(28,41,55,.92)!important;
  color:#e8eef5!important;
}
html[data-theme="dark"] .user-msg,
html[data-theme="dark"] .message.user-msg{
  background:linear-gradient(135deg,#dce8f5,#9fb4c9)!important;
  color:#101821!important;
}
html[data-theme="dark"] .chat-container{
  background:rgba(9,15,22,.78)!important;
}
html[data-theme="dark"] .chat-input-area,
html[data-theme="dark"] .copy-value-wrap,
html[data-theme="dark"] .balance-content,
html[data-theme="dark"] .model-filter,
html[data-theme="dark"] .image-tools,
html[data-theme="dark"] .image-mode-tabs,
html[data-theme="dark"] .image-actions{
  color:#e8eef5!important;
}
html[data-theme="dark"] .image-selector,
html[data-theme="dark"] .image-prompt,
html[data-theme="dark"] .chat-input{
  background:#111b26!important;
  color:#e8eef5!important;
}
html[data-theme="dark"] .generated-image{
  background:#0b1118!important;
}

/* Dark mode remaining white controls */
html[data-theme="dark"] .copy-value,
html[data-theme="dark"] code.copy-value,
html[data-theme="dark"] #apiEndpoint,
html[data-theme="dark"] #apiKeyMask{
  background:#0c141d!important;
  color:#e8eef5!important;
  border-color:rgba(218,232,246,.14)!important;
}
html[data-theme="dark"] .btn,
html[data-theme="dark"] button.btn,
html[data-theme="dark"] #sendBtn,
html[data-theme="dark"] #saveImageBtn,
html[data-theme="dark"] #refreshModelsBtn,
html[data-theme="dark"] #refreshPublicBalanceBtn,
html[data-theme="dark"] #refreshSiteBalanceBtn,
html[data-theme="dark"] #refreshImageModelsBtn,
html[data-theme="dark"] #toggleKeyBtn,
html[data-theme="dark"] [data-clip="endpoint"],
html[data-theme="dark"] [data-clip="key"]{
  background:#172331!important;
  color:#e8eef5!important;
  border:1px solid rgba(218,232,246,.16)!important;
}
html[data-theme="dark"] .btn-primary,
html[data-theme="dark"] #sendBtn,
html[data-theme="dark"] [data-clip="endpoint"],
html[data-theme="dark"] [data-clip="key"]{
  background:linear-gradient(135deg,#dce8f5,#9fb4c9)!important;
  color:#101821!important;
  border-color:rgba(255,255,255,.18)!important;
}
html[data-theme="dark"] #saveImageBtn{
  background:linear-gradient(135deg,#7ce1ae,#62d7ff)!important;
  color:#07131d!important;
  border-color:rgba(255,255,255,.16)!important;
}
html[data-theme="dark"] .model-selector,
html[data-theme="dark"] #modelSelect,
html[data-theme="dark"] #imageModelSelect{
  background-color:#111b26!important;
  color:#e8eef5!important;
  border-color:rgba(218,232,246,.16)!important;
}
html[data-theme="dark"] .btn:hover{
  filter:brightness(1.08);
}

/* Dark mode chat toolbar/model and send button precise fixes */
html[data-theme="dark"] .chat-toolbar,
html[data-theme="dark"] .current-model{
  background:rgba(17,27,38,.78)!important;
  color:#e8eef5!important;
  border-color:rgba(218,232,246,.14)!important;
}
html[data-theme="dark"] .current-model strong,
html[data-theme="dark"] #currentModelName{
  color:#7ce1ae!important;
}
html[data-theme="dark"] .chat-toolbar-actions .btn,
html[data-theme="dark"] #clearChatBtn,
html[data-theme="dark"] #chatPrivacyOpenBtn{
  background:#172331!important;
  color:#e8eef5!important;
  border:1px solid rgba(218,232,246,.16)!important;
}
html[data-theme="dark"] #chatPrivacyOpenBtn{
  background:rgba(217,76,76,.18)!important;
  color:#ffb1a8!important;
  border-color:rgba(217,76,76,.24)!important;
}
html[data-theme="dark"] .chat-input-area #sendBtn,
html[data-theme="dark"] button#sendBtn.btn.btn-primary{
  background:linear-gradient(135deg,#7ce1ae,#62d7ff)!important;
  color:#07131d!important;
  border:1px solid rgba(255,255,255,.18)!important;
  box-shadow:0 12px 28px rgba(98,215,255,.12)!important;
  opacity:1!important;
}
html[data-theme="dark"] .chat-input-area #sendBtn:disabled{
  opacity:.58!important;
  filter:grayscale(.2)!important;
}


/* Public/site key split */
@media (max-width: 760px) {
    .info-layout,
    .site-status-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}
html[data-theme="dark"] .warn-note{background:rgba(74,45,18,.48)!important;border-color:rgba(251,191,36,.18)!important;color:#f3c177!important}
html[data-theme="dark"] .compact-value{color:#e8eef5!important}

/* 2026-05-07: public models use tag cloud; private web models keep selector-only UI */
.public-models-block {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.public-model-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    margin-top: 2px;
}
.compact-search {
    min-height: 36px;
    font-size: .74rem;
    padding-inline: 12px;
}
.compact-toggle {
    min-height: 36px;
    padding-inline: 12px;
    font-size: .72rem;
    white-space: nowrap;
}
.public-model-tag-list {
    margin-top: 0;
    max-height: 148px;
    overflow: hidden;
    padding-right: 2px;
}
.public-model-tag-list.is-expanded {
    max-height: none;
    overflow: visible;
}
.public-model-tag {
    cursor: default;
}
.site-model-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}
.model-inline-note {
    color: #60778a;
    font-size: .74rem;
    line-height: 1.6;
}
html[data-theme="dark"] .model-inline-note {
    color: #aab8c5;
}
@media(max-width:640px){
    .public-model-toolbar{grid-template-columns:1fr;}
    .compact-toggle{width:100%;justify-content:center;}
    .public-model-tag-list{max-height:190px;overflow:auto;-webkit-overflow-scrolling:touch;}
    .public-model-tag-list.is-expanded{max-height:300px;overflow:auto;-webkit-overflow-scrolling:touch;}
}
.public-model-tag {
    border: 0;
    appearance: none;
    cursor: pointer;
    transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}
.public-model-tag:hover,
.public-model-tag:focus-visible {
    transform: translateY(-1px);
    background: #e2f1fa;
    box-shadow: 0 8px 18px rgba(47, 94, 125, .13);
    outline: none;
}
html[data-theme="dark"] .public-model-tag:hover,
html[data-theme="dark"] .public-model-tag:focus-visible {
    background: rgba(61, 86, 109, .92) !important;
}


/* First-visit public key notice */
.public-notice-card {
    width: min(100%, 560px);
}
.public-notice-message {
    display: grid;
    gap: 10px;
    text-align: left;
}
.public-notice-message p {
    margin: 0;
    line-height: 1.75;
}
.public-notice-message strong {
    color: #164d72;
}
html[data-theme="dark"] .public-notice-message strong {
    color: #d5ecff;
}
@media(max-width:520px){
    .public-notice-card{width:calc(100vw - 24px)!important;}
}


/* Compact metric rows: value on the right */
.metric-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}
.metric-title {
    display: grid;
    gap: 4px;
    min-width: 0;
}
.metric-value {
    flex: 0 0 auto;
    margin: 0;
    text-align: right;
    white-space: nowrap;
    line-height: 1.1;
}
.compact-balance-content {
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}
.compact-balance-content .balance-detail {
    min-width: 0;
}
.public-notice-card {
    padding: 20px 20px 18px !important;
}
.public-notice-card .dialog-title {
    margin-bottom: 10px;
}
.public-notice-card .dialog-message {
    font-size: .88rem;
}
.public-notice-card .dialog-actions {
    margin-top: 14px;
}
@media(max-width:520px){
    .metric-head{align-items:center;}
    .metric-value{font-size:1.28rem;}
    .compact-balance-content{grid-template-columns:1fr;}
    .compact-balance-content .btn{width:100%;justify-content:center;}
    .public-notice-card{padding:18px 16px 16px!important;}
}

/* 2026-05-07: chat toolbar model selector + compact public notice */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}
.model-inline-select {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 360px;
    min-width: 0;
}
.model-inline-select > span {
    flex: 0 0 auto;
}
.chat-model-selector {
    flex: 1 1 260px;
    min-height: 36px;
    padding: 0 12px;
    font-size: .78rem;
}
.chat-refresh-model {
    min-height: 36px;
    padding-inline: 12px;
    font-size: .74rem;
    white-space: nowrap;
}
.public-notice-dialog .public-notice-card {
    width: min(390px, calc(100vw - 30px)) !important;
    max-width: min(390px, calc(100vw - 30px)) !important;
}
.public-notice-dialog .dialog-help strong {
    color: #8a4b08;
}
.public-notice-actions {
    grid-template-columns: 1fr;
}
.public-notice-actions .btn {
    width: 100%;
    justify-content: center;
}
@media(max-width:700px){
    .chat-toolbar {
        align-items: stretch;
    }
    .model-inline-select {
        width: 100%;
        flex: 1 1 100%;
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto;
        justify-content: start;
        text-align: left;
    }
    .chat-model-selector {
        width: 100%;
        min-width: 0;
    }
    .chat-refresh-model {
        width: auto !important;
        min-width: 58px;
    }
}
@media(max-width:520px){
    .metric-head {
        justify-content: space-between !important;
        text-align: left !important;
    }
    .metric-title {
        text-align: left !important;
        justify-items: start !important;
    }
    .metric-value {
        text-align: right !important;
        align-self: center !important;
    }
    .public-notice-dialog .public-notice-card {
        width: min(330px, calc(100vw - 36px)) !important;
        max-width: min(330px, calc(100vw - 36px)) !important;
    }
}
@media(max-width:390px){
    .model-inline-select {
        grid-template-columns: 1fr auto;
    }
    .model-inline-select > span {
        grid-column: 1 / 3;
    }
}

/* Final mobile correction: metric rows stay horizontal; chat model selector loses pill shell */
@media (max-width: 640px) {
    .copy-head.metric-head {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 10px !important;
        width: 100%;
    }
    .copy-head.metric-head .metric-title {
        min-width: 0;
        flex: 1 1 auto;
        display: grid;
        gap: 3px;
        text-align: left !important;
        justify-items: start !important;
    }
    .copy-head.metric-head .metric-value {
        flex: 0 0 auto;
        margin-left: auto;
        text-align: right !important;
        white-space: nowrap;
        font-size: 1.18rem;
        max-width: 42%;
    }
}
.model-inline-select.current-model {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    border-radius: 0 !important;
    color: inherit !important;
    overflow: visible !important;
}
.model-inline-select.current-model > span {
    color: #52687b;
    font-weight: 850;
    font-size: .82rem;
}
.chat-model-selector {
    border-radius: 12px !important;
    background: rgba(248, 251, 254, .96) !important;
    border: 1px solid rgba(72, 104, 132, .16) !important;
    box-shadow: none !important;
}
html[data-theme="dark"] .model-inline-select.current-model {
    background: transparent !important;
    border: 0 !important;
}
html[data-theme="dark"] .model-inline-select.current-model > span {
    color: #b6c4d0;
}
html[data-theme="dark"] .chat-model-selector {
    background: rgba(17,27,38,.82) !important;
    border-color: rgba(218,232,246,.12) !important;
}
@media (max-width: 700px) {
    .model-inline-select.current-model {
        display: grid !important;
        grid-template-columns: auto minmax(0, 1fr) auto !important;
        align-items: center;
        gap: 8px;
        width: 100% !important;
    }
}
@media (max-width: 390px) {
    .model-inline-select.current-model {
        grid-template-columns: auto minmax(0, 1fr) !important;
    }
    .chat-refresh-model {
        grid-column: 1 / 3;
        width: 100% !important;
        justify-content: center;
    }
}

/* 2026-05-07 visual fatigue pass: stronger form contrast and sane mobile model row */
:root {
    --field-bg-strong: #ffffff;
    --field-border-strong: rgba(55, 83, 110, .34);
    --field-border-hover: rgba(35, 91, 132, .48);
    --field-shadow-strong: 0 10px 26px rgba(30, 64, 92, .08), inset 0 0 0 1px rgba(255,255,255,.7);
    --field-focus-ring: 0 0 0 3px rgba(32, 118, 174, .16), 0 12px 28px rgba(30, 64, 92, .12);
}
.chat-input,
.model-selector,
.image-selector,
.model-search,
.file-input,
.copy-value {
    background: var(--field-bg-strong) !important;
    border-color: var(--field-border-strong) !important;
    color: #17283a !important;
    box-shadow: var(--field-shadow-strong) !important;
}
.chat-input,
.model-selector,
.image-selector,
.model-search {
    border-width: 1.5px !important;
}
.chat-input {
    min-height: 48px;
    border-radius: 16px !important;
    line-height: 1.65;
}
#userInput.chat-input {
    min-height: 48px;
    background: #fff !important;
}
#imageGeneratePromptInput,
#imageEditPromptInput {
    min-height: 96px;
    background: #fff !important;
}
.chat-input:hover,
.model-selector:hover,
.image-selector:hover,
.model-search:hover {
    border-color: var(--field-border-hover) !important;
}
.chat-input:focus,
.model-selector:focus,
.image-selector:focus,
.model-search:focus {
    border-color: rgba(24, 103, 160, .72) !important;
    box-shadow: var(--field-focus-ring) !important;
    outline: none !important;
}
.chat-input::placeholder,
.model-search::placeholder {
    color: #6e8295 !important;
}
.chat-input-area,
.image-panel,
.image-tools {
    background: rgba(245, 249, 252, .82) !important;
    border: 1px solid rgba(67, 99, 126, .12) !important;
}
.chat-input-area {
    padding: 8px;
    border-radius: 20px;
}
.image-panel {
    padding: 14px;
    border-radius: 24px;
}
.image-tools {
    padding: 8px;
    border-radius: 18px;
}
.model-inline-select.current-model {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) auto !important;
    align-items: center !important;
    gap: 8px !important;
}
.chat-model-selector {
    min-height: 38px !important;
    border-radius: 12px !important;
    text-align: left !important;
    text-align-last: left !important;
}
.chat-refresh-model {
    min-height: 38px !important;
}
html[data-theme="dark"] {
    --field-bg-strong: #0e1721;
    --field-border-strong: rgba(165, 190, 214, .32);
    --field-border-hover: rgba(145, 205, 255, .52);
    --field-shadow-strong: 0 10px 28px rgba(0,0,0,.28), inset 0 0 0 1px rgba(255,255,255,.035);
    --field-focus-ring: 0 0 0 3px rgba(98, 215, 255, .18), 0 12px 30px rgba(0,0,0,.34);
}
html[data-theme="dark"] .chat-input,
html[data-theme="dark"] .model-selector,
html[data-theme="dark"] .image-selector,
html[data-theme="dark"] .model-search,
html[data-theme="dark"] .file-input,
html[data-theme="dark"] .copy-value {
    background: var(--field-bg-strong) !important;
    border-color: var(--field-border-strong) !important;
    color: #edf5fc !important;
    box-shadow: var(--field-shadow-strong) !important;
}
html[data-theme="dark"] .chat-input-area,
html[data-theme="dark"] .image-panel,
html[data-theme="dark"] .image-tools {
    background: rgba(7, 14, 22, .52) !important;
    border-color: rgba(165, 190, 214, .14) !important;
}
html[data-theme="dark"] .chat-input::placeholder,
html[data-theme="dark"] .model-search::placeholder {
    color: #8fa4b8 !important;
}
@media (max-width: 760px) {
    .model-inline-select.current-model {
        grid-template-columns: auto minmax(0, 1fr) auto !important;
    }
    .model-inline-select.current-model > span {
        white-space: nowrap;
    }
    .chat-refresh-model {
        width: auto !important;
        min-width: 58px !important;
        padding-inline: 12px !important;
        justify-content: center;
    }
    .chat-model-selector {
        width: 100% !important;
        min-width: 0 !important;
    }
}
@media (max-width: 430px) {
    .model-inline-select.current-model {
        grid-template-columns: auto minmax(0, 1fr) auto !important;
        gap: 6px !important;
    }
    .model-inline-select.current-model > span {
        font-size: .76rem;
    }
    .chat-model-selector {
        font-size: .72rem !important;
        padding-inline: 9px !important;
    }
    .chat-refresh-model {
        min-width: 50px !important;
        padding-inline: 9px !important;
        font-size: .72rem !important;
    }
    .chat-input-area {
        grid-template-columns: minmax(0,1fr) auto !important;
    }
    .chat-input-area .btn {
        width: auto !important;
        min-width: 64px;
    }
}
@media (max-width: 360px) {
    .model-inline-select.current-model {
        grid-template-columns: 1fr auto !important;
    }
    .model-inline-select.current-model > span {
        grid-column: 1 / 3;
    }
}


/* 2026-05-07 model selector centering + chat input alignment */
.model-selector,
.image-selector,
.chat-model-selector {
    text-align: center !important;
    text-align-last: center !important;
}
.model-selector option,
.image-selector option,
.chat-model-selector option {
    text-align: center !important;
}
.chat-input-area {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: center !important;
    gap: 8px !important;
}
#userInput.chat-input {
    min-height: 46px !important;
    max-height: 140px;
    padding-top: 10px !important;
    padding-bottom: 10px !important;
    align-self: stretch;
}
#sendBtn {
    height: 46px !important;
    min-height: 46px !important;
    align-self: center !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    line-height: 1 !important;
}
@media(max-width:430px){
    .chat-input-area {
        grid-template-columns: minmax(0, 1fr) auto !important;
    }
    #sendBtn {
        width: auto !important;
        min-width: 64px !important;
    }
}


/* Usage notes and visible model-select affordance */
.info-note {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 16px;
    background: #eef7ff;
    border: 1px solid rgba(45, 126, 184, .22);
    color: #24536f;
    font-size: .76rem;
    font-weight: 800;
    line-height: 1.65;
}
.site-usage-note {
    margin-top: 12px;
}
.model-select-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}
.select-hint-arrow {
    display: inline-grid;
    place-items: center;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: rgba(45, 126, 184, .12);
    color: #235b7a;
    font-size: .74rem;
    font-weight: 950;
    line-height: 1;
}
.model-inline-select:hover .select-hint-arrow {
    background: rgba(45, 126, 184, .2);
}
html[data-theme="dark"] .info-note {
    background: rgba(45, 126, 184, .14);
    border-color: rgba(142, 204, 246, .24);
    color: #c9e7fb;
}
html[data-theme="dark"] .select-hint-arrow {
    background: rgba(142, 204, 246, .16);
    color: #d8efff;
}
@media(max-width:430px){
    .info-note {
        font-size: .72rem;
        padding: 9px 10px;
        border-radius: 14px;
    }
    .model-select-label {
        font-size: .74rem;
    }
    .select-hint-arrow {
        width: 16px;
        height: 16px;
        font-size: .68rem;
    }
}

/* 2026-05-07 compact copy buttons in public key card */
.public-info-card .copy-value-wrap .btn,
.public-info-card .btn-row .btn {
    min-height: 34px !important;
    height: 34px !important;
    padding: 0 13px !important;
    border-radius: 12px !important;
    font-size: .74rem !important;
    line-height: 1 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    white-space: nowrap;
}
.public-info-card .btn-row {
    display: flex;
    gap: 7px;
    align-items: center;
    flex: 0 0 auto;
}
.public-info-card .copy-value-wrap {
    align-items: center;
    gap: 8px;
}
@media(max-width:640px){
    .public-info-card .copy-value-wrap {
        grid-template-columns: minmax(0,1fr) auto !important;
    }
    .public-info-card .copy-value-wrap .btn,
    .public-info-card .btn-row .btn {
        min-height: 32px !important;
        height: 32px !important;
        padding-inline: 10px !important;
        font-size: .7rem !important;
    }
    .public-info-card .btn-row {
        gap: 6px;
    }
}

/* Mobile copy rows: value first, actions second */
@media(max-width:640px){
    .public-info-card .copy-value-wrap {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 8px !important;
        align-items: stretch !important;
    }
    .public-info-card .copy-value-wrap .copy-value {
        width: 100% !important;
        max-width: 100% !important;
        min-height: 34px;
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
    }
    .public-info-card .copy-value-wrap > .btn,
    .public-info-card .copy-value-wrap .btn-row {
        width: 100%;
        justify-content: center;
    }
    .public-info-card .copy-value-wrap > .btn {
        justify-self: center;
        width: min(100%, 150px) !important;
    }
    .public-info-card .btn-row {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .public-info-card .btn-row .btn {
        width: 100% !important;
    }
}


/* Manual usage guide button and richer guide dialog */
.hero-action-plain {
    border: 0;
    cursor: pointer;
    font: inherit;
}
.public-notice-links {
    display: grid;
    gap: 6px;
    text-align: left;
}
.public-notice-links p {
    margin: 0;
    line-height: 1.55;
}
.public-notice-links a {
    color: #155f91;
    font-weight: 900;
    text-decoration: none;
    border-bottom: 1px dashed rgba(21, 95, 145, .42);
}
.public-notice-links a:hover {
    color: #0f456f;
    border-bottom-style: solid;
}
.public-notice-actions .btn {
    min-height: 34px;
}
html[data-theme="dark"] .public-notice-links a {
    color: #9bd8ff;
    border-bottom-color: rgba(155, 216, 255, .38);
}
@media(max-width:520px){
    .public-notice-links {
        gap: 5px;
        font-size: .72rem;
    }
    .public-notice-actions {
        grid-template-columns: 1fr 1fr;
    }
}

/* 2026-05-07 recover image area width after contrast pass */
.image-card .image-panel {
    width: 100%;
    box-sizing: border-box;
    padding: 12px !important;
}
.image-card .image-result {
    width: 100%;
    box-sizing: border-box;
    padding-inline: 18px;
}
.image-card .image-empty,
.image-card .image-status {
    max-width: 100%;
    line-height: 1.7;
    word-break: normal !important;
    overflow-wrap: normal !important;
}
.image-card .footer-tip,
.image-card .footer-tip span {
    width: 100%;
    max-width: 100%;
    word-break: normal !important;
    overflow-wrap: normal !important;
}
.image-card .footer-tip {
    text-align: center !important;
    justify-items: center !important;
}
@media(min-width:761px){
    .image-card .image-empty br {
        display: none;
    }
    .image-card .image-empty,
    .image-card .footer-tip span {
        white-space: normal;
    }
}
@media(max-width:520px){
    .image-card .image-panel {
        padding: 10px !important;
    }
    .image-card .image-result {
        padding-inline: 12px;
    }
    .image-card .image-empty,
    .image-card .footer-tip span {
        font-size: .74rem;
        line-height: 1.65;
    }
}

/* Keep image footer tip readable; avoid one-character wrapping */
.image-panel > .footer-tip {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    text-align: center !important;
    width: 100% !important;
    min-width: 0;
}
.image-panel > .footer-tip span {
    display: inline-block !important;
    width: auto !important;
    max-width: 100% !important;
    white-space: nowrap !important;
    word-break: keep-all !important;
    overflow-wrap: normal !important;
    text-wrap: nowrap;
}
@media(max-width:420px){
    .image-panel > .footer-tip span {
        white-space: normal !important;
        word-break: keep-all !important;
        overflow-wrap: normal !important;
        max-width: 18em !important;
    }
}
