:root {
    --bg-color: #0b0c10;
    --panel-bg: rgba(31, 40, 51, 0.85);
    --primary-text: #c5c6c7;
    --highlight: #66fcf1;
    --highlight-dark: #45a29e;
    --laser-color: #ff2a2a;
    --mirror-color: #39ff14;
    --fixed-mirror-color: #fca311;
    --crystal-color: #00f0ff;
    
    --success-bg: rgba(57, 255, 20, 0.2);
    --success-border: #39ff14;
    --fail-bg: rgba(255, 42, 42, 0.2);
    --fail-border: #ff2a2a;
}

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

body {
    font-family: 'Space Grotesk', sans-serif;
    background-color: var(--bg-color);
    color: var(--primary-text);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(69, 162, 158, 0.1), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(102, 252, 241, 0.05), transparent 25%);
    overflow: hidden;
}

/* Ekran Yönetimi */
.screen {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: absolute;
    top: 0;
    left: 0;
    opacity: 1;
    transition: opacity 0.5s ease;
}

.screen.hidden {
    opacity: 0;
    pointer-events: none;
    z-index: -1;
}

/* Menü Konteynerleri */
.menu-container {
    background: rgba(11, 12, 16, 0.9);
    border: 2px solid var(--highlight-dark);
    padding: 50px;
    border-radius: 20px;
    box-shadow: 0 0 30px rgba(102, 252, 241, 0.2);
    text-align: center;
    backdrop-filter: blur(10px);
}

.game-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 3rem;
    color: #fff;
    margin-bottom: 40px;
    line-height: 1.2;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
}

.game-title span {
    color: var(--highlight);
    font-size: 2rem;
    text-shadow: 0 0 15px var(--highlight);
}

.screen-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 2rem;
    color: var(--highlight);
    margin-bottom: 30px;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.menu-btn {
    background: transparent;
    color: var(--highlight);
    border: 2px solid var(--highlight-dark);
    padding: 15px 30px;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.menu-btn:hover {
    background: rgba(102, 252, 241, 0.1);
    box-shadow: 0 0 15px rgba(102, 252, 241, 0.4);
    transform: translateY(-2px);
}

.menu-btn.primary {
    background: var(--highlight-dark);
    color: #0b0c10;
    font-weight: bold;
}

.menu-btn.primary:hover {
    background: var(--highlight);
    box-shadow: 0 0 20px var(--highlight);
}

/* Ayarlar Listesi */
.settings-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 40px;
    text-align: left;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.2rem;
    width: 300px;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #1f2833;
    transition: .4s;
    border: 1px solid var(--highlight-dark);
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 3px;
    bottom: 3px;
    background-color: var(--primary-text);
    transition: .4s;
}

input:checked + .slider {
    background-color: var(--highlight-dark);
}

input:checked + .slider:before {
    transform: translateX(26px);
    background-color: #0b0c10;
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Oyun Ekranı Düzeni */
.game-header {
    width: 95vw;
    max-width: 1400px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--panel-bg);
    border: 1px solid var(--highlight-dark);
    border-radius: 12px;
    margin-bottom: 20px;
    margin-top: 20px;
}

.level-info {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.5rem;
    color: #fff;
}

.level-info span {
    color: var(--highlight);
}

.icon-btn {
    background: transparent;
    border: 1px solid rgba(102, 252, 241, 0.3);
    color: var(--primary-text);
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Space Grotesk', sans-serif;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.game-container {
    display: flex;
    width: 95vw;
    max-width: 1400px;
    height: calc(85vh - 80px); /* header payı */
    gap: 20px;
    padding: 0 20px 20px 20px;
}

