/* Projektor-Ansicht - Vollbild, kein UI */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
}

body:not(.show-toolbar):not(.calibrating) {
    cursor: none;
}

#table-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#tableCanvas {
    display: block;
}

/* ================================
   Projektor-Toolbar (unter dem Tisch)
   ================================ */
#projector-toolbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.85);
    z-index: 15;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

body.show-toolbar #projector-toolbar {
    opacity: 1;
    pointer-events: auto;
}

/* Toolbar bei Mausbewegung einblenden */
body.calibrating #projector-toolbar {
    opacity: 0;
    pointer-events: none;
}

#projector-toolbar button {
    background: #333;
    color: #ccc;
    border: 1px solid #555;
    padding: 8px 18px;
    border-radius: 6px;
    font-family: Arial, sans-serif;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s;
}

#projector-toolbar button:hover {
    background: #555;
    color: #fff;
}

/* Status-Anzeige (nur bei Problemen sichtbar) */
#status {
    position: fixed;
    top: 10px;
    right: 10px;
    padding: 6px 12px;
    border-radius: 4px;
    font-family: Arial, sans-serif;
    font-size: 12px;
    color: #fff;
    background: rgba(0,0,0,0.6);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: 10;
}

#status.visible {
    opacity: 1;
}

#status.error {
    background: rgba(200,0,0,0.8);
}

#status.connected {
    background: rgba(0,150,0,0.8);
}

/* Warte-Bildschirm */
#waiting {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #666;
    font-family: Arial, sans-serif;
    z-index: 5;
    transition: opacity 0.5s;
    cursor: pointer;
}

#table-container {
    cursor: pointer;
}

#waiting.hidden {
    opacity: 0;
    pointer-events: none;
}

#waiting h1 {
    font-size: 28px;
    margin-bottom: 10px;
    color: #888;
}

#waiting p {
    font-size: 16px;
    color: #555;
}

#waiting .hint {
    margin-top: 20px;
    font-size: 13px;
    color: #444;
}

#waiting kbd {
    background: #333;
    color: #aaa;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: monospace;
    border: 1px solid #555;
}

/* ================================
   Kalibrierungs-Overlay (4-Ecken-Warp)
   ================================ */
#calibration-overlay {
    position: fixed;
    inset: 0;
    z-index: 20;
}

.corner-handle {
    position: fixed;
    width: 40px;
    height: 40px;
    border: 3px solid #ff4444;
    border-radius: 50%;
    background: rgba(255, 68, 68, 0.3);
    color: #ff4444;
    font-family: Arial, sans-serif;
    font-size: 11px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    transform: translate(-50%, -50%);
    user-select: none;
    z-index: 21;
    transition: background 0.15s;
}

.corner-handle:hover,
.corner-handle.dragging {
    background: rgba(255, 68, 68, 0.6);
    cursor: grabbing;
}

.calibration-hint {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: #ccc;
    padding: 10px 20px;
    border-radius: 8px;
    font-family: Arial, sans-serif;
    font-size: 15px;
    text-align: center;
    z-index: 22;
}

.calibration-buttons {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    z-index: 22;
}

.calib-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 6px;
    font-family: Arial, sans-serif;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.15s;
}

.calib-btn-save {
    background: #2ecc40;
    color: #000;
}

.calib-btn-save:hover {
    background: #3ddb50;
}

.calib-btn-reset {
    background: #ff6600;
    color: #fff;
}

.calib-btn-reset:hover {
    background: #ff8833;
}

.calib-btn-done {
    background: #3b82f6;
    color: #fff;
}

.calib-btn-done:hover {
    background: #5a9af7;
}

body.calibrating {
    cursor: default !important;
}

body.calibrating #table-container {
    outline: 2px dashed rgba(255, 68, 68, 0.5);
}

/* ================================
   Kamera-Overlay
   ================================ */
#camera-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    pointer-events: none;
}

#camera-overlay canvas {
    max-width: 100%;
    max-height: 100%;
    opacity: 0.5;
}
