/* Online Okey - ortak stiller, ana sayfa, taşlar */
:root {
  --night: #06261a;
  --felt-dark: #0b3b27;
  --felt: #12714a;
  --wood: #5b3a1f;
  --wood-light: #8d5d2d;
  --ivory: #f7f0dc;
  --ivory-edge: #bfb08a;
  --brass: #d9b25a;
  --brass-dark: #b98a2b;
  --text: #eef7f1;
  --muted: #a9c7b5;
  --danger: #ff9b8f;
  --c-yellow: #cf8f00;
  --c-blue: #1d5fc4;
  --c-black: #1c1c1e;
  --c-red: #c8302a;
  --ui-font: "Trebuchet MS", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --head-font: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }
body {
  font-family: var(--ui-font);
  color: var(--text);
  background: radial-gradient(1200px 700px at 50% -10%, #17835a 0%, var(--felt-dark) 55%, var(--night) 100%) fixed;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-text-size-adjust: 100%;
}

h1, h2 { font-family: var(--head-font); margin: 0; }
a { color: inherit; }
.muted { color: var(--muted); font-size: .95rem; line-height: 1.45; margin: .4rem 0; }
.center-text { text-align: center; }
.error { color: var(--danger); font-size: .95rem; margin: .6rem 0 0; }
.notice { background: rgba(217, 178, 90, .15); border: 1px solid rgba(217, 178, 90, .4); padding: 8px 12px; border-radius: 10px; font-size: .92rem; }

:focus-visible { outline: 3px solid #ffe08a; outline-offset: 2px; }

/* ---------- Butonlar ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 11px 18px; border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .2);
  background: rgba(255, 255, 255, .09);
  color: var(--text); font: 600 15px/1.1 var(--ui-font);
  cursor: pointer; text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn:hover:not(:disabled) { background: rgba(255, 255, 255, .16); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(#ecc96f, var(--brass-dark));
  color: #2a1d05; border-color: #f0d68e;
  box-shadow: 0 2px 0 #8a6218;
}
.btn.primary:hover:not(:disabled) { background: linear-gradient(#f3d584, #c9962f); }
.btn.big { width: 100%; padding: 15px 18px; font-size: 17px; }
.btn.small { padding: 8px 12px; font-size: 14px; border-radius: 10px; }
.btn.ghost { background: transparent; }

.panel {
  background: rgba(0, 0, 0, .28);
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 18px;
  padding: 20px;
}

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: .92rem; color: var(--muted); margin-bottom: 6px; }
input[type="text"] {
  width: 100%; padding: 13px 14px; border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .22);
  background: rgba(0, 0, 0, .35); color: var(--text);
  font: 17px var(--ui-font);
}
input[type="text"]::placeholder { color: #7ea593; }

/* ---------- Ana sayfa ---------- */
.home {
  max-width: 440px; margin: 0 auto;
  padding: max(28px, env(safe-area-inset-top)) 18px max(24px, env(safe-area-inset-bottom));
}
.tagline { text-align: center; color: var(--muted); line-height: 1.5; margin: 18px 6px 22px; }

.logo { display: flex; justify-content: center; gap: 10px; margin: 18px 0 0; }
.logo-tile {
  width: 64px; height: 90px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #fffdf4, #f0e6c8);
  box-shadow: 0 6px 0 var(--ivory-edge), 0 12px 16px rgba(0, 0, 0, .5);
  font: 800 48px/1 var(--head-font);
}
.logo-tile:nth-child(1) { transform: rotate(-5deg); color: var(--c-yellow); }
.logo-tile:nth-child(2) { transform: rotate(2deg) translateY(2px); color: var(--c-blue); }
.logo-tile:nth-child(3) { transform: rotate(-2deg); color: var(--c-black); }
.logo-tile:nth-child(4) { transform: rotate(5deg) translateY(1px); color: var(--c-red); }

.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .9rem; margin: 20px 0 14px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: rgba(255, 255, 255, .16); }
.join-row { display: flex; gap: 10px; }
.join-row input { flex: 1; min-width: 0; letter-spacing: .12em; }
.join-row .btn { width: auto; min-width: 96px; }
#roomCode { text-align: center; }

.resume {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 16px; padding: 12px 14px; border-radius: 12px;
  background: rgba(217, 178, 90, .14); border: 1px solid rgba(217, 178, 90, .4);
  font-size: .95rem;
}
.live { text-align: center; color: var(--muted); font-size: .92rem; margin-top: 22px; }
.live b { color: var(--text); }
.live-dot, .dot {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  background: #5be08f; margin-right: 7px; vertical-align: baseline;
}
.dot.off { background: #8a8f8c; }

/* ---------- Üst çubuk ---------- */
.topbar {
  display: flex; align-items: center; gap: 10px;
  min-height: 48px; padding: 6px 10px;
  padding-top: max(6px, env(safe-area-inset-top));
  background: rgba(0, 0, 0, .38);
  border-bottom: 1px solid rgba(255, 255, 255, .1);
}
.brand { font: 800 20px var(--head-font); text-decoration: none; letter-spacing: .06em; color: var(--brass); }
.chip {
  border: 1px solid rgba(255, 255, 255, .2); background: rgba(255, 255, 255, .08);
  color: var(--text); border-radius: 999px; padding: 6px 12px; font: 14px var(--ui-font); cursor: pointer;
}
.chip b { letter-spacing: .08em; }
.turn-info { flex: 1; text-align: center; font-size: 14px; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.turn-info.mine { color: #ffe08a; font-weight: 700; }

.conn-banner { background: #8a5a12; color: #fff3d6; text-align: center; padding: 6px; font-size: 14px; }

/* ---------- Bekleme odası ---------- */
.lobby { max-width: 460px; margin: 0 auto; padding: 18px 14px 30px; }
.lobby-card h2 { font-size: 1.5rem; }
.invite { display: flex; gap: 8px; margin: 12px 0; }
.invite input { font-size: 14px; padding: 10px 12px; }
.code-big {
  font: 800 44px/1 var(--head-font); letter-spacing: .28em; text-align: center;
  padding: 14px 0 14px .28em; margin: 6px 0 14px;
  background: rgba(0, 0, 0, .3); border-radius: 14px; color: var(--brass);
}
.lobby-players { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; }
.lobby-slot {
  display: flex; align-items: center; gap: 4px; padding: 12px 14px; border-radius: 12px;
  background: rgba(255, 255, 255, .08); font-size: 1.05rem;
}
.lobby-slot.empty { background: transparent; border: 1px dashed rgba(255, 255, 255, .25); color: var(--muted); }
.lobby-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { font-size: .78rem; background: var(--brass); color: #2a1d05; padding: 3px 8px; border-radius: 999px; font-weight: 700; }

/* ---------- Pencere / bildirim ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(0, 12, 7, .72); overflow-y: auto;
}
.modal {
  width: 100%; max-width: 440px; background: #0e3826; border: 1px solid rgba(217, 178, 90, .5);
  border-radius: 18px; padding: 22px; box-shadow: 0 20px 50px rgba(0, 0, 0, .55);
}
.modal h2 { font-size: 1.5rem; margin-bottom: 6px; }
.modal-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.modal-actions .btn { flex: 1; min-width: 120px; }

.toast {
  position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 80; max-width: min(92vw, 440px); background: #101a14; color: #fff; padding: 11px 16px;
  border-radius: 12px; border: 1px solid rgba(255, 255, 255, .2); font-size: .95rem; text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
}

/* ---------- OKEY TAŞI ---------- */
.tile {
  --w: 34px;
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: calc(var(--w) * .07);
  width: var(--w); height: calc(var(--w) * 1.4);
  border-radius: calc(var(--w) * .17);
  background: linear-gradient(160deg, #fffdf4 0%, #f1e8cd 100%);
  box-shadow: 0 calc(var(--w) * .07) 0 var(--ivory-edge), 0 calc(var(--w) * .13) calc(var(--w) * .2) rgba(0, 0, 0, .45);
  font-family: "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif; font-weight: 800;
  user-select: none; -webkit-user-select: none; cursor: pointer; color: #222; touch-action: manipulation;
}
.tile .n { font-size: calc(var(--w) * .56); line-height: 1; }
.tile .ring {
  width: calc(var(--w) * .25); height: calc(var(--w) * .25);
  border: calc(var(--w) * .06) solid currentColor; border-radius: 50%;
}
.tile.c0 { color: var(--c-yellow); }
.tile.c1 { color: var(--c-blue); }
.tile.c2 { color: var(--c-black); }
.tile.c3 { color: var(--c-red); }
.tile.fake { color: #1e8a4c; }
.tile.fake .n { font-size: calc(var(--w) * .6); }
.tile.is-okey { outline: calc(var(--w) * .07) solid #e8b84a; outline-offset: calc(var(--w) * -.02); }
.tile.is-okey::after {
  content: "★"; position: absolute; top: calc(var(--w) * .02); right: calc(var(--w) * .08);
  font-size: calc(var(--w) * .24); color: #c68a00;
}
.tile.xs { --w: 24px; cursor: default; }

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