* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #00ff41;
    --primary-rgb: 0, 255, 65;
    --accent: #00ffff;
    --danger: #ff0040;
}

body {
    background: #000;
    overflow: hidden;
    font-family: 'Share Tech Mono', monospace;
    color: var(--primary);
}

body.theme-callcenter {
    --primary: #00bfff;
    --primary-rgb: 0, 191, 255;
    --accent: #ff9f43;
}

body.theme-japan {
    --primary: #ff2222;
    --primary-rgb: 255, 34, 34;
    --accent: #ff6b6b;
}

body.theme-munich {
    --primary: #FFD700;
    --primary-rgb: 255, 215, 0;
    --accent: #FFA500;
}

body.theme-berlin {
    --primary: #00BCD4;
    --primary-rgb: 0, 188, 212;
    --accent: #26C6DA;
}

body.theme-realestate {
    --primary: #2E7D32;
    --primary-rgb: 46, 125, 50;
    --accent: #D4A017;
}

body.theme-dhipaya {
    --primary: #00bfff;
    --primary-rgb: 0, 191, 255;
    --accent: #ff9f43;
}

body.theme-interpreter {
    --primary: #20B2AA;
    --primary-rgb: 32, 178, 170;
    --accent: #FF7043;
}

canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
}

#matrix-canvas {
    z-index: 1;
}

#face-canvas {
    z-index: 2;
}

#status {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10;
    font-size: 14px;
    letter-spacing: 2px;
    text-shadow: 0 0 10px var(--primary), 0 0 20px var(--primary);
    transition: color 0.3s, text-shadow 0.3s;
}

#status.error {
    color: var(--danger);
    text-shadow: 0 0 10px var(--danger), 0 0 20px var(--danger);
}

#status.listening {
    color: var(--primary);
    animation: pulse-glow 1s ease-in-out infinite;
}

#status.speaking {
    color: var(--accent);
    text-shadow: 0 0 10px var(--accent), 0 0 20px var(--accent);
}

#status.muted {
    color: #94a3b8;
    opacity: 0.7;
    letter-spacing: 2px;
}

@keyframes pulse-glow {
    0%, 100% { text-shadow: 0 0 10px var(--primary), 0 0 20px var(--primary); }
    50% { text-shadow: 0 0 20px var(--primary), 0 0 40px var(--primary), 0 0 60px var(--primary); }
}

#transcript {
    position: fixed;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    max-width: 700px;
    max-height: 150px;
    overflow-y: auto;
    z-index: 10;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(var(--primary-rgb), 0.2);
    border-radius: 8px;
    padding: 12px 16px;
    backdrop-filter: blur(4px);
}

#transcript::-webkit-scrollbar {
    width: 4px;
}

#transcript::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 2px;
}

#transcript-inner {
    font-size: 13px;
    line-height: 1.6;
}

.transcript-line {
    margin-bottom: 4px;
    opacity: 0;
    animation: fade-in 0.3s forwards;
}

.transcript-line.user {
    color: var(--primary);
}

.transcript-line.ai {
    color: var(--accent);
}

.transcript-line .label {
    font-weight: bold;
    margin-right: 8px;
}

@keyframes fade-in {
    to { opacity: 1; }
}

#controls {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    font-size: 12px;
    letter-spacing: 1px;
    color: rgba(var(--primary-rgb), 0.6);
    display: none;
    align-items: center;
}

#mic-level {
    display: inline-block;
    width: 80px;
    height: 6px;
    background: rgba(var(--primary-rgb), 0.1);
    border: 1px solid rgba(var(--primary-rgb), 0.3);
    border-radius: 3px;
    overflow: hidden;
    vertical-align: middle;
}

#mic-level-bar {
    height: 100%;
    width: 0%;
    background: var(--primary);
    box-shadow: 0 0 6px var(--primary);
    transition: width 0.05s;
}

#controls .separator {
    margin: 0 10px;
    opacity: 0.3;
}

#controls .key-hint {
    opacity: 0.5;
}

#mic-status {
    transition: color 0.2s;
}

#mic-status.muted {
    color: var(--danger);
}

#mic-toggle-btn {
    font-family: 'Share Tech Mono', monospace;
    font-size: 14px;
    letter-spacing: 1px;
    color: var(--primary);
    background: rgba(var(--primary-rgb), 0.1);
    border: 1px solid rgba(var(--primary-rgb), 0.4);
    border-radius: 8px;
    padding: 10px 20px;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

#mic-toggle-btn:active {
    background: rgba(var(--primary-rgb), 0.3);
    transform: scale(0.95);
}

