/* Platform stilleri (ana sayfa, butonlar, bantlar, toast, modal). Oyuna özel stiller games/<id>/client/style.css. Mobil öncelikli; 35–60 yaş: büyük yazı, büyük dokunma alanı. */
:root {
  --bg: #2a1a0f;
  --bg2: #3a2617;
  --card: #fbf3e4;
  --ink: #fbf3e4;
  --ink-dark: #2a1a0f;
  --muted: #e2cfae;
  --wa: #0f7a3f;
  --wa-hi: #0c6634;
  --primary: #f5b301;
  --primary-hi: #ffc933;
  --line: rgba(251, 243, 228, .18);
  --ok: #4ade80;
  --radius: 14px;
  --gut: 16px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 18px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
h1, h2 { line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.3rem; }
p { margin: 0 0 .6em; }
.muted { color: var(--muted); font-size: 1rem; }
.center { text-align: center; }
button, input { font: inherit; }

/* ---- Butonlar ---- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: .5em;
  width: 100%; min-height: 52px; padding: 10px 18px;
  border: 0; border-radius: var(--radius);
  font-size: 1.1rem; font-weight: 700; text-decoration: none; text-align: center;
  cursor: pointer; user-select: none;
  transition: transform .08s ease, background-color .15s ease;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .6; cursor: default; }
.btn:focus-visible, input:focus-visible, .game-card:focus-within, .seg label:focus-within { outline: 3px solid var(--primary-hi); outline-offset: 2px; }
.btn + .btn { margin-top: 10px; }
.btn-xl { min-height: 60px; font-size: 1.25rem; }
.btn-wa { background: var(--wa); color: #fff; }
.btn-wa:hover { background: var(--wa-hi); }
.btn-primary { background: var(--primary); color: var(--ink-dark); }
.btn-primary:hover { background: var(--primary-hi); }
.btn-ghost { background: transparent; color: var(--ink); border: 2px solid var(--line); }
.btn-ghost.ok { border-color: var(--ok); color: var(--ok); }
.wa-ico { width: 1.4em; height: 1.4em; flex: none; }
.linkish { background: none; border: 0; padding: 4px 0; color: inherit; cursor: pointer; font-weight: 700; min-height: 44px; text-align: left; }
.linkish small { font-weight: 400; color: var(--muted); font-size: .85rem; }

/* ---- Form ---- */
.field { display: block; margin: 0 0 14px; }
.field > span { display: block; font-weight: 700; margin-bottom: 6px; }
.field input {
  width: 100%; min-height: 54px; padding: 10px 14px;
  border: 2px solid #c9b48a; border-radius: 12px;
  background: #fffdf8; color: var(--ink-dark); font-size: 1.15rem;
}

/* ---- Toast + bağlantı ---- */
#toast {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  max-width: min(92vw, 480px); padding: 12px 18px; border-radius: 12px;
  background: #fffdf8; color: var(--ink-dark); font-weight: 600; font-size: 1rem;
  box-shadow: 0 6px 24px rgba(0,0,0,.45); transition: opacity .2s, transform .2s; z-index: 50;
  text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
.conn {
  position: fixed; top: calc(8px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  padding: 6px 14px; border-radius: 999px; background: #fffdf8; color: var(--ink-dark);
  font-size: 1rem; font-weight: 700; z-index: 40; box-shadow: 0 2px 10px rgba(0,0,0,.4);
}
.conn::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 50%; background: #e0a100; animation: blink 1s infinite; }
.conn[hidden] { display: none; }
@keyframes blink { 50% { opacity: .2; } }

/* ---- Ana sayfa ---- */
.home { max-width: 520px; margin: 0 auto; padding: calc(20px + env(safe-area-inset-top)) var(--gut) 32px; }
.home-head p { color: var(--muted); }
.home-form fieldset { border: 0; margin: 0 0 16px; padding: 0; min-width: 0; }
.home-form legend { font-weight: 700; margin-bottom: 8px; padding: 0; }
.games { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.games legend { grid-column: 1 / -1; }
.game-card {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 104px; padding: 10px 6px; border-radius: var(--radius);
  background: var(--bg2); border: 3px solid transparent; text-align: center;
}
.game-card input { position: absolute; opacity: 0; pointer-events: none; }
.game-card.active { border-color: var(--primary); background: #4a3019; cursor: pointer; }
.game-card.soon { opacity: .6; }
.g-ico { font-size: 2rem; line-height: 1; }
.g-name { font-weight: 800; font-size: 1.1rem; }
.soon-tag { font-size: .8rem; font-weight: 700; background: #6b5440; color: var(--ink); padding: 2px 8px; border-radius: 999px; }
.seg { display: grid !important; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.seg legend { grid-column: 1 / -1; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; }
.seg span {
  display: flex; align-items: center; justify-content: center; min-height: 56px;
  border-radius: 12px; background: var(--bg2); border: 3px solid transparent; font-size: 1.3rem; font-weight: 800; cursor: pointer;
}
.seg input:checked + span { border-color: var(--primary); background: #4a3019; color: var(--primary-hi); }
.home-form .btn-xl { margin-top: 8px; }

/* Oyunların ortak kullandığı durum satırları */
.status-line { font-size: 1.1rem; font-weight: 700; text-align: center; margin: 8px 0 4px; }
.info { background: var(--bg2); border-radius: 12px; padding: 10px 14px; font-size: 1.05rem; margin: 4px 0 8px; }
.info.last { border-left: 6px solid #ff8a3d; }
.tag-watch { display: inline-block; background: #4a3a6b; padding: 6px 14px; border-radius: 999px; font-weight: 700; }

/* Bantlar */
.band { margin: 10px var(--gut) 6px; padding: 16px; border-radius: 16px; background: var(--card); color: var(--ink-dark); }
.band .muted { color: #6b5440; }
.band .btn-ghost { color: var(--ink-dark); border-color: #c9b48a; }
.band .btn-ghost.ok { color: #0f7a3f; border-color: #0f7a3f; }
.band.invite.is-new { box-shadow: 0 0 0 4px var(--primary), 0 10px 30px rgba(0,0,0,.4); animation: glow 1.8s ease-in-out 3; }
@keyframes glow { 50% { box-shadow: 0 0 0 8px var(--primary-hi), 0 10px 30px rgba(0,0,0,.4); } }
.band.join h2 { font-size: 1.4rem; }
.band.result { text-align: center; }
/* Modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; padding: var(--gut); z-index: 60; }
.modal[hidden] { display: none; }
.modal-card { width: 100%; max-width: 420px; background: var(--card); color: var(--ink-dark); border-radius: 16px; padding: 18px; }
.modal-card .row { display: flex; gap: 10px; }
.modal-card .row .btn { margin-top: 0; }
.modal-card .btn-ghost { color: var(--ink-dark); border-color: #c9b48a; }

.noscript { padding: 20px; }

/* Oyunun bant yeri yoksa kabuk bantları oyun alanının üstüne koyar */
.shell-band { max-width: 640px; margin: 0 auto; }
.band.mini { padding: 10px; }

/* ---- Oda kabuğu: üst çubuk (menü + emoji) ---- */
body[data-page="room"] { --shell-bar: 46px; }
.shell-bar {
  position: sticky; top: 0; z-index: 40; height: var(--shell-bar); box-sizing: border-box;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 0 max(8px, env(safe-area-inset-right)) 0 max(8px, env(safe-area-inset-left));
  background: #2a190d; border-bottom: 1px solid rgba(255,255,255,.08);
}
.sb-btn {
  min-height: 38px; min-width: 44px; padding: 4px 12px; border-radius: 999px; cursor: pointer;
  background: var(--bg2); color: var(--ink); border: 2px solid rgba(255,255,255,.12); font-size: 1rem; font-weight: 700;
}
.sb-btn[hidden] { display: none; }
.sb-emoji { font-size: 1.35rem; padding: 0 10px; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.sb-title { flex: 1; text-align: center; font-weight: 800; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-danger { background: #b3261e; color: #fff; }
.menu-card .btn { width: 100%; margin-top: 10px; }
.muted.small, .small { font-size: .95rem; }

/* Emoji çekmecesi */
.emoji-tray {
  position: fixed; top: calc(var(--shell-bar) + 6px); right: 8px; z-index: 45; width: min(340px, calc(100vw - 16px));
  background: var(--card); color: var(--ink-dark); border-radius: 16px; padding: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.45);
}
.emoji-tray[hidden] { display: none; }
.et-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.et-e {
  height: 50px; border: 0; border-radius: 12px; background: transparent; cursor: pointer; font-size: 30px; line-height: 1;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}
.et-e:active { background: rgba(0,0,0,.08); transform: scale(.92); }
.et-kb { display: block; margin-top: 8px; font-size: .95rem; }
.et-kb input { width: 100%; box-sizing: border-box; margin-top: 4px; min-height: 44px; font-size: 1.1rem; border-radius: 10px; border: 2px solid #c9b48a; padding: 6px 10px; }

/* Emoji balonları */
.bubbles { position: fixed; inset: 0; pointer-events: none; z-index: 50; }
.bubble {
  position: fixed; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center;
  background: #fffdf6; color: var(--ink-dark); border-radius: 18px; padding: 6px 12px 4px; box-shadow: 0 8px 22px rgba(0,0,0,.45);
  animation: bubble 2.8s ease-out forwards;
}
.b-e { font-size: 44px; line-height: 1.1; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.b-n { font-size: .85rem; font-weight: 800; }
@keyframes bubble {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(.4); }
  12% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
  20% { transform: translate(-50%, -50%) scale(1); }
  80% { opacity: 1; transform: translate(-50%, -70%); }
  100% { opacity: 0; transform: translate(-50%, -90%); }
}
@media (prefers-reduced-motion: reduce) { .bubble { animation: none; } }

/* Ana sayfa: son masalar */
.recent { margin: 0 0 14px; }
.recent[hidden] { display: none; }
.recent h2 { font-size: 1.1rem; margin: 0 0 6px; }
.recent-row {
  display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 6px 12px; margin-bottom: 6px;
  background: var(--bg2); color: var(--ink); border-radius: 12px; text-decoration: none;
}
.recent-row .g-ico { font-size: 1.5rem; }
.recent-row .r-name { flex: 1; font-weight: 700; }
.recent-row .r-ago { color: var(--muted); font-size: .9rem; }
.recent-row .r-go { color: var(--primary); font-weight: 800; }
.modal-card .muted { color: #6b5440; }
.et-e { padding: 0; min-width: 0; }
.et-kb input { background: #fffdf6; color: var(--ink-dark); }
