:root {
    --piston-height: 100px;
    --cyl-height: 300px;
    --cyl-width: 160px;
    --bg-color: #1e1e1e;
    --accent-color: #3498db;
    --metal-dark: #555;
    --metal-light: #999;
    --primary-color: #2563eb;
    /* Otomotiv Mavisi */
    --primary-hover: #1d4ed8;
    --bg-dark: #111827;
    /* Ana Koyu Arkaplan */
    --bg-card: #1f2937;
    /* Kart Arkaplanı */
    --text-main: #f3f4f6;
    /* Beyaz Yazı */
    --text-muted: #9ca3af;
    /* Gri Yazı */
    --border-color: #374151;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

a {
    text-decoration: none;
    color: inherit;
    transition: 0.3s;
}

ul {
    list-style: none;
}

.navbar {

    background-color: #1f2937;
    border-bottom: 1px solid var(--border-color);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    padding: 1rem 0;
    width: 100% !important;
    padding: 0;
}



.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;

}

.logo {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--primary-color);
}

/* Masaüstü Navigasyon Linkleri (Varsayılan olarak görünür) */
.nav-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    /* Masaüstünde yan yana durmaları için */
}

.nav-links li a {
    color: white;
    text-decoration: none;
    padding: 10px 15px;
    display: block;
}

.nav-links li a:hover,
.nav-links li a.active {
    background-color: #555;
    border-radius: 5px;
}

/* Hamburger Menü İkonu (Varsayılan olarak gizli) */
.menu-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
    padding: 10px;
}

.bar {
    width: 25px;
    height: 3px;
    background-color: white;
    margin: 4px 0;
    transition: 0.4s;
}

/* Sidebar Stilleri */
.sidebar {
    position: fixed;
    /* Sabit kalması için */
    top: 0;
    right: -250px;
    /* Başlangıçta ekran dışı (gizli) */
    width: 250px;
    height: 100%;

    background-color: #1f2937;
    border-bottom: 1px solid var(--border-color);
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.5);
    transition: right 0.3s ease;
    /* Açılıp kapanma animasyonu */
    z-index: 1000;
    /* Diğer elementlerin üstünde olması için */
}

/* JavaScript ile eklenecek sınıf: Sidebar açıkken */
.sidebar.open {
    right: 0;
    /* Ekran içine kaydır */
}

.sidebar-links {
    list-style: none;
    padding: 20px 0;
    margin: 0;
}

.sidebar-links li a {
    color: white;
    text-decoration: none;
    padding: 15px 20px;
    display: block;
    /* Tam genişlik kaplaması için */
    border-bottom: 1px solid #444;
}

.sidebar-links li a:hover,
.sidebar-links li a.active {
    background-color: #444;
}

.close-btn {
    position: absolute;
    /* Sidebar'ın sağ üst köşesine sabitle */
    top: 10px;
    right: 20px;
    font-size: 30px;
    color: white;
    cursor: pointer;
    line-height: 1;
    /* X işaretinin dikey hizalaması için */
    padding: 5px;
    transition: color 0.2s;
}

.close-btn:hover {
    color: #f00;
    /* Kırmızı renk vererek dikkat çek */
}

/* 768px'in Altı (Mobil Görünüm) */
@media screen and (max-width: 768px) {

    /* Hamburger ikonunu göster */
    .menu-toggle {
        display: flex;
    }

    /* Masaüstü linklerini gizle */
    .nav-links {
        display: none;
    }
}

/* Hamburger menü açıldığında ikonun X'e dönüşmesi (İsteğe bağlı görsel efekt) */
.menu-toggle.active .bar:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active .bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.menu-toggle.active .bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.main-content {

    max-width: 40%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* --- Kontrol Paneli --- */
.controls {
    margin: 80px 0px;
    background: #2c2c2c;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    display: grid;
    gap: 10px;
    align-items: center;
    grid-template-columns: 1fr 1fr 1fr;

}

button {
    padding: 8px 16px;
    cursor: pointer;
    border: none;
    border-radius: 4px;
    font-weight: bold;
    transition: 0.2s;
}

.btn-start {
    background-color: #27ae60;
    color: white;
}

.btn-stop {
    background-color: #c0392b;
    color: white;
}

.btn-step {
    background-color: #f39c12;
    color: white;
}

input[type="range"] {
    margin: 0 10px;
}

/* --- Motor Bloğu --- */
.engine-container {
    position: relative;
    width: var(--cyl-width);
    height: 400px;
    background: #333;
    border: 4px solid #444;
    border-radius: 10px;
    overflow: hidden;
   
}

.chamber-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 200px;
    opacity: 0.3;
    transition: background-color 0.1s;
}

.valves {
    position: absolute;
    top: 0;
    width: 100%;
    height: 40px;
    display: flex;
    justify-content: space-around;
    z-index: 2;
}

.valve {
    width: 20px;
    height: 40px;
    background: var(--metal-light);
    transition: transform 0.1s;
    transform-origin: top center;
    border-bottom-left-radius: 5px;
    border-bottom-right-radius: 5px;
}

.valve.intake {
    background: #88ccff;
}

/* Mavi ton - Hava girişi */
.valve.exhaust {
    background: #ffaa88;
}

/* Kırmızı ton - Egzoz */

.spark-plug {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 30px;
    background: white;
    z-index: 3;
}

.spark {
    position: absolute;
    bottom: -10px;
    left: -10px;
    width: 30px;
    height: 30px;
    background: radial-gradient(circle, yellow, orange, transparent);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.05s;
}

/* Piston Grubu */
.piston-group {
    position: absolute;
    width: 100%;
    top: 50px;
    /* Başlangıç offset */
}

.piston {
    width: 90%;
    height: var(--piston-height);
    background: linear-gradient(to right, var(--metal-dark), var(--metal-light), var(--metal-dark));
    margin: 0 auto;
    border-radius: 5px;
    position: relative;
    z-index: 2;
}

.connecting-rod {
    width: 14px;
    height: 120px;
    background: #555;
    margin: -10px auto 0;
    position: relative;
    transform-origin: top center;
    z-index: 1;
}

.crankshaft {
    position: absolute;
    bottom: 55px;
    left: 50%;
    width: 80px;
    height: 80px;
    border: 5px solid var(--metal-light);
    border-radius: 50%;
    transform: translateX(-50%);
    opacity: 0.5;
}

/* --- Bilgi Paneli --- */
.info-panel {
    margin-top: 20px;
    margin-bottom: 100px;
    text-align: center;
    background: #222;
    padding: 20px;
    border-radius: 8px;
    width: 300px;
    border-left: 5px solid var(--accent-color);
}

.stroke-name {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--accent-color);
    margin-bottom: 10px;
}

.stroke-desc {
    font-size: 0.9em;
    color: #ccc;
    line-height: 1.4;
}

.data-display {
    font-family: monospace;
    margin-top: 10px;
    color: #666;
    font-size: 0.8em;
}

@media (max-width: 992px) {
    .controls {
        max-width: 80%;
        grid-template-columns: 1fr 1fr 1fr;

    }
    .main-content {
        flex-direction: column;
        max-width: 90%;
    }
}