#languageSelectionOverlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    align-items: center;
    justify-content: center;
    z-index: 10000;
    display: none;
}

#languageSelectionOverlay.hidden {
    display: none;
}

.user-input {
    width: 70%;
    resize: none;
    transition: height 0.25s ease, background .25s ease;
    margin: 24px 32px;
    color: #6f6f6f;
    font-family: "Consolas", "Courier New", sans-serif;
    font-weight: 500;
    font-size: 26px;
    line-height: 36px;
    outline: none;
    max-height: 50vh;
    overflow-y: auto;
    display: none;
    padding-top: 8px;
    white-space-collapse: collapse !important;
    clear: both;
    position: relative;
    caret-color: transparent;
    cursor: default;
}

.user-input:empty:after {
    content: "";
    display: block;
    left: 0;
    top: 0;
    width: 12px;
    height: 24px;
    color: #00ff00;
    position: absolute;

    font-size: 24px;
    line-height: 36px;
    margin-top: 12px;
    margin-left: 32px;
    background: #00ff00;
    pointer-events: none;
    user-select: none;
    animation: blink 1s infinite;
    transition: opacity 0.5s ease;
}

.user-input:not(:empty):after {
    content: "";
    display: block;
    width: 12px;
    height: 24px;
    position: absolute;
    background: #00ff00;
    pointer-events: none;
    user-select: none;
    animation: blink 1s infinite;
    left: var(--caret-left, 36px);
    top: var(--caret-top, 16px);
}

.user-input.typing:not(:empty):after {
    animation: none;
    opacity: 1;
}

@keyframes blink {
    0% {
        opacity: 0.55;
    }

    35% {
        opacity: 0;
    }

    75% {
        opacity: 0;
    }

    100% {
        opacity: 0.55;
    }
}

.user-input *::empty {
    display: none;
}

.user-input:before {
    content: ">";
    padding-left: 12px;
    padding-right: 12px;
    color: #39651f;
    font-weight: 500;
}

.user-input:active,
.user-input:focus {
    color: #40ff18;
}

body.chat-mode .user-input {
    display: block;
    margin-top: 64px;
}

.user-input::selection {
    background: #673a67;
    color: #ffffff;
}

.user-input::-webkit-scrollbar {
    width: 8px;
}

.user-input::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
}

.user-input::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.user-input::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}


#languageCards {
    display: flex;
    gap: 30px;
    padding: 40px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 1200px;
}

.language-card {
    background: linear-gradient(135deg, rgba(30, 30, 30, 0.9), rgba(50, 50, 50, 0.8));
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 30px 20px;
    width: 128px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    opacity: 0.55;
    transition: all .15s linear;
}

.language-card:hover {
    border-color: rgba(0, 255, 0, 0.5);
    box-shadow: 0 12px 48px rgba(0, 255, 0, 0.2);
    background: linear-gradient(135deg, rgba(40, 40, 40, 0.95), rgba(60, 60, 60, 0.9));
    position: relative;
    opacity: 1;
}


.language-card .fi {
    font-size: 64px;
    margin-bottom: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.language-info {
    display: flex;
    width: 100%;
    flex-direction: column;
    justify-content: space-evenly;
    align-items: center;
    align-content: center;
    height: 100%;
}

.language-info h2 {
    font-family: 'Jost', sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 15px 0;
    letter-spacing: 0.5px;
}

.language-info p {
    font-family: 'Jost', sans-serif;
    font-size: 14px;
    font-weight: 400;
    color: #b0b0b0;
    margin: 8px 0;
    line-height: 1.6;
}

.language-desc {
    min-height: 60px;
    color: #d0d0d0 !important;
}

.language-tools {
    font-size: 13px !important;
    color: #00ff00 !important;
    font-weight: 500 !important;
    min-height: 40px;
}

html,
body {
    font-family: 'Jost', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #1a0a07;
    background-image: url(/static/gfx/pcb.png);
    overflow: hidden;
    height: 100%;
}

body.chat-mode #volumeCanvas {
    display: none;
}

body.chat-mode #callControls {
    display: none;
}

