/* Eliyte Tavla — stil. Sıcak ahşap & pirinç paleti; büyük dokunma hedefleri;
 * Dynamic Type dostu rem ölçüleri; koyu tema. */

:root {
  --bg: #14100a;
  --bg2: #1e1810;
  --card: #241c12;
  --card2: #2c2216;
  --gold: #e3b34c;
  --gold2: #c9962f;
  --text: #f3ead7;
  --muted: #a89a7c;
  --danger: #d05548;
  --green: #63b57f;
  --radius: 16px;
  font-size: 16px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, 'Segoe UI', sans-serif;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}

#app { height: 100dvh; display: flex; flex-direction: column; position: relative; overflow: hidden; }

/* ---------- ekranlar ---------- */
.screen {
  position: absolute; inset: 0;
  display: none;
  flex-direction: column;
  overflow-y: auto;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px calc(env(safe-area-inset-bottom, 0px) + 12px);
  background: radial-gradient(120% 90% at 50% 0%, var(--bg2), var(--bg));
}
.screen.active { display: flex; animation: fadeIn .22s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- tipografi & butonlar ---------- */
h1 { font-size: 1.7rem; font-weight: 800; letter-spacing: .01em; }
h2 { font-size: 1.35rem; font-weight: 800; }
h3 { font-size: 1.02rem; font-weight: 700; margin: 14px 0 8px; }
p { line-height: 1.45; }
small, .muted { color: var(--muted); }
.center { text-align: center; }
.hidden { display: none !important; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 14px;
  padding: 13px 18px;
  font-size: 1rem; font-weight: 700; font-family: inherit;
  color: var(--text); background: var(--card2);
  cursor: pointer;
  min-height: 48px;
  transition: transform .08s ease, filter .12s ease;
}
.btn:active { transform: scale(.97); filter: brightness(1.12); }
.btn:disabled { opacity: .45; }
.btn-primary { background: linear-gradient(160deg, var(--gold), var(--gold2)); color: #241a06; }
.btn-gold { background: linear-gradient(160deg, #f2cd6e, var(--gold2)); color: #241a06; }
.btn-ghost { background: var(--card2); }
.btn-danger { background: linear-gradient(160deg, #d05548, #a03a30); color: #fff; }
.btn-link { background: transparent; color: var(--gold); min-height: 40px; padding: 8px; }
.btn-lg { min-height: 56px; font-size: 1.06rem; border-radius: 18px; width: 100%; }
.btn-sm { min-height: 38px; padding: 6px 14px; font-size: .9rem; border-radius: 10px; }

.icon-btn {
  background: var(--card2); border: none; color: var(--text);
  width: 42px; height: 42px; border-radius: 12px; font-size: 1.05rem;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
input {
  background: var(--card); border: 1px solid #3c3020; color: var(--text);
  border-radius: 12px; padding: 12px 14px; font-size: 1rem; font-family: inherit;
  width: 100%; min-height: 46px;
}
input:focus { outline: 2px solid var(--gold2); border-color: transparent; }
code { background: #00000055; padding: 2px 8px; border-radius: 8px; font-size: .92em; color: var(--gold); }

/* ---------- boot & onboarding ---------- */
#screen-boot { align-items: center; justify-content: center; }
.boot-inner { text-align: center; }
.logo-dice {
  width: 92px; height: 92px; margin: 0 auto 16px;
  background: linear-gradient(160deg, var(--gold), var(--gold2));
  border-radius: 26px; display: flex; align-items: center; justify-content: center;
  font-size: 3rem; box-shadow: 0 12px 40px #00000088, inset 0 2px 0 #ffffff55;
}
.logo-dice.big { animation: bob 1.6s ease-in-out infinite alternate; }
@keyframes bob { from { transform: translateY(-6px) rotate(-3deg); } to { transform: translateY(6px) rotate(3deg); } }

.onb { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; text-align: center; }
.onb .tagline { color: var(--muted); font-size: 1.05rem; }
.onb-btns { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 12px; }

/* ---------- home ---------- */
.home-top { margin-bottom: 14px; }
.profile-chip {
  width: 100%; display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid #3a2d1b; border-radius: var(--radius);
  padding: 12px 14px; cursor: pointer; color: var(--text); font-family: inherit; text-align: left;
}
.profile-chip .avatar { font-size: 1.6rem; }
.pc-info { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.pc-info small { color: var(--muted); }
.xp-bar { width: 100%; height: 6px; background: #00000066; border-radius: 4px; overflow: hidden; }
.xp-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), #f2cd6e); border-radius: 4px; transition: width .6s ease; }
.xp-bar.big { height: 10px; margin: 10px 0 4px; }

.home-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mode-card {
  display: flex; flex-direction: column; gap: 6px; align-items: flex-start;
  background: var(--card); border: 1px solid #3a2d1b; border-radius: var(--radius);
  padding: 16px; cursor: pointer; color: var(--text); font-family: inherit; text-align: left;
  min-height: 96px;
}
.mode-card:active { transform: scale(.98); }
.mode-card .mc-icon { font-size: 1.7rem; }
.mc-body { display: flex; flex-direction: column; gap: 3px; }
.mode-card b { font-size: 1.02rem; display: block; }
.mode-card small { color: var(--muted); display: block; }
.mode-ranked { background: linear-gradient(150deg, #3a2c12, #241c12); border-color: var(--gold2); }
.home-bottom {
  margin-top: 16px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
}
.home-nav {
  background: var(--card); border: 1px solid #3a2d1b; border-radius: 14px;
  color: var(--text); font-family: inherit; padding: 10px 4px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 1.2rem;
}
.home-nav small { font-size: .68rem; color: var(--muted); }

/* ---------- oyun ekranı ---------- */
#screen-game { padding: 0; overflow: hidden; }
.game-top {
  display: flex; align-items: center; gap: 10px;
  padding: calc(env(safe-area-inset-top, 0px) + 8px) 12px 8px;
}
.g-players { flex: 1; display: flex; align-items: center; justify-content: center; gap: 10px; }
.g-player { display: flex; flex-direction: column; align-items: center; gap: 1px; opacity: .55; min-width: 90px; }
.g-player.active { opacity: 1; }
.g-player.active b { color: var(--gold); }
.g-player b { font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 110px; }
.g-player small { font-size: .68rem; color: var(--muted); }
.g-vs { color: var(--muted); font-size: .8rem; }
.g-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.g-player.active .g-dot { background: var(--green); box-shadow: 0 0 8px var(--green); }
.g-timer { min-width: 44px; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--gold); }
.g-timer.urgent { color: var(--danger); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .4; } }

.game-board-wrap { flex: 1; position: relative; min-height: 0; }
#board { width: 100%; height: 100%; display: block; touch-action: none; }

.game-bottom { padding: 8px 14px calc(env(safe-area-inset-bottom, 0px) + 10px); }
.g-pips { display: flex; gap: 14px; justify-content: center; font-size: .78rem; color: var(--muted); margin-bottom: 8px; flex-wrap: wrap; }
.g-pips b { color: var(--text); }
.bar-warn { color: var(--danger); }
.g-actions { display: flex; gap: 10px; align-items: center; }
.btn-roll { flex: 1; }
.btn-roll.pulse { animation: rollPulse 1.4s ease-in-out infinite; }
@keyframes rollPulse { 0%,100% { box-shadow: 0 0 0 0 #e3b34c66; } 50% { box-shadow: 0 0 0 12px #e3b34c00; } }

.g-banner {
  position: absolute; left: 50%; top: 24%; transform: translateX(-50%) translateY(-8px);
  background: #000000cc; color: var(--text); border: 1px solid var(--gold2);
  padding: 10px 22px; border-radius: 999px; font-weight: 700;
  opacity: 0; pointer-events: none; transition: all .25s ease; z-index: 5;
  white-space: nowrap;
}
.g-banner.show { opacity: 1; transform: translateX(-50%) translateY(0); }

#tutBanner {
  position: absolute; left: 12px; right: 12px; bottom: 10px;
  background: #000000d9; border: 1px solid var(--gold2); border-radius: var(--radius);
  padding: 12px 14px; text-align: center; z-index: 6;
  animation: fadeIn .3s ease;
}
#tutBanner p { font-weight: 700; margin-bottom: 4px; }

/* ---------- sonuç ---------- */
#screen-result { align-items: center; justify-content: center; }
.result { width: 100%; max-width: 420px; text-align: center; display: flex; flex-direction: column; gap: 14px; }
.result.r-win .r-head { font-size: 4rem; }
.result.r-lose .r-head { font-size: 3.4rem; filter: grayscale(.4); }
.r-type { color: var(--gold); font-weight: 800; font-size: 1.1rem; }
.r-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.r-stats > div { background: var(--card); border-radius: 12px; padding: 10px 4px; }
.r-stats small { display: block; font-size: .68rem; }
.r-stats b { font-size: 1.05rem; }
.r-stats .up { color: var(--green); }
.r-stats .down { color: var(--danger); }
.r-xp { background: var(--card); border-radius: var(--radius); padding: 14px; }
.r-xp-row { display: flex; justify-content: space-between; align-items: center; font-weight: 800; color: var(--gold); }
.bonus-chip { background: var(--gold); color: #241a06; border-radius: 999px; padding: 2px 10px; font-size: .8rem; }
.r-level { color: var(--muted); font-size: .85rem; }
.r-levelup { color: var(--gold); font-weight: 800; margin-top: 6px; animation: pop .5s ease; }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.1); } 100% { transform: scale(1); } }
.r-ach { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.ach-chip { background: var(--card2); border: 1px solid var(--gold2); border-radius: 999px; padding: 6px 12px; font-size: .82rem; }

/* ---------- sekmeler ---------- */
.tab-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }

/* profil */
.prof-card { background: var(--card); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.prof-id-row { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.avatar { width: 44px; height: 44px; background: var(--card2); border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0; }
.avatar.big { width: 58px; height: 58px; font-size: 1.8rem; }
.prof-name { font-size: 1.1rem; }
.p2p-row { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 16px; }
.stat-grid > div { background: var(--card); border-radius: 12px; padding: 10px 4px; text-align: center; }
.stat-grid small { display: block; font-size: .66rem; }
.stat-grid b { font-size: 1rem; }
.ach-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; padding-bottom: 20px; }
.ach { background: var(--card); border-radius: 12px; padding: 10px; opacity: .45; display: flex; flex-direction: column; gap: 2px; }
.ach.on { opacity: 1; border: 1px solid var(--gold2); }
.ach b { font-size: .86rem; }
.ach small { font-size: .7rem; }

/* liderlik */
.lb-season { display: flex; justify-content: space-between; background: var(--card); padding: 10px 14px; border-radius: 12px; margin-bottom: 10px; font-size: .88rem; }
.lb-me { background: #2c2413; border: 1px solid var(--gold2); border-radius: 12px; padding: 8px 14px; margin-bottom: 10px; font-weight: 700; }
.lb-list { display: flex; flex-direction: column; gap: 4px; padding-bottom: 20px; }
.lb-row { display: flex; align-items: center; gap: 10px; background: var(--card); border-radius: 10px; padding: 9px 12px; }
.lb-you { border: 1px solid var(--gold2); }
.lb-system { opacity: .75; }
.lb-rank { min-width: 34px; font-weight: 800; text-align: center; }
.lb-name { flex: 1; display: flex; flex-direction: column; }
.lb-name small { color: var(--muted); font-size: .66rem; }
.lb-rating { font-weight: 800; color: var(--gold); font-variant-numeric: tabular-nums; }

/* arkadaşlar */
.fr-search { display: flex; gap: 8px; margin-bottom: 10px; }
.fr-search input { flex: 1; }
.fr-row, .fr-result { display: flex; align-items: center; gap: 10px; background: var(--card); border-radius: 12px; padding: 10px 12px; margin-bottom: 6px; }
.fr-info, .fr-r-info { flex: 1; display: flex; flex-direction: column; }
.fr-info small { font-size: .74rem; }
.fr-result code { font-size: .74rem; }
.fr-body { min-height: 120px; }

/* mağaza */
.st-section { margin-bottom: 20px; }
.st-row { display: flex; gap: 12px; align-items: center; }
.st-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.st-item { background: var(--card); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.st-item.sel { border: 1px solid var(--gold2); }
.st-item.locked { opacity: .6; }
.st-swatch { width: 100%; height: 54px; border-radius: 10px; display: block; }
.sel-chip { color: var(--gold); font-weight: 700; }

/* ayarlar */
.se-group { background: var(--card); border-radius: var(--radius); padding: 6px 16px; margin-bottom: 14px; }
.se-row { display: flex; justify-content: space-between; align-items: center; padding: 13px 0; font-weight: 600; gap: 10px; }
.se-row + .se-row { border-top: 1px solid #ffffff10; }
.se-row input[type="checkbox"] { width: 24px; height: 24px; accent-color: var(--gold); min-height: 24px; }
.se-lang { display: flex; gap: 8px; padding: 8px 0 12px; }
.se-lang .btn { flex: 1; }
.se-link { display: block; padding: 13px 0; color: var(--text); text-decoration: none; font-weight: 600; }
.se-link + .se-link { border-top: 1px solid #ffffff10; }
#seAccountBody { padding: 8px 0 12px; display: flex; flex-direction: column; gap: 10px; }

/* overlay & modallar */
.overlay {
  position: absolute; inset: 0; background: #000000b3; z-index: 20;
  display: none; align-items: center; justify-content: center; padding: 24px;
}
.overlay.active { display: flex; }
.modal {
  background: var(--bg2); border: 1px solid #3c3020; border-radius: 22px;
  padding: 22px; width: 100%; max-width: 380px; text-align: center;
  display: flex; flex-direction: column; gap: 12px;
  animation: pop .25s ease;
}
.modal h2 { margin-bottom: 4px; }
.modal-sheet { max-width: 420px; }
.confirm-text { font-weight: 700; }
.confirm-btns { display: flex; gap: 10px; }
.confirm-btns .btn { flex: 1; }
.chat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.diff-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* toast */
#toast {
  position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%) translateY(12px);
  background: #000000d9; color: var(--text); border: 1px solid #3c3020;
  padding: 10px 20px; border-radius: 999px; font-weight: 600; z-index: 30;
  opacity: 0; pointer-events: none; transition: all .25s ease; white-space: nowrap;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* iPad / geniş ekran */
@media (min-width: 700px) {
  .home-modes { grid-template-columns: repeat(3, 1fr); max-width: 760px; margin: 0 auto; width: 100%; }
  .home-top, .home-bottom { max-width: 760px; margin-left: auto; margin-right: auto; width: 100%; }
  .ach-grid, .st-grid { grid-template-columns: repeat(3, 1fr); }
}
