/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

:root {
    --primary: #00d4ff;
    --primary-dark: #0099cc;
    --secondary: #ff6b35;
    --accent: #ffd700;
    --danger: #ff3333;
    --success: #00cc66;
    --dark: #0a1628;
    --darker: #050d18;
    --light: #e0f7ff;
    --gray: #2a3f5f;
    
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    background: var(--darker);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--light);
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 480px;
    margin: 0 auto;
    background: linear-gradient(180deg, var(--dark) 0%, var(--darker) 100%);
    overflow: hidden;
}

#gameCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

#bg-pattern {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(0, 212, 255, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 107, 53, 0.03) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* Screens */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
    padding: 20px;
    padding-top: calc(20px + var(--safe-top));
    padding-bottom: calc(20px + var(--safe-bottom));
}

.screen.active {
    display: flex;
}

.screen-content {
    width: 100%;
    max-width: 360px;
    text-align: center;
    animation: fadeInUp 0.5s ease;
    position: relative;
    padding: 18px 16px;
    border-radius: 20px;
    background: rgba(5, 13, 24, 0.62);
    border: 1px solid rgba(0, 212, 255, 0.14);
    box-shadow: 0 18px 50px rgba(0,0,0,0.45);
    backdrop-filter: blur(10px);
}

/* Start screen backdrop glow */
.start-backdrop {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 25% 15%, rgba(0, 212, 255, 0.18) 0%, transparent 55%),
        radial-gradient(circle at 80% 70%, rgba(255, 107, 53, 0.16) 0%, transparent 55%),
        linear-gradient(180deg, rgba(0,0,0,0.25) 0%, rgba(0,0,0,0.55) 100%);
    pointer-events: none;
    z-index: 0;
}

#start-screen .screen-content {
    z-index: 1;
}

.start-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 12px;
}

.badge {
    font-size: 11px;
    letter-spacing: 0.8px;
    font-weight: 800;
    padding: 7px 10px;
    border-radius: 999px;
    border: 1px solid rgba(0, 212, 255, 0.25);
    background: rgba(0, 212, 255, 0.08);
    color: var(--light);
    text-transform: uppercase;
}

.badge-warm {
    border-color: rgba(255, 107, 53, 0.35);
    background: rgba(255, 107, 53, 0.10);
}

.badge-cold {
    border-color: rgba(150, 230, 255, 0.35);
    background: rgba(0, 212, 255, 0.08);
}

.start-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 14px 0 18px;
}

.mini-card {
    border-radius: 14px;
    padding: 12px 12px;
    background: rgba(10, 22, 40, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.mini-title {
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.6px;
    color: var(--primary);
    margin-bottom: 6px;
    text-transform: uppercase;
}

.mini-text {
    font-size: 12px;
    color: rgba(224, 247, 255, 0.88);
    line-height: 1.2;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Logo */
.logo-area {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;   /* YATAY ORTA */
    align-items: center;       /* DİKEY ORTA (gerekirse) */
    width: 100%;
}

#logo-img {
    max-width: 180px;
    height: auto;
    display: block;
    margin: 0 auto;            /* ekstra garanti */
    filter: drop-shadow(0 4px 8px rgba(0, 212, 255, 0.3));
}


.logo-fallback {
    font-size: 28px;
    font-weight: 900;
    letter-spacing: 4px;
    color: var(--primary);
    text-shadow: 0 0 20px rgba(0, 212, 255, 0.5);
    border: 2px solid var(--primary);
    padding: 12px 24px;
    display: inline-block;
    border-radius: 8px;
}

/* Typography */
.game-title {
    font-size: 32px;
    font-weight: 900;
    color: var(--light);
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    line-height: 1.2;
}

.tagline {
    font-size: 16px;
    color: var(--primary);
    margin-bottom: 30px;
    font-weight: 500;
    letter-spacing: 1px;
}

/* Buttons */
.button-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.btn {
    width: 100%;
    padding: 16px 24px;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--darker);
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.4);
}

.btn-primary:active {
    transform: scale(0.98);
    box-shadow: 0 2px 8px rgba(0, 212, 255, 0.3);
}

.btn-secondary {
    background: var(--gray);
    color: var(--light);
    border: 2px solid var(--primary);
}

.btn-secondary:active {
    background: var(--primary);
    color: var(--darker);
}

.btn-icon {
    background: transparent;
    border: 1px solid var(--gray);
    color: var(--light);
    padding: 10px 16px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.settings-row {
    margin-bottom: 20px;
}

.best-score {
    font-size: 14px;
    color: var(--gray);
    font-weight: 500;
}

/* Modal */
.modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 13, 24, 0.95);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 20;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--dark);
    border: 2px solid var(--primary);
    border-radius: 16px;
    padding: 24px;
    width: 100%;
    max-width: 340px;
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-content h2 {
    color: var(--primary);
    margin-bottom: 20px;
    font-size: 24px;
    text-align: center;
}

