* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body {
    background: #0f172a;
    color: #e5e7eb;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    padding: 1.5rem 1rem;
    max-width: 960px;
    margin: 0 auto;
}

header h1 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

header p {
    color: #cbd5f5;
    font-size: 0.95rem;
}

main {
    flex: 1;
    max-width: 960px;
    margin: 0 auto 2rem;
    padding: 0 1rem;
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: 1.5rem;
}

@media (max-width: 800px) {
    main {
        grid-template-columns: 1fr;
    }
}

.video-section, .text-section, .info-section {
    background: #020617;
    border-radius: 1rem;
    padding: 1rem;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.3);
}

/* МЫҚТЫ, ТҰРАҚТЫ ӨЛШЕМ ҮШІН ASPECT-RATIO ҚОСТЫҚ */
.video-wrapper {
    position: relative;
    border-radius: 0.75rem;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.4);
    background: #020617;
    aspect-ratio: 4 / 3;
}

/* Видео мен canvas-ты толық wrapper-ге жайамыз */
video#video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 1 !important;      /* басқа стильдер басып тастамасын деп */
    z-index: 1;
    background: #020617;
}

/* Overlay – үстінде, бірақ transparent */
#overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
    background: transparent !important;
}

/* Бұрынғы жалпы ереже керек емес, бірақ қалдырсақ та зиян емес:
video, canvas {
    width: 100%;
    height: auto;
    display: block;
}
*/

.status-badge {
    position: absolute;
    bottom: 0.75rem;
    left: 0.75rem;
    background: rgba(15, 23, 42, 0.85);
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    font-size: 0.8rem;
    border: 1px solid rgba(148, 163, 184, 0.4);
    z-index: 3;
}

.controls {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

button {
    flex: 1;
    padding: 0.6rem 0.9rem;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: transform 0.1s ease, box-shadow 0.1s ease, opacity 0.2s;
}

#startBtn {
    background: #22c55e;
    color: #022c22;
    box-shadow: 0 8px 18px rgba(34, 197, 94, 0.4);
}

#startBtn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

#stopBtn {
    background: #f97316;
    color: #1b1205;
    box-shadow: 0 8px 18px rgba(249, 115, 22, 0.4);
}

button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 14px 25px rgba(15, 23, 42, 0.7);
}

button:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.7);
}

.text-section h2, .info-section h2 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
}

.recognized-text {
    min-height: 6rem;
    padding: 0.75rem;
    border-radius: 0.75rem;
    background: #020617;
    border: 1px solid rgba(148, 163, 184, 0.6);
    font-size: 1rem;
    line-height: 1.5;
}

.hint {
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: #9ca3af;
}

.hint ul {
    margin-left: 1.1rem;
}

.gesture-debug {
    font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.8rem;
    color: #a5b4fc;
}

.info-section {
    grid-column: 1 / -1;
    margin-top: 1rem;
    font-size: 0.95rem;
    color: #d1d5db;
}

.info-section ol {
    margin-left: 1.1rem;
    margin-bottom: 0.75rem;
}

.info-section li {
    margin-bottom: 0.35rem;
}

footer {
    padding: 0.75rem 1rem 1.2rem;
    text-align: center;
    font-size: 0.8rem;
    color: #6b7280;
}