* {
    font-family: "Jost", Tahoma, Geneva, Verdana, sans-serif;
}


#statusDisplay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10000;
    pointer-events: none;
    display: none;
}

#statusDisplay.active {
    display: block;
}

#statusText {
    color: white;
    font-size: 18px;
    font-weight: 400;
    text-align: center;
    white-space: nowrap;
    opacity: 1;
    transition: opacity 0.3s ease;
}


#statusLinear {
    margin: 10px auto 0 auto;
    width: 260px;
    height: 6px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    overflow: hidden;
    opacity: 1;
    transition: opacity 0.4s ease 0.15s;
    display: none;
}

#statusLinearBar {
    height: 100%;
    width: 0%;
    background: #5ce600;
    border-radius: 4px;
    transition: width 0.25s ease, opacity 0.4s ease;
}


#statusLinear.is-done {
    opacity: 0;
}

div#subtitle {
    position: absolute;
    background: none;
    font-size: 18px;
    text-align: center;
    width: 400px;
    bottom: 15%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    border-radius: 4px;
    z-index: 10000;
    pointer-events: none;
    user-select: none;
}

#textInputWindow {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    width: 400px;
    height: 300px;
    background-color: rgb(0 0 0);
    background-image: url(/static/gfx/bg.png);
    border-radius: 4px;
    z-index: 10002;
    resize: both;
    overflow: hidden;
    min-width: 300px;
    min-height: 200px;
    padding-bottom: 20px;
    box-shadow: 8px 8px 16px #000000;
    border: 1px solid #2a2a2a;
    border-top: none;
}

#textInputHeader {
    background-color: #2a2a2a;
    padding: 6px 20px;
    cursor: move;
    user-select: none;
}

#textInputHeader span {
    color: #cccccc;
    font-family: Jost, sans-serif;
    font-size: 16px;
    font-weight: 500;
    text-transform: uppercase;
}

#closeTextInput {
    background: transparent;
    border: none;
    color: #ff4444;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    line-height: 20px;
    float: right;
}

#resetTextInput,
#resetDebugConsole {
    right: 48px;
    position: absolute;
    background: transparent;
    border: none;
    color: #676767;
    font-size: 20px;
    line-height: 24px;
    cursor: pointer;
}

#resetTextInput:hover,
#resetDebugConsole:hover {
    color: #868686;
}

#closeTextInput:hover {
    color: #ff6666;
}

#textInputWindow .input-content {
    padding: 15px;
    display: flex;
    flex-direction: column;
    height: calc(100% - 54px);
}

#textInputArea {
    flex: 1;
    background: #1a1a1a;
    color: #fff;
    border: none;
    border-radius: 2px;
    padding: 10px;
    font-family: Jost, sans-serif;
    font-size: 18px;
    resize: none;
    outline: none;
    font-weight: normal;
    box-shadow: 4px 3px 6px #000000ba inset;
}

#textInputArea::placeholder {
    color: #2c2c2c;
}


#textInputWindow .button-row {
    margin-top: 10px;
    display: flex;
    gap: 10px;
}

#sendTextBtn {
    flex: 1;
    background: #1b5e00;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    padding: 10px;
    font-family: Jost, sans-serif;
    cursor: pointer;
}

#sendTextBtn:hover {
    background: #2d9e00;
}

#clearTextBtn {
    background: #333;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 10px 20px;
    font-family: Jost, sans-serif;
    cursor: pointer;
}

#clearTextBtn:hover {
    background: #444;
}


.notification-container {
    position: fixed;
    bottom: 20px;
    left: 20px;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    z-index: 10000;
    pointer-events: none;
}

@media (max-width: 768px) {
    .notification-container {
        top: 20px;
        bottom: auto;
    }
}

.notification {
    width: 300px;
    height: 64px;
    background: rgba(0, 0, 0, 0.85);
    border-radius: 4px;
    display: flex;
    align-items: center;
    padding: 8px;
    gap: 8px;
    font-family: Jost, system-ui, -apple-system, sans-serif;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.notification.show {
    opacity: 1;
}

.notification-icon {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    object-fit: contain;
}

.notification-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0px;
    overflow: hidden;
}

