/* Prevent pull-to-refresh on mobile */
html, body { overscroll-behavior-y: none !important; overscroll-behavior-x: none !important; }
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
  min-height: 100vh;
  min-height: -webkit-fill-available;
  min-height: 100dvh;
  padding-top: env(safe-area-inset-top);
  
  /* Derin Loş Işık (Ambient Glow) - Tahta tonlarıyla uyumlu */
  background-color: #1f1f28; /* Zifiri karanlıktan bir tık açığa alındı */
  background-image: radial-gradient(circle at center, rgba(112, 65, 30, 0.22) 0%, transparent 65%); /* Loş ahşap ışığı artırıldı */
  
  color: #ecf0f1;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  overflow: hidden;
  position: relative;
  image-rendering: pixelated;
}

body::before {
  content: "";
  position: absolute;
  top: -50%; left: -50%; width: 200%; height: 200%;
  /* Yavaşça Akan Izgara (Scrolling Grid) */
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.03) 2px, transparent 2px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 2px, transparent 2px);
  background-size: 64px 64px;
  z-index: -2;
  pointer-events: none;
  animation: gridScroll 40s linear infinite;
}

@keyframes gridScroll {
  0% { transform: translate(0, 0); }
  100% { transform: translate(64px, 64px); }
}

.floating-bg-container {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  overflow: hidden;
  z-index: -1;
  pointer-events: none;
}

.floating-checker {
  position: absolute;
  border-radius: 50%;
  border: 3px solid #080a0f;
  box-shadow: 
    inset -4px -4px 0px rgba(0,0,0,0.3),
    inset 4px 4px 0px rgba(255,255,255,0.25),
    inset 0 0 0 4px rgba(0,0,0,0.15),
    inset 0 0 0 8px rgba(255,255,255,0.1),
    5px 5px 0px rgba(0,0,0,0.4);
  box-sizing: border-box;
  /* Başlangıç pozisyonu JS değişkenlerinden */
  left: var(--sx);
  top: var(--sy);
  /* alternate kaldırıldı, linear infinite kaldı */
  animation: floatChecker linear infinite;
  /* Mobilde performans için trasform-style ekle */
  will-change: transform;
}

.floating-checker::before {
  content: "";
  position: absolute;
  top: 25%; left: 25%;
  width: 50%; height: 50%;
  border-radius: 50%;
  border: 3px solid #080a0f;
  background: rgba(0,0,0,0.08);
  box-shadow: inset -2px -2px 0px rgba(0,0,0,0.2);
  box-sizing: border-box;
}

.floating-checker::after {
  content: "";
  position: absolute;
  top: 38%; left: 38%;
  width: 24%; height: 24%;
  border-radius: 50%;
  background: rgba(255,255,255,0.35);
  box-sizing: border-box;
}