.help-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.help-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--darker);
    padding: 12px;
    border-radius: 8px;
}

.help-icon {
    font-size: 24px;
    width: 40px;
    text-align: center;
}

.help-item p {
    font-size: 14px;
    color: var(--light);
    text-align: left;
}

.help-tips {
    background: var(--darker);
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 13px;
    line-height: 1.6;
}

.help-tips p {
    margin-bottom: 8px;
    color: var(--light);
}

.help-tips strong {
    color: var(--accent);
}

/* HUD */
.hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 12px 16px;
    padding-top: calc(12px + var(--safe-top));
    z-index: 5;
    pointer-events: none;
}

.hud.hidden {
    display: none;
}

.hud-top {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.hud-item {
    background: rgba(10, 22, 40, 0.9);
    border: 1px solid var(--primary);
    border-radius: 8px;
    padding: 8px 12px;
    text-align: center;
    min-width: 70px;
    backdrop-filter: blur(4px);
}

.hud-label {
    display: block;
    font-size: 10px;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.hud-value {
    display: block;
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}

.hud-shield {
    position: absolute;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(90deg, var(--success), #00aa55);
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    animation: pulse 2s infinite;
    box-shadow: 0 4px 12px rgba(0, 204, 102, 0.4);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.milestone-popup {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 212, 255, 0.95);
    color: var(--darker);
    padding: 16px 24px;
    border-radius: 12px;
    font-weight: 700;
    animation: milestonePop 0.5s ease;
    box-shadow: 0 8px 32px rgba(0, 212, 255, 0.4);
}

@keyframes milestonePop {
    0% { transform: translate(-50%, -50%) scale(0); }
    50% { transform: translate(-50%, -50%) scale(1.1); }
    100% { transform: translate(-50%, -50%) scale(1); }
}

.milestone-content {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

/* Game Over Screen */
.fail-badge {
    background: var(--danger);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 20px;
    font-weight: 900;
    letter-spacing: 2px;
    margin-bottom: 16px;
    animation: shake 0.5s ease;
    box-shadow: 0 4px 16px rgba(255, 51, 51, 0.4);
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.game-over-title {
    font-size: 24px;
    color: var(--light);
    margin-bottom: 24px;
}

.final-stats {
    background: var(--dark);
    border: 1px solid var(--gray);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    width: 100%;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--gray);
    font-size: 16px;
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-value {
    color: var(--primary);
    font-weight: 700;
}

.promo-message {
    font-size: 14px;
    color: var(--gray);
    font-style: italic;
    margin-bottom: 24px;
    line-height: 1.5;
    padding: 0 10px;
}

/* Touch Controls */
.touch-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 120px;
    display: flex;
    z-index: 8;
    pointer-events: auto;
}

.touch-controls.hidden {
    display: none;
}

.touch-zone {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    opacity: 0.3;
    transition: opacity 0.2s;
}

.touch-zone:active {
    opacity: 0.6;
    background: rgba(0, 212, 255, 0.1);
}

.touch-left::after { content: '◀'; }
.touch-jump::after { content: '▲'; }
.touch-right::after { content: '▶'; }

/* Pause Button */
.btn-pause {
    position: absolute;
    top: calc(12px + var(--safe-top));
    right: 12px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gray);
    border: 2px solid var(--primary);
    color: var(--light);
    font-size: 18px;
    cursor: pointer;
    z-index: 6;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-pause.hidden {
    display: none;
}

/* Toast */
.toast {
    position: absolute;
    bottom: 140px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent);
    color: var(--darker);
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 14px;
    z-index: 15;
    animation: slideUp 0.3s ease;
}

.toast.hidden {
    display: none;
}

@keyframes slideUp {
    from { transform: translateX(-50%) translateY(20px); opacity: 0; }
    to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* Utility */
.hidden {
    display: none !important;
}

/* Responsive */
@media (max-height: 600px) {
    .game-title { font-size: 28px; }
    .tagline { font-size: 14px; margin-bottom: 20px; }
    .btn { padding: 14px 20px; font-size: 16px; }
}

@media (min-width: 481px) {
    #game-container {
        box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
    }
}

/* --- Premium F1 vibe tweaks (v2) --- */
#gameCanvas{
  image-rendering: auto;
  filter: drop-shadow(0 18px 40px rgba(0,0,0,.55));
}

#bg-pattern::after{
  content:"";
  position:absolute; inset:0;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(255,255,255,0.02) 0px,
      rgba(255,255,255,0.02) 1px,
      transparent 2px,
      transparent 6px
    );
  mix-blend-mode: overlay;
  opacity: .25;
}

.hud-item{
  box-shadow: 0 10px 30px rgba(0,0,0,.25), 0 0 16px rgba(0,212,255,.15);
}

.milestone-popup{
  border: 1px solid rgba(255,255,255,.25);
}

.fail-badge{
  text-shadow: 0 0 18px rgba(255,51,51,.45);
}
