/* Harfle — sayfa ortak oyun şablonunu (play-page.css) kullanır; mod menüsü, tahta, klavye ve sonuç
   oyun panelinin içinde (.board-frame) aynı akışta gösterilir. Burada yalnızca Harfle'ye özgü parçalar var. */
body[data-game='harfane'] {
  --frame: #14553f; --title: #1f7a4d; --title-shadow: #0b3527;
  --green: #2c8c62; --green-dark: #14553f; --mint: #e0f2e8; --lime: #d8f278;
  --yellow: #f4c84f; --gray: #87918d; --error: #c94f58;
}
.hidden { display: none !important; }

/* Başlıktaki Harfle düğmeleri (giriş, yardım, istatistik) */
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.live-label { display: flex; align-items: center; gap: 7px; margin-right: 4px; color: var(--muted); font-size: 11px; font-weight: 600; white-space: nowrap; }
.live-label span { width: 8px; height: 8px; border-radius: 50%; background: #65b77b; box-shadow: 0 0 0 4px #e4f2e6; }
.auth-button, .home-auth-button { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); cursor: pointer; font-size: 12px; font-weight: 700; white-space: nowrap; transition: .18s ease; }
.auth-button { padding: 9px 14px; }
.auth-button:hover, .home-auth-button:hover { border-color: var(--green); color: var(--green-dark); }
.icon-button, .modal-close { display: grid; width: 38px; height: 38px; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; font-size: 16px; transition: .18s ease; }
.icon-button:hover, .modal-close:hover { border-color: var(--green); background: var(--mint); color: var(--green-dark); }

