/* Trio Match — mobil öncelikli stil */
:root {
  --bg1: #151a3a;
  --bg2: #2a1650;
  --ink: #f4f1ff;
  --muted: #a9a3d1;
  --panel: rgba(255, 255, 255, 0.07);
  --panel-line: rgba(255, 255, 255, 0.12);
  --coral: #ff6b6b;
  --mint: #38e3b0;
  --gold: #ffc94d;
  --violet: #8b5cf6;
  --danger: #ff4f6d;
  --u: min(1vw, 0.56dvh, 4.8px);
  --radius: 14px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  font-family: ui-rounded, "SF Pro Rounded", "Nunito", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(120% 80% at 50% 0%, #2c2470 0%, var(--bg1) 55%, #0d1026 100%) fixed, var(--bg1);
  color: var(--ink);
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
[hidden] { display: none !important; }

#app {
  position: relative;
  max-width: 480px;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background-image: radial-gradient(rgba(255,255,255,.05) 1px, transparent 1.4px);
  background-size: 18px 18px;
}
@media (min-width: 520px) {
  #app { box-shadow: 0 0 0 1px var(--panel-line), 0 30px 80px rgba(0,0,0,.5); }
}

.screen { position: absolute; inset: 0; display: none; padding: calc(var(--safe-t) + 10px) 14px calc(var(--safe-b) + 10px); }
.screen.active { display: flex; }

/* ---------- Ortak ---------- */
.btn {
  border: 1px solid var(--panel-line);
  background: var(--panel);
  border-radius: 999px;
  padding: 12px 22px;
  font-weight: 700;
  font-size: 16px;
  transition: transform .12s ease, background .2s;
}
.btn:active { transform: scale(.96); }
.btn.primary {
  background: linear-gradient(135deg, var(--coral), #ff9a5a);
  border: none;
  color: #2a0c18;
  box-shadow: 0 6px 0 #b4404a, 0 12px 24px rgba(255, 107, 107, .35);
}
.btn.primary:active { transform: translateY(4px); box-shadow: 0 2px 0 #b4404a; }
.btn.big { font-size: 22px; padding: 16px 0; width: min(100%, 300px); letter-spacing: .04em; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.icon-btn {
  width: 42px; height: 42px; border-radius: 12px;
  border: 1px solid var(--panel-line); background: var(--panel);
  font-size: 18px; display: grid; place-items: center;
}

/* ---------- Ana menü ---------- */
#home { flex-direction: column; align-items: center; justify-content: safe center; gap: 14px; text-align: center; overflow-y: auto; }

.home-top { position: absolute; top: calc(var(--safe-t) + 10px); left: 14px; right: 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#home { padding-top: calc(var(--safe-t) + 64px); }
.logo { display: flex; flex-direction: column; align-items: center; margin-bottom: 6px; }
.logo-rings { width: 132px; height: 88px; overflow: visible; }
.logo-rings circle { fill: none; stroke-width: 9; mix-blend-mode: screen; }
.logo-rings .r1 { stroke: var(--coral); animation: bob 3s ease-in-out infinite; }
.logo-rings .r2 { stroke: var(--mint); animation: bob 3s ease-in-out .4s infinite; }
.logo-rings .r3 { stroke: var(--gold); animation: bob 3s ease-in-out .8s infinite; }
@keyframes bob { 50% { transform: translateY(-4px); } }
.logo h1 {
  margin: 4px 0 0; font-size: 46px; line-height: .95; letter-spacing: .06em; font-weight: 900;
  display: flex; flex-direction: column;
  text-shadow: 0 4px 0 rgba(0,0,0,.35);
}
.logo h1 span { font-size: 26px; letter-spacing: .42em; color: var(--gold); padding-left: .42em; }
.tagline { margin: 8px 0 0; color: var(--muted); font-weight: 600; }

.panel {
  width: min(100%, 360px);
  background: var(--panel); border: 1px solid var(--panel-line);
  border-radius: 20px; padding: 14px;
  display: flex; flex-direction: column; gap: 12px;
}
.field { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.label { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 700; }
.seg { display: flex; background: rgba(0,0,0,.25); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button {
  flex: 1; border: none; background: transparent; padding: 9px 4px; border-radius: 9px;
  font-weight: 700; font-size: 15px; color: var(--muted);
}
.seg button.on { background: linear-gradient(135deg, #5a4bd8, var(--violet)); color: #fff; box-shadow: 0 2px 10px rgba(139,92,246,.45); }
.stats { color: var(--muted); font-size: 13px; margin: 0; min-height: 1em; }

/* ---------- Profil ve menü ---------- */
.profile {
  display: flex; align-items: center; gap: 12px; width: min(100%, 320px);
  background: var(--panel); border: 1px solid var(--panel-line); border-radius: 18px; padding: 10px 12px;
}
.profile:focus-within { border-color: var(--mint); box-shadow: 0 0 0 3px rgba(56,227,176,.18); }
.avatar.big { width: 54px; height: 54px; font-size: 30px; border: none; cursor: pointer; position: relative; }
.profile .avatar.big::after {
  content: "✎"; position: absolute; right: -3px; bottom: -3px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--ink); color: #1b1945; font-size: 12px; display: grid; place-items: center; font-weight: 900;
}
.avatar.big:active { transform: scale(.94); }
.name-field { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; text-align: left; }
.name-field input {
  font: inherit; font-weight: 800; font-size: 20px; color: var(--ink);
  background: transparent; border: none; border-bottom: 2px solid rgba(255,255,255,.18); border-radius: 0;
  padding: 4px 0 6px; width: 100%; outline: none; user-select: text; -webkit-user-select: text;
}
.name-field input::placeholder { color: rgba(169,163,209,.6); font-weight: 700; }
.name-field input:focus { border-bottom-color: var(--mint); }
.join-form input {
  font: inherit; font-weight: 800; color: var(--ink);
  background: rgba(0,0,0,.28); border: 1px solid var(--panel-line); border-radius: 12px;
  width: 100%; outline: none; user-select: text; -webkit-user-select: text;
}
.join-form input:focus { border-color: var(--mint); box-shadow: 0 0 0 3px rgba(56,227,176,.2); }
.name-field input.need { border-bottom-color: var(--gold); animation: shake .45s; }
.profile:has(input.need) { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(255,201,77,.25); }
.menu { display: flex; flex-direction: column; gap: 12px; width: min(100%, 320px); align-items: stretch; }
.menu .btn.big { width: 100%; }
.btn.big { line-height: 1.15; }
.btn.big small { display: block; font-size: 12.5px; font-weight: 700; letter-spacing: 0; opacity: .75; margin-top: 2px; }
.btn.big.alt { font-size: 19px; padding: 12px 0; background: rgba(255,255,255,.09); }
.btn:disabled { opacity: .4; pointer-events: none; }

.sheet-text { margin: 0 0 4px; color: var(--muted); font-size: 14px; line-height: 1.4; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; font-weight: 700; margin: 4px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--panel-line); }
.join-form { display: flex; gap: 8px; }
.join-form input { text-align: center; letter-spacing: .35em; text-transform: uppercase; font-size: 22px; padding: 10px 6px; }
.join-form .btn { flex: none; }
.sheet .btn.big { width: 100%; }
.sheet .panel { width: 100%; }
.avatar-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; justify-items: center; margin: 6px 0; }
.avatar-grid .avatar.on { box-shadow: 0 0 0 3px var(--mint), inset 0 -3px 0 rgba(0,0,0,.25); }
.mode-text { margin: 2px 2px 0; font-size: 13px; line-height: 1.4; color: var(--muted); text-align: left; }

.toast {
  position: absolute; left: 50%; bottom: calc(var(--safe-b) + 18px); transform: translateX(-50%); z-index: 40;
  max-width: calc(100% - 32px); width: max-content; padding: 10px 16px; border-radius: 14px;
  background: #0d1026; border: 1px solid var(--panel-line); box-shadow: 0 10px 30px rgba(0,0,0,.5);
  font-size: 14px; font-weight: 700; text-align: center; white-space: pre-line; animation: rise .25s ease;
}

.mode-pick {
  display: flex; flex-direction: column; gap: 4px; text-align: left; width: 100%;
  background: rgba(255,255,255,.07); border: 2px solid var(--panel-line); border-radius: 18px; padding: 14px 16px;
  transition: transform .12s, border-color .2s;
}
.mode-pick:active { transform: scale(.97); }
.mode-pick .mode-name { font-size: 21px; font-weight: 900; }
.mode-pick .mode-desc { font-size: 13.5px; line-height: 1.4; color: var(--muted); }
.mode-pick .mode-desc b { color: var(--ink); }
.mode-pick.spicy { border-color: rgba(255,107,107,.45); background: rgba(255,107,107,.08); }
.mode-pick.last { box-shadow: 0 0 0 3px rgba(56,227,176,.35); border-color: var(--mint); }
.mode-pick.last .mode-name::after { content: "  · son seçimin"; font-size: 12px; font-weight: 700; color: var(--mint); }

/* ---------- Oda ---------- */
#lobby { flex-direction: column; gap: 12px; overflow-y: auto; }
.room-code {
  background: var(--panel); border: 1px solid var(--panel-line); border-radius: 20px; padding: 14px;
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
}
.room-code .code { font-size: 48px; font-weight: 900; letter-spacing: .22em; padding-left: .22em; color: var(--gold); line-height: 1; text-shadow: 0 4px 0 rgba(0,0,0,.35); user-select: text; -webkit-user-select: text; }
.code-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.code-actions .btn { padding: 10px 16px; font-size: 15px; }
.room-code .hint { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.searching { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 14px 0 4px; text-align: center; }
.searching p { margin: 0; font-weight: 800; font-size: 17px; line-height: 1.5; }
.searching small { font-weight: 700; color: var(--muted); font-size: 13px; }
.spinner { width: 54px; height: 54px; border-radius: 50%; border: 5px solid rgba(255,255,255,.1); border-top-color: var(--mint); border-right-color: var(--gold); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.seats { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.seat {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 14px;
  background: var(--panel); border: 1px solid var(--panel-line); min-height: 46px;
}
.seat.me { border-color: rgba(56,227,176,.5); background: rgba(56,227,176,.08); }
.seat.empty { border-style: dashed; background: transparent; color: var(--muted); }
.seat.empty .avatar { background: rgba(255,255,255,.06); box-shadow: none; }
.seat.offline { opacity: .55; }
.seat-name { font-weight: 800; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-name small { color: var(--muted); font-weight: 700; }
.seat-tag { font-size: 12px; color: var(--muted); font-weight: 700; white-space: nowrap; }
.seat-x { border: none; background: rgba(255,79,109,.15); color: var(--danger); width: 30px; height: 30px; border-radius: 9px; font-weight: 900; }
.lobby-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.host-tools { display: flex; gap: 8px; }
.host-tools .btn { flex: 1; padding: 14px 8px; }
.host-tools .btn.primary { flex: 1.6; font-size: 18px; }
.wait-text { margin: 0; text-align: center; color: var(--muted); font-weight: 700; font-size: 13.5px; }
.seg button:disabled { opacity: 1; }
.seg button:disabled:not(.on) { opacity: .5; }

/* ---------- Portal (BoxGames) ---------- */
#welcome, #portal { flex-direction: column; align-items: center; gap: 14px; overflow-y: auto; text-align: center; }
#welcome { justify-content: safe center; }
.brand { display: flex; flex-direction: column; align-items: center; }
.brand h1 { margin: 6px 0 0; font-size: 44px; font-weight: 900; letter-spacing: .04em; line-height: 1; text-shadow: 0 4px 0 rgba(0,0,0,.35); }
.brand h1 span { color: var(--gold); margin-left: .12em; }
.brand.small h1 { font-size: 26px; }
.brand-box { width: 86px; height: 86px; position: relative; transform: rotate(-8deg); }
.brand-box i { position: absolute; width: 46px; height: 46px; border-radius: 12px; box-shadow: inset 0 -4px 0 rgba(0,0,0,.25), 0 6px 14px rgba(0,0,0,.35); }
.brand-box i:nth-child(1) { left: 0; top: 0; background: var(--coral); }
.brand-box i:nth-child(2) { right: 0; top: 10px; background: var(--mint); }
.brand-box i:nth-child(3) { left: 20px; bottom: 0; background: var(--gold); }
.fine { margin: 0; max-width: 320px; font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.social-box { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; }
.btn.fb { background: #1877f2; border: none; color: #fff; width: 100%; }
.btn.small { font-size: 13.5px; padding: 6px 12px; }

.portal-top { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.me-chip { display: flex; align-items: center; gap: 8px; min-width: 0; background: var(--panel); border: 1px solid var(--panel-line); border-radius: 999px; padding: 4px 14px 4px 4px; }
.me-chip b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 140px; }
.chips-pill { flex: none; background: linear-gradient(135deg, #3a2a00, #5a4200); border: 1px solid rgba(255,201,77,.5); color: var(--gold); border-radius: 999px; padding: 8px 14px; font-weight: 900; font-size: 15px; }
.chips-pill:active, .me-chip:active { transform: scale(.96); }
.daily { width: 100%; max-width: 420px; display: flex; align-items: center; gap: 12px; text-align: left; padding: 12px 14px; border-radius: 18px;
  background: linear-gradient(135deg, rgba(255,201,77,.18), rgba(255,107,107,.14)); border: 1px solid rgba(255,201,77,.45); animation: rise .3s ease; }
.daily-icon { font-size: 30px; }
.daily div { flex: 1; display: flex; flex-direction: column; }
.daily small { color: var(--muted); font-weight: 700; }
.daily .btn { padding: 10px 16px; }
.section-title { align-self: flex-start; margin: 6px 2px 0; font-size: 14px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.games { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.game-card { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px 14px; border-radius: 20px;
  background: var(--panel); border: 1px solid var(--panel-line); transition: transform .12s; }
.game-card:active { transform: scale(.98); }
.game-card .logo-rings { width: 64px; height: 44px; flex: none; }
.game-info { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.game-info b { font-size: 19px; }
.game-info small { color: var(--muted); font-weight: 700; font-size: 12.5px; }
.play-tag { background: linear-gradient(135deg, var(--coral), #ff9a5a); color: #2a0c18; font-weight: 900; border-radius: 999px; padding: 8px 16px; }
.game-card.soon { opacity: .6; border-style: dashed; }
.soon-icon { width: 64px; text-align: center; font-size: 28px; }

.email-form { display: flex; flex-direction: column; gap: 10px; text-align: left; }
.email-form label { display: flex; flex-direction: column; gap: 4px; }
.email-form input {
  font: inherit; font-weight: 700; font-size: 17px; color: var(--ink); background: rgba(0,0,0,.28);
  border: 1px solid var(--panel-line); border-radius: 12px; padding: 11px 12px; outline: none; user-select: text; -webkit-user-select: text;
}
.email-form input:focus { border-color: var(--mint); }
.form-msg { margin: 0; min-height: 1em; font-size: 13.5px; line-height: 1.4; color: var(--muted); }
.form-msg.ok { color: var(--mint); }
.form-msg.err { color: #ff8fa0; }
.save-box { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 16px; background: rgba(255,201,77,.1); border: 1px solid rgba(255,201,77,.35); }
.sheet-text.small { font-size: 12.5px; }

/* ---------- Kart ---------- */
.card {
  --w: calc(var(--u) * 12);
  width: var(--w); height: calc(var(--w) * 1.4);
  border-radius: calc(var(--w) * .16);
  position: relative; flex: none;
  perspective: 600px;
}
.card .inner {
  position: absolute; inset: 0; transform-style: preserve-3d;
  transition: transform .45s cubic-bezier(.3,1.4,.5,1);
}
.card.up .inner { transform: rotateY(180deg); }
.card .face, .card .back {
  position: absolute; inset: 0; border-radius: inherit; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  overflow: hidden;
}
.card .face { transform: rotateY(180deg); }
.card.faceonly .inner { transform: none; transition: none; }
.card.faceonly .face { transform: none; }

.back {
  background:
    radial-gradient(circle at 38% 42%, transparent 22%, rgba(255,255,255,.22) 23%, rgba(255,255,255,.22) 27%, transparent 28%),
    radial-gradient(circle at 62% 42%, transparent 22%, rgba(255,255,255,.22) 23%, rgba(255,255,255,.22) 27%, transparent 28%),
    radial-gradient(circle at 50% 62%, transparent 22%, rgba(255,201,77,.55) 23%, rgba(255,201,77,.55) 27%, transparent 28%),
    repeating-linear-gradient(45deg, rgba(255,255,255,.05) 0 4px, transparent 4px 9px),
    linear-gradient(160deg, #6d4cf0, #3b1f96);
  border: 2px solid rgba(255,255,255,.35);
  box-shadow: 0 3px 0 #22105e, 0 6px 14px rgba(0,0,0,.35);
}
.face {
  --c: #888;
  background: linear-gradient(180deg, #fffaf0 0%, #fff1dc 100%);
  border: 2px solid var(--c);
  box-shadow: 0 3px 0 color-mix(in srgb, var(--c) 60%, #000), 0 6px 14px rgba(0,0,0,.3);
  color: var(--c);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.face::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 22%;
  background: var(--c); opacity: .9;
}
.face .num { position: relative; font-weight: 900; font-size: calc(var(--w) * .5); line-height: 1; margin-top: 12%; letter-spacing: -.04em; }
.face svg { width: 40%; height: 26%; fill: currentColor; margin-top: 4%; }
.face .corner {
  position: absolute; top: 2%; left: 8%; font-size: calc(var(--w) * .17); font-weight: 900; color: #fff;
}
.face.v7 {
  background: radial-gradient(circle at 50% 35%, #2b2f6e, #13153a);
  border-color: var(--gold);
  color: var(--gold);
  text-shadow: 0 0 12px rgba(255,201,77,.6);
}
.face.v7::before { background: linear-gradient(90deg, #ffcf4d, #ff9f1c); }
.face.v7 .corner { color: #3a2400; text-shadow: none; }

/* ---------- Oyun ekranı ---------- */
#game { flex-direction: column; gap: 8px; padding-left: 10px; padding-right: 10px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.turn-pill {
  flex: 1; text-align: center; font-weight: 800; font-size: 15px;
  padding: 9px 12px; border-radius: 999px; background: var(--panel); border: 1px solid var(--panel-line);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background .3s, color .3s;
}
.turn-pill.mine { background: linear-gradient(135deg, var(--mint), #2bc7d9); color: #052a22; border-color: transparent; }
.turn-pill.urgent { background: linear-gradient(135deg, var(--gold), var(--coral)); color: #2a0c18; animation: pulse .9s ease infinite; }
.goal { margin: -2px 0 0; text-align: center; font-size: 12.5px; font-weight: 800; color: var(--gold); min-height: 16px; }
.opp.offline { opacity: .6; }
.flag { font-size: 11px; }

.opponents { display: grid; grid-template-columns: repeat(var(--cols, 3), 1fr); gap: 6px; }
.opp {
  position: relative;
  background: var(--panel); border: 1px solid var(--panel-line); border-radius: var(--radius);
  padding: 6px 6px 6px; display: flex; flex-direction: column; gap: 4px; min-width: 0;
  transition: border-color .25s, box-shadow .25s, transform .25s;
}
.opp.active { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(255,201,77,.35), 0 0 20px rgba(255,201,77,.25); }
.opp.hit { animation: pulse .5s ease; }
@keyframes pulse { 40% { transform: scale(1.05); } }
.opp-head { display: flex; align-items: center; gap: 6px; min-width: 0; }
.opp-info { min-width: 0; flex: 1; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-size: 17px; background: var(--av, #555); box-shadow: inset 0 -3px 0 rgba(0,0,0,.25);
}
.avatar.small { width: 26px; height: 26px; font-size: 15px; }
.opp-name { font-weight: 800; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.2; }
.opp-sub { display: flex; align-items: center; gap: 4px; height: 14px; }
.opp-count { font-size: 11px; color: var(--muted); font-weight: 800; }
.mini-hand { display: flex; padding-left: 3px; }
.mini-hand i {
  width: 8px; height: 12px; border-radius: 2px; margin-left: -3px;
  background: linear-gradient(160deg, #6d4cf0, #3b1f96); border: 1px solid rgba(255,255,255,.4);
}
.trios { display: flex; gap: 3px; flex-wrap: wrap; justify-content: flex-end; max-width: 50%; }
.me .trios { max-width: none; }
.chip {
  --c: #888;
  min-width: 18px; height: 18px; padding: 0 4px; border-radius: 6px; font-size: 11px; font-weight: 900;
  display: grid; place-items: center; background: var(--c); color: #fff; box-shadow: 0 2px 0 rgba(0,0,0,.3);
}
.chip.v7 { background: linear-gradient(135deg, #ffcf4d, #ff9f1c); color: #3a2400; }
.opp-actions { display: flex; gap: 4px; }
.opp-actions button {
  flex: 1; border: none; border-radius: 8px; padding: 6px 0; font-size: 12px; min-height: 28px; font-weight: 800;
  background: rgba(56, 227, 176, .16); color: var(--mint);
  box-shadow: inset 0 0 0 1px rgba(56,227,176,.4);
}
.opp-actions button:disabled { opacity: .25; box-shadow: none; background: rgba(255,255,255,.05); color: var(--muted); }
.opp-actions button:not(:disabled):active { transform: scale(.94); }
.opp.locked .opp-actions button { opacity: .25; pointer-events: none; }

.table { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: center; gap: 8px; overflow: hidden; }
.middle {
  display: grid; grid-template-columns: repeat(var(--mcols, 5), auto); justify-content: center; gap: calc(var(--u) * 1.6);
}
.middle .card { --w: var(--mw, calc(var(--u) * 12.5)); }
.middle .card.pickable { cursor: pointer; }
.middle .card.pickable .back { animation: glow 1.8s ease-in-out infinite; }
.middle .card.pickable:active { transform: scale(.94); }
.middle .card.gone { visibility: hidden; }
@keyframes glow { 50% { box-shadow: 0 3px 0 #22105e, 0 0 0 2px rgba(56,227,176,.6), 0 0 16px rgba(56,227,176,.45); } }

.tray-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.tray {
  display: flex; gap: 10px; justify-content: center; align-items: center;
  min-height: calc(var(--tw, calc(var(--u) * 17)) * 1.4 + 16px);
  padding: 6px 14px; border-radius: 18px; min-width: 70%;
  background: rgba(0,0,0,.22); border: 1px dashed rgba(255,255,255,.14);
  transition: background .3s, border-color .3s;
}
.tray .slot {
  width: var(--tw, calc(var(--u) * 17)); height: calc(var(--tw, calc(var(--u) * 17)) * 1.4); border-radius: calc(var(--tw, 60px) * .16);
  border: 2px dashed rgba(255,255,255,.12); display: grid; place-items: center; position: relative;
}
.tray .card { --w: var(--tw, calc(var(--u) * 17)); animation: pop .35s cubic-bezier(.3,1.6,.5,1); }
.tray .tag {
  position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%);
  font-size: 10px; font-weight: 800; white-space: nowrap; background: #0d1026; border: 1px solid var(--panel-line);
  padding: 1px 6px; border-radius: 999px; color: var(--muted); z-index: 2;
}
@keyframes pop { from { transform: scale(.4) translateY(20px); opacity: 0; } }
.tray.fail { background: rgba(255,79,109,.18); border-color: var(--danger); animation: shake .45s; }
.tray.trio { background: rgba(255,201,77,.18); border-color: var(--gold); }
.tray.trio .card { animation: celebrate .9s ease infinite; }
@keyframes shake { 20%,60% { transform: translateX(-7px); } 40%,80% { transform: translateX(7px); } }
@keyframes celebrate { 50% { transform: translateY(-6px) rotate(-3deg); } }
.announce { margin: 0; min-height: 20px; font-size: 14px; font-weight: 700; color: var(--muted); text-align: center; }
.announce b { color: var(--ink); }

.me {
  background: linear-gradient(180deg, rgba(56,227,176,.08), rgba(56,227,176,.02));
  border: 1px solid rgba(56,227,176,.22); border-radius: 18px; padding: 8px 8px 10px;
  transition: box-shadow .3s, border-color .3s;
}
.me.active { border-color: var(--mint); box-shadow: 0 0 0 2px rgba(56,227,176,.3), 0 0 26px rgba(56,227,176,.2); }
.me-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 4px; }
.me-name { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.hand-hint { display: flex; justify-content: space-between; font-size: 11px; font-weight: 800; color: var(--mint); padding: 0 4px 4px; visibility: hidden; }
.me.active .hand-hint { visibility: visible; }
.hand { display: flex; justify-content: center; align-items: flex-end; min-height: calc(var(--u) * 13 * 1.4 + 6px); padding-top: 6px; }
.hand .card { --w: calc(var(--u) * 13); margin-left: var(--overlap, 0px); transition: transform .2s; }
.hand .card:first-child { margin-left: 0; }
.hand .card.pickable { cursor: pointer; transform: translateY(-6px); }
.hand .card.pickable .face { box-shadow: 0 3px 0 color-mix(in srgb, var(--c) 60%, #000), 0 0 0 3px var(--mint), 0 0 18px rgba(56,227,176,.6); }
.hand .card.pickable:active { transform: translateY(-2px) scale(.96); }
.hand .empty { color: var(--muted); font-size: 13px; font-weight: 700; padding: 18px 0; }

/* ---------- Katmanlar ---------- */
.overlay {
  position: absolute; inset: 0; z-index: 20; display: grid; place-items: center; padding: 18px;
  background: rgba(8, 9, 26, .72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: fade .2s ease;
}
@keyframes fade { from { opacity: 0; } }
.sheet {
  width: min(100%, 380px); max-height: calc(100dvh - 40px); overflow: auto;
  background: linear-gradient(180deg, #2a2366, #1b1945); border: 1px solid var(--panel-line);
  border-radius: 24px; padding: 22px 18px; display: flex; flex-direction: column; gap: 10px; text-align: center;
  box-shadow: 0 30px 60px rgba(0,0,0,.5);
  animation: rise .3s cubic-bezier(.3,1.4,.5,1);
}
@keyframes rise { from { transform: translateY(30px) scale(.96); opacity: 0; } }
.sheet h2 { margin: 0 0 6px; font-size: 24px; }
.rules { text-align: left; }
.rules h2 { text-align: center; }
.rules h3 { margin: 6px 0 0; font-size: 17px; text-align: center; }
.mode-card { background: rgba(255,255,255,.06); border: 1px solid var(--panel-line); border-radius: 14px; padding: 10px 12px; font-size: 14px; line-height: 1.45; }
.mode-card.spicy { border-color: rgba(255,107,107,.45); background: rgba(255,107,107,.08); }
.mode-card > b { font-size: 15px; }
.mode-card p { margin: 4px 0 0; }
.mode-card .small { font-size: 12.5px; color: var(--muted); }
.pairs { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.pairs span { background: rgba(0,0,0,.3); border-radius: 8px; padding: 3px 8px; font-weight: 800; font-size: 13px; }
.rules ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 14.5px; line-height: 1.45; }
.rules ul { margin: 4px 0 0; padding-left: 18px; }
.tip { background: rgba(255,201,77,.12); border: 1px solid rgba(255,201,77,.3); border-radius: 12px; padding: 10px; font-size: 13.5px; margin: 4px 0; }
.result-badge { font-size: 64px; line-height: 1; }
.result p { margin: 0; color: var(--muted); }
.result-trios { display: flex; justify-content: center; gap: 8px; margin: 6px 0 8px; }
.result-trios .card { --w: 52px; }

.confetti { position: absolute; inset: 0; pointer-events: none; z-index: 30; overflow: hidden; }
.confetti i {
  position: absolute; top: -12px; width: 8px; height: 12px; border-radius: 2px;
  animation: fall var(--d, 1.6s) linear forwards;
}
@keyframes fall { to { transform: translate(var(--x, 0), 105dvh) rotate(var(--r, 540deg)); opacity: .9; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Kısa ekranlar (ör. iPhone SE tarayıcıda) */
@media (max-height: 700px) {
  #home { gap: 10px; }
  .logo-rings { width: 96px; height: 64px; }
  .logo h1 { font-size: 36px; }
  .logo h1 span { font-size: 20px; }
  .panel { padding: 10px 12px; gap: 8px; }
  .seg button { padding: 7px 4px; }
  .btn.big { padding: 13px 0; font-size: 20px; }
  .btn.big.alt { padding: 9px 0; font-size: 17px; }
  .menu { gap: 9px; }
  .avatar.big { width: 46px; height: 46px; font-size: 26px; }
  .room-code .code { font-size: 40px; }
}