.notification-title {
    color: #00ff00;
    font-size: 20px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notification-description {
    color: #999999;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


#debugConsole {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    width: 600px;
    height: 400px;
    background: rgb(0 0 0 / 67%);
    border-radius: 4px;
    z-index: 10003;
    resize: both;
    overflow: hidden;
    min-width: 400px;
    min-height: 300px;
    padding-bottom: 20px;
    box-shadow: 4px 4px 12px #000;
    border: 1px solid #2a2a2a;
    border-top: none;
    background-color: rgb(0 0 0);
    background-image: url(/static/gfx/bg.png);
}

#debugHeader {
    background: #2a2a2a;
    padding: 6px 20px;
    cursor: move;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

#debugHeader span {
    color: #cccccc;
    font-family: Jost, sans-serif;
    font-size: 16px;
}

#closeDebugConsole {
    background: transparent;
    border: none;
    color: #ff4444;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    line-height: 20px;
}

#closeDebugConsole:hover {
    color: #ff6666;
}

.debug-content {
    height: calc(100% - 38px);
    overflow-y: auto;
    /* padding: 10px; */
}

#debugLog {
    list-style: none;
    margin: 0;
    padding: 0;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.4;
}

#debugLog li {
    padding: 4px 16px;
    white-space: pre-wrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: 'Consolas', 'Courier New', monospace;
    color: #8b8b8b;
}

#debugLog li:nth-child(odd) {
    border-bottom: 1px dashed #363a09;

}

#debugLog li:nth-child(even) {
    border-bottom: 1px dashed #363a09;

}

li.topic-message {
    color: #00ffc2;

}

#debugLog li.ai-message {
    color: #00ff00;
}

#debugLog li.user-message {
    color: #9370db;
}

#debugLog li.text-input-message {
    color: #ba55d3;
}

#debugLog li.system-message {
    color: #999999;

}

.debug-content::-webkit-scrollbar {
    width: 8px;
}

.debug-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
}

.debug-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.debug-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}


#categoryIndicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.85);
    color: #00ff00;
    padding: 8px 16px;
    border-radius: 20px;
    font-family: Jost, sans-serif;
    font-size: 13px;
    font-weight: 600;
    z-index: 9999;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(0, 255, 0, 0.3);
}

#categoryIndicator.show {
    opacity: 1;
    transform: translateY(0);
}


#callControls {
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    gap: 20px;
    z-index: 9998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#callControls.connected {
    display: flex;
}

#callControls.connected:hover {
    opacity: 1 !important;
    pointer-events: auto;
}

body:hover #callControls.connected {
    opacity: 0.8;
    pointer-events: auto;
}


#callControls.touch-visible {
    opacity: 1 !important;
    pointer-events: auto !important;
}

.call-control-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: none;
    background: rgba(50, 50, 50, 0.9);
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.call-control-btn:hover {
    transform: scale(1.1);
    background: rgba(70, 70, 70, 0.95);
}

.call-control-btn.end-call {
    background: rgba(220, 20, 20, 0.9);
}

.call-control-btn.end-call:hover {
    background: rgba(255, 30, 30, 0.95);
}

.call-control-btn.muted {
    background: rgba(255, 140, 0, 0.9);
}

.call-control-btn.muted:hover {
    background: rgba(255, 160, 0, 0.95);
}

.call-control-btn i {
    pointer-events: none;
}


#canvas {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    opacity: 1;
    transition: opacity .45 ease-in-out !important;
}

.fade {
    opacity: .20 !important;
}

#galleryCanvas {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: auto;
}

#volumeCanvas {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 64px;
    height: 260px;
    z-index: 9997;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    cursor: pointer;
}

#volumeCanvas.connected {
    pointer-events: auto;
}

#volumeCanvas.connected:hover {
    opacity: 1;
}

body:hover #volumeCanvas.connected {
    opacity: 0.6;
}


#volumeCanvas.touch-visible,
#volumeCanvas.volume-active {
    opacity: 1 !important;
}


