/* ==========================================================================
   1. GRUNDLAYOUT & STRUKTUR
   ========================================================================== */
body, html {
    margin: 0;
    padding: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #1a1a1a;
}

/* Der Startbildschirm */
#lobby-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #111;
    color: white;
}

.lobby-box {
    background: #2c3e50;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    text-align: center;
    width: 320px;
}

.lobby-box input {
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    border-radius: 6px;
    border: none;
    box-sizing: border-box;
    font-size: 16px;
}

.lobby-actions {
    margin-top: 15px;
}

.action-divider {
    margin: 10px 0;
    color: #bdc3c7;
    font-size: 14px;
}

.btn-main, .btn-sub {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    font-size: 14px;
}
.btn-main { background: #27ae60; color: white; }
.btn-sub { background: #3498db; color: white; }

/* Der Hauptcontainer für das aktive Spiel */
#game-screen {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

/* ==========================================================================
   2. IN-GAME BEREICHE (UI oben, Board Mitte, Hand unten)
   ========================================================================== */
#ui {
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 15px;
    border-bottom: 3px solid #27ae60;
    z-index: 1000;
}

#room-display {
    float: right;
    background: #27ae60;
    padding: 5px 10px;
    border-radius: 4px;
    font-weight: bold;
}

#game-status {
    margin-top: 10px;
}

#board {
    flex: 1; /* Schiebt die Handkarten nach ganz unten */
    background: #2c3e50;
    position: relative;
    overflow: hidden;
    cursor: grab;
}

#zoom-layer {
    width: 5000px;
    height: 5000px;
    position: absolute;
    transform-origin: 0 0;
    background-image: radial-gradient(rgba(255,255,255,0.05) 1px, transparent 1px);
    background-size: 50px 50px;
}

#hand {
    height: 220px;
    background: #ecf0f1;
    border-top: 6px solid #34495e;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    z-index: 100;
    box-sizing: border-box;
}

#cards-container {
    display: flex;
    gap: 15px;
    padding: 10px;
    width: 100%;
    justify-content: center;
    overflow-x: auto;
}

/* ==========================================================================
   3. ELEMENTE (Karten, Moleküle, Knöpfe)
   ========================================================================== */
.card {
    width: 100px;
    height: 140px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 10px;
    font-weight: bold;
    color: white;
    cursor: grab;
    box-shadow: 0 6px 12px rgba(0,0,0,0.2);
    transition: transform 0.2s, box-shadow 0.2s;
    border: 3px solid transparent;
    font-size: 14px;
    box-sizing: border-box;
}

.card:hover {
    transform: translateY(-10px);
    box-shadow: 0 12px 20px rgba(0,0,0,0.3);
}

.card.compound { background: #3498db; border-color: #2980b9; }
.card.reagent { background: #e67e22; border-color: #d35400; }
.card.action { background: #e74c3c; border-color: #c0392b; font-size: 12px; }
.card:active { cursor: grabbing; }

.molecule {
    position: absolute;
    background: white;
    padding: 15px;
    border-radius: 12px;
    border: 3px solid #27ae60;
    text-align: center;
    width: 140px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
    transform: translate(-50%, -50%);
    user-select: none;
    z-index: 10;
}

.molecule strong { display: block; font-size: 16px; margin-bottom: 5px; color: #2c3e50; }

.reagent-badge {
    margin-top: 8px;
    background: #e67e22;
    color: white;
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    display: inline-block;
}

.drag-over {
    transform: translate(-50%, -50%) scale(1.15) !important;
    border-color: #f1c40f !important;
    background: #fff9e6 !important;
}

.molecule.reaction-arrow {
    width: 80px;
    height: 60px;
    padding: 5px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    transform: translate(-50%, -50%);
}

#end-turn-button, #draw-button {
    cursor: pointer;
    font-weight: bold;
    padding: 6px 12px;
    border-radius: 4px;
    border: none;
}

/* Das Hauptmolekül braucht ein relatives Layout */
.molecule-node {
    position: relative;
    /* Deine bestehenden Styles (Hintergrund, Border etc.) */
}

/* Gemeinsame Styles für beide Zonen */
.synth-zone {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    background: #27ae60; /* Schönes Chemie-Grün */
    color: white;
    font-weight: bold;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    cursor: pointer;
    user-select: none;
    z-index: 10;
}

/* Links positionieren für Retro */
.zone-retro {
    left: -35px; /* Setzt den Button links NEBEN die Box */
}

/* Rechts positionieren für Forward */
.zone-forward {
    right: -35px; /* Setzt den Button rechts NEBEN die Box */
}

/* Wenn man über das Molekül hovert, fahren die Ohren aus! */
.molecule-node:hover .synth-zone {
    opacity: 1;
    pointer-events: auto; /* Jetzt klick-/droppbar */
}

.molecule-node:hover .zone-retro {
    transform: translateX(-100%); /* Schiebt sich links raus */
}

.molecule-node:hover .zone-forward {
    transform: translateX(100%); /* Schiebt sich rechts raus */
}

#end-turn-button { background: #e74c3c; color: white; margin-left: 10px; }
#draw-button { background: #27ae60; color: white; }
#end-turn-button:disabled, #draw-button:disabled { background: #7f8c8d; cursor: not-allowed; opacity: 0.5; }

h1 { margin: 0; font-size: 20px; color: #27ae60; }
p { margin: 5px 0 0; font-size: 12px; opacity: 0.8; }