:root {
  --ink: #f5f2e8;
  --muted: #9db4ae;
  --gold: #f3b943;
  --gold-dark: #b77912;
  --red: #c8424c;
  --deep: #06191c;
  --deep-2: #0a2727;
  --felt: #0e5145;
  --felt-light: #17705e;
  --panel: rgba(13, 44, 44, .84);
  --line: rgba(255,255,255,.11);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--deep);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--deep); }
body { min-height: 100vh; min-height: 100dvh; overflow-x: hidden; padding-bottom: env(safe-area-inset-bottom); }
button, input { font: inherit; }
button { color: inherit; }

.screen { display: none; min-height: 100vh; min-height: 100dvh; }
.screen.active { display: flex; }
.eyebrow { color: var(--gold); font-size: .72rem; font-weight: 900; letter-spacing: .2em; margin: 0 0 .7rem; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 24px; box-shadow: 0 24px 70px rgba(0,0,0,.28); backdrop-filter: blur(18px); }

.auth-screen {
  align-items: center; justify-content: center; gap: clamp(3rem, 8vw, 9rem); padding: 3rem 5vw;
  background:
    radial-gradient(circle at 18% 30%, rgba(29, 128, 98, .35), transparent 35%),
    radial-gradient(circle at 85% 80%, rgba(196, 123, 18, .16), transparent 27%),
    linear-gradient(145deg, #041316, #0a2928 60%, #07191b);
  position: relative; overflow: hidden;
}
.auth-screen::before { content: "♠   ♥   ♣   ♦"; position: absolute; inset: auto -5% -10%; font-size: min(25vw, 290px); color: rgba(255,255,255,.018); white-space: nowrap; transform: rotate(-8deg); }
.brand-block { width: min(520px, 90vw); position: relative; z-index: 1; }
.brand-block h1 { margin: 0; font-family: Georgia, serif; font-size: clamp(3.6rem, 8vw, 7.3rem); line-height: .83; letter-spacing: -.06em; text-shadow: 0 9px 35px rgba(0,0,0,.25); }
.brand-block h1 span { display: block; color: var(--gold); font-style: italic; margin-left: .7em; }
.brand-copy { color: var(--muted); max-width: 440px; font-size: 1.06rem; line-height: 1.65; }
.brand-mark { height: 90px; margin-bottom: 1.2rem; position: relative; }
.mini-card { position: absolute; display: grid; place-items: center; width: 58px; height: 82px; border-radius: 8px; background: #faf7ed; color: #172222; font-size: 1.9rem; font-family: Georgia, serif; box-shadow: 0 14px 30px rgba(0,0,0,.25); transform: rotate(-13deg); }
.mini-card + .mini-card { left: 43px; transform: rotate(12deg); }
.mini-card.red { color: var(--red); }
.auth-card { width: min(420px, 94vw); padding: 1.3rem; position: relative; z-index: 2; }
.auth-card .primary-button { position: relative; z-index: 20; pointer-events: auto; touch-action: manipulation; }
.tabs { display: flex; padding: 5px; border-radius: 14px; background: rgba(0,0,0,.22); margin-bottom: 1.4rem; }
.tab { flex: 1; border: 0; border-radius: 10px; padding: .75rem; background: transparent; color: var(--muted); cursor: pointer; font-weight: 800; }
.tab.active { background: rgba(255,255,255,.09); color: var(--ink); }
.auth-form { display: none; gap: .55rem; }
.auth-form.active { display: flex; flex-direction: column; }
.auth-form label { color: #d4e1dc; font-size: .78rem; font-weight: 800; margin-top: .35rem; }
.auth-form input { width: 100%; border: 1px solid var(--line); background: rgba(0,0,0,.22); color: white; border-radius: 13px; padding: .95rem 1rem; outline: none; }
.auth-form input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(243,185,67,.1); }
.auth-form small { color: var(--muted); text-align: center; margin-top: .5rem; }
.primary-button { margin-top: 1rem; width: 100%; border: 0; border-radius: 14px; padding: 1rem 1.2rem; background: linear-gradient(135deg, #f5c85b, #dc941c); color: #17201e; font-weight: 950; cursor: pointer; box-shadow: 0 11px 28px rgba(220,148,28,.2); transition: transform .18s, filter .18s; }
.primary-button:hover { transform: translateY(-2px); filter: brightness(1.08); }
.primary-button span { float: right; }

.lobby-screen { flex-direction: column; background: radial-gradient(circle at 75% 10%, rgba(38,124,98,.27), transparent 30%), var(--deep); }
.topbar { height: 78px; padding: 0 max(5vw, 1rem); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.compact-brand { font-family: Georgia, serif; font-weight: 900; letter-spacing: .06em; }
.compact-brand span { color: var(--gold); }
.profile-chip, .player-badge { display: flex; align-items: center; gap: .7rem; }
.profile-chip span:last-child, .player-badge span:last-child { display: flex; flex-direction: column; }
.profile-chip small, .player-badge small { color: var(--muted); font-size: .69rem; margin-top: .1rem; }
.account-upgrade { margin-left:8px; padding:5px 8px; border:1px solid rgba(255,255,255,.35); border-radius:7px; color:#17201e; background:var(--gold); font-size:.64rem; font-weight:800; cursor:pointer; }
.avatar { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: linear-gradient(145deg, #e9bd5c, #9c5c14); border: 2px solid rgba(255,255,255,.35); color: #17201e; font-weight: 950; }
.lobby-content { width: min(1120px, 92vw); margin: auto; padding: 3rem 0 5rem; }
.welcome-row { display: flex; align-items: flex-end; gap: 1rem; margin-bottom: 1.8rem; }
.welcome-row > div:first-child { margin-right: auto; }
.welcome-row h2 { margin: 0; font-family: Georgia, serif; font-size: clamp(2rem, 5vw, 3.2rem); }
.welcome-row p:last-child { color: var(--muted); margin-bottom: 0; }
.stat-pill { min-width: 90px; padding: .7rem 1rem; border: 1px solid var(--line); border-radius: 14px; display: grid; grid-template-columns: auto 1fr; gap: 0 .5rem; background: rgba(255,255,255,.03); }
.stat-pill span { color: var(--gold); grid-row: 1 / 3; align-self: center; }
.stat-pill small { color: var(--muted); }
.lobby-grid { display: grid; grid-template-columns: 1.18fr .82fr; gap: 1.4rem; }
.setup-panel, .mode-panel { padding: clamp(1.2rem, 3vw, 2rem); }
.setup-panel h3 { font-size: .9rem; margin: 0 0 .8rem; }
.setup-panel h3:not(:first-child) { margin-top: 1.8rem; }
.choice-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .7rem; }
.choice { min-height: 79px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.035); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2rem; }
.choice b { font-size: 1.2rem; }
.choice small { color: var(--muted); }
.choice.active { border-color: var(--gold); background: rgba(243,185,67,.11); box-shadow: inset 0 0 0 1px rgba(243,185,67,.15); }
.choice.active b { color: var(--gold); }
.choice-grid.compact .choice { min-height: 54px; }
.choice-grid.compact .choice b { font-size: .9rem; }
.segmented { display: flex; gap: 5px; padding: 5px; background: rgba(0,0,0,.22); border-radius: 13px; }
.segmented button { flex: 1; border: 0; border-radius: 9px; padding: .7rem; color: var(--muted); background: transparent; cursor: pointer; }
.segmented button.active { background: rgba(255,255,255,.1); color: white; font-weight: 800; }
.mode-panel { position: relative; overflow: hidden; }
.mode-panel::after { content: "♠"; position: absolute; right: -30px; bottom: -100px; font-size: 260px; color: rgba(255,255,255,.025); pointer-events: none; }
.mode-panel h3 { font-family: Georgia, serif; font-size: 2rem; margin: 0; }
.mode-panel > p:not(.eyebrow) { color: var(--muted); line-height: 1.55; }
.mode-panel ul { padding: 0; list-style: none; color: #d8e5e0; line-height: 2; font-size: .86rem; }
.mode-panel li span { color: var(--gold); margin-right: .5rem; }
.mode-visual { min-height: 145px; display: flex; align-items: center; justify-content: center; gap: 1.1rem; }
.player-orb { display: grid; place-items: center; width: 83px; height: 83px; border: 5px solid rgba(243,185,67,.25); border-radius: 50%; background: linear-gradient(145deg, #f0c463, #9f6417); color: #112320; font-weight: 1000; box-shadow: 0 15px 28px rgba(0,0,0,.2); }
.player-orb.bot { background: linear-gradient(145deg, #e8eee9, #7b9490); border-color: rgba(255,255,255,.15); }
.versus { font: italic 900 .8rem Georgia, serif; color: var(--muted); }

.game-screen { flex-direction: column; width: 100%; max-width: 100vw; height: 100dvh; min-height: 0; overflow: hidden; background: #07191b; box-sizing: border-box; padding-bottom: env(safe-area-inset-bottom); }
.game-header { width: 100%; min-width: 0; height: 60px; flex: 0 0 60px; padding: 0 max(2vw, .7rem); display: flex; align-items: center; gap: .8rem; overflow: hidden; border-bottom: 1px solid var(--line); background: #07191b; }
.mobile-hamburger { display: none; width: 38px; height: 38px; padding: 8px 7px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.04); cursor: pointer; }
.mobile-hamburger i { display: block; height: 2px; margin: 4px 0; border-radius: 2px; background: #f3d77d; }
.game-header > #leave-game, .game-header > .round-info, .game-header > .deck-info, .game-header > #sound-toggle { display: none; }
.mobile-hamburger { display: block; }
.icon-button { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,.04); cursor: pointer; font-size: 1.1rem; }
.round-info { display: flex; flex-direction: column; }
.round-info small { color: var(--muted); font-size: .7rem; }
.deck-info { margin-left: auto; display: flex; align-items: center; gap: .45rem; }
.table-shell { position: relative; width: 100%; max-width: 100vw; flex: 1 1 auto; height: auto; min-width: 0; min-height: 0; overflow: hidden; background: radial-gradient(ellipse at center, var(--felt-light), var(--felt) 58%, #092f2c); border: 9px solid #1b3030; box-shadow: inset 0 0 60px rgba(0,0,0,.45); }
.felt-texture { position: absolute; inset: 0; opacity: .16; background-image: repeating-linear-gradient(35deg, transparent 0 3px, rgba(255,255,255,.05) 3px 4px); pointer-events: none; }
.player-zone { position: absolute; left: 0; width: 100%; height: 28%; display: flex; align-items: center; justify-content: center; }
.opponent-zone { top: 0; }
.you-zone { bottom: 0; }
.player-badge { position: absolute; left: 3%; top: 18%; padding: .55rem .8rem; border-radius: 14px; background: rgba(3,20,19,.62); border: 1px solid rgba(255,255,255,.1); min-width: 150px; }
.player-badge.you { top: auto; bottom: 12%; }
.player-badge.opponent .avatar { background: linear-gradient(145deg, #dce4e0, #6a8380); }
.score-box { position: absolute; right: 3%; top: 19%; width: 70px; padding: .5rem; border-radius: 13px; background: rgba(3,20,19,.62); text-align: center; border: 1px solid rgba(255,255,255,.1); }
.you-zone .score-box { top: auto; bottom: 13%; }
.score-box small { display: block; color: var(--muted); font-size: .58rem; letter-spacing: .12em; }
.score-box b { color: var(--gold); font-size: 1.45rem; }
.hand { display: flex; align-items: center; justify-content: center; min-width: 200px; }
.bot-hand { align-self: flex-start; margin-top: 2.6vh; }
.player-hand { align-self: flex-end; margin-bottom: 3.3vh; padding-top: 16px; }
.playing-card, .card-back { width: clamp(63px, 8.4vh, 92px); height: auto; aspect-ratio: 175 / 243; border-radius: 8px; box-shadow: 0 7px 16px rgba(0,0,0,.34); }
.playing-card { position: relative; box-sizing: border-box; padding: 0; border: 0; background: transparent; color: #141b1a; font-family: Georgia, serif; flex: 0 0 auto; user-select: none; overflow: hidden; }
.playing-card img { display: block; width: 100%; height: 100%; object-fit: cover; border: 0; border-radius: 7px; pointer-events: none; }
.playing-card.red { color: #bb2938; }
.playing-card .corner { position: absolute; top: 5px; left: 7px; font-size: clamp(.85rem, 1.8vh, 1.2rem); font-weight: 900; line-height: .85; text-align: center; }
.playing-card .corner.bottom { top: auto; left: auto; bottom: 5px; right: 7px; transform: rotate(180deg); }
.playing-card .suit-center { position: absolute; inset: 0; display: grid; place-items: center; font-size: clamp(2.2rem, 5vh, 4rem); }
.pip-grid { position: absolute; inset: 20px 10px 17px; display: grid; grid-template-columns: 1fr; grid-auto-rows: 1fr; align-items: center; justify-items: center; font-family: Georgia, serif; font-size: clamp(1.1rem, 2.5vh, 1.65rem); line-height: 1; }
.pip-grid i { font-style: normal; }
.pip-2, .pip-3 { align-content: space-around; }
.pip-4, .pip-6, .pip-8, .pip-10 { grid-template-columns: 1fr 1fr; }
.pip-4, .pip-6, .pip-8, .pip-10 { grid-auto-rows: 1fr; }
.pip-5, .pip-7, .pip-9 { grid-template-columns: 1fr 1fr 1fr; }
.pip-5 i:nth-child(3), .pip-7 i:nth-child(4), .pip-9 i:nth-child(5) { grid-column: 2; }
.pip-7 i:nth-child(6), .pip-9 i:nth-child(7) { grid-column: 1; }
.pip-7 i:nth-child(7), .pip-9 i:nth-child(8) { grid-column: 3; }
.face-mark { position: absolute; inset: 19px 9px 17px; display: grid; place-items: center; border: 2px solid currentColor; border-radius: 50%; font: 900 clamp(2rem, 5vh, 3.4rem) Georgia, serif; }
.pip-grid { inset: 17px 8px 15px; overflow: hidden; grid-template-columns: repeat(3, 1fr) !important; grid-template-rows: repeat(4, 1fr); grid-auto-rows: auto; align-content: center; font-size: clamp(.85rem, 2.1vh, 1.35rem); }
.pip-grid i { grid-column: auto !important; }
.modern-card { border: 0; background: transparent; }
.player-hand .playing-card { margin-left: clamp(-17px, -1.4vw, -8px); cursor: pointer; transition: transform .18s, filter .18s; }
.player-hand .playing-card:first-child { margin-left: 0; }
.player-hand .playing-card:hover, .player-hand .playing-card:focus { transform: translateY(-14px) rotate(-1deg); filter: brightness(1.08); outline: 2px solid var(--gold); }
.player-hand.disabled .playing-card { cursor: not-allowed; filter: brightness(.72); pointer-events: none; }
.player-hand.disabled .playing-card:hover { transform: none; outline: none; }
.card-back { display: block; border: 3px solid #e8dfca; background-color: #163c4a; background-image: linear-gradient(45deg, rgba(255,255,255,.12) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.12) 75%), linear-gradient(45deg, rgba(255,255,255,.12) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.12) 75%); background-size: 13px 13px; background-position: 0 0, 6px 6px; }
.bot-hand .card-back { margin-left: -34px; transform: rotate(2deg); }
.bot-hand .card-back:first-child { margin-left: 0; }
.card-back.tiny { width: 25px; height: 35px; border-width: 2px; border-radius: 4px; box-shadow: none; }
.center-zone { position: absolute; inset: 25% 0 25%; display: grid; place-items: center; }
.pile-wrap { text-align: center; }
.pile { height: clamp(100px, 15vh, 155px); min-width: 100px; position: relative; display: grid; place-items: center; }
.pile .playing-card { position: absolute; }
.pile .playing-card:nth-last-child(2) { transform: translate(-6px, 3px) rotate(-5deg); }
.pile .playing-card:last-child { transform: translate(4px, -2px) rotate(3deg); }
.pile-count { margin-top: .4rem; display: inline-block; font-size: .65rem; color: #d8e8e2; background: rgba(0,0,0,.28); border-radius: 99px; padding: .25rem .6rem; }
.captured-status { position: absolute; top: 50%; transform: translateY(-50%); display: flex; align-items: baseline; gap: .25rem; color: var(--muted); }
.captured-status.left { left: 4%; }
.captured-status.right { right: 4%; }
.captured-status b { color: white; font-size: 1.5rem; }
.captured-status small { color: var(--gold); font-weight: 900; }
.captured-status span { font-size: .65rem; }
.timer { position: absolute; bottom: 0; left: 0; right: 0; height: 4px; background: rgba(0,0,0,.22); }
.timer span { display: block; width: 100%; height: 100%; background: var(--gold); transform-origin: left; }
.game-toast { position: absolute; z-index: 12; top: 3%; left: 50%; transform: translateX(-50%) translateY(-8px); opacity: 0; border-radius: 99px; padding: .55rem 1rem; background: rgba(5,25,23,.88); border: 1px solid rgba(255,255,255,.13); font-weight: 800; font-size: .82rem; transition: .2s; white-space: nowrap; }
.game-toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.game-toast.gold { color: var(--gold); }

.score-dialog { width: min(460px, 92vw); border: 1px solid var(--line); border-radius: 22px; padding: 1.8rem; color: var(--ink); background: #0a2928; box-shadow: 0 30px 100px #000; }
.score-dialog::backdrop { background: rgba(2,11,12,.78); backdrop-filter: blur(5px); }
.score-dialog h2 { font-family: Georgia, serif; margin: 0 0 1.2rem; text-align: center; font-size: 2rem; }
.score-dialog .eyebrow { text-align: center; }
.card-style-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.card-style-option { display: grid; gap: 5px; justify-items: center; padding: 12px 8px; border: 2px solid #294b49; border-radius: 12px; color: var(--ink); background: #123735; cursor: pointer; }
.card-style-option.selected { border-color: var(--gold); box-shadow: 0 0 0 2px #f3b94355; }
.card-style-option small { color: var(--muted); font-size: .68rem; }
.style-preview { display: grid; place-items: center; width: 48px; height: 64px; border-radius: 5px; font: 900 1rem Georgia, serif; }
.classic-preview { color: #b51f2f; background: #fff; border: 2px solid #ddd; }
.modern-preview { color: #c52b3b; background: linear-gradient(145deg,#fffdf6,#e7dfd0); border: 2px solid #d1b778; box-shadow: inset 0 0 0 2px #fff; }
.table-menu-dialog { width: 180px; max-height: 90vh; overflow-y: auto; padding: 10px 15px 15px; border: 0; border-radius: 3px; background: #f4f4f4; box-shadow: 0 12px 35px #0009; }
.table-menu-dialog::backdrop { background: rgba(0,0,0,.42); }
.table-menu-dialog .dialog-close { top: 8px; right: 8px; width: 25px; height: 25px; }
.table-menu-dialog .ref-blue-button { display: block; width: 120px; min-height: 30px; margin: 40px auto 0; padding: 0 7px; font-size: .68rem; }
.table-menu-dialog .ref-blue-button + .ref-blue-button { margin-top: 10px; }
.menu-game-info { margin: 28px 0 4px; padding-bottom: 6px; border-bottom: 1px solid #bbb; color: #333; text-align: center; font-size: .72rem; }
.menu-game-info b, .menu-game-info span { display: block; }
.menu-game-info span { margin-top: 3px; color: #666; font-size: .62rem; }
.menu-game-info i { font-style: normal; }
.social-dialog { width: min(360px, 92vw); padding: 22px; border: 1px solid #55716d; border-radius: 16px; color: var(--ink); background: #0b2928; box-shadow: 0 20px 70px #000b; }
.social-dialog::backdrop { background: #00100dcc; backdrop-filter: blur(4px); }
.social-profile-head { display: flex; align-items: center; gap: 12px; margin: 12px 0 18px; }
.social-profile-head h2 { margin: 0; font: 700 1.35rem Georgia,serif; }
.social-profile-head small { color: #7ed5a4; }
.social-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 6px; margin-bottom: 18px; text-align: center; }
.social-stats span { padding: 8px 4px; border-radius: 8px; background: #123b38; }
.social-stats b, .social-stats small { display: block; }.social-stats small { color: var(--muted); font-size: .65rem; }
.message-list { height: 190px; overflow-y: auto; display: grid; align-content: end; gap: 8px; padding: 8px; margin: 12px 0; background: #071c1e; border-radius: 10px; }
.message { max-width: 80%; padding: 7px 10px; border-radius: 10px; font-size: .78rem; }.message.incoming { background: #254d48; }.message.outgoing { justify-self: end; background: #6b3d92; }
#message-form { display: flex; gap: 6px; } #message-input { min-width: 0; flex: 1; padding: 9px; border: 1px solid #40645f; border-radius: 7px; color: white; background: #102d2c; }
.result-icon { margin: -3.6rem auto 1rem; display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--gold); color: #12201e; border: 6px solid #0a2928; font-size: 1.5rem; }
.score-table { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.score-row { display: grid; grid-template-columns: 1fr 60px 60px; padding: .7rem .85rem; border-bottom: 1px solid var(--line); color: var(--muted); }
.score-row:last-child { border: 0; }
.score-row b { color: white; text-align: center; }
.score-row.heading { background: rgba(255,255,255,.04); font-size: .75rem; }
.score-row.total { color: white; font-weight: 900; }
.score-row.total b { color: var(--gold); font-size: 1.2rem; }

@media (max-width: 760px) {
  .auth-screen { width: 100%; overflow-x: hidden; }
  .auth-card { width: 100%; max-width: 420px; }
  .auth-card button, .auth-card input, .auth-card .tab { touch-action: manipulation; }
  .mobile-hamburger { display: block; }
  .auth-screen { flex-direction: column; gap: 1.5rem; padding: 2rem 1rem; }
  .brand-block { text-align: center; }
  .brand-block h1 { font-size: 3.9rem; }
  .brand-mark { width: 105px; margin: 0 auto 1rem; }
  .brand-copy { display: none; }
  .welcome-row { align-items: stretch; flex-wrap: wrap; }
  .welcome-row > div:first-child { flex-basis: 100%; }
  .stat-pill { flex: 1; }
  .lobby-grid { grid-template-columns: 1fr; }
  .choice-grid { gap: .4rem; }
  .choice { min-height: 68px; }
  .player-badge { min-width: 0; left: 2%; top: 7%; padding: .35rem .5rem; }
  .player-badge.you { bottom: 4%; }
  .player-badge .avatar { width: 34px; height: 34px; }
  .player-badge span:last-child { display: none; }
  .score-box { right: 2%; top: 8%; width: 58px; padding: .35rem; }
  .you-zone .score-box { bottom: 5%; }
  .captured-status.left { left: 2%; }
  .captured-status.right { right: 2%; }
  .round-info { flex: 0 1 auto; }
  .deck-info { flex: 0 0 auto; }
  .game-header .icon-button:last-child { display: none; }
  .bot-hand { margin-top: 1.5vh; }
  .player-hand { margin-bottom: 2vh; }
  .playing-card, .card-back { width: clamp(58px, 10.2vh, 78px); height: clamp(81px, 14.2vh, 109px); }
}

@media (max-height: 620px) {
  .game-header { height: 48px; flex-basis: 48px; }
  .playing-card, .card-back { width: 54px; height: 75px; }
  .player-hand { margin-bottom: 1vh; }
  .bot-hand { margin-top: 1vh; }
}

/* Piştix salon → masa oluştur → hazır akışı */
.ref-lobby { background: #d7d7d7; color: #1b1b1b; }
.ref-lobby .topbar { background: linear-gradient(#2390d1, #126ea9); color: white; border: 0; box-shadow: 0 2px 6px #777; }
.ref-lobby .profile-chip small { color: #d9efff; }
.saloon-shell { width: min(980px, 100%); height: calc(100dvh - 78px - env(safe-area-inset-bottom)); min-height:0; margin: auto; padding: 10px 10px calc(10px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; }
.saloon-titlebar { min-height: 38px; padding: 8px 12px; display: flex; justify-content: space-between; color: white; background: #4b4b4b; border: 1px solid #2b2b2b; }
.saloon-titlebar span { color: #ddd; font-size: .85rem; }
.saloon-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: 2fr 1fr; gap: 7px; padding-top: 7px; }
.saloon-table-list, .saloon-players { background: #f7f7f7; border: 1px solid #999; overflow: auto; }
.grid-head, .table-row, .player-row { display: grid; align-items: center; min-height: 38px; border-bottom: 1px solid #bbb; }
.player-row { grid-template-columns: 32px 1fr auto; gap: 7px; padding: 4px 8px; cursor: pointer; }
.player-row > span:nth-child(2) { display:flex; flex-direction:column; min-width:0; }
.player-row > span:nth-child(2) b { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.player-row > span:nth-child(2) small { color:#777; font-size:.66rem; }
.lobby-avatar { width:28px; height:28px; display:grid; place-items:center; border-radius:50%; color:#fff; background:linear-gradient(145deg,#bd8b31,#5f321f); font-weight:900; }
.player-row:hover { background:#d7efff; }
.player-row.current-player { background:#fff6d7; }
.grid-head { position: sticky; top: 0; z-index: 1; grid-template-columns: 1fr .55fr .35fr .35fr; padding: 0 10px; color: white; background: linear-gradient(#6c6c6c, #4b4b4b); font-size: .78rem; font-weight: 700; }
.table-row { width: 100%; grid-template-columns: 1fr .55fr .35fr .35fr; padding: 0 10px; border-width: 0 0 1px; color: #222; background: linear-gradient(#fff, #e8e8e8); text-align: left; cursor: pointer; }
.table-row:nth-child(odd) { background: #f0f6fa; }
.table-row:hover { background: #d7efff; }
.saloon-players .grid-head { grid-template-columns: 1fr 70px; }
.player-row { padding: 0 10px; font-size: .85rem; }
.player-row { cursor: pointer; }
.player-row b { text-align: right; color: #176fa5; }
.empty-rows { height: 100%; background: repeating-linear-gradient(#fafafa 0 38px, #e5e5e5 38px 39px); }
.saloon-actions { display: flex; gap: 7px; padding: 8px 0 0; }
.ref-blue-button { min-height: 38px; padding: 0 20px; border: 1px solid #07598f; border-radius: 4px; color: white; background: linear-gradient(#29a3e8, #0872b5); box-shadow: inset 0 1px rgba(255,255,255,.38), 0 1px 2px #777; font-weight: 700; cursor: pointer; }
.ref-blue-button:hover { background: linear-gradient(#3ab1ef, #0b82c7); }
.ref-blue-button.exit { margin-left: auto; }
.room-dialog { width: min(380px, 94vw); padding: 16px 18px 20px; color: #171717; background: #f4f4f4; border: 2px solid #8d8d8d; border-radius: 3px; box-shadow: 0 10px 35px #0009; }
.room-dialog::backdrop { background: rgba(0,0,0,.55); }
.room-dialog h2 { margin: 0 0 16px; padding-bottom: 9px; font-size: 1.1rem; text-align: center; border-bottom: 1px solid #bbb; }
.dialog-close { position: absolute; right: 8px; top: 7px; width: 30px; height: 30px; border: 1px solid #777; color: white; background: #555; cursor: pointer; }
.room-dialog form { display: grid; gap: 10px; }
.room-dialog label { position: relative; display: grid; grid-template-columns: 112px 1fr; align-items: center; gap: 8px; font-size: .85rem; font-weight: 600; }
.room-dialog select { width: 100%; min-height: 34px; padding: 4px 30px 4px 8px; border: 1px solid #999; border-radius: 2px; color: #111; background: white; }
.room-dialog #room-mode { border: 2px solid #2b8fca; background: #eef9ff; font-weight: 700; }
.room-dialog #room-ai-difficulty { border: 2px solid #9b6bd1; background: #fbf4ff; font-weight: 700; }
.online-empty { color: #777; font-style: italic; pointer-events: none; }
.admin-link { display:block; margin-top:14px; color:#9ddcff; text-align:center; font-size:.78rem; text-decoration:none; }
.admin-link:hover { text-decoration:underline; }
.store-link { display:block; margin:8px auto 0; padding:0; border:0; background:none; color:#f3d77d; font-size:.78rem; cursor:pointer; }
#room-ai-difficulty-row[hidden] { display:none !important; }
.store-dialog { width:min(440px,92vw); max-height:88vh; overflow:auto; }
.store-section { display:grid; gap:9px; }
.store-product { padding:11px; border:1px solid #365b59; border-radius:9px; background:#113432; }
.store-product b { display:block; color:#f3d77d; }
.store-product small { display:block; margin:5px 0; color:var(--muted); line-height:1.35; }
.store-plans { display:flex; flex-wrap:wrap; gap:5px; margin:7px 0; }
.store-plans span { padding:3px 7px; border-radius:10px; background:#0b2928; color:#c9e2dc; font-size:.72rem; }
.store-product button { width:100%; }
.store-note { display:block; margin-top:13px; color:var(--muted); }
.auth-notice { min-height:1.2em; margin:10px 0 0; color:#ff9b9b; text-align:center; font-size:.82rem; font-weight:700; }
.contact-info { margin-top:14px; padding-top:10px; border-top:1px solid rgba(255,255,255,.12); color:var(--muted); font-size:.76rem; text-align:center; line-height:1.5; }
.room-dialog .select-suffix { position: absolute; right: 34px; font-size: .75rem; color: #555; pointer-events: none; }
.room-dialog .create-room { grid-column: 1 / -1; width: calc(100% - 120px); margin-left: 120px; margin-top: 8px; }
.room-screen { flex-direction: column; background: #d1d1d1; color: #171717; }
.room-screen .topbar { background: linear-gradient(#2390d1, #126ea9); color: white; border: 0; }
.room-screen .icon-button { color: white; border-color: #08659a; background: #0d74ae; }
.room-table { position: relative; flex: 1; overflow: hidden; background: radial-gradient(ellipse, #16815d, #07573e 68%); border: 10px solid #604326; box-shadow: inset 0 0 40px #003524; }
.waiting-card { position: absolute; width: min(330px, 88vw); left: 50%; top: 50%; transform: translate(-50%,-50%); padding: 15px; background: #f4f4f4; border: 2px solid #777; box-shadow: 0 8px 25px #0008; }
.waiting-card h2 { margin: 0 0 10px; padding-bottom: 8px; border-bottom: 1px solid #bbb; text-align: center; font-size: 1.1rem; }
.waiting-card dl { margin: 0; }
.waiting-card dl div { display: flex; justify-content: space-between; gap: 20px; padding: 4px 2px; font-size: .82rem; }
.waiting-card dt { color: #555; }
.waiting-card dd { margin: 0; font-weight: 700; text-align: right; }
.waiting-card p { margin: 12px 0 8px; color: #1479b5; text-align: center; font-weight: 700; }
.waiting-card .ref-blue-button { width: 100%; }
.seat { position: absolute; display: flex; flex-direction: column; align-items: center; color: white; text-shadow: 0 1px 2px #000; }
.opponent-seat { top: 4%; left: 50%; transform: translateX(-50%); }
.your-seat { bottom: 4%; left: 50%; transform: translateX(-50%); }
.seat-avatar { width: 58px; height: 58px; display: grid; place-items: center; border: 3px solid #ddd; border-radius: 50%; background: #777; font-size: 1.35rem; font-weight: 900; }
.seat-avatar.ready { background: #d99824; }
.seat small { color: #d5efe6; }

@media (max-width: 650px) {
  .account-upgrade { font-size:.52rem; padding:4px 5px; margin-left:3px; }
  .salons-screen .topbar { padding:0 6px; gap:3px; }
  .salons-screen .profile-chip { gap:3px; font-size:.65rem; }
  .salons-screen .profile-chip .avatar { width:28px; height:28px; }
  .saloon-grid { grid-template-columns: 1fr; }
  .saloon-players { display: block; min-height: 150px; max-height: 205px; }
  .saloon-actions .ref-blue-button:nth-child(3) { display: none; }
  .saloon-actions { flex-wrap: wrap; padding-bottom: env(safe-area-inset-bottom); }
  .saloon-actions .ref-blue-button { flex: 1 1 30%; min-width:0; padding: 0 6px; font-size:.62rem; }
  .saloon-titlebar { font-size:.72rem; }
  .saloon-shell { padding:6px; }
  .room-dialog label { grid-template-columns: 105px 1fr; }
  .room-dialog .create-room { width: calc(100% - 113px); margin-left: 113px; }
  .waiting-card { top: 48%; }
}

/* Oyun masası: dört koltuk, bilgi kutuları ve mobil menü */
.table-shell { background: radial-gradient(ellipse at center, #187f60 0%, #0c6048 54%, #084735 100%); border-color: #5e4328; }
.table-shell::after { content: ""; position: absolute; inset: 0; border: 1px solid rgba(255,255,255,.12); pointer-events: none; }
.player-badge { width: 180px; height: 55px; min-width: 0; padding: 3px 7px; border-radius: 2px; background: linear-gradient(90deg, rgba(35,18,77,.94), rgba(82,39,125,.9)); border: 1px solid rgba(255,255,255,.42); box-shadow: 0 2px 5px #0008; }
.player-badge.opponent { left: 50%; top: 12%; transform: translateX(-50%); }
.player-badge.you { left: 50%; bottom: 5%; top: auto; transform: translateX(-50%); }
.player-badge .avatar { width: 48px; height: 48px; flex: 0 0 48px; border-radius: 2px; border: 1px solid #f4d36c; background: linear-gradient(145deg,#e2ae37,#89521b); }
.player-badge.opponent .avatar { background: linear-gradient(145deg,#d9e3e2,#718a88); }
.player-badge span:last-child { min-width: 0; overflow: hidden; }
.player-badge span:last-child b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-badge span:last-child small { color: #f3d77d; }
.score-box { width: 82px; height: 55px; top: 18%; padding: 7px; border-radius: 2px; background: linear-gradient(90deg, rgba(35,18,77,.94), rgba(82,39,125,.9)); border: 1px solid rgba(255,255,255,.38); box-shadow: 0 2px 5px #0008; }
.score-box b { font-size: 1.25rem; }
.you-zone .score-box { bottom: 11%; }
.table-endpoint, .table-clock { position: absolute; z-index: 4; top: auto; bottom: 21%; width: 92px; height: 44px; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 1px solid rgba(255,255,255,.38); border-radius: 2px; color: #fff; background: linear-gradient(90deg, rgba(35,18,77,.94), rgba(82,39,125,.9)); box-shadow: 0 2px 5px #0008; }
.table-endpoint { left: 2%; }
.table-clock { right: 2%; }
.table-endpoint small, .table-clock small { font-size: .55rem; letter-spacing: .14em; color: #f3d77d; }
.table-endpoint b, .table-clock b { font-size: .85rem; }
.table-action-strip { position: absolute; z-index: 6; top: 2%; right: 2%; display: flex; gap: 4px; }
.table-action { min-width: 52px; min-height: 28px; padding: 0 7px; border: 1px solid #07598f; border-radius: 3px; color: #fff; background: linear-gradient(#29a3e8,#0872b5); font-size: .67rem; font-weight: 700; box-shadow: 0 1px 2px #0008; cursor: pointer; }
.side-player { position: absolute; z-index: 3; top: 50%; width: 86px; display: none; flex-direction: column; align-items: center; transform: translateY(-50%); }
.side-player.visible { display: flex; }
.left-player-zone { left: 1%; }
.right-player-zone { right: 1%; }
.side-player-badge { width: 70px; min-height: 76px; padding: 4px; display: flex; flex-direction: column; align-items: center; border: 1px solid rgba(255,255,255,.36); border-radius: 2px; color: #fff; background: linear-gradient(90deg, rgba(35,18,77,.94), rgba(82,39,125,.9)); box-shadow: 0 2px 5px #0008; font-size: .63rem; }
.side-player-badge .avatar { width: 29px; height: 29px; border-radius: 2px; font-size: .8rem; background: linear-gradient(145deg,#e5bd4d,#965c1c); }
.side-player-badge small { color: #f3d77d; font-size: .55rem; }
.side-card-stack { display: flex; flex-direction: column; gap: 1px; margin-top: 6px; }
.side-card-stack .card-back.tiny { width: 20px; height: 28px; }
.table-chat-bubble { position: absolute; z-index: 9; right: 13%; top: 31%; display: none; max-width: 145px; padding: 7px 11px; border: 1px solid rgba(255,255,255,.3); border-radius: 10px; color: #fff; background: rgba(24,18,55,.9); box-shadow: 0 3px 8px #0007; font-size: .72rem; }
.table-chat-bubble.show { display: block; }
.table-chat-bubble::after { content: ""; position: absolute; bottom: -7px; left: 18px; width: 12px; height: 12px; background: rgba(24,18,55,.9); border-right: 1px solid rgba(255,255,255,.3); border-bottom: 1px solid rgba(255,255,255,.3); transform: rotate(45deg); }
.center-zone { inset: 24% 0 24%; }
.captured-status { padding: 3px 7px; border: 1px solid rgba(255,255,255,.26); border-radius: 2px; background: rgba(35,18,77,.75); }
.captured-status.left { left: 10%; }
.captured-status.right { right: 10%; }
.pile .playing-card { width: 72px; height: 96px; }
.player-hand .playing-card { width: 72px; height: 96px; }
.player-hand { margin-bottom: 10vh; }
.bot-hand { display: none !important; }
.bot-hand .card-back { display: none; }
.side-card-stack { display: none !important; }
.timer { height: 3px; background: rgba(0,0,0,.35); }

@media (max-width: 760px) {
  .table-action-strip { inset: 0; top: 0; right: auto; width: 100%; height: 0; display: block; transform: none; }
  .table-action-strip .table-action { position: absolute; top: 2%; }
  .table-action-strip .table-action:first-child { left: 2%; }
  .table-action-strip .table-action:nth-child(2) { right: 2%; }
  .table-action-strip .table-action:nth-child(2) { display: none; }
  .table-action-strip .table-action:nth-child(3) { display: none; }
  .table-action { min-width: 48px; min-height: 25px; padding: 0 5px; font-size: .6rem; }
  .table-endpoint, .table-clock { top: auto; bottom: 19%; width: 61px; height: 36px; }
  .table-endpoint { left: 1.5%; }
  .table-clock { right: 1.5%; }
  .table-endpoint b, .table-clock b { font-size: .7rem; }
  .table-endpoint small, .table-clock small { font-size: .46rem; }
  .player-badge { width: 112px; height: 45px; padding: 2px 4px; }
  .player-badge .avatar { width: 37px; height: 37px; flex-basis: 37px; }
  .player-badge span:last-child { display: flex; font-size: .72rem; }
  .score-box { width: 57px; height: 43px; padding: 4px; }
  .score-box b { font-size: 1rem; }
  .bot-hand { display: none !important; }
  .side-player { width: 55px; }
  .side-player-badge { width: 52px; min-height: 62px; font-size: .52rem; }
  .side-player-badge .avatar { width: 24px; height: 24px; }
  .side-player-badge small { font-size: .45rem; }
  .side-card-stack { display: none; }
  .left-player-zone { left: 0; }
  .right-player-zone { right: 0; }
  .center-zone { inset: 23% 0 23%; }
  .captured-status.left { left: 16%; }
  .captured-status.right { right: 16%; }
  .captured-status { font-size: .62rem; }
  .captured-status b { font-size: 1rem; }
  .table-chat-bubble { right: 20%; top: 34%; }
  .player-hand .playing-card, .pile .playing-card { width: clamp(57px, 14vw, 72px); height: clamp(76px, 19vw, 96px); }
  .player-hand { position: absolute; left: 50%; bottom: 8%; transform: translateX(-50%); align-self: auto; width: min(86vw, 330px); min-width: 0; justify-content: center; margin: 0; }
}

@media (max-width: 380px) {
  .table-action:nth-child(3) { display: none; }
  .player-badge { width: 96px; }
  .player-badge span:last-child { font-size: .64rem; }
  .side-player-badge { width: 47px; }
  .captured-status.left { left: 11%; }
  .captured-status.right { right: 11%; }
  .player-hand { bottom: 8%; width: 220px; }
  .player-hand .playing-card { width: 58px; height: 78px; flex: 0 0 58px; margin-left: -17px; }
  .player-hand .playing-card:first-child { margin-left: 0; }
}

/* Girişten sonraki iki sütunlu salon seçimi */
.salons-screen { flex-direction: column; background: #d7d7d7; color: #1b1b1b; }
.salons-screen .topbar { background: linear-gradient(#2390d1, #126ea9); color: white; border: 0; box-shadow: 0 2px 6px #777; }
.salons-screen .profile-chip small { color: #d9efff; }
.salons-page { width: min(1000px, 94vw); margin: auto; padding: 22px 0 18px; }
.salons-heading { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 13px; padding: 0 4px; }
.salons-heading h2 { margin: 0; font: 700 2rem Georgia, serif; color: #313131; }
.salons-heading p:last-child { margin: 4px 0 0; color: #666; font-size: .84rem; }
.salons-heading .eyebrow { margin-bottom: 4px; color: #176fa5; }
.online-total { min-width: 120px; padding: 8px 13px; border: 1px solid #aaa; border-radius: 3px; background: linear-gradient(#fff,#e7e7e7); text-align: center; box-shadow: 0 1px 2px #999; }
.online-total b { display: block; color: #176fa5; font-size: 1.35rem; }
.online-total small { color: #666; font-size: .72rem; }
.salon-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.salon-column { min-height: 448px; padding: 8px; border: 1px solid #858585; background: #ededed; box-shadow: inset 0 0 0 1px #fff, 0 2px 4px #999; }
.salon-column-header { height: 49px; padding: 7px 14px; display: flex; flex-direction: column; justify-content: center; border: 1px solid #2d2350; color: white; background: linear-gradient(#654c93,#382761); box-shadow: inset 0 1px rgba(255,255,255,.4); }
.fast-column .salon-column-header { border-color: #084f70; background: linear-gradient(#2e9fd0,#126b99); }
.salon-column-header b { font-size: .98rem; }
.salon-column-header small { color: #e3dff2; font-size: .68rem; }
.fast-column .salon-column-header small { color: #d9f2ff; }
.salon-list { display: flex; flex-direction: column; gap: 8px; padding: 10px 3px; }
.salon-button { position: relative; min-height: 78px; padding: 11px 96px 10px 17px; border: 1px solid #55427b; border-radius: 3px; color: white; background: linear-gradient(135deg,#655293,#392663); text-align: left; box-shadow: inset 0 1px rgba(255,255,255,.34), 0 2px 3px #777; cursor: pointer; transition: transform .15s, filter .15s; }
.salon-button.salon-disabled { border-color:#8b2929; background:linear-gradient(135deg,#7e3232,#4b1f25); cursor:not-allowed; filter:saturate(.75); }

/* Piştix oyun masası: büyük kartlar ve sürekli genel sohbet alanı */
.table-chat { position:absolute; z-index:10; left:4%; right:4%; bottom:1%; height:92px; display:flex; flex-direction:column; background:#fff; border:5px solid #4d79a4; box-shadow:0 2px 4px #45627d; color:#4d6680; }
.table-chat-log { flex:1; overflow:auto; padding:6px 9px; font:16px Georgia,serif; line-height:1.2; }
.table-chat-log div:nth-child(2n) { color:#627b43; }
.table-chat form { display:flex; height:34px; border-top:1px solid #c7c7c7; }
.table-chat input { flex:1; min-width:0; border:0; color:#344d64; background:#fff; padding:4px 8px; }
.table-chat button { width:42px; border:0; border-left:1px solid #d1d1d1; color:#fff; background:#4d79a4; cursor:pointer; }
.mobile-table-actions { display:none; }

@media (max-width:760px) {
  .player-hand { bottom:22%; width:min(88vw,340px); }
  .player-hand .playing-card { width:72px; height:104px; flex-basis:72px; margin-left:-18px; }
  .pile .playing-card,.table-card-back { width:84px; height:118px; }
  .player-badge.you { bottom:13%; }
  .table-chat { left:1%; right:1%; bottom:0; height:104px; }
  .table-chat-log { font-size:14px; }
}
@media (max-width:380px) {
  .player-hand { bottom:22%; width:250px; }
  .player-hand .playing-card { width:66px; height:96px; flex-basis:66px; margin-left:-17px; }
}

/* Mobil masa yerleşimi: ekran kaymaz, hamburger üstte, sohbet elin altında */
@media (max-width:760px) {
  .game-screen { position:fixed; inset:0; width:100%; height:100svh; min-height:0; overflow:hidden; z-index:50; background:#414141; }
  .game-header { position:absolute; z-index:40; top:0; left:0; width:100%; height:66px; padding:0 4px; display:flex; align-items:flex-start; background:linear-gradient(#6591bd,#3f6d9a); border:0; pointer-events:none; }
  .game-header #leave-game { display:none !important; }
  .game-header .mobile-hamburger { display:block !important; pointer-events:auto; position:relative; z-index:60; width:38px; height:38px; margin:0 9px 0 0; padding:7px; background:linear-gradient(#fff 0 3px,transparent 3px 10px,#fff 10px 13px,transparent 13px 20px,#fff 20px 23px,transparent 23px); border:0; border-right:1px solid rgba(255,255,255,.8); border-radius:0; }
  .game-header .mobile-hamburger i { display:none !important; }
  .mobile-game-profile { position:absolute; top:24px; right:4px; height:42px; display:flex; align-items:center; gap:3px; padding-right:4px; color:#fff; font:700 12px Arial,sans-serif; text-align:right; }
  .mobile-game-profile > span:first-child,.mobile-game-profile > b { display:block; line-height:13px; }
  .mobile-game-profile > span:first-child { font-size:14px; }
  .mobile-game-profile > b { font-size:12px; }
  .mobile-game-avatar { order:3; width:34px; height:34px; margin-left:3px; border:1px solid #e6c768; border-radius:2px; display:grid; place-items:center; color:#fff; background:#7c9d70; font-size:18px; }
  .game-header .round-info { display:none; }
  .table-action-strip,.table-action-strip *,#table-score-button,#table-menu-button,#table-sound-button { display:none !important; visibility:hidden !important; }
  .table-shell { position:absolute; inset:0; width:100%; height:100%; border:8px solid #4d79a4; padding-top:42px; }
  .mobile-table-actions { position:absolute; z-index:30; top:73px; left:5px; right:5px; height:84px; display:block; pointer-events:none; }
  .mobile-table-actions button { position:absolute; width:74px; height:39px; padding:0 3px; border:1px solid #315878; border-radius:2px; color:#fff; background:linear-gradient(#6591bd,#3f6d9a); box-shadow:none; font:700 16px Arial,sans-serif; pointer-events:auto; }
  #mobile-write-button { left:0; top:0; }
  #mobile-sound-button { left:0; top:43px; }
  #mobile-exit-button { right:0; top:0; }
  #mobile-lobby-button { right:0; top:43px; }
  .opponent-zone .player-badge { top:70px; z-index:12; }
  .opponent-zone .score-box { top:92px; z-index:12; }
  .center-zone { inset:120px 0 280px; }
  .table-endpoint,.table-clock { top:31%; bottom:auto; }
  .captured-status.left,.captured-status.right { top:48%; transform:none; z-index:18; }
  .captured-status.left { left:2%; }
  .captured-status.right { right:2%; }
  /* Mobil alt yerleşim: el -> profil -> sohbet */
  .player-hand { bottom:118%; z-index:8; }
  .player-badge.you { bottom:75%; z-index:9; }
  .you-zone .score-box { bottom:75%; z-index:9; }
  .captured-status.left,.captured-status.right { top:65%; }
  .game-toast { top:35px; max-width:210px; padding:6px 10px; font-size:.64rem; }
  .table-chat { left:1%; right:1%; bottom:0; height:20%; min-height:140px; max-height:155px; z-index:20; }
}

/* Piştix masa düzeni: geniş gri zemin, mavi çerçeve ve merkezde tek kart arkası */
.game-screen { background:#4c78a4; }
.table-shell { background:#c9c9c9; border:8px solid #4d79a4; box-shadow:inset 0 0 0 1px #e9f2fa; }
.table-shell::after { border-color:rgba(44,77,110,.35); }
.player-badge,.score-box,.table-endpoint,.table-clock,.captured-status { background:linear-gradient(#5d83ad,#3e638c); border-color:#315878; box-shadow:0 2px 4px #45627d; }
.player-badge.opponent,.player-badge.you { border-radius:0; }
.table-card-back { position:absolute; z-index:1; left:50%; top:50%; width:76px; height:106px; transform:translate(-50%,-50%) translate(-7px,-8px) rotate(-3deg); border:3px solid #fff; border-radius:8px; background:#fff url('assets/cards/back.png') center/cover no-repeat; box-shadow:0 4px 7px #555; }
.pile { z-index:2; }
.pile .playing-card { z-index:3; }
.salon-button.fast { border-color: #0a5e85; background: linear-gradient(135deg,#318eb8,#155d83); }
.salon-button:hover { transform: translateY(-2px); filter: brightness(1.1); }
.salon-name { display: block; font-size: 1.08rem; font-weight: 900; }
.salon-meta { display: block; margin-top: 6px; color: #f6e38c; font-size: .76rem; }
.salon-meta i { display: inline-block; width: 8px; height: 8px; margin-right: 3px; border-radius: 50%; background: #49e28b; box-shadow: 0 0 6px #49e28b; }
.salon-meta b { color: #ffd34b; margin-left: 4px; }
.salon-require { position: absolute; right: 12px; top: 30px; color: #e5dcf5; font-size: .66rem; text-align: right; }
.salon-button.fast .salon-require { color: #ccefff; }
.salons-back { margin-top: 14px; min-width: 90px; }
.salon-switch-button { min-height: 33px; padding: 0 10px; border: 1px solid #07598f; border-radius: 3px; color: white; background: linear-gradient(#29a3e8,#0872b5); cursor: pointer; font-size: .74rem; font-weight: 700; }

@media (max-width: 680px) {
  .salons-page { width: 94vw; padding-top: 14px; }
  .salons-heading h2 { font-size: 1.6rem; }
  .salons-heading p:last-child { max-width: 220px; }
  .online-total { min-width: 96px; }
  .salon-columns { grid-template-columns: 1fr; gap: 10px; }
  .salon-column { min-height: 0; padding: 6px; }
  .salon-column-header { height: 43px; }
  .salon-button { min-height: 70px; }
  .salons-back { margin-top: 10px; }
}

/* Tek kaynak mobil masa yerleşimi - önceki mobil kuralların tamamını ezer. */
@media (max-width:760px) {
  .game-screen { position:fixed !important; inset:0 !important; width:100% !important; height:100svh !important; overflow:hidden !important; }
  .table-shell { position:absolute !important; inset:0 !important; width:100% !important; height:100% !important; overflow:hidden !important; }

  /* Üst menü: solda çerçeveli hamburger + dikey ayraç, sağda ad/puan alt alta
     ve yanlarında avatar. Tüm içerik barın dikey ortasında hizalanır. */
  .game-header { position:absolute !important; inset:0 0 auto 0 !important; height:58px !important; padding:0 !important; background:linear-gradient(#3f6d9a,#2b4f74) !important; border:0 !important; border-bottom:1px solid rgba(255,255,255,.34) !important; pointer-events:none !important; }
  .game-header::after { content:'' !important; position:absolute !important; left:54px !important; top:9px !important; bottom:9px !important; width:1px !important; background:rgba(255,255,255,.45) !important; }
  .game-header .mobile-hamburger { position:absolute !important; top:10px !important; left:8px !important; width:38px !important; height:38px !important; margin:0 !important; padding:0 7px !important; display:flex !important; flex-direction:column !important; justify-content:center !important; gap:5px !important; border:1px solid rgba(255,255,255,.55) !important; border-radius:5px !important; background:rgba(255,255,255,.1) !important; box-shadow:none !important; pointer-events:auto !important; z-index:60 !important; }
  .game-header .mobile-hamburger i { display:block !important; width:100% !important; height:4px !important; margin:0 !important; border-radius:1px !important; background:#fff !important; }
  .mobile-game-profile { position:absolute !important; top:9px !important; right:8px !important; height:40px !important; max-width:calc(100% - 74px) !important; display:grid !important; grid-template-columns:minmax(0,1fr) auto !important; grid-template-rows:auto auto !important; align-items:center !important; column-gap:8px !important; padding:0 !important; text-align:right !important; }
  .mobile-game-profile > span:first-child { grid-column:1 !important; grid-row:1 !important; display:block !important; max-width:100% !important; font-size:15px !important; line-height:19px !important; overflow:hidden !important; text-overflow:ellipsis !important; white-space:nowrap !important; }
  .mobile-game-profile > b { grid-column:1 !important; grid-row:2 !important; display:block !important; font-size:14px !important; line-height:18px !important; white-space:nowrap !important; }
  .mobile-game-avatar { grid-column:2 !important; grid-row:1 / span 2 !important; width:40px !important; height:40px !important; margin:0 !important; border:1px solid rgba(255,255,255,.6) !important; border-radius:6px !important; font-size:20px !important; }

  .table-action-strip,.table-action-strip *,#table-score-button,#table-menu-button,#table-sound-button,#leave-game { display:none !important; visibility:hidden !important; width:0 !important; height:0 !important; }
  .mobile-table-actions { position:absolute !important; z-index:35 !important; top:68px !important; left:4px !important; right:4px !important; height:79px !important; display:block !important; }
  .mobile-table-actions button { width:72px !important; height:37px !important; margin:0 !important; padding:0 2px !important; appearance:none !important; -webkit-appearance:none !important; -webkit-tap-highlight-color:transparent !important; outline:0 !important; box-shadow:none !important; overflow:hidden !important; white-space:nowrap !important; font-size:15px !important; }
  .mobile-table-actions button:focus,.mobile-table-actions button:focus-visible,.mobile-table-actions button:active { outline:0 !important; box-shadow:none !important; }
  #mobile-write-button,#mobile-exit-button { top:0 !important; }
  #mobile-sound-button,#mobile-lobby-button { top:42px !important; }

  /* Rakip rozeti ve skoru, mobil aksiyon butonlarının arasında ortalanır:
     böylece Çık/Salon butonlarının arkasında hiçbir kutu kalmaz. */
  .opponent-zone { top:0 !important; height:190px !important; pointer-events:none !important; }
  .opponent-zone .player-badge { width:180px !important; top:80px !important; bottom:auto !important; left:50% !important; right:auto !important; transform:translateX(-50%) !important; pointer-events:auto !important; }
  .player-badge { gap:5px !important; padding:2px 7px !important; }
  .player-badge .avatar { width:32px !important; height:32px !important; flex:0 0 32px !important; }
  .badge-score { min-width:20px !important; font-size:1rem !important; }
  .badge-points { font-size:.8rem !important; }
  .player-badge .badge-id b { font-size:.72rem !important; }
  .player-badge span:last-child small { font-size:.55rem !important; overflow:hidden !important; text-overflow:ellipsis !important; white-space:nowrap !important; }

  /* Masanın orta bloğu (deste + bitiş/süre + toplanan kart) tek bir değişkenden
     konumlanır. Değer, destenin görünen ortası rakip rozeti ile elin tam
     ortasına denk gelecek şekilde hesaplanır. */
  .table-shell { --pile-top:max(145px,calc(50% - 157px)); }
  .center-zone { position:absolute !important; inset:0 !important; display:block !important; pointer-events:none !important; }
  .pile { height:124px !important; }
  .pile-count { margin-top:3px !important; padding:2px 7px !important; font-size:.6rem !important; }
  .pile-wrap { position:absolute !important; z-index:5 !important; top:var(--pile-top) !important; left:50% !important; transform:translateX(-50%) !important; pointer-events:auto !important; }
  .game-toast { position:absolute !important; z-index:25 !important; top:calc(var(--pile-top) + 146px) !important; left:50% !important; max-width:210px !important; padding:6px 10px !important; font-size:.64rem !important; }
  .table-chat-bubble { display:none !important; }
  .table-endpoint,.table-clock { height:48px !important; top:calc(var(--pile-top) + 16px) !important; bottom:auto !important; }
  .table-endpoint i,.table-clock i { font-size:.6rem !important; }
  .captured-status.left,.captured-status.right { top:calc(var(--pile-top) + 74px) !important; bottom:auto !important; transform:none !important; z-index:18 !important; }
  .captured-status.left { left:2% !important; }
  .captured-status.right { right:2% !important; }

  .you-zone { position:absolute !important; inset:0 !important; width:100% !important; height:100% !important; pointer-events:none !important; }
  .player-hand { position:absolute !important; z-index:8 !important; top:auto !important; bottom:196px !important; left:50% !important; transform:translateX(-50%) !important; margin:0 !important; pointer-events:auto !important; }
  .player-badge.you { width:200px !important; position:absolute !important; z-index:9 !important; top:auto !important; bottom:146px !important; left:50% !important; transform:translateX(-50%) !important; pointer-events:auto !important; }
  .timer { position:absolute !important; z-index:31 !important; top:auto !important; bottom:139px !important; left:0 !important; right:0 !important; }
  .table-chat { bottom:0 !important; z-index:30 !important; height:136px !important; min-height:136px !important; max-height:136px !important; }
}

/* Dar telefonlarda (≤380px) mobil masa ölçüleri küçültülür. */
@media (max-width:380px) {
  .mobile-table-actions button { width:70px !important; font-size:13px !important; letter-spacing:-.2px !important; }
  .opponent-zone .player-badge { width:150px !important; }
  .player-badge.you { width:180px !important; }
}

/* Alçak ekranlarda (≤700px) masa dikeyde sıkıştırılır. */
@media (max-width:760px) and (max-height:700px) {
  .table-shell { --pile-top:max(140px,min(calc(50% - 132px),calc(100% - 434px))); }
  .pile { height:108px !important; }
  .pile .playing-card,.table-card-back { width:74px !important; height:104px !important; }
  .game-toast { top:calc(var(--pile-top) + 125px) !important; }
  .player-hand { bottom:172px !important; }
  .player-hand .playing-card { width:62px !important; height:88px !important; flex-basis:62px !important; margin-left:-16px !important; }
  .player-hand .playing-card:first-child { margin-left:0 !important; }
  .player-badge.you,.you-zone .score-box { bottom:124px !important; }
  .timer { bottom:118px !important; }
  .table-chat { height:114px !important; min-height:114px !important; max-height:114px !important; }
  .table-chat-log { font-size:13px !important; }
}

/* Çok alçak ekranlarda (≤620px) en sıkışık yerleşim. */
@media (max-width:760px) and (max-height:620px) {
  .table-shell { --pile-top:max(132px,min(calc(50% - 115px),calc(100% - 398px))); }
  .mobile-table-actions { top:62px !important; }
  .opponent-zone .player-badge { top:74px !important; }
  .pile { height:96px !important; }
  .pile .playing-card,.table-card-back { width:66px !important; height:92px !important; }
  .game-toast { top:calc(var(--pile-top) + 117px) !important; }
  .player-hand { bottom:158px !important; }
  .player-hand .playing-card { width:56px !important; height:80px !important; flex-basis:56px !important; margin-left:-15px !important; }
  .player-badge.you,.you-zone .score-box { bottom:108px !important; }
  .timer { bottom:104px !important; }
  .table-chat { height:102px !important; min-height:102px !important; max-height:102px !important; }
}

/* Masaüstü masa yerleşimi: sohbet paneli artık oyuncunun rozetini/skorunu
   örtmüyor, rakip skor kutusu da üstteki aksiyon şeridinin altında kalmıyor. */
@media (min-width:761px) {
  .opponent-zone .score-box { margin-top:18px; }
  .table-endpoint,.table-clock { bottom:28%; }
  .pile-wrap { position:relative; top:-42px; }
  .player-hand { margin-bottom:182px; }
  .player-badge.you,.you-zone .score-box { bottom:120px; }
  .timer { bottom:112px; z-index:11; }
}

/* Alçak masaüstü/tablet pencerelerinde masa dikeyde sıkıştırılır. */
@media (min-width:761px) and (max-height:760px) {
  .pile-wrap { top:-78px; }
  .table-endpoint,.table-clock { bottom:36%; }
  .player-hand { margin-bottom:176px; }
  .player-badge.you,.you-zone .score-box { bottom:104px; }
  .timer { bottom:98px; }
}

/* ---- Avatar seçimi ---- */
.avatar-picker { margin: -.3rem 0 1.1rem; display: grid; gap: .55rem; justify-items: center; }
.avatar-picker-label { color: #d4e1dc; font-size: .78rem; font-weight: 800; }
.avatar-options { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.avatar-option { width: clamp(44px,13vw,52px); height: clamp(44px,13vw,52px); padding: 0; border: 2px solid rgba(255,255,255,.18); border-radius: 14px; background-color: rgba(0,0,0,.2); background-size: cover; background-position: center; background-repeat: no-repeat; cursor: pointer; transition: transform .15s, border-color .15s, box-shadow .15s; }
.avatar-option:hover { transform: translateY(-2px); }
.avatar-option.selected { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(243,185,67,.22); }
.avatar-random { padding: .42rem .9rem; border: 1px solid var(--line); border-radius: 99px; background: rgba(255,255,255,.06); color: var(--muted); font-size: .72rem; font-weight: 800; cursor: pointer; }
.avatar-random:hover { color: var(--ink); border-color: var(--gold); }
.avatar.has-avatar, .seat-avatar.has-avatar, .lobby-avatar.has-avatar, .mobile-game-avatar.has-avatar {
  background-color: transparent !important; background-size: cover !important; background-position: center !important; background-repeat: no-repeat !important; color: transparent !important;
}

/* ---- El sonucu penceresi: masanın mavi çerçeve + açık panel diliyle ---- */
#score-dialog { width: min(330px,90vw); padding: 0; overflow: hidden; border: 5px solid #4d79a4; border-radius: 4px; color: #4d6680; background: #eef3f8; box-shadow: 0 14px 38px #000a; }
#score-dialog::backdrop { background: rgba(18,32,50,.62); backdrop-filter: blur(3px); }
#score-dialog .result-head { display: flex; align-items: center; gap: 11px; padding: 11px 14px; background: linear-gradient(#5d83ad,#3e638c); border-bottom: 1px solid #315878; }
#score-dialog .result-icon { flex: 0 0 42px; width: 42px; height: 42px; margin: 0; display: grid; place-items: center; border: 2px solid #f4d36c; border-radius: 50%; background: linear-gradient(#f7d06a,#d2941a); color: #43300a; font-size: 1.15rem; box-shadow: 0 2px 5px #0005; }
#score-dialog .result-titles { display: block; min-width: 0; }
#score-dialog .eyebrow { display: block; margin: 0; color: #f3d77d; font-size: .56rem; letter-spacing: .16em; text-align: left; }
#score-dialog h2 { margin: 2px 0 0; color: #fff; font: 700 1.12rem Georgia,serif; text-align: left; }
#score-dialog .result-body { padding: 12px 14px 14px; }
#score-dialog .score-table { border: 1px solid #b9c9da; border-radius: 3px; background: #fff; }
#score-dialog .score-row { grid-template-columns: minmax(0,1fr) 62px 62px; padding: 8px 10px; border-bottom: 1px solid #dde5ee; color: #4d6680; font-size: .79rem; }
#score-dialog .score-row > * { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#score-dialog .score-row b { color: #22405f; }
#score-dialog .score-row.heading { background: #dfe8f2; color: #5b7590; font-size: .64rem; font-weight: 800; }
#score-dialog .score-row.total { background: #f4f8fc; color: #22405f; font-weight: 900; }
#score-dialog .score-row.total b { color: #b5791a; font-size: 1.05rem; }
#score-dialog .primary-button { margin-top: 12px; width: 100%; padding: .7rem 1rem; border: 1px solid #b8860f; border-radius: 3px; background: linear-gradient(#f7d06a,#d2941a); color: #3c2a08; font-weight: 900; box-shadow: inset 0 1px rgba(255,255,255,.5), 0 2px 4px #45627d; }
#score-dialog .primary-button:hover { transform: none; filter: brightness(1.06); }

/* ---- Rozet içi skor + hesap puanı (referans masa düzeni) ---- */
.badge-score { flex: 0 0 auto; min-width: 22px; color: #fff; font-size: 1.15rem; font-weight: 900; text-align: center; text-shadow: 0 1px 2px #0007; }
.player-badge .badge-id { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; text-align: right; }
.player-badge .badge-id b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge-points { font-style: normal; font-weight: 900; color: #f3d77d; font-size: .92rem; letter-spacing: .02em; }
.player-badge { width: 232px; }
.table-endpoint i, .table-clock i { font-style: normal; font-weight: 900; color: #fff; font-size: .72rem; letter-spacing: .04em; }
.table-endpoint, .table-clock { height: 62px; }

/* Rakibin kartları masada gösterilmez. */
.bot-hand, .bot-hand .card-back { display: none !important; }