#disconnectionBox {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgb(0 0 0 / 43%);
    color: #6f6f6f;
    padding: 12px 32px;
    border-radius: 8px;
    border: 0px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 1000;
    font-size: 14px;
    font-family: 'Jost', system-ui, -apple-system, sans-serif;
    flex-direction: column;
    flex-wrap: nowrap;
    align-content: center;
}

#disconnectionBox div {
    display: block;
    font-size: 18px;
}

#disconnectionBox button {
    background: #1b5e00;
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    text-shadow: 0 0 4px black;
    margin-right: 6px;
}

#disconnectionBox button:hover {
    background: #247002;
}

#disconnectionBox button.secondary {
    background: #4d4d4d;

}

#disconnectionBox button.secondary:hover {
    background: #636363;
}

#disconnectionBox~#topRightControls,
body.disconnected #topRightControls {
    opacity: 0 !important;
    pointer-events: none !important;
}

#topRightControls {
    position: fixed;
    top: 24px;
    right: 32px;
    z-index: 9998;
    /* opacity: 0; */
    transition: opacity 0.3s ease;
    pointer-events: none;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-direction: row-reverse;
}

#topRightControls.connected {
    pointer-events: auto;
}

body:hover #topRightControls.connected {
    opacity: 1;
}

#topRightControls.touch-visible {
    opacity: 1 !important;
}


#connectionQuality {
    --signal-color: #00ff00;
    display: inline-flex;
    align-items: flex-end;
    height: 24px;
    padding: 2px 4px;
    border-radius: 4px;


    cursor: default;
}

#connectionQuality .signal-bars {
    display: inline-flex;
    align-items: flex-end;
}

#connectionQuality .bar {
    width: 3px;
    margin: 0 1px;
    background: rgba(255, 255, 255, 0.18);
    border-radius: 1px;
    transition: background-color 0.2s ease, opacity 0.2s ease;
    opacity: 0.6;
}

#connectionQuality .bar-1 {
    height: 8px;
}

#connectionQuality .bar-2 {
    height: 12px;
}

#connectionQuality .bar-3 {
    height: 16px;
}

#connectionQuality .bar-4 {
    height: 20px;
}

#connectionQuality .bar-5 {
    height: 24px;
}

#connectionQuality .bar.active {
    background: var(--signal-color);
    opacity: 1;
}

#connectionQuality.weak {
    --signal-color: #ff4d4d;
}


#connectionQuality.fair {
    --signal-color: #ffb84d;
}


#connectionQuality.good {
    --signal-color: #e6ff4d;
}


#connectionQuality.strong {
    --signal-color: #00ff66;
}

.utility-btn {
    width: 32px;
    height: 32px;
    border-radius: 10%;
    border: none;
    background: rgba(80, 80, 80, 0.8);
    color: #ccc;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    opacity: 0.25;
}

.utility-btn:hover {
    background: rgba(100, 100, 100, 0.9);
    color: #fff;
    transform: scale(1.1);
}

.utility-btn.active {
    opacity: 1;
}


#customModeSelector {
    position: relative;
    margin-right: 8px;
}

#modeSelectorButton {
    background: rgba(0, 0, 0, 0.55);
    padding: 8px 12px 8px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Jost', sans-serif;
    font-size: 14px;
    color: #ccc;
    border-radius: 6%;
}

#modeSelectorButton:hover {
    background: rgba(20, 20, 20, 0.95);
    border-color: rgba(255, 255, 255, 0.3);
}

#currentModeIcon {
    font-size: 14px;
    line-height: 1;
}

#currentModeText {
    font-weight: 500;
}

#modeSelectorButton i.fa-chevron-down {
    font-size: 10px;
    transition: transform 0.2s ease;
}

#customModeSelector.open #modeSelectorButton i.fa-chevron-down {
    transform: rotate(180deg);
}

#modeDropdownMenu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: rgba(20, 20, 20, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    min-width: 120px;
    display: none;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

#customModeSelector.open #modeDropdownMenu {
    display: flex;
}

.mode-option {
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: background 0.2s ease;
    font-family: 'Jost', sans-serif;
    font-size: 14px;
    color: #ccc;
}