#mic-toggle-btn.muted {
    color: var(--danger);
    background: rgba(255, 0, 64, 0.15);
    border-color: rgba(255, 0, 64, 0.4);
}

#end-session-btn {
    font-family: 'Share Tech Mono', monospace;
    font-size: 14px;
    letter-spacing: 1px;
    color: var(--danger);
    background: rgba(255, 0, 64, 0.1);
    border: 1px solid rgba(255, 0, 64, 0.4);
    border-radius: 8px;
    padding: 10px 20px;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

#end-session-btn:active {
    background: rgba(255, 0, 64, 0.3);
    transform: scale(0.95);
}

/* Start overlay */
#start-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(8px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 20px 0;
}

#start-overlay.hidden {
    display: none;
}

.start-content {
    text-align: center;
    max-width: 900px;
    margin: auto;
}

.start-content h1 {
    font-size: 64px;
    letter-spacing: 8px;
    text-shadow: 0 0 20px #00ff41, 0 0 40px #00ff41;
    margin-bottom: 8px;
}

.start-content h1 .accent {
    color: #00ffff;
    text-shadow: 0 0 20px #00ffff, 0 0 40px #00ffff;
}

.app-icon {
    width: 120px;
    height: 120px;
    border-radius: 24px;
    margin-bottom: 16px;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.1);
}

.start-content > p {
    font-size: 14px;
    opacity: 0.6;
    margin-bottom: 28px;
}

.start-content .hint {
    font-size: 11px;
    opacity: 0.3;
    margin-top: 16px;
}

/* Character select */
.character-select {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 30px;
    padding: 0 10px;
}

.character-card {
    width: 180px;
    padding: 16px 12px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    background: rgba(255, 255, 255, 0.03);
}

.character-card:hover {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.06);
}

.character-card.selected {
    border-color: #00ff41;
    box-shadow: 0 0 20px rgba(0, 255, 65, 0.2), inset 0 0 20px rgba(0, 255, 65, 0.05);
}

.character-card[data-character="callcenter"].selected {
    border-color: #00bfff;
    box-shadow: 0 0 20px rgba(0, 191, 255, 0.2), inset 0 0 20px rgba(0, 191, 255, 0.05);
}

.character-card[data-character="japan"].selected {
    border-color: #ff2222;
    box-shadow: 0 0 20px rgba(255, 34, 34, 0.3), inset 0 0 20px rgba(255, 34, 34, 0.05);
}

.character-card[data-character="munich"].selected {
    border-color: #FFD700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3), inset 0 0 20px rgba(255, 215, 0, 0.05);
}

.character-card[data-character="berlin"].selected {
    border-color: #00BCD4;
    box-shadow: 0 0 20px rgba(0, 188, 212, 0.3), inset 0 0 20px rgba(0, 188, 212, 0.05);
}

.character-card[data-character="realestate"].selected {
    border-color: #2E7D32;
    box-shadow: 0 0 20px rgba(46, 125, 50, 0.3), inset 0 0 20px rgba(46, 125, 50, 0.05);
}

.character-card[data-character="dhipaya"].selected {
    border-color: #00bfff;
    box-shadow: 0 0 20px rgba(0, 191, 255, 0.3), inset 0 0 20px rgba(0, 191, 255, 0.05);
}