/* Panel içi ortak metinler */
.harfle-kicker { margin: 0 0 8px; color: var(--lime); font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.play-panel .board-frame { display: grid; }

/* 1) Mod menüsü */
.harfle-menu { padding: clamp(14px, 2.2vw, 26px); color: #fff; }
.harfle-menu h2 { margin: 0; font: 700 clamp(28px, 3.4vw, 42px) / 1.02 'Fredoka', sans-serif; letter-spacing: -.02em; }
.harfle-menu h2 em { color: var(--lime); font-style: normal; }
.harfle-menu-copy { max-width: 46ch; margin: 12px 0 0; color: rgb(255 255 255 / .78); font-size: 15px; line-height: 1.5; }
.mode-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 24px; }
.mode-card { position: relative; display: flex; min-height: 200px; flex-direction: column; align-items: flex-start; overflow: hidden; padding: 20px; border: 1px solid rgb(255 255 255 / .14); border-radius: 18px; background: #fffefa; color: var(--ink); cursor: pointer; text-align: left; transition: transform .2s ease, box-shadow .2s ease; }
.mode-card::after { position: absolute; right: -46px; bottom: -75px; width: 170px; height: 170px; border: 1px solid rgba(24, 93, 65, .11); border-radius: 50%; box-shadow: 0 0 0 22px rgba(24, 93, 65, .035), 0 0 0 45px rgba(24, 93, 65, .025); content: ''; }
.mode-card:hover { transform: translateY(-4px); box-shadow: 0 16px 34px rgb(0 0 0 / .22); }
.mode-card:focus-visible { outline: 3px solid var(--lime); outline-offset: 3px; }
.mode-number { position: absolute; top: 20px; right: 20px; color: #9aa69f; font-size: 11px; font-weight: 700; }
.mode-icon { display: grid; width: 44px; height: 44px; place-items: center; margin-bottom: 22px; border-radius: 14px; background: var(--mint); color: var(--green-dark); font-size: 22px; font-weight: 700; }
.mode-card strong { font: 700 23px 'Fredoka', sans-serif; letter-spacing: -.01em; }
.mode-card small { max-width: 230px; margin-top: 6px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.mode-card i { margin-top: auto; padding-top: 16px; color: var(--green); font-size: 13px; font-style: normal; font-weight: 800; }
.mode-series { border-color: var(--lime); background: #0b3527; color: #fff; }
.mode-series::after { border-color: rgba(255,255,255,.17); box-shadow: 0 0 0 22px rgba(255,255,255,.04), 0 0 0 45px rgba(255,255,255,.03); }
.mode-series .mode-number, .mode-series small { color: rgba(255,255,255,.7); }
.mode-series .mode-icon { background: rgba(216,242,120,.16); color: var(--lime); }
.mode-series i { color: var(--lime); }
.mode-practice .mode-icon { background: #fff1d2; color: #b5721f; }
.home-account { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-top: 20px; padding-top: 16px; border-top: 1px solid rgb(255 255 255 / .16); color: rgb(255 255 255 / .75); font-size: 13px; }
.home-auth-button { padding: 9px 14px; }

/* 2) Oyun: tahta, klavye, sonuç */
.harfle-game { display: grid; justify-items: center; gap: 14px; padding: 4px 0; }
.harfle-game > .harfle-kicker { justify-self: stretch; margin: 0; text-align: center; }
.board-wrap { position: relative; display: flex; flex-direction: column; align-items: center; padding: 20px 20px 14px; border-radius: 18px; background: #fffefa; box-shadow: 0 12px 30px rgb(0 0 0 / .18); }
.board { display: grid; grid-template-columns: repeat(5, 58px); gap: 7px; }
.tile { display: grid; width: 58px; height: 58px; place-items: center; border: 2px solid #e2e8e2; border-radius: 13px; background: #fbfcf9; color: var(--ink); font: 700 25px 'Fredoka', sans-serif; text-transform: uppercase; transition: transform .12s ease, background .2s ease, border .2s ease; }
.tile.filled { border-color: #93bca1; background: #fff; transform: scale(1.025); }
.tile.correct { border-color: var(--green); background: var(--green); color: white; }
.tile.present { border-color: var(--yellow); background: var(--yellow); color: #42370f; }
.tile.absent { border-color: var(--gray); background: var(--gray); color: white; }
.tile.invalid { border-color: var(--error); background: #fff0f0; color: var(--error); animation: harfle-shake .3s ease; }
@keyframes harfle-shake { 25% { transform: translateX(-5px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }
.message { min-height: 18px; margin: 10px 0 0; color: var(--green-dark); font-size: 13px; font-weight: 700; text-align: center; }
.message.error { color: var(--error); }
.message-pulse { animation: harfle-pulse .3s ease; }
@keyframes harfle-pulse { 50% { transform: translateY(-2px); opacity: .55; } }
.keyboard { display: flex; flex-direction: column; align-items: center; gap: 7px; width: min(100%, 560px); }
.key-row { display: flex; width: 100%; justify-content: center; gap: 5px; }
.key-row:nth-child(2) { width: 92%; }
.key-row:nth-child(3) { width: 86%; }
.key { flex: 1 1 0; min-width: 0; height: 46px; padding: 0 3px; border: 0; border-radius: 10px; background: #eef2ea; color: #26352f; cursor: pointer; font: 700 14px 'Roboto Condensed', sans-serif; text-transform: uppercase; box-shadow: 0 3px 0 rgb(0 0 0 / .18); transition: .15s ease; }
.key:hover { background: #fff; transform: translateY(-2px); }
.key.wide { flex: 1.5 1 0; font-size: 11px; }
.key.correct { background: var(--green); color: #fff; }
.key.present { background: var(--yellow); color: #42370f; }
.key.absent { background: #5b6662; color: #e6ebe7; }
@keyframes harfle-rise { from { opacity: 0; transform: translateY(8px); } }

/* Başlıktaki yardım/istatistik pencereleri */
.modal-backdrop { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; background: rgba(18, 38, 30, .44); backdrop-filter: blur(6px); }
.modal { position: relative; width: min(100%, 430px); max-height: 90vh; overflow: auto; border: 1px solid var(--line); border-radius: 22px; padding: 32px; background: var(--surface); box-shadow: 0 20px 60px rgba(23, 54, 43, .12); }
.modal-close { position: absolute; top: 16px; right: 16px; border: 0; font-size: 21px; }
.modal h2 { margin: 0 40px 10px 0; color: var(--green-dark); font: 700 26px 'Fredoka', sans-serif; }
.modal h3 { color: var(--ink); font-size: 12px; font-weight: 700; text-transform: uppercase; }
.modal p { color: var(--muted); font-size: 14px; line-height: 1.6; }
.auth-form { display: grid; gap: 14px; margin-top: 22px; }
.auth-form label { display: grid; gap: 7px; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.auth-form input { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 12px; outline: 0; background: #fbfcf9; color: var(--ink); font: 14px 'Roboto Condensed', sans-serif; }
.auth-form input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(44,140,98,.1); }
.auth-submit { margin-top: 3px; border: 0; border-radius: 10px; padding: 13px; background: var(--green-dark); color: #fff; cursor: pointer; font-size: 13px; font-weight: 700; }
.auth-switch { margin: 16px 0 0; border: 0; background: transparent; color: var(--green); cursor: pointer; font-size: 12px; font-weight: 700; }
.auth-error { min-height: 17px; margin: 10px 0 0 !important; color: var(--error) !important; font-size: 12px !important; }
.rules { margin: 20px 0 0; padding: 0; list-style: none; }
.rules li { display: flex; gap: 11px; align-items: center; margin: 12px 0; color: var(--muted); font-size: 13px; }
.rule-tile { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 9px; color: #fff; font-size: 12px; font-weight: 800; }
.rule-tile.green { background: var(--green); }
.rule-tile.yellow { background: var(--yellow); color: #42370f; }
.rule-tile.gray { background: var(--gray); }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 22px 0; }
.stat { padding: 14px 5px; border: 1px solid var(--line); border-radius: 12px; background: #f7f9f5; text-align: center; }
.stat strong { display: block; color: var(--green-dark); font: 700 23px 'Fredoka', sans-serif; }
.stat span { color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.distribution { margin-top: 17px; }
.distribution-row { display: flex; align-items: center; gap: 8px; margin: 6px 0; color: var(--muted); font-size: 12px; }
.distribution-row b { display: block; min-width: 18px; text-align: right; }
.distribution-bar { min-width: 20px; height: 20px; border-radius: 5px; padding: 2px 7px; background: var(--green); color: #fff; text-align: right; font-size: 11px; font-weight: 700; }
.toast { position: fixed; bottom: 25px; left: 50%; z-index: 70; transform: translate(-50%, 20px); padding: 12px 17px; border-radius: 11px; background: var(--ink); color: #fff; font-size: 13px; font-weight: 600; opacity: 0; pointer-events: none; transition: .25s ease; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.goal-equation b.goal-green { background: var(--green); color: #fff; }
.goal-equation b.goal-yellow { background: var(--yellow); color: #42370f; }
.goal-equation b.goal-gray { background: var(--gray); color: #fff; }

@media (max-width: 900px) {
  .mode-grid { grid-template-columns: 1fr; gap: 10px; }
  .mode-card { min-height: 0; padding: 16px 18px; }
  .mode-icon { width: 38px; height: 38px; margin-bottom: 10px; border-radius: 12px; font-size: 19px; }
  .mode-card strong { font-size: 20px; }
  .mode-card i { position: absolute; right: 18px; bottom: 16px; padding: 0; }
}
@media (max-width: 760px) {
  .live-label { display: none; }
  .harfle-menu { padding: 12px 4px; }
  .home-account { align-items: flex-start; flex-direction: column; }
  .board-wrap { width: 100%; padding: 14px 8px 10px; }
  .board { grid-template-columns: repeat(5, min(15vw, 58px)); gap: 6px; }
  .tile { width: min(15vw, 58px); height: min(15vw, 58px); border-radius: 11px; font-size: min(7vw, 25px); }
  .keyboard { width: 100%; gap: 6px; }
  .key-row { gap: 3px; }
  .key { height: 44px; border-radius: 8px; font-size: 13px; }
  .key.wide { font-size: 10px; }
}
@media (max-width: 400px) {
  .topbar-actions { gap: 5px; }
  .icon-button { width: 34px; height: 34px; }
  .auth-button { padding: 8px 10px; }
  .key-row { gap: 2px; }
  .key { height: 40px; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .tile, .key, .mode-card, .message-pulse { animation: none; transition: none; }
}

/* Tam ekran: kutu boyutu hesaplanan çerçeve genişliğinden türetilir; game-shell.js çerçeveyi ekrana sığdırır. */
body[data-game='harfane'] .play-panel.is-fullscreen .board { --fs-tile: clamp(30px, calc((var(--fs-fit-w, 400px) - 72px) / 5), 104px); grid-template-columns: repeat(5, var(--fs-tile)); }
body[data-game='harfane'] .play-panel.is-fullscreen .tile { width: var(--fs-tile); height: var(--fs-tile); font-size: calc(var(--fs-tile) * .46); }
body[data-game='harfane'] .play-panel.is-fullscreen .keyboard { width: min(100%, 640px); }
@media (max-height: 560px) {
  body[data-game='harfane'] .play-panel.is-fullscreen .harfle-game { gap: 8px; }
  body[data-game='harfane'] .play-panel.is-fullscreen .harfle-game > .harfle-kicker { display: none; }
  body[data-game='harfane'] .play-panel.is-fullscreen .key { height: 32px; }
  body[data-game='harfane'] .play-panel.is-fullscreen .board-wrap { padding: 8px 10px; }
}
/* Kısa yatay ekranda (telefon yan) tahta solda, klavye/sonuç sağda. */
@media (orientation: landscape) and (max-height: 600px) {
  body[data-game='harfane'] .play-panel.is-fullscreen .harfle-game { grid-template-columns: auto minmax(280px, 1fr); align-items: center; column-gap: 16px; }
  body[data-game='harfane'] .play-panel.is-fullscreen .board-wrap { grid-row: 1 / span 2; }
  body[data-game='harfane'] .play-panel.is-fullscreen .board { --fs-tile: clamp(24px, calc((var(--fs-fit-w, 400px) - 330px) / 5), 72px); }
}
/* Yeşil panel üzerinde alt çubuk etiketleri okunur kalsın (telefon düzeni vurgu rengini kullanır). */
body[data-game='harfane'] .play-panel-footer .score-card > span { color: rgb(255 255 255 / .8) !important; }
/* Tam ekranda mod menüsü sığdırılmaz: tam genişlikte durur, sığmazsa kendi içinde kayar. */
body[data-game='harfane'] .play-panel.is-fullscreen .harfle-menu { max-height: calc(100dvh - 150px); overflow: auto; overscroll-behavior: contain; }

/* Sahne kısaysa mod menüsü sığacak kadar sıkılaşır (ortak sahne standardı, play-page.css flow-layer). */
@container flow-layer (max-height: 640px) {
  .harfle-menu { padding: 6px 4px; }
  .harfle-menu-copy { display: none; }
  .harfle-menu h2 { font-size: 26px; }
  .mode-grid { gap: 8px; margin-top: 12px; }
  .mode-card { min-height: 0; padding: 11px 14px; }
  .mode-card::after { display: none; }
  .mode-icon { width: 30px; height: 30px; margin-bottom: 6px; border-radius: 10px; font-size: 16px; }
  .mode-card strong { font-size: 18px; }
  .mode-card small { margin-top: 3px; font-size: 11.5px; line-height: 1.3; }
  .mode-card i { padding-top: 6px; font-size: 12px; }
  .home-account { margin-top: 10px; padding-top: 10px; }
}