.mode-option:hover {
    background: rgba(40, 40, 40, 0.95);
    color: #fff;
}

.mode-option i {
    font-size: 14px;
}

.mode-option.selected {
    background: rgba(0, 255, 0, 0.1);
    color: #00ff00;
}

#customLanguageSelector {
    position: relative;
}

#languageSelectorButton {
    background: rgba(0, 0, 0, 0.55);
    padding: 8px 12px 8px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Jost', sans-serif;
    font-size: 14px;
    color: #ccc;
    border-radius: 6%;
}

#languageSelectorButton:hover {
    background: rgba(20, 20, 20, 0.95);
    border-color: rgba(255, 255, 255, 0.3);
}

#currentFlag {
    font-size: 20px;
    line-height: 1;
    opacity: .5;
}

#currentLangText {
    font-weight: 500;
}

#languageSelectorButton i {
    font-size: 10px;
    transition: transform 0.2s ease;
}

#customLanguageSelector.open #languageSelectorButton i {
    transform: rotate(180deg);
}

#languageDropdownMenu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: rgba(20, 20, 20, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    min-width: 140px;
    display: none;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

#customLanguageSelector.open #languageDropdownMenu {
    display: flex;
}

.lang-option {
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: background 0.2s ease;
    font-family: 'Jost', sans-serif;
    font-size: 14px;
    color: #ccc;
}

.lang-option:hover {
    background: rgba(40, 40, 40, 0.95);
    color: #fff;
}

.lang-option .fi {
    font-size: 18px;
}

.lang-option.selected {
    background: rgba(0, 255, 0, 0.1);
    color: #00ff00;
}

/* Upward opening dropdown for bottom positioning */
#customLanguageSelector.open-upward #languageDropdownMenu {
    top: auto;
    bottom: calc(100% + 4px);
    flex-direction: column-reverse;
}

/* Animation for upward opening */
#customLanguageSelector.open-upward #languageDropdownMenu {
    animation: slideUp 0.2s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.image-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    animation: fadeIn 0.3s ease;
}

.image-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    animation: zoomIn 0.3s ease;
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #ff4444;
    font-size: 50px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease;
    z-index: 1001;
    line-height: 40px;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-modal:hover,