/* Sol Taraf: Oyun Alanı */
.canvas-section {
    flex: 7;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.canvas-wrapper {
    position: relative;
    border: 2px solid var(--highlight-dark);
    border-radius: 12px;
    box-shadow: 0 0 20px rgba(69, 162, 158, 0.3);
    background-color: #050505;
    background-image: 
        linear-gradient(rgba(102, 252, 241, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(102, 252, 241, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    overflow: hidden;
}

canvas {
    display: block;
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

.hud {
    position: absolute;
    top: 20px;
    left: 20px;
    pointer-events: none;
}

.hud h2 {
    font-family: 'Orbitron', sans-serif;
    color: var(--highlight);
    margin-bottom: 5px;
    text-shadow: 0 0 10px rgba(102, 252, 241, 0.5);
    letter-spacing: 2px;
}

.hud p {
    font-size: 1.1rem;
    color: #fff;
}

.legend {
    position: absolute;
    bottom: 20px;
    left: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    pointer-events: none;
    background: rgba(0, 0, 0, 0.6);
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
}

.color-box {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}
.color-box.source { background-color: var(--laser-color); box-shadow: 0 0 5px var(--laser-color); }
.color-box.mirror { background-color: var(--mirror-color); box-shadow: 0 0 5px var(--mirror-color); }
.color-box.mirror.fixed { background-color: var(--fixed-mirror-color); box-shadow: 0 0 5px var(--fixed-mirror-color); }
.color-box.target { background-color: var(--crystal-color); border-radius: 50%; box-shadow: 0 0 5px var(--crystal-color); }

/* Sağ Taraf: Kontrol Paneli */
.ui-section {
    flex: 3;
    display: flex;
    flex-direction: column;
}

.panel {
    background-color: var(--panel-bg);
    border: 1px solid var(--highlight-dark);
    border-radius: 12px;
    padding: 30px;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5), 0 10px 30px rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    overflow-y: auto;
}

.panel h3 {
    font-family: 'Orbitron', sans-serif;
    color: var(--highlight);
    margin-bottom: 20px;
    font-size: 1.5rem;
    text-align: center;
    letter-spacing: 1.5px;
    border-bottom: 1px solid rgba(102, 252, 241, 0.3);
    padding-bottom: 15px;
}

.task-box {
    background-color: rgba(0, 0, 0, 0.4);
    border-left: 4px solid var(--highlight);
    padding: 15px;
    border-radius: 0 8px 8px 0;
    margin-bottom: 30px;
    font-size: 1rem;
    line-height: 1.5;
}

.task-box strong {
    color: #fff;
    font-weight: 700;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

.dynamic-inputs {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.input-container label {
    font-size: 0.9rem;
    color: var(--primary-text);
    margin-bottom: 5px;
    display: block;
}

.input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.input-group input {
    width: 100%;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid var(--highlight-dark);
    color: var(--highlight);
    font-family: 'Orbitron', sans-serif;
    font-size: 1.5rem;
    padding: 10px 40px 10px 15px;
    border-radius: 8px;
    outline: none;
    transition: all 0.3s ease;
}

.input-group input:focus {
    border-color: var(--highlight);
    box-shadow: 0 0 15px rgba(102, 252, 241, 0.4);
}

/* Spin butonlarını gizle */
input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { 
    -webkit-appearance: none; 
    margin: 0; 
}
input[type=number] {
    -moz-appearance: textfield;
}

.degree-symbol {
    position: absolute;
    right: 15px;
    font-size: 1.5rem;
    color: var(--highlight-dark);
    pointer-events: none;
}

.action-btn {
    background: linear-gradient(45deg, #1f2833, var(--highlight-dark));
    color: #fff;
    border: 2px solid var(--highlight);
    padding: 15px;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    text-shadow: 0 0 5px rgba(0,0,0,0.5);
    box-shadow: 0 4px 15px rgba(69, 162, 158, 0.4);
}

.action-btn:hover {
    background: linear-gradient(45deg, var(--highlight-dark), var(--highlight));
    color: #0b0c10;
    box-shadow: 0 0 20px rgba(102, 252, 241, 0.6);
    transform: translateY(-2px);
}

.action-btn:active {
    transform: translateY(1px);
}

.reset-btn {
    background: transparent;
    color: var(--primary-text);
    border: 1px solid rgba(197, 198, 199, 0.3);
    padding: 10px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.reset-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.message-box {
    margin-top: auto;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    font-weight: 700;
    font-size: 1rem;
    animation: popIn 0.3s ease-out;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message-box.hidden {
    display: none;
}

.message-box.success {
    background-color: var(--success-bg);
    border: 2px solid var(--success-border);
    color: var(--success-border);
    text-shadow: 0 0 10px rgba(57, 255, 20, 0.5);
}

.message-box.fail {
    background-color: var(--fail-bg);
    border: 2px solid var(--fail-border);
    color: var(--fail-border);
    text-shadow: 0 0 10px rgba(255, 42, 42, 0.5);
}

.next-btn {
    background: var(--highlight);
    color: #000;
    border: none;
    padding: 10px;
    font-family: 'Orbitron', sans-serif;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
}
.next-btn.hidden {
    display: none;
}
.next-btn:hover {
    background: #fff;
}

@keyframes popIn {
    0% { transform: scale(0.9); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* Mobil / Küçük Ekranlar için Responsive Tasarım */
@media (max-width: 900px) {
    body, .screen {
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
    }
    .screen {
        justify-content: flex-start;
        padding-top: 20px;
        padding-bottom: 40px;
    }
    .game-container {
        flex-direction: column;
        height: auto;
        overflow: visible;
        margin-bottom: 30px;
        padding: 0 10px;
    }
    .canvas-section, .ui-section {
        flex: none;
        width: 100%;
    }
    .panel {
        height: auto;
        padding: 15px;
    }
    .game-header {
        flex-direction: column;
        gap: 10px;
        height: auto;
        text-align: center;
        padding: 10px;
    }
    .legend {
        position: relative;
        bottom: 0;
        left: 0;
        margin-top: 10px;
        justify-content: center;
    }
    .hud {
        position: relative;
        top: 0;
        left: 0;
        margin-bottom: 10px;
        text-align: center;
    }
    .canvas-wrapper {
        display: flex;
        flex-direction: column;
        padding: 10px;
    }
}
