.wordle{
    min-height: 740px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* KART: kalın mavi border kaldırıldı, yerine ince çerçeve + üst mavi şerit + yumuşak mavi gölge */
.grid-wordle{
    position: relative;
    width: min(100%, 460px);
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 10px auto;
    padding: 78px 14px 16px;      /* üstte logo/butonlara yer */
    box-sizing: border-box;
    background-color: aliceblue;
    background-image: linear-gradient(180deg, rgba(255,255,255,.8), rgba(13,110,253,.04));
    border: 1px solid rgba(13, 110, 253, 0.18);
    border-radius: 24px;
    box-shadow:
        0 2px 6px rgba(13, 110, 253, 0.08),
        0 28px 60px -14px rgba(13, 110, 253, 0.30);
    overflow: hidden;
}
.grid-wordle::before{             /* üstteki ince mavi şerit */
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 5px;
    background: linear-gradient(90deg, #0D6EFD, #6ea8fe, #0D6EFD);
}

/* LOGO: tam ortada */
.wordle-h{
    position: absolute;
    top: 14px;
    left: 0;
    right: 0;
    margin-inline: auto;
    width: 180px;
    height: auto;
    cursor: pointer;
    transition: transform 0.2s ease;
    will-change: transform;
}
.wordle-h:hover{ transform: scale(1.1); }

/* INFO: yuvarlak buton, "?" CSS ile çiziliyor (Font Awesome ikonu gizlenir) */
.wordle-how{
    position: absolute;
    top: 14px;
    right: 14px;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #fff;
    border: 1.5px solid rgba(13, 110, 253, 0.35);
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.15);
    cursor: pointer;
    transition: transform .2s ease, background .2s ease, border-color .2s ease;
    will-change: transform;
}
.wordle-how i{ display: none; }
.wordle-how::after{
    content: "?";
    font: 800 17px/1 "Segoe UI", system-ui, sans-serif;
    color: #0D6EFD;
    transition: color .2s ease;
}
.wordle-how:hover{ background: #0D6EFD; border-color: #0D6EFD; transform: scale(1.1); }
.wordle-how:hover::after{ color: #fff; }

/* GIVE UP: sade hap buton, üzerine gelince dolar */
.giveup{
    position: absolute;
    top: 14px;
    left: 14px;
    width: auto;
    margin: 0;
    padding: 7px 14px;
    border-radius: 999px;
    border: 1.5px solid #0D6EFD;
    background: #fff;
    color: #0D6EFD;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .2px;
    white-space: nowrap;
    text-align: center;
    cursor: pointer;
    user-select: none;
    box-shadow: none;
    transition: background .2s ease, color .2s ease, box-shadow .2s ease, transform .2s ease;
    will-change: transform;
}
.giveup:hover{
    background: #0D6EFD;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(13, 110, 253, 0.35);
}
.giveup:active{ transform: scale(.96); }

/* TAHTA */
.wordle-x{
    order: 1;
    width: 316px;                 /* 5 x 60px + 4 x 4px */
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;

    gap: 4px;
    margin: 0 auto;
}
.square{
    width: 60px;
    height: 60px;
    border: solid 2px rgba(14, 11, 11, 0.329);
    box-sizing: border-box;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font: bold 15px/1 "Segoe UI", system-ui, sans-serif;
    font-size: 26px;
    font-weight: 800;
    text-transform: uppercase;
    user-select: none;
    background: rgb(235, 245, 255);
    color: rgb(67, 67, 67);
}
.wordle-x div.filled { border-color:#0D6EFD; animation: pop .1s ease; }
.wordle-x div.correct{ background:#6aaa64; border-color:#4f8a49; color:#fff; }
.wordle-x div.present{ background:#c9b458; border-color:#a8943a; color:#fff; }
.wordle-x div.absent { background:#787c7e; border-color:#5d6062; color:#fff; }
.wordle-x div.shake  { animation: shake .4s; }

@keyframes pop{ 50%{ transform:scale(1.12); } }
@keyframes shake{
    20%,60%{ transform:translateX(-4px); }
    40%,80%{ transform:translateX(4px); }
}

/* ================= KLAVYE ================= */
.keyboard-container{
    order: 2;
    width: 100%;                    /* auto yerine 100%: karttan taşmasın */
    margin-top: 5px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.keyboard-container .keyboard-row{
    display: flex;
    justify-content: center;
    width: 100%;
    max-width: 520px;               /* 520px'ten büyümez, dar ekranda küçülür */
    margin-inline: auto;
    touch-action: manipulation;
}

.keyboard-container button{
    flex: 1 1 0;
    min-width: 0;
    height: 60px;
    margin: 0 2.5px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: #f1f5ff;
    color: #000000;
    font: bold 15px/1 "Segoe UI", system-ui, sans-serif;
    text-transform: uppercase;
    text-align: center;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 0 1px rgba(14, 11, 11, 0.12), 0 2px 0 rgba(13, 110, 253, 0.18);
    transition: transform .1s, background .15s, box-shadow .1s;
    -webkit-tap-highlight-color: transparent;
}
.keyboard-container button:hover{ background:#c3c7cc; }
.keyboard-container button:active{
    transform: translateY(2px);
    box-shadow: inset 0 0 0 1px rgba(14, 11, 11, 0.12);
}

/* Enter ve Del */
.keyboard-container button.wide-button{
    flex: 1.5 1 0;
    font-size: 12px;
}
.keyboard-container button.wide-button i{
    font-size: 18px;
    pointer-events: none;
}


/* Tahminden sonra tuş renkleri (JS ile classList.add) */
.keyboard-container button.correct{ background:#6aaa64; color:#fff; }
.keyboard-container button.present{ background:#c9b458; color:#fff; }
.keyboard-container button.absent { background:#787c7e; color:#fff; }

/* ============ TELEFON: sadece konum değişir, tuş boyutu aynı ============ */
@media (max-width: 480px){
       .wordle{
        padding-bottom: calc(var(--key-h) * 3 + var(--key-gap) * 2 + 30px + env(safe-area-inset-bottom));
    }

    .keyboard-container{
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 50;
        margin: 0;
        padding: 10px 3px calc(10px + env(safe-area-inset-bottom));
        background: #e4eaf4;
        border-top: 1px solid rgba(13, 110, 253, 0.18);
        box-sizing: border-box;
    }
}

/* Dokunmatikte hover rengi takılı kalmasın */
@media (hover: none){
    .keyboard-container button:hover{ background:#f1f5ff; }
    .keyboard-container button.correct:hover{ background:#6aaa64; }
    .keyboard-container button.present:hover{ background:#c9b458; }
    .keyboard-container button.absent:hover{ background:#787c7e; }
}

.alert-box{
    position: absolute;
    top: 50%;                       /* tahtanın hemen üstü, gerekirse ayarla */
    z-index: 10;
    margin-inline: auto;
    min-width: 140px;
    max-width: calc(100% - 28px);
    padding: 10px 18px;
    box-sizing: border-box;

    display: flex;                   /* yazıyı ortalar */
    align-items: center;
    justify-content: center;
    text-align: center;

    background: #fff;
    color: #111;
    font: 600 14px/1.3 "Segoe UI", system-ui, sans-serif;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(13, 110, 253, .25);

    /* varsayılan: görünmez ve tıklanamaz */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .25s ease, transform .25s ease, visibility .25s;
}

/* JS bu sınıfı ekleyince görünür */
.alert-box.show{
    opacity: 1;
    visibility: visible;
    animation: alert-in .3s ease both;
}

.result{
    display: none;
    position: absolute;
    top: 20%;
    align-items: center;
    margin: 0 auto;
    flex-direction: column;
    z-index: 10;
    width: 300px;
    height: 400px;
    border: 1px solid #0D6EFD;
    background-color: #0D6EFD;
    border-radius: 22.5px;

  background: rgba(13, 110, 253, 0.15);
  backdrop-filter: blur(3px) saturate(160%);
  -webkit-backdrop-filter: blur(12px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35),
              inset 0 1px 0 rgba(255, 255, 255, 0.4);
}


.result h2{
    margin-top: 20px;
    display: flex;
    font-size: xx-large;

}

.result .close-btn{
    position: absolute;
    display: flex;
    text-decoration: none;
    background-color: transparent;
    background: none;
    border: none;
    font-weight: bold;
    font-size: large;
    top: 0;
    right: 0;
    margin: 7.5px;

    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}

.result .tryagnbtn{
    position: absolute;
    display: flex;
    margin: 10px;
    bottom: 0;
    text-decoration: none;
    border-radius: 17.5px;
    border:1px solid #004cbf;
    background-color: #0D6EFD;
    font-weight: bold;
    width: 200px;
    height: 35px;
    justify-content: center;
    align-items: center;

    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;

}

.result .tryagnbtn:hover {
    background-color: #0b5ed7; /* Biraz daha koyu ve canlı mavi */
    border-color: #0a58ca;
    box-shadow: 1px 1px 14px rgba(13, 110, 253, 0.45); /* Parlayan gölge */
    transform: translateY(-2px); /* Buton hafifçe havaya kalkar */
}

/* ── ACTIVE: Tıklandığında (Basılma Hissi) ── */
.result .tryagnbtn:active {
    background-color: #0a58ca; /* Daha koyu ton */
    transform: translateY(1px) scale(0.97); /* Basılma/küçülme efekti */
    box-shadow: 0 2px 5px rgba(13, 110, 253, 0.3); /* Gölge içeri gömülür */
}

.tryagnbtn .try-agan{
    color: white;
    display: flex;
    position: absolute;
}


.result.show{
    display: flex !important;
}



.result-win{
    display: none;
    position: absolute;
    top: 20%;
    align-items: center;
    margin: 0 auto;
    flex-direction: column;
    z-index: 10;
    width: 300px;
    height: 400px;
    border: 1px solid #0D6EFD;
    background-color: #0D6EFD;
    border-radius: 22.5px;

  background: rgba(13, 110, 253, 0.15);
  backdrop-filter: blur(3px) saturate(160%);
  -webkit-backdrop-filter: blur(12px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35),
              inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.result-win .tryagnbtn{
    position: absolute;
    display: flex;
    margin: 10px;
    bottom: 0;
    text-decoration: none;
    border-radius: 17.5px;
    border:1px solid #004cbf;
    background-color: #0D6EFD;
    font-weight: bold;
    width: 200px;
    height: 35px;
    justify-content: center;
    align-items: center;

    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;

}


.result-win .close-btn{
    position: absolute;
    display: flex;
    text-decoration: none;
    background-color: transparent;
    background: none;
    border: none;
    font-weight: bold;
    font-size: large;
    top: 0;
    right: 0;
    margin: 7.5px;

    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}

.result-win h2{
    margin-top: 20px;
    display: flex;

}


.result-win .tryagnbtn:hover {
    background-color: #0b5ed7; /* Biraz daha koyu ve canlı mavi */
    border-color: #0a58ca;
    box-shadow: 1px 1px 14px rgba(13, 110, 253, 0.45); /* Parlayan gölge */
    transform: translateY(-2px); /* Buton hafifçe havaya kalkar */
}

/* ── ACTIVE: Tıklandığında (Basılma Hissi) ── */
.result-win .tryagnbtn:active {
    background-color: #0a58ca; /* Daha koyu ton */
    transform: translateY(1px) scale(0.97); /* Basılma/küçülme efekti */
    box-shadow: 0 2px 5px rgba(13, 110, 253, 0.3); /* Gölge içeri gömülür */
}

.result-win .tryagnbtn .try-agan{
    color: white;
    display: flex;
    position: absolute;
}

.result-win.show{
    display: flex !important;
}

.result-win .scoreui{
  font-weight: 500;
  margin: 20px;
}

.scr-txt{
    font-weight: bolder;
    font-size: x-large;
    margin: 20px;
}

.result .scoreui, .result-win .scoreui{
    font-weight: bold;
    font-size: medium;
    border: 1px solid #0D6EFD;
    width: 75px;
    height: 30px;
    border-radius: 12.5px;
    display: flex;
    text-align: center;
    align-items: center;
    justify-content: center;
    background-color: white;
}



/* How to Play penceresi */
.howto-modal{
  display: none;
  position: fixed;
  inset: 0;
  z-index: 20;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
}

.howto-modal.show{
  display: flex;
}

.howto{
  position: relative;
  width: 380px;
  max-width: 92vw;
  max-height: 90vh;
  overflow-y: auto;
  box-sizing: border-box;
  padding: 24px;
  background: #fff;
  border: 1px solid #0D6EFD;
  border-radius: 22.5px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  color: #1a1a1b;
}

.howto-close{
  position: absolute;
  top: 0;
  right: 0;
  margin: 7.5px;
  background: none;
  border: none;
  font-weight: bold;
  font-size: large;
  cursor: pointer;
}

.howto-title{ margin: 0 0 4px; font-size: 26px; }
.howto-subtitle{ margin: 0 0 12px; font-size: 17px; }
.howto-rules{ margin: 0 0 12px; padding-left: 20px; line-height: 1.5; }
.howto-examples-title{
  margin: 14px 0 10px;
  padding-top: 12px;
  font-size: 17px;
  border-top: 1px solid #d3d6da;
}
.howto-example{ margin-bottom: 14px; }
.howto-example p{ margin: 8px 0 0; font-size: 15px; }
.howto-row{ display: flex; gap: 5px; }

.howto-tile{
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  border: 2px solid #d3d6da;
  font-size: 22px;
  font-weight: bold;
  user-select: none;
}
.howto-tile.correct{ background: #6aaa64; border-color: #6aaa64; color: #fff; }
.howto-tile.present{ background: #c9b458; border-color: #c9b458; color: #fff; }
.howto-tile.absent { background: #787c7e; border-color: #787c7e; color: #fff; }

.howto-footer{ margin: 16px 0 0; font-weight: bold; text-align: center; }