.close-modal:focus {
    color: #ff6666;
    transform: scale(1.1);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes zoomIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.alertBox {
    pointer-events: none;
    user-select: none;
    width: 200px;
    height: 48px;
    overflow: hidden;
    z-index: 999;
    opacity: 0;
    display: block;
    position: absolute;
    top: calc(50% - 24px);
    left: calc(50% - 100px);
    z-index: 99999;
    transition: opacity .35s ease-in-out;
}

.alertBox.active {
    opacity: 1;
}

.alertBox:before {
    display: block;
    content: "";
    width: 100%;
    height: 100%;
    animation: bgpulse 1s linear infinite;
    position: absolute;
    left: 0;
    top: 0;
    background: linear-gradient(135deg, #464612 0%, #464629 100%);
}

.scrollText {
    position: absolute;
    white-space: nowrap;
    font-family: 'Jost', Arial, sans-serif;
    font-size: 32px;
    font-weight: 500;
    color: #968d3f;
    text-transform: uppercase;
    animation: scroll 64s linear infinite;
    line-height: 48px;
}

.alertBox.static .scrollText {
    animation: none;
    text-align: center !important;
    width: 100%;
    color: #00e1e1 !important;

}

.alertBox.static {
    text-align: center !important;
    transition: none;
}

@keyframes scroll {
    0% {
        left: 0;
    }

    100% {
        left: -2000%;
    }
}

@keyframes bgpulse {
    0% {
        opacity: .4;
    }

    50% {
        opacity: 0.1;
    }

    100% {
        opacity: .4;
    }

}

.cornerTL {
    position: absolute;
    top: 0;
    left: 0;
    width: 6px;
    height: 6px;
    border-top: 1px solid #8d8d0f;
    border-left: 1px solid #8d8d0f;
}

.cornerTR {
    position: absolute;
    top: 0;
    right: 0;
    width: 6px;
    height: 6px;
    border-top: 1px solid #8d8d0f;
    border-right: 1px solid #8d8d0f;
}

.cornerBL {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 6px;
    height: 6px;
    border-bottom: 1px solid #8d8d0f;
    border-left: 1px solid #8d8d0f;
}

.cornerBR {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 6px;
    height: 6px;
    border-bottom: 1px solid #8d8d0f;
    border-right: 1px solid #8d8d0f;
}

.alertBox span {
    opacity: 0.85;
}

.alertBox.small {
    height: 24px;
}

.alertBox.small .scrollText {
    font-size: 14px;
    line-height: 24px;
}

.alertBox.error * {
    border-color: #8d0f0f;
    color: #b94f4f !important;
}

.alertBox.error:before {
    background: linear-gradient(135deg, #461212 0%, #462929 100%);
}

.alertbox.error .scrollText {
    color: #963f3f !important;
}

.alertBox * {
    border-color: #0f8d28;
    color: #0f8d28 !important;
}

.alertBox:before {
    background: linear-gradient(135deg, #154612 0%, #294629 100%);
}

.alertbox .scrollText {
    color: #0f8d28 !important;
}

.alertBox.static:before {
    animation: bgpulse 3s linear infinite;
}

.alertBox.static * {
    border-color: #447e7e;
}

.alertBox.static:before {
    background: linear-gradient(0deg, #447e7e 0%, #447e7e 100%);
}


@media (max-width: 768px) {
    .language-info {
        display: none;
    }

    .language-card {
        padding: 0;
        background: #84000000;
        bordeR: none;
    }

    #topRightControls {
        top: auto;
        bottom: 24px;
        /* right: 16px; */
        display: flex;
        flex-wrap: nowrap;
        justify-content: center;
        align-content: flex-end;
    }

    #disconnectionBox {
        display: flex;
        width: 100%;
        align-content: center;
        background: none;
        bottom: 64px;
    }

    /* Hide debug and text input toggle buttons on mobile */
    #toggleDebugBtn,
    #toggleTextBtn {
        display: none !important;
    }

    /* Ensure debug console and text input window are hidden on mobile */
    #debugConsole,
    #textInputWindow {
        display: none !important;
    }
}

.overlay {
    position: fixed;
    background: rgb(0 0 0);
    font-family: 'Jost', system-ui, sans-serif;
    color: #fff;
    user-select: none;
    pointer-events: auto;
}

.overlay--data-counter {
    top: 12px;
    left: 12px;
    z-index: 10000;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 13px;
    line-height: 18px;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.overlay--data-counter span {
    font-family: "Consolas", "Courier new", monospace;
}


/* Data counter color styles */
.overlay--data-counter .data-sent {
    color: #ff9999;
}

.overlay--data-counter .data-received {
    color: #99ff99;
}

.overlay--data-counter .data-speed {
    color: #999999;
}

/* Hide data transfer counter in chat mode */
.chat-mode .overlay--data-counter {
    display: none !important;
}

.overlay--token-counter {
    top: 12px;
    left: 12px;
    z-index: 10000;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 13px;
    line-height: 18px;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

/* Token counter color styles */
.overlay--token-counter .token-input {
    color: #ff9999;
}

.overlay--token-counter .token-output {
    color: #99ff99;
}

.overlay--token-counter .token-cost {
    color: #ffffff;
}

.overlay--token-counter .token-context {
    color: #999999;
}

/* Flash animation for value updates */
@keyframes flash-yellow {
    0% {
        color: #ffff00;
        text-shadow: 0 0 8px rgba(255, 255, 0, 0.8);
    }

    100% {
        color: inherit;
        text-shadow: none;
    }
}

.flash-update {
    animation: flash-yellow 0.6s ease-out;
}

/* Hide token counter in voice mode */
body:not(.chat-mode) .overlay--token-counter {
    display: none !important;
}

.overlay--clip-monitor {
    top: 12px;
    right: 12px;
    z-index: 20000;
    min-width: 160px;
    max-width: 220px;
    padding: 6px 10px 8px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 17px;
    color: #d0f0ff;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.overlay__title {
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #9bd8ff;
    margin-bottom: 4px;
}

.clip-list {
    display: flex;
    gap: 2px;
    flex-direction: column;
    flex-wrap: nowrap;
    align-content: flex-start;
    justify-content: flex-start;
    align-items: stretch;
}

.clip-list__item:nth-child(odd) {
    background: #1a1a1a;
}

.clip-list__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-direction: row;
}

.clip-list__duration {
    color: #bfffc9;
}

.clip-list__status {
    font-size: 11px;
    color: #bfffc9;
}

.clip-list__controls {
    display: flex;
    gap: 4px;
    align-items: center;
}

.clip-list__btn {
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: inherit;
    padding: 2px 4px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 10px;
    transition: background 0.2s ease;
    text-decoration: none;
}

.clip-list__btn:hover,
.clip-list__btn:focus-visible {
    background: rgb(130 130 130);
    outline: none;
}

.clip-list__btn:active {
    background: rgb(76 0 0);
    outline: none;
}

.clip-list__item.is-skipped .clip-list__duration,
.clip-list__item.is-skipped .clip-list__status,
.clip-list__item.is-skipped .clip-list__btn {
    color: #ffb3b3;
}

#clipWindow {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    width: 360px;
    height: 320px;
    min-width: 260px;
    min-height: 220px;
    resize: both;
    overflow: hidden;
    transform: translate(-50%, -50%);
    border-radius: 4px;
    border: 1px solid #2a2a2a;
    border-top: none;
    box-shadow: 4px 4px 12px #000;
    z-index: 10003;
    background-color: rgb(0 0 0);
    background-image: url(/static/gfx/bg.png);
}

#clipWindowHeader {
    position: absolute;
    background: #2a2a2a;
    padding: 6px 12px;
    cursor: move;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
    left: 0;
    top: 0;
    width: calc(100% - 24px);

}

