
        :root {
            --bg-color: #0d1117;
            --panel-bg: #161b22;
            --text-color: #c9d1d9;
            --accent-color: #58a6ff;
            --success-color: #3fb950;
            --border-color: #30363d;
        }
        
        *, *::before, *::after {
            box-sizing: border-box;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
            background-color: var(--bg-color);
            color: var(--text-color);
            display: flex;
            align-items: center;
            justify-content: center;
            min-height: 100vh;
            margin: 0;
            padding: 20px;
            flex-direction: column;
            box-sizing: border-box;
        }

        .container {
            background-color: var(--panel-bg);
            border: 1px solid var(--border-color);
            border-radius: 8px;
            padding: 30px;
            width: 100%;
            max-width: 1400px;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
            text-align: center;
            margin-bottom: 20px;
        }

        .device-info {
            background-color: #0d1117;
            border: 1px solid var(--border-color);
            border-radius: 6px;
            padding: 12px 16px;
            margin-bottom: 20px;
            font-family: 'Courier New', Courier, monospace;
            font-size: 14px;
            color: #8b949e;
            text-align: left;
            display: none;
        }

        .device-info span { color: var(--text-color); }

        .dashboard-panel {
            background-color: #0d1117;
            border: 1px solid var(--border-color);
            border-radius: 6px;
            padding: 15px;
            display: flex;
            justify-content: space-between;
            margin-bottom: 20px;
        }

        .stat-box {
            text-align: center;
            flex-grow: 1;
        }

        .stat-box h3 {
            margin: 0;
            color: var(--accent-color);
            font-size: 28px;
        }

        .stat-box p {
            margin: 5px 0 0 0;
            font-size: 14px;
            color: #8b949e;
        }

        .slider-container {
            margin: 20px 0;
            text-align: left;
        }

        input[type=range] {
            width: 100%;
            margin-top: 10px;
            accent-color: var(--accent-color);
        }

        h1 { margin-bottom: 5px; }
        h1 span { color: var(--accent-color); }
        .sub { color: #8b949e; margin-bottom: 25px; }

        .main-tabs {
            display: flex;
            gap: 4px;
            margin-bottom: 20px;
            border-bottom: 2px solid var(--border-color);
            padding-bottom: 0;
        }
        .main-tab {
            padding: 10px 20px;
            font-size: 15px;
            font-weight: 500;
            color: #8b949e;
            cursor: pointer;
            border-bottom: 2px solid transparent;
            margin-bottom: -2px;
            transition: color 0.2s, border-color 0.2s;
        }
        .main-tab:hover { color: var(--text-color); }
        .main-tab.active { color: var(--accent-color); border-bottom-color: var(--accent-color); }
        .main-panel { display: none; }
        .main-panel.active { display: block; }

        @keyframes spin { to { transform: rotate(360deg); } }
        @keyframes blink { 0%,100% { opacity:1; } 50% { opacity:0; } }

        .code-output {
            font-family: 'Courier New', Courier, monospace;
            background: #010409;
            border: 1px solid var(--border-color);
            border-radius: 6px;
            padding: 14px;
            font-size: 13px;
            line-height: 1.6;
            white-space: pre-wrap;
            overflow-x: auto;
            max-height: 400px;
            overflow-y: auto;
        }
        .code-output .hljs { background: transparent; padding: 0; }

        #guide-content { scrollbar-color: #30363d transparent; }
        #guide-content h1 { color: #e6edf3; }
        #guide-content h2 { color: #e6edf3; }
        #guide-content a { color: #58a6ff; }
        #guide-content table { border: 1px solid #30363d; border-radius: 6px; overflow: hidden; }
        #guide-content pre { scrollbar-color: #30363d transparent; }
        .builder-tip { position: relative; }
        .builder-tip[data-tip]:hover::after {
            content: attr(data-tip);
            position: absolute; bottom: calc(100% + 8px); left: 0;
            background: #1c2028; border: 1px solid #30363d; border-radius: 8px;
            padding: 10px 14px; font-size: 12px; color: #c9d1d9;
            white-space: pre-wrap; max-width: 340px; min-width: 220px;
            z-index: 100; box-shadow: 0 6px 16px rgba(0,0,0,0.5);
            pointer-events: none; line-height: 1.6; font-weight: 400;
        }

        .code-task-card {
            background: #0d1117;
            border: 1px solid var(--border-color);
            border-radius: 6px;
            padding: 14px;
            margin-bottom: 12px;
        }
        .code-task-card .prompt { color: #d29922; font-size: 14px; margin-bottom: 10px; }
        .code-task-card .meta { color: #8b949e; font-size: 12px; margin-top: 10px; }

        .code-step {
            display: flex;
            align-items: center;
            gap: 10px;
            font-size: 13px;
            color: #8b949e;
            padding: 6px 0;
        }
        .code-step.active { color: var(--accent-color); }
        .code-step.done { color: var(--success-color); }
        .code-step.error { color: #f85149; }
        .step-icon { font-size: 16px; width: 20px; text-align: center; }

        .status-box {
            font-family: 'Courier New', Courier, monospace;
            background-color: #010409;
            border: 1px solid var(--border-color);
            border-radius: 6px;
            padding: 15px;
            height: 120px;
            overflow-y: auto;
            text-align: left;
        }

        .status-box p {
            margin: 0 0 5px 0;
            color: var(--success-color);
            font-size: 14px;
        }

        .btn {
            background-color: #238636;
            color: #ffffff;
            border: 1px solid rgba(240, 246, 252, 0.1);
            border-radius: 6px;
            padding: 10px 20px;
            font-size: 16px;
            font-weight: 500;
            cursor: pointer;
            transition: background-color 0.2s;
        }

        .btn:hover { background-color: #2ea043; }
        .hidden { display: none; }

        .compat-banner {
            border-radius: 6px;
            padding: 14px 18px;
            margin-bottom: 20px;
            font-size: 14px;
            line-height: 1.6;
            display: none;
        }
        .compat-banner.gpu {
            background: #23392020;
            border: 1px solid #3fb95040;
            color: var(--success-color);
        }
        .compat-banner.cpu {
            background: #d2992215;
            border: 1px solid #d2992240;
            color: #d29922;
        }
        .compat-banner code {
            background: #0d1117;
            padding: 2px 6px;
            border-radius: 3px;
            font-size: 12px;
            color: var(--text-color);
        }
        .compat-banner summary {
            cursor: pointer;
            font-weight: 600;
            margin-bottom: 6px;
        }
        .compat-banner details[open] summary {
            margin-bottom: 10px;
        }

        .chat-box {
            background-color: var(--panel-bg);
            border: 1px solid var(--border-color);
            border-radius: 6px;
            padding: 15px;
            height: 500px;
            overflow-y: auto;
            text-align: left;
            margin-bottom: 20px;
            display: flex;
            flex-direction: column;
            gap: 10px;
        }
        
        .chat-msg {
            background-color: #0d1117;
            padding: 12px;
            border-radius: 6px;
            border-left: 3px solid var(--accent-color);
            font-size: 15px;
        }

        .chat-prompt {
            color: #8b949e;
            font-size: 13px;
            margin-bottom: 5px;
            display: block;
        }

        .token-detail {
            background: #010409;
            border: 1px solid var(--border-color);
            border-radius: 4px;
            padding: 10px 12px;
            margin-top: 8px;
            font-family: 'Courier New', monospace;
            font-size: 13px;
            line-height: 1.8;
            display: none;
        }
        .token-detail.visible { display: block; }
        .token-detail .tok {
            background: #1c2333;
            border: 1px solid #30363d;
            border-radius: 3px;
            padding: 2px 5px;
            margin: 2px;
            display: inline-block;
            color: var(--text-color);
        }
        .token-detail .tok-en { border-color: #58a6ff44; }
        .token-detail .tok-fi { border-color: #d2992244; }
        .toggle-tokens {
            background: none;
            border: 1px solid var(--border-color);
            border-radius: 4px;
            color: #8b949e;
            font-size: 12px;
            padding: 3px 8px;
            cursor: pointer;
        }
        .toggle-tokens:hover { color: var(--text-color); border-color: #8b949e; }

        .task-option {
            background: var(--panel-bg);
            border: 2px solid var(--border-color);
            border-radius: 8px;
            padding: 14px;
            cursor: pointer;
            transition: border-color 0.2s;
            position: relative;
        }
        .task-option:hover { border-color: #8b949e; }
        .task-option.selected { border-color: var(--accent-color); background: #58a6ff10; }
        .task-title { font-weight: 600; font-size: 15px; color: var(--text-color); margin-bottom: 4px; }
        .task-desc { font-size: 12px; color: #8b949e; line-height: 1.4; margin-bottom: 8px; }
        .task-size { font-size: 11px; color: #6e7681; }
        .task-badge {
            position: absolute;
            top: 10px;
            right: 10px;
            font-size: 10px;
            font-weight: 600;
            padding: 2px 8px;
            border-radius: 10px;
        }
        .task-ready { background: #23392050; color: var(--success-color); border: 1px solid #23392080; }
        .task-soon { background: #d2992215; color: #d29922; border: 1px solid #d2992240; }
        .task-info {
            display: none;
            margin-top: 10px;
            padding-top: 10px;
            border-top: 1px solid var(--border-color);
            font-size: 12px;
            line-height: 1.6;
            color: #8b949e;
        }
        .task-info strong { color: var(--text-color); }
        .task-info em { color: var(--accent-color); font-style: normal; }
        .task-option.selected .task-info { display: block; }

        .download-bar {
            background: #0d1117;
            border: 1px solid var(--border-color);
            border-radius: 6px;
            padding: 12px 16px;
            margin-bottom: 16px;
            display: none;
        }
        .download-bar .bar-track {
            background: #21262d;
            border-radius: 4px;
            height: 8px;
            margin-top: 8px;
            overflow: hidden;
        }
        .download-bar .bar-fill {
            background: var(--accent-color);
            height: 100%;
            border-radius: 4px;
            transition: width 0.3s ease;
        }

        .metric-card {
            background: var(--panel-bg);
            border: 1px solid var(--border-color);
            border-radius: 6px;
            padding: 10px;
            text-align: center;
        }
        .metric-val {
            font-size: 20px;
            font-weight: 700;
            color: var(--accent-color);
        }
        .metric-label {
            font-size: 11px;
            color: #8b949e;
            margin-top: 2px;
        }
        .terminal-panel {
            background:#010409;
            border:1px solid var(--border-color);
            border-radius:6px;
            padding:15px;
            font-family: 'Courier New', Courier, monospace;
            font-size:14px;
            color:var(--success-color);
            height: clamp(200px, 35vh, 500px);
            overflow-y:auto;
            text-align:left;
            white-space: pre-wrap;
        }
        .terminal-line { margin: 4px 0; }
        .terminal-prompt { color: #d29922; }
        .org-chart {
            display: flex;
            flex-direction: row;
            align-items: center;
            gap: 6px;
            margin-bottom: 12px;
            padding: 10px 12px;
            overflow-x: auto;
        }
        .org-level {
            display: flex;
            gap: 6px;
            position: relative;
            z-index: 2;
            flex-shrink: 0;
        }
        .org-connector {
            width: 20px;
            height: 2px;
            background: linear-gradient(to right, rgba(88, 166, 255, 0.8), rgba(88, 166, 255, 0.2));
            align-self: center;
            flex-shrink: 0;
        }
        .org-branch {
            display: none;
        }
        .org-chart.vertical {
            flex-direction: column;
            align-items: center;
            gap: 0;
        }
        .org-chart.vertical .org-connector {
            width: 2px;
            height: 24px;
            background: linear-gradient(to bottom, rgba(88, 166, 255, 0.8), rgba(88, 166, 255, 0.2));
        }
        .avatar-card {
            background: linear-gradient(145deg, rgba(33, 38, 45, 0.4) 0%, rgba(13, 17, 23, 0.8) 100%);
            backdrop-filter: blur(12px);
            border: 1px solid rgba(240, 246, 252, 0.1);
            border-radius: 12px;
            padding: 6px 6px 4px;
            text-align: center;
            width: 72px;
            opacity: 0.8;
            cursor: pointer;
            transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
            box-shadow: 0 4px 8px rgba(0,0,0,0.3);
        }
        .avatar-card:hover {
            opacity: 0.85;
            transform: translateY(-2px) scale(1.02);
            border-color: rgba(240, 246, 252, 0.3);
            box-shadow: 0 8px 14px rgba(0,0,0,0.4);
        }
        @keyframes idle-breathe {
            0%, 100% { transform: translateY(0) scale(1); }
            50% { transform: translateY(-2px) scale(1.01); }
        }
        @keyframes talking-head {
            0%   { transform: scale(1.05) scaleY(1) translateY(0); }
            25%  { transform: scale(1.05) scaleY(0.96) scaleX(1.02) translateY(2px); }
            50%  { transform: scale(1.05) scaleY(1.02) scaleX(0.98) translateY(-2px); }
            75%  { transform: scale(1.05) scaleY(0.97) scaleX(1.01) translateY(1px); }
            100% { transform: scale(1.05) scaleY(1) translateY(0); }
        }
        
        .avatar-card img {
            width: 50px;
            height: 50px;
            border-radius: 12px;
            margin-bottom: 4px;
            border: 2px solid rgba(240, 246, 252, 0.1);
            transition: all 0.4s ease;
            object-fit: cover;
            background: #010409;
            animation: idle-breathe 4s infinite ease-in-out;
            transform-origin: bottom center;
        }
        
        .avatar-card.active, .avatar-card.selected {
            opacity: 1;
            transform: translateY(-8px) scale(1.05);
            border-color: var(--accent-color);
            background: linear-gradient(145deg, rgba(88, 166, 255, 0.15) 0%, rgba(13, 17, 23, 0.9) 100%);
            box-shadow: 0 16px 24px rgba(0,0,0,0.5), 0 0 20px rgba(88, 166, 255, 0.3);
            z-index: 2;
        }

        .avatar-card.selected img {
            border-color: var(--accent-color);
            box-shadow: 0 0 25px rgba(88, 166, 255, 0.5);
            transform: scale(1.05);
            animation: none;
        }

        .avatar-card.active img {
            border-color: var(--accent-color);
            box-shadow: 0 0 25px rgba(88, 166, 255, 0.8);
            animation: talking-head 0.4s infinite ease-in-out;
            transform-origin: bottom center;
        }
        @keyframes talking-head-gallery {
            0%   { transform: scaleY(1) translateY(0); }
            25%  { transform: scaleY(0.94) scaleX(1.04) translateY(3px); }
            50%  { transform: scaleY(1.04) scaleX(0.96) translateY(-3px); }
            75%  { transform: scaleY(0.96) scaleX(1.02) translateY(1px); }
            100% { transform: scaleY(1) translateY(0); }
        }
        .gallery-head {
            width: 55px;
            height: 55px;
            border-radius: 12px;
            border: 2px solid rgba(240, 246, 252, 0.1);
            object-fit: cover;
            background: #010409;
            transition: all 0.3s ease;
            opacity: 0.4;
            filter: grayscale(80%);
        }
        .gallery-head.active {
            opacity: 1;
            filter: grayscale(0%);
            border-color: var(--accent-color);
            box-shadow: 0 0 15px rgba(88, 166, 255, 0.5);
            transform-origin: bottom center;
        }
        
        @keyframes confused-shake {
            0%   { transform: translateX(0); }
            25%  { transform: translateX(-2px) rotate(-3deg); }
            50%  { transform: translateX(0); }
            75%  { transform: translateX(2px) rotate(3deg); }
            100% { transform: translateX(0); }
        }
        
        .gallery-head-wrap[data-tooltip]::before {
            content: attr(data-tooltip);
            position: absolute;
            bottom: 110%;
            left: 50%;
            transform: translateX(-50%);
            background: rgba(13, 17, 23, 0.95);
            color: #f0f6fc;
            padding: 8px 12px;
            border-radius: 6px;
            font-size: 11px;
            white-space: pre-wrap;
            width: 140px;
            text-align: left;
            border: 1px solid var(--border-color);
            z-index: 100;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.2s;
            box-shadow: 0 4px 12px rgba(0,0,0,0.5);
        }
        .gallery-head-wrap:hover[data-tooltip]:not([data-tooltip=""])::before { opacity: 1; }

        /* Yhteiset kuplasäännöt */
        .gallery-head-wrap.state-question::after,
        .gallery-head-wrap.state-alert::after,
        .gallery-head-wrap.active:not(.state-question):not(.state-alert)::after {
            position: absolute;
            top: -10px;
            right: -10px;
            font-size: 14px;
            width: 24px;
            height: 24px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
            z-index: 10;
        }

        /* State: Kysymys (Oranssi ?) */
        .gallery-head-wrap.state-question::after {
            content: '?';
            color: #ffffff;
            font-weight: 900;
            font-family: system-ui, -apple-system, sans-serif;
            animation: speech-pulse 1s infinite alternate;
            background: #d29922; border: 1px solid #e3a830;
        }
        .gallery-head.state-question {
            border-color: #d29922; box-shadow: 0 0 15px rgba(210, 153, 34, 0.4);
            animation: confused-shake 2s infinite ease-in-out; filter: grayscale(10%); opacity: 0.9;
        }

        /* State: Alert (Punainen !) */
        .gallery-head-wrap.state-alert::after {
            content: '!';
            color: #ffffff;
            font-weight: 900;
            font-family: system-ui, -apple-system, sans-serif;
            animation: speech-pulse 0.5s infinite alternate;
            background: #da3633; border: 1px solid #ff7b72;
        }
        .gallery-head.state-alert {
            border-color: #ff4444; box-shadow: 0 0 15px rgba(255, 68, 68, 0.5);
            animation: confused-shake 0.5s infinite; filter: grayscale(30%); opacity: 0.9;
        }
        
        .gallery-head-wrap { position: relative; display: inline-block; cursor: help; }
        @keyframes speech-pulse {
            0% { transform: scale(0.8) translateY(0); opacity: 0.6; }
            50% { transform: scale(1.1) translateY(-2px); opacity: 1; }
            100% { transform: scale(0.8) translateY(0); opacity: 0.6; }
        }
        .gallery-head-wrap.active:not(.state-question):not(.state-alert)::after {
            content: '💬';
            background: #0d1117;
            border: 1px solid var(--accent-color);
        }
        .avatar-name { font-weight: 700; font-size: 10px; color: #f0f6fc; letter-spacing: 0.3px; margin-bottom: 0; }
        .avatar-role { font-size: 10px; color: #8b949e; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; line-height: 1.2; word-wrap: break-word; }
        .agent-prompt-editor {
            margin-top: 12px;
            background: var(--panel-bg);
            border: 1px solid var(--border-color);
            border-radius: 6px;
            padding: 12px;
            display: none;
        }
        .agent-prompt-editor.visible { display: block; }
        .agent-prompt-editor textarea {
            width: 100%;
            background: #010409;
            border: 1px solid var(--border-color);
            border-radius: 4px;
            color: var(--text-color);
            font-size: 13px;
            font-family: 'Courier New', monospace;
            padding: 8px;
            resize: vertical;
            min-height: 40px;
            outline: none;
        }
        .agent-prompt-editor textarea:focus { border-color: var(--accent-color); }
        .agent-prompt-label {
            font-size: 12px;
            color: #8b949e;
            margin-bottom: 6px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        .agent-prompt-label strong { color: var(--text-color); }
        .lang-selector { display: flex; gap: 6px; background: #010409; padding: 4px; border-radius: 6px; border: 1px solid var(--border-color); }
        .lang-btn { background: transparent; border: none; color: #8b949e; font-size: 11px; font-weight: 600; cursor: pointer; padding: 4px 8px; border-radius: 4px; transition: all 0.2s; }
        .lang-btn:hover { color: #c9d1d9; }
        .lang-btn.active { background: rgba(88, 166, 255, 0.15); color: var(--accent-color); }
        
        @media (max-width: 768px) {
            body { padding: 5px; margin: 0; }
            .container { padding: 15px; border: none; border-radius: 0; border-bottom: 1px solid var(--border-color); }
            .dashboard-panel { flex-direction: column; gap: 15px; padding: 10px; }
            .stat-box { border-right: none !important; border-bottom: 1px solid #30363d; padding-bottom: 10px; }
            .stat-box:last-child { border-bottom: none; padding-bottom: 0; }
            
            /* Typography & Header */
            h1 { font-size: 22px; }
            .sub { font-size: 11px; }
            .lang-selector { flex-direction: column; gap: 4px; }
            [style*="justify-content: space-between; align-items: flex-start"] { align-items: center !important; }

            /* Tabs */
            .main-tabs { display: flex; overflow-x: auto; white-space: nowrap; padding-bottom: 5px; margin-bottom: 15px; gap: 10px; }
            .main-tab { padding: 8px 10px; font-size: 13px; text-align: center; }

            /* Grid optimizations */
            #task-selector { grid-template-columns: 1fr !important; }
            #metrics-grid { grid-template-columns: 1fr 1fr !important; }

            /* Org chart mobile tweaks */
            .org-chart { padding: 6px; gap: 4px; }
            .org-level { flex-wrap: wrap; gap: 4px !important; }
            .org-connector { width: 12px; }

            /* Avatar cards downscaling */
            .avatar-card { width: 56px; padding: 4px 3px 2px; }
            .avatar-card img { width: 36px; height: 36px; margin-bottom: 2px; border-radius: 8px; }
            .avatar-name { font-size: 9px; margin-bottom: 0; }

            /* User Input Area */
            #user-input-box > div { flex-direction: column; }
            #send-btn { width: 100%; padding: 12px; }
            
            #code-input-container { flex-direction: column !important; }
            #code-send-btn { width: 100%; margin-top: 5px; }
        }

        /* Responsiivinen korkeus */
        @media (max-height: 900px) {
            .terminal-panel { height: clamp(150px, 25vh, 250px); }
            .agent-prompt-editor textarea { min-height: 30px; }
            .container > div:first-child { margin-bottom: 6px; }
            .container h1 { font-size: 22px; }
            .container .sub { font-size: 12px; }
            .avatar-card { padding: 4px 4px 2px; }
            .avatar-card img { width: 40px; height: 40px; margin-bottom: 2px; }
        }
        @media (min-height: 1200px) {
            .terminal-panel { height: clamp(350px, 40vh, 600px); }
            .agent-prompt-editor textarea { min-height: 80px; }
        }
    

  * { box-sizing: border-box; margin: 0; padding: 0; }
  body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, sans-serif; background: #0d1117; color: #c9d1d9; padding: 24px; max-width: 960px; margin: 0 auto; line-height: 1.5; }
  h1 { color: #f0f6fc; margin-bottom: 4px; font-size: 24px; }
  h2 { color: #c9d1d9; margin: 28px 0 14px; border-bottom: 1px solid #30363d; padding-bottom: 8px; font-size: 18px; }
  h3 { color: #8b949e; margin: 16px 0 8px; }
  pre { font-family: ui-monospace, "Cascadia Code", "SF Mono", Menlo, monospace; tab-size: 4; }
  a { color: #58a6ff; }
  details summary { list-style: none; cursor: pointer; }
  details summary::-webkit-details-marker { display: none; }
  details[open] summary { color: #58a6ff; }
  .sl-badge { display: inline-block; border: 1px solid; border-radius: 6px; padding: 3px 10px; margin: 2px; font-size: 11px; cursor: help; white-space: nowrap; position: relative; transition: transform 0.15s; }
  .sl-badge:hover { transform: translateY(-1px); filter: brightness(1.3); }
  .sl-badge[data-tip]:hover::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: #1c2028; border: 1px solid #30363d; border-radius: 6px; padding: 8px 12px; font-size: 11px; color: #c9d1d9; white-space: pre-wrap; max-width: 350px; min-width: 180px; z-index: 10; box-shadow: 0 4px 12px rgba(0,0,0,0.5); pointer-events: none; line-height: 1.5; }
