:root {
            color-scheme: light;
            --bg: #f2f3f7;
            --card-bg: #ffffff;
            --text: #2d2d2d;
            --text-muted: #6b6e76;
            --border: #d8d9df;
            --button-bg: #f6f6f8;
            --button-hover: #e9ebef;
            --button-active: #dce2ee;
            --section-title: #2f3b63;
            --shadow: 0 8px 18px rgba(0,0,0,0.08);
            --qa-bg: #f9f9fb;
            --action-bg: #eef0f5;
        }

        html[data-theme="dark"] {
            color-scheme: dark;
            --bg: #111217;
            --card-bg: #1d1f26;
            --text: #e5e5e5;
            --text-muted: #9ea0a6;
            --border: #3a3c42;
            --button-bg: #292b33;
            --button-hover: #3a3d47;
            --button-active: #4b4f5a;
            --section-title: #9bb8ff;
            --shadow: 0 10px 24px rgba(0,0,0,0.4);
            --qa-bg: #242631;
            --action-bg: #323542;
        }

        * {
            box-sizing: border-box;
        }

        body {
            margin: 0;
            padding: 0;
            font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
            background: var(--bg);
            color: var(--text);
            display: flex;
            min-height: 100vh;
            align-items: center;
            justify-content: center;
        }

        .app-shell {
            width: 100%;
            max-width: 900px;
            padding: 16px;
        }

        .card {
            background: var(--card-bg);
            border-radius: 14px;
            border: 1px solid var(--border);
            box-shadow: var(--shadow);
            padding: 20px;
        }

        .header-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 10px;
            gap: 10px;
        }

        .title-block h1 {
            font-size: 1.6rem;
            margin: 0;
            color: var(--text);
        }

        .title-sub {
            margin: 2px 0 0;
            font-size: 0.9rem;
            color: var(--text-muted);
        }

        .theme-toggle {
            font-size: 1.2rem;
            background: none;
            border: 1px solid transparent;
            cursor: pointer;
            padding: 4px 10px;
            border-radius: 999px;
            color: var(--text);
            transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
        }

        .theme-toggle:hover {
            background: var(--button-hover);
            border-color: var(--border);
        }

        .theme-toggle:active {
            transform: scale(0.95);
            background: var(--button-active);
        }

        .field-label {
            margin-top: 12px;
            margin-bottom: 6px;
            font-size: 0.9rem;
            color: var(--text);
        }

        textarea {
            width: 100%;
            min-height: 110px;
            border-radius: 10px;
            border: 1px solid var(--border);
            background: var(--card-bg);
            padding: 10px;
            font-size: 0.95rem;
            color: var(--text);
            resize: vertical;
        }

        textarea:focus {
            border-color: #7aa5f7;
            outline: none;
            box-shadow: 0 0 0 2px rgba(122,165,247,0.35);
        }

        .hint {
            margin-top: 4px;
            font-size: 0.8rem;
            color: var(--text-muted);
        }

        .mood-row {
            margin-top: 12px;
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 10px;
        }

        @media (min-width: 640px) {
            .mood-row {
                grid-template-columns: repeat(5, 1fr);
            }
        }

        .mood-button {
            padding: 10px 8px;
            border-radius: 10px;
            border: 1px solid var(--border);
            background: var(--button-bg);
            color: var(--text);
            cursor: pointer;
            font-size: 0.85rem;
            transition: all 0.1s ease;
            text-align: center;
        }

        .mood-button span {
            display: block;
        }

        .mood-button strong {
            display: block;
            font-weight: 600;
            margin-bottom: 2px;
        }

        .mood-button small {
            display: block;
            font-size: 0.75rem;
            color: var(--text-muted);
        }

        .mood-button:hover {
            background: var(--button-hover);
        }

        .mood-button:active {
            background: var(--button-active);
        }

        .mood-button.disabled {
            opacity: 0.45;
            pointer-events: none;
        }

        .status-row {
            margin-top: 8px;
            min-height: 18px;
            font-size: 0.8rem;
            color: var(--text-muted);
        }

        .status-row.error {
            color: #b91c1c;
        }

        .responses {
            margin-top: 18px;
            max-height: 52vh;
            overflow-y: auto;
        }

        .qa-block {
            background: var(--qa-bg);
            border: 1px solid var(--border);
            padding: 14px;
            border-radius: 10px;
            margin-bottom: 12px;
            animation: fadeInUp 0.2s ease-out;
        }

        .qa-header {
            display: flex;
            justify-content: space-between;
            color: var(--text-muted);
            font-size: 0.85rem;
        }

        .qa-mode {
            font-weight: 600;
            color: var(--section-title);
        }

        .qa-time {
            color: var(--text-muted);
        }

        .qa-question-label {
            margin-top: 8px;
            font-size: 0.8rem;
            color: var(--text-muted);
        }

        .qa-question-text {
            margin-top: 2px;
            font-size: 0.95rem;
            color: var(--text);
            white-space: pre-wrap;
        }

        .qa-answer-text {
            margin-top: 10px;
            font-size: 0.95rem;
            color: var(--text);
            white-space: pre-wrap;
        }

        .qa-section-title {
            display: block;
            font-weight: 600;
            margin-top: 10px;
            margin-bottom: 2px;
            color: var(--section-title);
        }

        .qa-actions {
            margin-top: 10px;
            display: flex;
            gap: 8px;
            justify-content: flex-end;
            flex-wrap: wrap;
        }

        .qa-action-button {
            border-radius: 999px;
            border: 1px solid var(--border);
            background: var(--action-bg);
            padding: 4px 10px;
            font-size: 0.8rem;
            cursor: pointer;
            color: var(--text);
            display: inline-flex;
            align-items: center;
            gap: 4px;
        }

        .qa-action-button:hover {
            filter: brightness(1.03);
        }

        .qa-action-button:active {
            transform: scale(0.97);
        }

        .disclaimer {
            margin-top: 18px;
            font-size: 0.75rem;
            color: var(--text-muted);
            text-align: center;
        }

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