/* UN Kahvesi — ortak tema */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;800&family=Nunito:wght@400;600;700;800&family=Caveat:wght@500;700&display=swap');

:root {
  --bg-0: #120b07;
  --bg-1: #1d120c;
  --wood-d: #2b1a10;
  --wood: #4a2c1b;
  --wood-l: #7a4a2b;
  --brass: #d6ad5f;
  --brass-d: #9c7637;
  --cream: #f4e7cf;
  --cream-d: #d9c6a2;
  --tea: #c0391f;
  --tea-l: #e2603f;
  --felt: #1d3a2c;
  --ok: #5fb37a;
  --muted: rgba(244, 231, 207, .62);
  --line: rgba(214, 173, 95, .28);
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  --r: 16px;
  --font-title: 'Playfair Display', Georgia, serif;
  --font-body: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-hand: 'Caveat', 'Comic Sans MS', cursive;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font-body);
  color: var(--cream);
  background: var(--bg-0);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; }

/* Kahvehane arka planı: sıcak lamba ışığı + ahşap lambri */
.un-ambient {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(1200px 700px at 50% -10%, rgba(255, 190, 110, .20), transparent 60%),
    radial-gradient(800px 600px at 10% 110%, rgba(192, 57, 31, .14), transparent 60%),
    repeating-linear-gradient(90deg, rgba(0,0,0,.18) 0 2px, transparent 2px 90px),
    linear-gradient(180deg, #24160e 0%, #160d08 60%, #0f0905 100%);
}
.un-ambient::after {
  content: ''; position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

/* Butonlar */
.un-btn {
  appearance: none; border: 0; cursor: pointer; user-select: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: 999px; font-weight: 800; letter-spacing: .2px;
  background: linear-gradient(180deg, #f0cf86, var(--brass) 45%, var(--brass-d));
  color: #2a1808; box-shadow: 0 2px 0 rgba(255,255,255,.35) inset, 0 -2px 0 rgba(0,0,0,.2) inset, 0 6px 16px rgba(0,0,0,.4);
  transition: transform .12s ease, filter .12s ease, opacity .2s;
}
.un-btn:active { transform: translateY(1px) scale(.98); filter: brightness(.95); }
.un-btn[disabled] { opacity: .45; pointer-events: none; }
.un-btn.tea { background: linear-gradient(180deg, #ef7a58, var(--tea) 50%, #8c2412); color: #fff3e8; }
.un-btn.ghost { background: rgba(244,231,207,.08); color: var(--cream); box-shadow: 0 0 0 1px var(--line) inset; }
.un-btn.small { padding: 8px 14px; font-size: 14px; }
.un-btn.icon { width: 42px; height: 42px; padding: 0; border-radius: 50%; }

.un-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  background: rgba(244,231,207,.08); box-shadow: 0 0 0 1px var(--line) inset; font-size: 13px; font-weight: 700;
}
.un-dot { width: 8px; height: 8px; border-radius: 50%; background: #888; box-shadow: 0 0 0 2px rgba(0,0,0,.3); }
.un-dot.on { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.un-dot.busy { background: var(--tea-l); }

/* Kart / panel */
.un-panel {
  background: linear-gradient(180deg, rgba(74,44,27,.92), rgba(43,26,16,.95));
  border-radius: var(--r); box-shadow: var(--shadow), 0 0 0 1px var(--line) inset;
}

/* Modal */
.un-modal-back {
  position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center;
  background: rgba(8,4,2,.62); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  padding: 20px; animation: unFade .2s ease;
}
.un-modal {
  width: min(420px, 100%); max-height: calc(100% - 20px); overflow: auto;
  padding: 22px 20px 18px; animation: unPop .28s cubic-bezier(.2,1.4,.4,1);
}
.un-modal h3 { margin: 0 0 6px; font-family: var(--font-title); font-size: 24px; color: var(--brass); }
.un-modal p { margin: 6px 0 14px; color: var(--muted); line-height: 1.45; }
.un-modal .row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; margin-top: 12px; }
.un-modal .col { display: grid; gap: 10px; }
@keyframes unFade { from { opacity: 0 } to { opacity: 1 } }
@keyframes unPop { from { opacity: 0; transform: translateY(12px) scale(.96) } to { opacity: 1; transform: none } }

/* Bildirim */
.un-toasts { position: fixed; left: 0; right: 0; top: calc(10px + var(--safe-t)); z-index: 1100; display: grid; justify-items: center; gap: 8px; pointer-events: none; }
.un-toast {
  pointer-events: auto; max-width: min(92vw, 420px); padding: 10px 16px; border-radius: 14px;
  background: rgba(30,18,11,.95); box-shadow: var(--shadow), 0 0 0 1px var(--line) inset; font-weight: 700;
  animation: unToast .3s cubic-bezier(.2,1.3,.4,1);
}
.un-toast.hand { font-family: var(--font-hand); font-size: 26px; font-weight: 700; color: var(--brass); padding: 6px 18px; }
@keyframes unToast { from { opacity: 0; transform: translateY(-10px) } to { opacity: 1; transform: none } }

/* Ayar satırları */
.un-set { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.un-set:last-child { border-bottom: 0; }
.un-set label { font-weight: 700; }
.un-switch { position: relative; width: 50px; height: 28px; flex: none; }
.un-switch input { opacity: 0; width: 0; height: 0; }
.un-switch span { position: absolute; inset: 0; border-radius: 99px; background: rgba(255,255,255,.15); transition: .2s; cursor: pointer; }
.un-switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--cream); transition: .2s; box-shadow: 0 2px 6px rgba(0,0,0,.4); }
.un-switch input:checked + span { background: var(--brass-d); }
.un-switch input:checked + span::after { transform: translateX(22px); background: #ffe3a6; }
input[type=range].un-range { width: 130px; accent-color: var(--brass); }

.un-input {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 0; outline: 0;
  background: rgba(0,0,0,.3); color: var(--cream); font: inherit; font-weight: 700;
  box-shadow: 0 0 0 1px var(--line) inset;
}
.un-input:focus { box-shadow: 0 0 0 2px var(--brass) inset; }

.un-avatar {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font-weight: 800; color: #2a1808; font-size: 16px;
  box-shadow: 0 0 0 2px rgba(255,255,255,.18), 0 4px 10px rgba(0,0,0,.35);
}

/* Çevrimiçi masa lobisi (kart/taş oyunları) */
.lobby { position: absolute; z-index: 30; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(420px, calc(100% - 24px)); max-height: calc(100% - 24px); overflow: auto; padding: 16px 18px; }
.lobby .lb-title { font-family: var(--font-title); font-size: 24px; color: var(--brass); margin-bottom: 8px; }
.lobby p { color: var(--cream-d); margin: 6px 0 10px; }
.lb-seats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 6px 0 4px; }
.lb-seat { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 12px; background: rgba(0,0,0,.25); box-shadow: 0 0 0 1px var(--line) inset; font-weight: 800; }
.lb-seat b { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--brass); color: #2a1808; font-size: 12px; flex: none; }
.lb-seat.bot { color: var(--muted); font-weight: 700; }
.lb-people { display: grid; gap: 6px; }
.lb-person { display: flex; align-items: center; gap: 8px; padding: 4px 6px; }
.lb-person span { flex: 1; font-weight: 800; }
.lb-empty { color: var(--muted); font-size: 14px; }
.lb-btns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }

/* El sonu puan tablosu */
.scoretbl { width: 100%; border-collapse: collapse; margin: 4px 0; font-weight: 700; }
.scoretbl td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: center; color: var(--cream-d); }
.scoretbl td:first-child { text-align: left; color: var(--muted); }
.scoretbl tr:first-child td { color: var(--brass); font-weight: 800; }
.scoretbl tr:last-child td { color: var(--cream); font-size: 18px; border-bottom: 0; }

/* 4 kişilik masa: oyuncu etiketleri */
.seat-tags { position: absolute; inset: 0; pointer-events: none; z-index: 12; }
.seat-tag { position: absolute; left: 0; top: 0; display: flex; align-items: center; gap: 7px; padding: 4px 10px 4px 4px; border-radius: 999px;
  background: rgba(18,11,7,.78); box-shadow: 0 0 0 1px var(--line) inset, 0 4px 12px rgba(0,0,0,.4); white-space: nowrap; transition: box-shadow .3s; }
.seat-tag .tx { display: flex; flex-direction: column; line-height: 1.1; }
.seat-tag b { font-size: 13px; color: var(--cream); }
.seat-tag span { font-size: 11px; font-weight: 800; color: var(--muted); }
.seat-tag.active { box-shadow: 0 0 0 2px var(--brass) inset, 0 0 18px rgba(214,173,95,.55); }
.seat-tag .bubble { left: 50%; transform: translateX(-50%); bottom: calc(100% + 6px); font-size: 20px; padding: 2px 12px; }
.bidbar { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.bidbar .un-btn { min-width: 52px; padding: 10px 12px; }
.suitbar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.suitbar button { font-size: 34px; padding: 10px 0; border-radius: 14px; border: 0; background: var(--cream); cursor: pointer; line-height: 1; }
.suitbar button small { display: block; font-size: 12px; font-weight: 800; color: #4a3424; margin-top: 4px; }

/* Dar ekran: alt kontrol çubuğu iki satır (ana düğme üstte, küçükler ve bilgi altta) */
@media (max-width: 520px) {
  body .tv-ctrl { flex-wrap: wrap; gap: 6px; padding: 6px 10px 10px; }
  body .tv-ctrl .main { order: -1; flex: 1 1 100%; min-width: 0; padding: 12px 16px; font-size: 17px; }
  body .tv-ctrl .tv-hint { order: 99; flex: 1 1 100%; min-width: 0; font-size: 12px; }
  body .tv-ctrl .un-btn.small { padding: 8px 12px; }
}

/* Ekranı kapatmayan karar paneli (ihale, koz): masanın ortasında, arkası net */
.ask-panel { position: absolute; z-index: 25; left: 50%; top: 44%; transform: translate(-50%, -50%); width: min(460px, calc(100% - 20px));
  padding: 12px 14px 14px; text-align: center; background: rgba(36,22,14,.92); box-shadow: 0 0 0 1px var(--line) inset, 0 12px 30px rgba(0,0,0,.5); animation: unPop .25s ease-out; }
.ask-panel .ap-title { font-family: var(--font-title); font-size: 20px; color: var(--brass); }
.ask-panel p { margin: 4px 0 10px; color: var(--cream-d); font-size: 14px; }
.ask-panel .bidbar .un-btn { min-width: 44px; padding: 8px 10px; }
.ask-panel .suitbar button { font-size: 28px; padding: 8px 0; }