.floating-checker.white { background-color: #e2e2e2; }
.floating-checker.black { background-color: #2b2b36; }
.floating-checker.red { background-color: #d13030; }

.floating-die {
  position: absolute;
  border: 2px solid #080a0f;
  box-shadow: 
    inset -2px -2px 0px rgba(0,0,0,0.25), 
    inset 2px 2px 0px rgba(255,255,255,0.2), 
    4px 4px 0px rgba(0,0,0,0.4);
  border-radius: 5px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  padding: 4px;
  gap: 2px;
  box-sizing: border-box;
  /* Başlangıç pozisyonu JS değişkenlerinden */
  left: var(--sx);
  top: var(--sy);
  /* alternate kaldırıldı, linear infinite kaldı */
  animation: floatChecker linear infinite;
  /* Mobilde performans için trasform-style ekle */
  will-change: transform;
}

.floating-die.white { background-color: #e2e2e2; }
.floating-die.black { background-color: #2b2b36; }

.floating-die .pip {
  background-color: #080a0f;
  border-radius: 50%;
  width: 100%;
  height: 100%;
}

.floating-die.white .pip { background-color: #080a0f; }
.floating-die.black .pip { background-color: #e2e2e2; }

@keyframes floatChecker {
  /* Başlangıçta transform yok, left/top (var(--sx), var(--sy)) geçerli */
  0% { 
    transform: translate(-50%, -50%) rotate(0deg);
    opacity: 0;
  }
  /* Ekran içine girerken belirginleş */
  10% {
    opacity: 1;
  }
  /* Ekran dışına çıkarken şeffaflaş */
  90% {
    opacity: 1;
  }
  /* Bitiş pozisyonuna transform ile git (var(--ex), var(--ey)) */
  100% { 
    /* translate değerleri JS'de hesaplanan bitiş noktasına göre ayarlandı */
    transform: translate(calc(var(--ex) - var(--sx) - 50%), calc(var(--ey) - var(--sy) - 50%)) rotate(360deg);
    opacity: 0;
  }
}

.container {
    text-align: center;
    width: 100%;
    max-width: 400px;
}

h1, h2, h3 { margin-bottom: 15px; text-shadow: 0 2px 4px rgba(0,0,0,0.5); }

.card {
    background-color: #2c3e50; padding: 30px; border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.6); display: flex; flex-direction: column; gap: 15px;
}

input {
    padding: 12px; border: none; border-radius: 6px; font-size: 16px; text-align: center;
    background-color: #34495e; color: white; outline: none; border: 1px solid #455a64;
}
input:focus { border-color: #3498db; }

.primary-btn {
    padding: 14px; border: none; border-radius: 6px; font-size: 16px; cursor: pointer;
    font-weight: bold; transition: all 0.2s ease-in-out; background-color: #27ae60; color: white;
}
.primary-btn:hover { background-color: #2ecc71; transform: translateY(-2px); }

#status-msg { margin-top: 15px; font-weight: bold; min-height: 20px; }

/* YUVARLAK BUTON TASARIMLARI */
.action-buttons {
    display: flex;
    flex-direction: row;
    gap: clamp(8px, 1.5vw, 15px);
    justify-content: flex-end;
    align-items: center;
}

/* Masaüstü web görünümünde butonların açıkça yatay sıralaması (Geri, Onay, Zar En Sağda) */
#undo-btn { order: 1; grid-row: auto; grid-column: auto; }
#confirm-btn { order: 2; grid-row: auto; grid-column: auto; }
#roll-btn { order: 3; grid-row: auto; grid-column: auto; }

.circle-btn {
    width: clamp(45px, 6vmin, 60px);
    height: clamp(45px, 6vmin, 60px);
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.4);
    font-size: clamp(20px, 3vmin, 26px);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 6px 16px rgba(0,0,0,0.6), inset 0 2px 4px rgba(255,255,255,0.25);
    transition: all 0.22s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    outline: none;
    color: white;
    position: relative;
    user-select: none;
}

.circle-btn .btn-icon {
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
    transition: transform 0.2s ease, filter 0.2s ease;
}

.circle-btn:hover {
    transform: translateY(-3px) scale(1.08);
    border-color: #ffffff;
    box-shadow: 0 10px 22px rgba(0,0,0,0.75), inset 0 2px 6px rgba(255,255,255,0.4);
}

.circle-btn:hover .btn-icon {
    transform: scale(1.12);
    filter: drop-shadow(0 0 8px rgba(255,255,255,0.8));
}

.circle-btn:active {
    transform: translateY(1px) scale(0.94);
    box-shadow: 0 2px 6px rgba(0,0,0,0.6);
}

/* Premium ve tok renk paletleri */
.circle-btn.primary { 
    background: radial-gradient(circle at 35% 35%, #2980b9 0%, #1c5980 70%, #0f3752 100%); 
    border-color: #3498db;
} 
.circle-btn.success { 
    background: radial-gradient(circle at 35% 35%, #27ae60 0%, #1e8449 70%, #114e2b 100%); 
    border-color: #2ecc71;
} 
.circle-btn.warning { 
    background: radial-gradient(circle at 35% 35%, #e67e22 0%, #d35400 70%, #873600 100%); 
    border-color: #f39c12;
} 
.circle-btn.dark { 
    background: radial-gradient(circle at 35% 35%, #4b6584 0%, #2d3a4b 70%, #18222d 100%); 
    border-color: #778ca3;
}

/* TAVLA TAHTASI */
#board-container { margin-top: 20px; display: flex; justify-content: center; width: 100%; padding: 0 10px; }

/* =========================================
   ULTRA GERÇEKÇİ TAVLA TAHTASI
   ========================================= */

.board {
    position: relative;

    /* Ekran çözünürlüğüne göre hem enine hem boyuna mükemmel orantılı büyüyüp küçülme (Responsive Sizing) */
    width: min(95vw, 900px, calc(68vh * 850 / 600));
    height: auto;
    
    aspect-ratio: 850 / 600;

    display: flex;
    flex-direction: column;
    justify-content: center;

    border-radius: 18px;

    overflow: hidden;

    /* Gerçekçi ahşap gövde dokusu ve ışıklandırması */
    background:
        repeating-linear-gradient(90deg, rgba(0,0,0,0.03) 0px, rgba(0,0,0,0.03) 1px, transparent 1px, transparent 4px),
        repeating-linear-gradient(0deg, rgba(255,255,255,0.02) 0px, rgba(255,255,255,0.02) 1px, transparent 1px, transparent 3px),
        linear-gradient(
            145deg,
            #5c3317 0%,
            #3e2211 25%,
            #2a160b 50%,
            #4b2915 75%,
            #6a3c1d 100%
        );

    /* Gerçekçi kalın ahşap çerçeve */
    border: 16px solid #1c0d06;

    /* Güçlendirilmiş 3D Derinlik ve Gölge + İnce Beyaz Şerit */
    box-shadow:
        0 0 0 1.5px rgba(255, 255, 255, 0.5),
        0 35px 70px rgba(0,0,0,0.95),
        inset 0 0 0 2px rgba(255,255,255,0.08),
        inset 0 0 35px rgba(0,0,0,0.5),
        inset 0 -35px 50px rgba(0,0,0,0.75);

    transform: perspective(1400px) rotateX(2deg);
}

.row { display: flex; height: 50%; width: 100%; }

.point {
    width: calc((100% - 7%) / 12); flex-shrink: 0; position: relative; display: flex;
    align-items: center; overflow: visible;
    /* Hafif 3D dış gölge ile kabartma hissi */
    filter: drop-shadow(1.5px 2px 2px rgba(0,0,0,0.6)) drop-shadow(-1px 0px 1px rgba(255,255,255,0.06));
}

.point::before {
    content: '';

    position: absolute;

    left: 0;
    right: 0;

    height: 88%;

    z-index: 1;

    /* İç pah kırılması ve hacim veren gölgeler */
    box-shadow:
        inset 2px 0 3px rgba(255,255,255,0.15),
        inset -2px 0 3px rgba(0,0,0,0.35),
        inset 0 0 10px rgba(255,255,255,0.05),
        inset 0 -8px 10px rgba(0,0,0,0.4);

    filter: saturate(1.1);
}
.point.up { flex-direction: column; justify-content: flex-start; }
.point.up::before { top: 0; clip-path: polygon(0 0, 100% 0, 50% 100%); }
.point.down { flex-direction: column-reverse; justify-content: flex-start; }
.point.down::before { bottom: 0; clip-path: polygon(50% 0%, 0 100%, 100% 100%); }
.point.odd::before {
    background:
        linear-gradient(
            to bottom,
            #e6d0b0 0%,
            #c8a97e 45%,
            #9c7a58 100%
        );
}

.point.even::before {
    background:
        linear-gradient(
            to bottom,
            #8e2f23 0%,
            #6b1f16 45%,
            #43120c 100%
        );
}

/* =========================================
   ORTA MENTEŞE / BAR
   ========================================= */

.bar {
    width: 7%;

    flex-shrink: 0;

    position: relative;

    height: 100%;

    background:
        linear-gradient(
            to right,
            #140904,
            #2d1810,
            #4a2b1a,
            #2d1810,
            #140904
        );

    border-left: 2px solid rgba(0,0,0,0.8);
    border-right: 2px solid rgba(255,255,255,0.05);

    box-shadow:
        inset 0 0 15px rgba(255,255,255,0.05),
        inset 0 0 30px rgba(0,0,0,0.7);

    z-index: 5;

    display: flex;
    flex-direction: column;
    align-items: center;

    padding: 0 !important;
}

/* Gerçekçi Metal Menteşe Hissi */
.bar::before {
    content: "";

    position: absolute;

    top: 5%;
    bottom: 5%;
    left: 50%;

    width: 8px;

    transform: translateX(-50%);

    /* Menteşe boğumları ve silindirik metalik yansıma */
    background:
        repeating-linear-gradient(
            to bottom,
            transparent,
            transparent 38px,
            rgba(0,0,0,0.7) 38px,
            rgba(0,0,0,0.7) 40px,
            transparent 40px
        ),
        linear-gradient(
            to right,
            #1a1a1a 0%,
            #666 20%,
            #aaa 40%,
            #e6e6e6 50%,
            #999 60%,
            #444 80%,
            #111 100%
        );

    border-radius: 4px;
    
    box-shadow:
        inset 0 1px 2px rgba(255,255,255,0.4),
        inset 0 -1px 2px rgba(0,0,0,0.8),
        2px 0 6px rgba(0,0,0,0.85),
        -1px 0 4px rgba(0,0,0,0.6);
        
    z-index: 10;
}

/* Tahtanın iki yarısı arasındaki derinlik boşluğu (menteşe yuvası) */
.bar::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 3px;
    transform: translateX(-50%);
    background: #060301;
    box-shadow: 
        inset 1px 0 2px rgba(0,0,0,0.9),
        0 0 3px rgba(0,0,0,0.9);
    z-index: 9;
}
.row.top-row .bar { justify-content: flex-start; }
.row.bottom-row .bar { justify-content: flex-end; }

/* Kırık taşların menteşe (hinge) elementlerinin üzerinde görünmesi için z-index değeri */
.bar .stone {
    z-index: 12;
}



/* =========================================
   ULTRA GERÇEKÇİ TAVLA TAŞLARI
   ========================================= */

.stone {
    width: 85%;
    aspect-ratio: 1/1;
    border-radius: 50%;

    position: relative;
    z-index: 6;

    flex-shrink: 0;

    border: 1px solid rgba(0,0,0,0.85);

    transition:
        transform 0.18s ease,
        box-shadow 0.18s ease;

    overflow: hidden;

    /* Gerçekçi yükseklik, yansıma ve zemin gölgesi */
    box-shadow:
        inset 0 4px 6px rgba(255,255,255,0.25),
        inset 0 -8px 12px rgba(0,0,0,0.65),
        0 6px 12px rgba(0,0,0,0.75),
        0 2px 4px rgba(0,0,0,0.5);
}

/* ORTA ÇUKUR */
.stone::before {
    content: "";

    position: absolute;

    top: 20%;
    left: 20%;

    width: 60%;
    height: 60%;

    border-radius: 50%;

    /* Daha derin ve gerçekçi çukur gölgesi */
    box-shadow:
        inset 0 6px 12px rgba(0,0,0,0.65),
        inset 0 -3px 6px rgba(255,255,255,0.15),
        0 2px 3px rgba(255,255,255,0.1);

    opacity: 1;
}

/* ÜST IŞIK PARLAMASI */
.stone::after {
    content: "";

    position: absolute;

    top: 8%;
    left: 15%;

    width: 50%;
    height: 25%;

    border-radius: 50%;

    /* Doğal ve yumuşak ışık yansıması */
    background: linear-gradient(to bottom, rgba(255,255,255,0.45), rgba(255,255,255,0));

    filter: blur(1px);

    transform: rotate(-20deg);
    
    pointer-events: none;
}

/* BEYAZ TAŞ */
.stone.white {
    background:
        radial-gradient(circle at 35% 25%,
            #ffffff 0%,
            #e6e6e6 30%,
            #c4c4c4 60%,
            #8a8a8a 100%);
}

/* SİYAH TAŞ */
.stone.black {
    background:
        radial-gradient(circle at 35% 25%,
            #5a636e 0%,
            #353f48 35%,
            #181f26 65%,
            #080a0e 100%);
}

/* ÜST ÜSTE DURUŞ */
.point.up .stone {
    margin-top: -35%;
}

.point.up .stone:first-child {
    margin-top: 5%;
}

.point.down .stone {
    margin-bottom: -35%;
}

.point.down .stone:first-child {
    margin-bottom: 5%;
}

/* SEÇİLEBİLİR TAŞ */
.stone.selectable {
    cursor: grab;

    box-shadow:
        inset 0 4px 6px rgba(255,255,255,0.12),
        inset 0 -8px 12px rgba(0,0,0,0.45),
        0 0 12px rgba(46, 204, 113, 0.45),
        0 5px 10px rgba(0,0,0,0.65);
}

.stone.selectable:active {
    cursor: grabbing;
}

/* HOVER EFEKTİ */
.stone.selectable:hover {
    transform: scale(1.12) translateY(-2px);

    box-shadow:
        inset 0 4px 6px rgba(255,255,255,0.14),
        inset 0 -8px 12px rgba(0,0,0,0.45),
        0 0 18px rgba(241, 196, 15, 0.35),
        0 10px 18px rgba(0,0,0,0.75);

    z-index: 15;
}

/* SÜRÜKLENEN TAŞ */
.stone.dragging {
    opacity: 0.6;
    transform: scale(1.15);
    z-index: 100;
}

.stone.selectable:hover {
    transform: scale(1.13);
    z-index: 20;

    box-shadow:
        0 0 18px rgba(241,196,15,0.45),
        0 10px 18px rgba(0,0,0,0.6),
        inset 0 -8px 12px rgba(0,0,0,0.45);
}

/* SEÇİLİ TAŞ */
.stone.selected {
    transform: scale(1.13);

    border: 2px solid #f1c40f;

    box-shadow:
        0 0 22px rgba(241,196,15,0.95),
        0 10px 20px rgba(0,0,0,0.7),
        inset 0 -8px 12px rgba(0,0,0,0.45);

    z-index: 25;
}

.point.up .stone { margin-top: -35%; }
.point.up .stone:first-child { margin-top: 5%; }
.point.down .stone { margin-bottom: -35%; }
.point.down .stone:first-child { margin-bottom: 5%; }

.stone.selectable {
    cursor: grab; box-shadow: 0 0 10px 4px rgba(46, 204, 113, 0.7), inset 0 -4px 6px rgba(0,0,0,0.5);
}
.stone.selectable:active { cursor: grabbing; }
.stone.selectable:hover { transform: scale(1.15); z-index: 15; }

/* Taşı sürüklerken uygulanacak efekt */
.stone.dragging {
    opacity: 0.6;
    transform: scale(1.15);
    z-index: 100;
}
.stone.selected {
    transform: scale(1.15); border: 2px solid #f1c40f;
    box-shadow: 0 0 15px 6px rgba(241, 196, 15, 0.8); z-index: 20;
}

.point.valid-target::after {
    content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 30px; height: 30px; border-radius: 50%; background-color: rgba(46, 204, 113, 0.6);
    box-shadow: 0 0 15px rgba(46, 204, 113, 1); z-index: 25; cursor: pointer;
    animation: pulseTarget 1s infinite alternate;
}
@keyframes pulseTarget {
    from { transform: translate(-50%, -50%) scale(1); opacity: 0.6; }
    to { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
}

#board-dice-area {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    display: flex; gap: 40px; z-index: 20;
    perspective: 1000px;
}
.die {
    width: 39px; height: 39px;
    transform-style: preserve-3d;
    position: relative;
    background: #ffffff; /* Kenar sızıntılarını önlemek için */
    border-radius: 8px; /* Taşıyıcıyı da ovalleştiriyoruz */
}

.die-side {
    width: 39px; height: 39px;
    position: absolute;
    background: linear-gradient(135deg, #ffffff, #f0f3f4);
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,0.08); /* Siyah çizgiyi yumuşattık */
    box-shadow: inset 0 0 8px rgba(0,0,0,0.1); /* Daha profesyonel gölge */
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    padding: 5px;
    gap: 2px;
    backface-visibility: hidden;
}
.die-dot {
    background-color: #1a252f;
    border-radius: 50%;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.6), 0 1px 1px rgba(255,255,255,0.8);
}
.die-dot.red {
    background-color: #c0392b;
}

.side-1 { transform: rotateY(0deg) translateZ(19.5px); }
.side-6 { transform: rotateY(180deg) translateZ(19.5px); }
.side-3 { transform: rotateY(90deg) translateZ(19.5px); }
.side-4 { transform: rotateY(-90deg) translateZ(19.5px); }
.side-5 { transform: rotateX(90deg) translateZ(19.5px); }
.side-2 { transform: rotateX(-90deg) translateZ(19.5px); }

/* 1 dot */
.side-1 .die-dot { grid-column: 2; grid-row: 2; width: 14px; height: 14px; margin: auto; }
/* 2 dots */
.side-2 .die-dot:nth-child(1) { grid-column: 1; grid-row: 1; }
.side-2 .die-dot:nth-child(2) { grid-column: 3; grid-row: 3; }
/* 3 dots */
.side-3 .die-dot:nth-child(1) { grid-column: 1; grid-row: 1; }
.side-3 .die-dot:nth-child(2) { grid-column: 2; grid-row: 2; }
.side-3 .die-dot:nth-child(3) { grid-column: 3; grid-row: 3; }
/* 4 dots */
.side-4 .die-dot:nth-child(1) { grid-column: 1; grid-row: 1; }
.side-4 .die-dot:nth-child(2) { grid-column: 3; grid-row: 1; }
.side-4 .die-dot:nth-child(3) { grid-column: 1; grid-row: 3; }
.side-4 .die-dot:nth-child(4) { grid-column: 3; grid-row: 3; }
/* 5 dots */
.side-5 .die-dot:nth-child(1) { grid-column: 1; grid-row: 1; }
.side-5 .die-dot:nth-child(2) { grid-column: 3; grid-row: 1; }
.side-5 .die-dot:nth-child(3) { grid-column: 2; grid-row: 2; }
.side-5 .die-dot:nth-child(4) { grid-column: 1; grid-row: 3; }
.side-5 .die-dot:nth-child(5) { grid-column: 3; grid-row: 3; }
/* 6 dots */
.side-6 .die-dot:nth-child(1) { grid-column: 1; grid-row: 1; }
.side-6 .die-dot:nth-child(2) { grid-column: 1; grid-row: 2; }
.side-6 .die-dot:nth-child(3) { grid-column: 1; grid-row: 3; }
.side-6 .die-dot:nth-child(4) { grid-column: 3; grid-row: 1; }
.side-6 .die-dot:nth-child(5) { grid-column: 3; grid-row: 2; }
.side-6 .die-dot:nth-child(6) { grid-column: 3; grid-row: 3; }
/* =========================================
   PUL TOPLAMA (BEAR-OFF) ALANI
   ========================================= */
#off-board-area {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 70px;
    background-color: #2d1810;
    border: 4px solid #1e0f0a;
    border-radius: 8px;
    margin-right: 20px;
    padding: 5px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.8);
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
#off-board-area.visible {
    visibility: visible;
    opacity: 1;
}

.off-zone {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 5px 0;
    border-radius: 4px;
    transition: all 0.2s;
}

#white-off-zone { justify-content: flex-start; }
#black-off-zone { justify-content: flex-end; }

/* Toplanmış taşların üst üste sıkışık ve profilden görünümü */
.off-stone {
    width: 45px;
    height: 12px;
    border-radius: 4px;
    margin: -1px 0; /* Üst üste binerler */
    border: 1px solid rgba(0,0,0,0.8);
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.2);
}

/* Hedef yandığında yeşil parlama efekti */
.valid-target-off {
    background-color: rgba(46, 204, 113, 0.3);
    box-shadow: inset 0 0 15px rgba(46, 204, 113, 0.8);
    cursor: pointer;
    animation: pulseOffZone 1s infinite alternate;
}

@keyframes pulseOffZone {
    from { background-color: rgba(46, 204, 113, 0.2); }
    to { background-color: rgba(46, 204, 113, 0.5); }
}
/* =========================================
   KALAN ZARLAR (PROFESYONEL VE SADE TASARIM)
   ========================================= */
#dice-container {
    align-items: center;
    gap: 12px;
    background: rgba(26, 37, 47, 0.8);
    padding: 8px 16px;
    border-radius: 30px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3), 0 4px 8px rgba(0,0,0,0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    margin-right: auto;
    margin-left: 20px;
}

.dice-badges {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    gap: 8px;
}

.dice-badge {
    display: flex;
    justify-content: center;
    align-items: center;
    width: clamp(26px, 4vmin, 34px);
    height: clamp(26px, 4vmin, 34px);
    background: linear-gradient(135deg, #fdfefe, #ecf0f1);
    color: #2c3e50;
    font-size: clamp(14px, 2vmin, 18px);
    font-weight: bold;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.4);
    border: 1px solid #bdc3c7;
}
/* =========================================
   PROFESYONEL LOBİ EKRANI TASARIMI
   ========================================= */
.game-title {
    font-size: 46px;
    font-weight: 900;
    letter-spacing: 6px;
    color: #ecf0f1;
    text-shadow: 0 4px 15px rgba(0,0,0,0.9), 0 2px 5px rgba(255,255,255,0.4);
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

/* YENİ PROFESYONEL ZAR TASARIMI */
.title-dice { 
    font-size: 42px; 
    color: #f1c40f; 
    text-shadow: 0 4px 6px rgba(0,0,0,0.8);
    font-family: 'Segoe UI Symbol', 'Arial Unicode MS', sans-serif;
    letter-spacing: -4px; 
}

.lobby-board {
    background: #1e0f0a;
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.9), inset 0 0 10px rgba(0,0,0,0.8);
    border: 4px solid #0a0502;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.lobby-half {
    background: radial-gradient(circle at center, #6b4226, #361f11);
    padding: 40px 20px;
    border-radius: 6px;
    position: relative;
    box-shadow: inset 0 0 30px rgba(0,0,0,0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    border: 2px solid #2a160c;
    overflow: hidden; 
}

/* =========================================
   GERÇEK FİZİK KURALLARINA UYGUN YATAY ÜÇGENLER (6'LI SET)
   ========================================= */
.lobby-points {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 30%; /* Daha dar oldukları için boylarını estetik olarak biraz uzattım */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    opacity: 0.4; 
    z-index: 1; 
}

.left-points { left: 0; }
.right-points { right: 0; }

.l-point { width: 100%; height: 16.66%; } /* 6 adet sığması için daraltıldı */

/* Sol üçgenler yatay düz durur, sağa doğru sivrilir */
.left-points .l-point { clip-path: polygon(0 0, 100% 50%, 0 100%); }
/* Sağ üçgenler yatay düz durur, sola doğru sivrilir */
.right-points .l-point { clip-path: polygon(100% 0, 0 50%, 100% 100%); }

/* Üçgen Renkleri ve Yönlü Gölgeleri */
.left-points .l-odd { background: linear-gradient(to right, #d5b895, #b89b78); }
.left-points .l-even { background: linear-gradient(to right, #7b241c, #511812); }
.right-points .l-odd { background: linear-gradient(to left, #d5b895, #b89b78); }
.right-points .l-even { background: linear-gradient(to left, #7b241c, #511812); }

.input-wrapper label {
    font-size: 12px;
    font-weight: 700;
    color: #d5b895;
    letter-spacing: 2px;
    text-align: left;
    margin-left: 5px;
}

.lobby-board input {
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid #5a3821;
    color: #f1c40f;
    font-size: 18px;
    padding: 15px;
    border-radius: 8px;
    box-shadow: inset 0 4px 10px rgba(0,0,0,0.8), 0 2px 0 rgba(255,255,255,0.1);
    text-align: center;
    letter-spacing: 1px;
    transition: all 0.3s ease;
}

.lobby-board input:focus {
    border-color: #f1c40f;
    box-shadow: inset 0 4px 10px rgba(0,0,0,0.8), 0 0 15px rgba(241, 196, 15, 0.3);
    outline: none;
}

.board-hinge {
    height: 25px;
    background: linear-gradient(to right, #110804, #3a2012, #110804);
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-top: 2px solid #000;
    border-bottom: 2px solid #000;
    margin: 2px 0;
}

.hinge-detail {
    width: 40px;
    height: 12px;
    background: linear-gradient(to bottom, #7f8c8d, #34495e);
    border-radius: 3px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.8), inset 0 1px 2px rgba(255,255,255,0.4);
    border: 1px solid #111;
}

.join-board-btn {
    background: linear-gradient(to bottom, #27ae60, #1e8449);
    color: #fff;
    border: 2px solid #145a32;
    font-size: 18px;
    font-weight: bold;
    padding: 16px 30px;
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.7), inset 0 2px 4px rgba(255,255,255,0.3);
    margin-top: 25px; 
    text-transform: uppercase;
    letter-spacing: 2px;
    width: 100%;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.join-board-btn:hover {
    background: linear-gradient(to bottom, #2ecc71, #27ae60);
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.8), inset 0 2px 4px rgba(255,255,255,0.4);
}

.join-board-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.8);
}
.game-title {
    font-family: 'Russo One', sans-serif;
    font-size: 52px;
    letter-spacing: 4px;
    color: #f5d08a;
    text-shadow:
        0 0 10px rgba(0,0,0,0.7),
        0 0 20px rgba(255,180,60,0.4);
}
/* =========================================
   SKOR TABELASI, SÜRE SAYACI VE OYUN SONU
   ========================================= */
.score-board {
    display: flex; gap: 12px; align-items: center; background: rgba(0, 0, 0, 0.5);
    padding: 6px 16px; border-radius: 10px; font-weight: bold; font-size: 15px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.6);
}
.score-item { display: flex; align-items: center; gap: 8px; color: #bdc3c7; }
#score-you-name, #score-opp-name { 
    font-family: 'Press Start 2P', monospace; 
    font-size: 11px; 
    max-width: 90px; 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
    text-transform: uppercase;
}
.score-val { color: #f1c40f; font-size: 18px; background: rgba(0,0,0,0.4); padding: 2px 8px; border-radius: 6px; }
.score-separator { color: #7f8c8d; font-size: 14px; opacity: 0.5; }

.timer-tube {
    position: absolute; top: 0; left: 0; right: 0; height: 6px;
    background-color: rgba(231, 76, 60, 0.2); z-index: 1;
}
.timer-liquid {
    height: 100%; width: 100%; background: linear-gradient(to right, #e74c3c, #c0392b);
    box-shadow: 0 0 10px rgba(231, 76, 60, 0.8);
}

.game-over-overlay {
    position: fixed; 
    top: 0; left: 0; right: 0; bottom: 0; 
    background: rgba(10, 8, 15, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 100000; 
    display: flex; 
    justify-content: center; 
    align-items: center;
    padding: 20px;
}

.game-over-box {
    background: linear-gradient(165deg, #2b180a 0%, #150a04 100%);
    padding: clamp(28px, 4vw, 45px) clamp(30px, 5vw, 55px);
    border-radius: 24px;
    border: 2px solid #f1c40f;
    text-align: center;
    box-shadow: 
      0 20px 60px rgba(0, 0, 0, 0.9),
      inset 0 1px 2px rgba(255, 255, 255, 0.25),
      0 0 35px rgba(241, 196, 15, 0.35);
    animation: popIn 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-width: min(90vw, 480px);
    width: 100%;
    position: relative;
    overflow: hidden;
}

/* VICTORY THEME */
.game-over-box.victory {
    border-color: #f1c40f;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9), inset 0 1px 2px rgba(255, 255, 255, 0.25), 0 0 40px rgba(241, 196, 15, 0.4);
    background: linear-gradient(165deg, #2d2407 0%, #151002 100%);
}

.game-over-box.victory .game-over-badge {
    background: radial-gradient(circle, #f39c12 0%, #d35400 100%);
    color: #fff;
    box-shadow: 0 0 25px rgba(241, 196, 15, 0.6);
}

.game-over-box.victory .game-over-title {
    color: #f1c40f;
    text-shadow: 0 0 15px rgba(241, 196, 15, 0.6);
}

/* DEFEAT THEME */
.game-over-box.defeat {
    border-color: #e74c3c;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9), inset 0 1px 2px rgba(255, 255, 255, 0.25), 0 0 40px rgba(231, 76, 60, 0.35);
    background: linear-gradient(165deg, #2d0e0e 0%, #150505 100%);
}

.game-over-box.defeat .game-over-badge {
    background: radial-gradient(circle, #e74c3c 0%, #900c3f 100%);
    color: #fff;
    box-shadow: 0 0 25px rgba(231, 76, 60, 0.5);
}

.game-over-box.defeat .game-over-title {
    color: #e74c3c;
    text-shadow: 0 0 15px rgba(231, 76, 60, 0.6);
}

.game-over-badge {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 0 auto 18px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid rgba(255, 255, 255, 0.2);
    animation: badgePulse 2s infinite ease-in-out;
}

@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.06); }
}

.game-over-title {
    font-family: 'Russo One', 'Press Start 2P', system-ui, sans-serif;
    font-size: clamp(24px, 5vw, 36px);
    letter-spacing: 2px;
    margin-bottom: 8px;
}

.game-over-winner {
    font-family: 'Outfit', system-ui, sans-serif;
    font-size: clamp(18px, 3.5vw, 24px);
    color: #f1f5f9;
    font-weight: 700;
    margin-bottom: 16px;
}

.points-pill {
    display: inline-block;
    padding: 8px 20px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    color: #2ecc71;
    font-weight: 800;
    font-size: clamp(14px, 2.5vw, 18px);
    margin-bottom: 22px;
    letter-spacing: 0.5px;
}

.game-over-timer-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.game-over-progress {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #f1c40f, #e67e22);
    border-radius: 4px;
}

.next-game-text {
    font-family: 'Outfit', system-ui, sans-serif !important;
    font-size: 14px !important;
    color: #94a3b8 !important;
    font-weight: 500 !important;
}

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

.game-hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(20, 25, 30, 0.85);
    padding: clamp(10px, 2vh, 20px) clamp(15px, 2vw, 30px);
    border-radius: 12px;
    border: 1.5px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 10px 30px rgba(0,0,0,0.6);
    margin-bottom: clamp(10px, 2vh, 20px);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(8px);
    width: 100%;
}

.hud-left { display: flex; align-items: center; justify-content: flex-start; gap: clamp(10px, 2vw, 25px); flex: 1; }
.hud-center { display: flex; flex-direction: row; align-items: center; justify-content: center; flex: 1; gap: 15px; }
.hud-right { display: flex; flex-direction: row; justify-content: flex-end; align-items: center; gap: clamp(8px, 1.5vw, 15px); flex: 1; }

#turn-indicator {
    font-weight: 800;
    font-size: 18px;
    letter-spacing: 1px;
    text-transform: uppercase;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}
/* Uçan Taş Animasyonu İçin */
.stone-clone {
    position: fixed;
    z-index: 1000;
    transition: transform 0.25s ease-out;
    pointer-events: none;
    margin: 0 !important;
}
/* =========================================
   MOBİL İÇİN SADE VE PROFESYONEL ARAYÜZ (HUD)
   ========================================= */

/* 1. DİKEY EKRAN (PORTRAIT) - OYUN İÇİ UYARI */
@media (max-width: 768px) and (orientation: portrait) {
    /* Lobi ekranındayken yatay/dikey çalışabilir, ancak oyun başladığında (game-screen block olduğunda) zorla yataya yönlendir. */
    #game-screen:not([style*="display: none"]) {
        display: none !important;
    }
    
    #game-screen:not([style*="display: none"]) ~ #portrait-warning {
        display: flex !important;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(26, 37, 47, 0.98);
        z-index: 99999;
        text-align: center;
        color: white;
        padding: 20px;
    }

    .warning-box {
        background: #2c3e50;
        padding: 40px 20px;
        border-radius: 15px;
        border: 2px solid #f1c40f;
        box-shadow: 0 0 30px rgba(241, 196, 15, 0.3);
        max-width: 350px;
    }

    .rotate-icon {
        font-size: 60px;
        margin-bottom: 20px;
        animation: rotatePhone 2s infinite ease-in-out;
    }

    @keyframes rotatePhone {
        0% { transform: rotate(0deg); }
        50% { transform: rotate(-90deg); }
        100% { transform: rotate(-90deg); }
    }

    .warning-box h2 {
        font-size: 24px;
        color: #f1c40f;
        margin-bottom: 15px;
    }

    .warning-box p {
        font-size: 16px;
        color: #ecf0f1;
        line-height: 1.5;
    }

    /* Lobi dikey sadeleştirme */
    .game-title { font-size: 32px !important; margin-bottom: 15px !important; }
    .lobby-half { padding: 25px 15px !important; }
}

/* 2. YATAY EKRAN (LANDSCAPE) - OYUN İÇİ HUD VE LOBİ DÜZELTMESİ */
@media (max-height: 600px) and (orientation: landscape), (max-width: 950px) and (orientation: landscape) {
    
    body {
        /* Mobil cihazlarda istenmeyen kaydırmaları engelle */
        overflow: hidden !important;
        touch-action: none; 
    }

    /* Oyun ekranı tam ekran esnek yapıya geçer */
    #game-screen:not([style*="display: none"]) {
        display: flex !important;
        flex-direction: row !important; 
        align-items: center !important;
        justify-content: space-between !important;
        height: 100vh !important;
        width: 100vw !important;
        gap: 10px !important;
        padding: 5px !important;
        max-width: 100% !important;
        margin: 0 !important;
        box-sizing: border-box;
    }

    /* Mobil HUD (Şeffaf Yan Panel) */
    .game-hud {
    display: flex !important;
    flex-direction: column !important;

    width: clamp(110px, 15vw, 140px) !important; 
        height: calc(100vh - 10px) !important;
        margin: 0 !important;
        justify-content: space-between !important;
        padding: 15px 10px !important;
        flex-shrink: 0 !important;
        background: rgba(10, 12, 16, 0.4) !important; 
        border: 1.5px solid rgba(255, 255, 255, 0.5) !important;
        border-radius: 16px;
        backdrop-filter: blur(4px);
    }

    .hud-left, .hud-center, .hud-right { 
        display: flex !important; 
        flex-direction: column !important; 
        width: 100% !important; 
        align-items: center !important; 
        gap: clamp(8px, 2vh, 16px) !important; 
    }
    
    /* Mobil görünümde aksiyon alanını (hud-right) sağa dayar */
    .hud-right { align-items: flex-end !important; }
    .hud-center { justify-content: center !important; }

    #turn-indicator { font-size: clamp(12px, 2.5vh, 15px) !important; text-align: center !important; line-height: 1.2; }
    
    .score-board { flex-direction: column !important; gap: clamp(4px, 1vh, 8px) !important; width: 100%; padding: clamp(6px, 1.5vh, 12px) !important; background: rgba(0,0,0,0.3) !important; border-radius: 12px !important; }
    .score-separator { display: none !important; } 
    .score-item { flex-direction: column !important; gap: 2px !important; font-size: clamp(10px, 2vh, 13px) !important; }
    #score-you-name, #score-opp-name { font-size: clamp(7px, 1.5vh, 10px) !important; max-width: 100%; }
    .score-val { font-size: clamp(14px, 3vh, 18px) !important; width: 100%; text-align: center; }
    
    .action-buttons { 
        display: grid !important; 
        grid-template-columns: 1fr !important;
        grid-template-rows: auto auto !important;
        justify-items: end !important; /* Butonları tamamen sağa dayar */
        gap: clamp(8px, 2vh, 15px) !important; 
        width: 100% !important;
    }

    /* Geri Al butonu üstte, Onay ve Zar at butonu tam altında aynı karede yer alır */
    #undo-btn { grid-row: 1 !important; grid-column: 1 !important; }
    #confirm-btn { grid-row: 2 !important; grid-column: 1 !important; }
    #roll-btn { grid-row: 2 !important; grid-column: 1 !important; }
    
    .circle-btn { 
        width: clamp(40px, 10vh, 55px) !important; 
        height: clamp(40px, 10vh, 55px) !important; 
        font-size: clamp(18px, 4vh, 26px) !important; 
    }

    #dice-container { width: 100% !important; }
    
    .dice-badges {
        flex-wrap: wrap !important;
        max-width: 80px !important;
        gap: 4px !important;
    }

    .dice-badge {
        width: clamp(22px, 5vh, 32px) !important;
        height: clamp(22px, 5vh, 32px) !important;
        font-size: clamp(12px, 2.5vh, 16px) !important;
    }

    /* Zar kutusunu hizalama */
    #dice-container { margin: 0 auto !important; width: 100% !important; justify-content: center !important; }
    .dice-badges { justify-content: center; }

    /* Tahta alanı kalan tüm alanı kaplar */
    #board-container {
    width: calc(100vw - clamp(120px, 15vw, 150px)) !important;
    height: calc(100vh - 10px) !important;
        margin: 0 !important;
        flex-grow: 1 !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 10px !important;
    }
    
    /* Pul toplama alanı biraz küçülür */
    #off-board-area {
        height: 95% !important;
        width: 50px !important;
        margin-right: 0 !important;
    }

    /* Tavla tahtasının kendisi yüksekliğe oturur */
    .board {
    aspect-ratio: 850 / 600 !important;

    width: min(
        calc(100vw - 170px),
        calc((100vh - 20px) * 1.4166)
    ) !important;

    height: auto !important;

    max-width: calc(100vw - 170px) !important;
    max-height: calc(100vh - 20px) !important;

    border-width: 8px !important;
    border-radius: 12px !important;
}

    /* Zarların mobildeki tahtada konumu */
    #board-dice-area {
        gap: 15px !important;
    }
    .die {
        width: 29px !important; height: 29px !important;
        background: #ffffff !important; /* Mobil taşıyıcı rengi */
        border-radius: 6px !important; /* Mobil taşıyıcı ovali */
    }
    .die-side {
        width: 29px !important; height: 29px !important;
        border-radius: 6px !important;
        padding: 3px !important;
        border: 1px solid rgba(0,0,0,0.08) !important; /* Mobil border yumuşatma */
    }
    .side-1 { transform: rotateY(0deg) translateZ(14.5px) !important; }
    .side-6 { transform: rotateY(180deg) translateZ(14.5px) !important; }
    .side-3 { transform: rotateY(90deg) translateZ(14.5px) !important; }
    .side-4 { transform: rotateY(-90deg) translateZ(14.5px) !important; }
    .side-5 { transform: rotateX(90deg) translateZ(14.5px) !important; }
    .side-2 { transform: rotateX(-90deg) translateZ(14.5px) !important; }

    /* LOBİ YATAY MODU: Dikey görüntüyü bozmadan oranlayarak koru */
    #lobby-screen { 
        max-width: 450px !important; 
        margin: 5px auto !important; 
    }
    .game-title { 
        font-size: 24px !important; 
        margin-bottom: 10px !important; 
    }
    .lobby-board { 
        flex-direction: column !important; /* Orijinal dikey dizilimi zorla */
    }
    .board-hinge { 
        display: flex !important; /* Menteşeyi geri getir */
    }
    .lobby-half { 
        padding: 10px !important; 
        gap: 10px !important;
    }
    .join-board-btn { 
        margin-top: 10px !important; 
        padding: 10px !important; 
    }
}

/* ── ULTRA-PREMIUM FLOATING (i) BUTTON & MODAL ── */
.global-how-to-btn {
  position: fixed;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  left: calc(20px + env(safe-area-inset-left, 0px));
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #452408 0%, #211003 70%, #0f0701 100%);
  border: 2px solid #e67e22;
  box-shadow: 
    0 8px 24px rgba(0, 0, 0, 0.75),
    inset 0 1px 2px rgba(255, 255, 255, 0.35),
    inset 0 -2px 6px rgba(0, 0, 0, 0.8),
    0 0 16px rgba(230, 126, 34, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 999999;
  outline: none;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.25s ease, border-color 0.25s ease;
  user-select: none;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

.how-to-btn-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #e67e22;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.8));
  transition: color 0.25s ease, transform 0.25s ease;
}

.how-to-icon {
  stroke: #e67e22;
  transition: stroke 0.25s ease, transform 0.25s ease;
}

.global-how-to-btn:hover {
  transform: translateY(-3px) scale(1.1);
  border-color: #ffffff;
  box-shadow: 
    0 12px 30px rgba(0, 0, 0, 0.85),
    inset 0 1px 2px rgba(255, 255, 255, 0.5),
    0 0 25px rgba(230, 126, 34, 0.6);
}

.global-how-to-btn:hover .how-to-icon {
  stroke: #ffffff;
  transform: scale(1.1);
}

.global-how-to-btn:active {
  transform: translateY(1px) scale(0.95);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.8);
}

/* Ambient Pulsing Aura Effect */
.btn-glow-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1.5px solid rgba(230, 126, 34, 0.35);
  animation: auraPulse 2.8s infinite cubic-bezier(0.45, 0, 0.55, 1);
  pointer-events: none;
}

@keyframes auraPulse {
  0% { transform: scale(0.92); opacity: 0.85; }
  50% { transform: scale(1.18); opacity: 0.15; }
  100% { transform: scale(0.92); opacity: 0.85; }
}

.global-how-to-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999999;
  padding: 15px;
  animation: fadeInHowToModal 0.25s ease-out forwards;
}

.global-how-to-modal.hidden {
  display: none !important;
}

.global-how-to-box {
  background: linear-gradient(165deg, #2c1604 0%, #120801 100%);
  border: 2px solid #e67e22;
  box-shadow: 0 0 35px rgba(0, 0, 0, 0.9), inset 0 1px 1px rgba(255, 255, 255, 0.15), 0 0 18px rgba(230, 126, 34, 0.25);
  color: #f8fafc;
  padding: 26px 28px;
  border-radius: 20px;
  width: min(92vw, 530px);
  position: relative;
  max-height: calc(88vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  font-family: 'Outfit', 'Inter', 'Poppins', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  -ms-overflow-style: none; /* IE and Edge */
  scrollbar-width: none; /* Firefox */}

.global-how-to-box::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  background: transparent !important;
}
.global-how-to-box::-webkit-scrollbar-thumb {
  display: none !important;
}

.global-how-to-close {
  position: absolute;
  top: 14px;
  z-index: 10;
  right: 18px;
  width: 36px !important;
  height: 36px !important;
  padding: 0 !important;
  border: none !important;
  background: transparent !important;
  color: #e67e22;
  font-size: 2rem;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: color 0.2s ease, transform 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.global-how-to-close:hover {
  color: #ffffff;
  transform: scale(1.15);
}

.global-how-to-title {
  color: #e67e22;
  font-size: 1.4rem;
  font-weight: 800;
  text-align: center;
  margin: 0 0 4px 0;
  padding: 0 35px;
  letter-spacing: 0.4px;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.85);
  font-family: inherit;
}

.global-how-to-subtitle {
  color: #cbd5e1;
  font-size: 0.88rem;
  text-align: center;
  margin: 0 0 20px 0;
  font-weight: 500;
  letter-spacing: 0.2px;
  opacity: 0.95;
  font-family: inherit;
}

.global-how-to-content .rules-section {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(230, 126, 34, 0.25);
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 14px;
}

.global-how-to-content h4 {
  color: #e67e22;
  font-size: 1.02rem;
  margin: 0 0 10px 0;
  font-weight: 700;
  letter-spacing: 0.2px;
  font-family: inherit;
}

.global-how-to-content p {
  font-size: 0.93rem;
  line-height: 1.65;
  color: #f1f5f9;
  margin: 0;
  font-weight: 400;
  letter-spacing: 0.15px;
  font-family: inherit;
}

.global-how-to-content ul, .global-how-to-content ol {
  margin: 0;
  padding-left: 22px;
  font-size: 0.92rem;
  color: #f1f5f9;
  line-height: 1.68;
  font-weight: 400;
  letter-spacing: 0.15px;
  font-family: inherit;
}

.global-how-to-content li {
  margin-bottom: 8px;
}

.global-how-to-content li strong {
  color: #ffffff;
  font-weight: 700;
}

.global-how-to-content li:last-child {
  margin-bottom: 0;
}

@keyframes fadeInHowToModal {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

/* ── MOBİL / DİK / YATIK EKRAN UYUMLULUĞU ── */
@media (max-width: 600px) {
  .global-how-to-btn {
    display: none !important;
  }
  .how-to-icon {
    width: 20px;
    height: 20px;
  }
  .global-how-to-box {
    padding: 20px 20px;
    border-radius: 16px;
  
  -ms-overflow-style: none; /* IE and Edge */
  scrollbar-width: none; /* Firefox */}
  .global-how-to-title {
    font-size: 1.2rem;
  }
  .global-how-to-content .rules-section {
    padding: 12px 14px;
    margin-bottom: 12px;
  }
  .global-how-to-content p, .global-how-to-content ul, .global-how-to-content ol {
    font-size: 0.88rem;
    line-height: 1.6;
  }
}

@media (max-height: 500px) {
  .global-how-to-btn {
    display: none !important;
  }
  .how-to-icon {
    width: 18px;
    height: 18px;
  }
  .global-how-to-box {
    max-height: 90vh;
    padding: 16px 18px;
  
  -ms-overflow-style: none; /* IE and Edge */
  scrollbar-width: none; /* Firefox */}
}

/* ── LANDSCAPE ENGELLEYİCİ (Masaüstü ve Dik Mobilde Gizli, Sadece Mobil Yatık Ekranda Görünür) ── */
#landscape-blocker {
  display: none !important;
}

@media (pointer: coarse) and (orientation: landscape) and (max-height: 500px) {
  #landscape-blocker {
    display: flex !important;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(13, 3, 23, 0.96);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 99999999;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    text-align: center;
    padding: 20px;
  }
  #landscape-blocker .rotate-icon {
    font-size: 3rem;
    color: #ffde00;
    margin-bottom: 12px;
    animation: rotatePhone 2s infinite ease-in-out;
  }
  #landscape-blocker h2 {
    font-size: 1.4rem;
    color: #ffde00;
    margin-bottom: 6px;
    font-weight: 800;
  }
  #landscape-blocker p {
    font-size: 0.95rem;
    color: #cbd5e1;
    margin: 0;
  }
}

@keyframes rotatePhone {
  0% { transform: rotate(0deg); }
  50% { transform: rotate(-90deg); }
  100% { transform: rotate(0deg); }
}