#clipWindowHeader span {
    color: #cccccc;
    font-family: Jost, sans-serif;
    font-size: 16px;
}

.clip-window-controls {
    display: flex;
    gap: 6px;
    align-items: center;
}

.clip-window-btn {
    background: transparent;
    border: none;
    color: #868686;
    font-size: 18px;
    width: 24px;
    height: 24px;
    line-height: 22px;
    text-align: center;
    border-radius: 2px;
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease;
}

.clip-window-btn:hover,
.clip-window-btn:focus-visible {
    color: #cccccc;
    background: rgba(255, 255, 255, 0.08);
    outline: none;
}

.clip-window-btn--close {
    color: #ff5d5d;
}

.clip-window-btn--close:hover,
.clip-window-btn--close:focus-visible {
    color: #ff7a7a;
}

.clip-window-btn--reset {
    color: #87d3ff;
}

.clip-window-btn--reset:hover,
.clip-window-btn--reset:focus-visible {
    color: #aee3ff;
}

#clipWindowContent {
    height: calc(100% - 38px);
    overflow-y: auto;
    padding-right: 4px;
    padding-top: 48px;
}

#clipWindow.is-collapsed {
    height: auto;
    min-height: 0;
    resize: none;
}

#clipWindow.is-collapsed #clipWindowContent {
    display: none;
}

.clip-list__empty {
    padding: 12px;
    text-align: center;
    font-size: 13px;
    color: #8ea1af;
}

/* Microphone Modal */
.mic-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

.mic-modal__box {
    text-align: center;
    max-width: 400px;
}

.mic-modal__msg {
    color: #91c6e9;
    font-size: 1.25em;
    /* margin-bottom: 24px; */
    /* line-height: 1.5; */
    background: #0e2a3a;
    padding: 12px 24px;
    border-radius: 4px;
    text-transform: uppercase;
}

.mic-modal__actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.mic-modal__btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    background: #fff;
    color: #000;
    font-size: 14px;
    cursor: pointer;
    font-weight: 500;
}

.mic-modal__btn--secondary {
    background: transparent;
    color: #fff;
}

.mic-modal__btn:hover {
    opacity: 0.9;
}

.mic-modal__btn--secondary:hover {
    border-color: #666;
}