.character-preview {
    width: 100px;
    height: 100px;
    margin: 0 auto 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.matrix-preview {
    background: radial-gradient(circle, rgba(0, 255, 65, 0.15), rgba(0, 20, 0, 0.8));
    border: 1px solid rgba(0, 255, 65, 0.3);
}

.callcenter-preview {
    background: radial-gradient(circle, rgba(0, 191, 255, 0.15), rgba(0, 10, 30, 0.8));
    border: 1px solid rgba(0, 191, 255, 0.3);
}

.preview-face {
    text-align: center;
    position: relative;
}

.preview-eyes {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-bottom: 4px;
}

.preview-eye {
    width: 10px;
    height: 10px;
    background: #00ff41;
    border-radius: 50%;
    box-shadow: 0 0 8px #00ff41;
}

.preview-eye.cc-eye {
    background: #00bfff;
    box-shadow: 0 0 8px #00bfff;
}

.preview-mustache {
    font-size: 14px;
    color: #00ff41;
    line-height: 1;
}

.preview-mouth {
    font-size: 12px;
    color: rgba(0, 255, 65, 0.6);
    margin-top: 2px;
}

.preview-headset {
    font-size: 28px;
    color: #00bfff;
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    text-shadow: 0 0 8px #00bfff;
}

.preview-smile {
    font-size: 18px;
    color: #00bfff;
    margin-top: 2px;
}

.cc-face {
    padding-top: 8px;
}

/* Japan mummy preview */
.japan-preview {
    background: radial-gradient(circle, rgba(255, 34, 34, 0.15), rgba(20, 0, 0, 0.8));
    border: 1px solid rgba(255, 34, 34, 0.3);
}

.preview-eye.japan-eye {
    background: #ff2222;
    box-shadow: 0 0 8px #ff2222;
}

.japan-face {
    padding-top: 4px;
}

.preview-bandage {
    font-size: 14px;
    color: rgba(255, 34, 34, 0.5);
    letter-spacing: 2px;
    margin-top: 4px;
}

/* Munich SpongeBob preview */
.munich-preview {
    background: radial-gradient(circle, rgba(255, 215, 0, 0.2), rgba(20, 15, 0, 0.8));
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 20%;
}

.preview-eye.munich-eye {
    width: 14px;
    height: 14px;
    background: #4fc3f7;
    box-shadow: 0 0 8px #4fc3f7;
    border: 2px solid #FFD700;
}

.munich-face {
    padding-top: 4px;
}

.preview-buck-teeth {
    font-size: 10px;
    color: #fff;
    line-height: 1;
    margin-top: 2px;
}

.munich-smile {
    color: #FFD700 !important;
    font-size: 16px !important;
}

/* Berlin engineer preview */
.berlin-preview {
    background: radial-gradient(circle, rgba(0, 188, 212, 0.15), rgba(0, 15, 20, 0.8));
    border: 1px solid rgba(0, 188, 212, 0.3);
}

.preview-eye.berlin-eye {
    background: #00BCD4;
    box-shadow: 0 0 8px #00BCD4;
}

.berlin-face {
    padding-top: 4px;
}

.preview-terminal {
    font-size: 10px;
    color: rgba(0, 188, 212, 0.6);
    letter-spacing: 1px;
    margin-top: 4px;
}

/* Realestate preview */
.realestate-preview {
    background: radial-gradient(circle, rgba(46, 125, 50, 0.15), rgba(5, 15, 5, 0.8));
    border: 1px solid rgba(46, 125, 50, 0.3);
}

/* Dhipaya insurance preview */
.dhipaya-preview {
    background: radial-gradient(circle, rgba(0, 191, 255, 0.15), rgba(0, 10, 30, 0.8));
    border: 1px solid rgba(0, 191, 255, 0.3);
}

.preview-eye.dhipaya-eye {
    background: #00bfff;
    box-shadow: 0 0 8px #00bfff;
}

.character-card {
    width: 180px;
    padding: 16px 12px;
}

.character-name {
    font-size: 15px;
    letter-spacing: 2px;
    margin-bottom: 6px;
    color: #fff;
}

.character-desc {
    font-size: 11px;
    opacity: 0.5;
    color: #aaa;
    line-height: 1.4;
}

#start-btn {
    font-family: 'Share Tech Mono', monospace;
    font-size: 18px;
    letter-spacing: 3px;
    color: #00ff41;
    background: transparent;
    border: 2px solid #00ff41;
    padding: 14px 40px;
    cursor: pointer;
    transition: all 0.3s;
    text-shadow: 0 0 10px #00ff41;
    box-shadow: 0 0 15px rgba(0, 255, 65, 0.2), inset 0 0 15px rgba(0, 255, 65, 0.1);
}

#start-btn:hover {
    background: rgba(0, 255, 65, 0.15);
    box-shadow: 0 0 30px rgba(0, 255, 65, 0.4), inset 0 0 30px rgba(0, 255, 65, 0.2);
    transform: scale(1.05);
}

.character-card[data-character="interpreter"].selected {
    border-color: #20B2AA;
    box-shadow: 0 0 20px rgba(32, 178, 170, 0.3), inset 0 0 20px rgba(32, 178, 170, 0.05);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .start-content h1 { font-size: 36px; letter-spacing: 4px; }
    .start-content { max-width: 100%; padding: 0 10px; }
    .character-select { gap: 10px; }
    .character-card { width: calc(33.3% - 10px); min-width: 100px; padding: 10px 6px; }
    .character-name { font-size: 11px; letter-spacing: 1px; }
    .character-desc { font-size: 9px; }
    .preview-face { transform: scale(0.8); }
}

@media (max-width: 400px) {
    .character-card { width: calc(33.3% - 8px); min-width: 90px; padding: 8px 4px; }
    .character-name { font-size: 10px; }
}
