/* Online Briç Skor — BBO Teamgame layout (video reference) */
@import url("https://fonts.googleapis.com/css2?family=Source+Sans+3:wght@400;600;700;800&display=swap");

:root {
  --felt: #1f6b3a;
  --felt-deep: #14522c;
  --header: #1a2744;
  --side-bg: #111820;
  --auction-bg: #d8dcd8;
  --auction-red: #9b1c1c;
  --gold-turn: #f5d547;
  --plate: #c8cdc8;
  --plate-me: #f5d547;
  --ink: #111;
  --muted: #a8b8c8;
  --card-w: 86px;
  --card-h: 122px;
  --card-w-sm: 64px;
  --card-h-sm: 90px;
  --card-w-me: 100px;
  --card-h-me: 142px;
  /* Kendi eli: sadece üst yarı (indeks) görünsün */
  --card-h-me-vis: 74px;
  --card-w-dummy: 84px;
  --card-h-dummy: 118px;
  --card-w-trick: 92px;
  --card-h-trick: 130px;
  /* Jumbo index strip visible in fan */
  --overlap-x: -48px;
  --overlap-y: -50px;
  --overlap-me: -58px;
  --overlap-dummy: -48px;
  --suit-gap: 8px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body.play-body {
  margin: 0;
  min-height: 100vh;
  font-family: "Source Sans 3", system-ui, sans-serif;
  background: #0a0e14;
  color: #eee;
  display: flex;
  flex-direction: column;
}

.play-top {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.35rem 0.75rem;
  background: var(--header);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.play-top strong { color: #f0c14b; font-size: 0.95rem; }
.play-top .top-meta { font-size: 0.8rem; color: var(--muted); margin-left: 0.75rem; }
.play-top nav { display: flex; align-items: center; gap: 0.15rem; }
.play-top a, .play-top button.linkish {
  color: #9ec0e0;
  text-decoration: none;
  margin-left: 0.55rem;
  font-size: 0.82rem;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.join-card {
  max-width: 380px;
  margin: 2rem auto;
  background: #152030;
  padding: 1.25rem;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.join-card label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.9rem; }
.join-card input, .join-card select {
  padding: 0.45rem 0.55rem;
  border-radius: 6px;
  border: 1px solid #345;
  background: #0c1520;
  color: #fff;
  font-family: inherit;
}

.btn {
  display: inline-block;
  padding: 0.4rem 0.7rem;
  border-radius: 6px;
  border: 1px solid transparent;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
}
.btn-primary { background: #f0c14b; color: #111; }
.btn-ghost { background: rgba(255,255,255,0.08); color: #ddd; border-color: rgba(255,255,255,0.12); }
.btn-ghost.calling {
  background: #7f1d1d;
  border-color: #ef4444;
  color: #fecaca;
  animation: callPulse 1.2s ease-in-out infinite;
}
.dir-call-flag {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 800;
  color: #fecaca;
  background: #7f1d1d;
  border: 1px solid #ef4444;
  border-radius: 999px;
  padding: 0.15rem 0.45rem;
  align-self: center;
}
.dir-call-flag.hidden { display: none !important; }
@keyframes callPulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.25); }
}
.btn-danger { background: #c0392b; color: #fff; }
.btn-ok { background: #27ae60; color: #fff; }

/* Main: table + history toggle + history */
.bbo-shell {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px minmax(260px, 340px);
  min-height: 0;
  overflow: hidden;
  transition: grid-template-columns 0.2s ease;
}
.bbo-shell.history-collapsed {
  grid-template-columns: minmax(0, 1fr) 32px 0px;
}
@media (max-width: 720px) {
  .bbo-shell {
    grid-template-columns: minmax(0, 1fr) 28px minmax(0, 200px);
  }
  .bbo-shell.history-collapsed {
    grid-template-columns: minmax(0, 1fr) 28px 0px;
  }
  :root {
    --card-w: 64px; --card-h: 90px;
    --card-w-sm: 48px; --card-h-sm: 68px;
    --card-w-me: 76px; --card-h-me: 108px;
    --card-w-dummy: 64px; --card-h-dummy: 90px;
    --card-w-trick: 70px; --card-h-trick: 98px;
    --overlap-x: -40px; --overlap-y: -42px;
    --overlap-me: -50px; --overlap-dummy: -40px;
  }
  .felt-side { width: 88px; }
}

.table-column {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.felt-wrap {
  flex: 1;
  display: flex;
  min-height: 0;
  background: var(--side-bg);
}

/* Left strip inside table (BBO style) */
.felt-side {
  width: 108px;
  flex-shrink: 0;
  background: #0d1218;
  padding: 0.45rem 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  border-right: 1px solid #1a2430;
  z-index: 3;
}
.menu-btn {
  width: 42px; height: 42px;
  border: none; border-radius: 6px;
  background: #2b6cb0; color: #fff;
  font-size: 1.25rem; cursor: pointer;
  display: grid; place-items: center;
}
.imp-box {
  background: #e8ece8;
  color: #222;
  border-radius: 4px;
  padding: 0.35rem 0.4rem;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.35;
}
.imp-box .imp-title { font-size: 0.62rem; color: #555; margin-bottom: 0.15rem; }
.board-badge {
  width: 72px; height: 72px;
  margin: 0.1rem auto;
  border-radius: 4px;
  background: #ddd;
  color: #222;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.7rem;
  border: 6px solid #888;
  position: relative;
}
.board-badge.vuln-ns { border-top-color: #c41e20; border-bottom-color: #c41e20; }
.board-badge.vuln-ew { border-left-color: #c41e20; border-right-color: #c41e20; }
.board-badge.vuln-both { border-color: #c41e20; }
.dealer-tag {
  position: absolute;
  bottom: 2px; left: 50%;
  transform: translateX(-50%);
  font-size: 0.65rem;
  font-weight: 800;
  background: #c41e20;
  color: #fff;
  padding: 0 5px;
  border-radius: 2px;
}
.contract-hud {
  margin: 0.15rem auto 0.35rem;
  min-width: 72px;
  max-width: 88px;
  padding: 0.28rem 0.35rem;
  border-radius: 6px;
  background: #0b3d26;
  border: 1px solid #2a8f55;
  color: #e8f8ef;
  text-align: center;
  font-weight: 800;
  font-size: 0.95rem;
  line-height: 1.2;
  letter-spacing: 0.02em;
}
.contract-hud .ch-strain.red { color: #ff8a8a; }
.contract-hud .ch-by {
  display: block;
  margin-top: 0.1rem;
  font-size: 0.68rem;
  font-weight: 700;
  color: #b7e4c7;
}
.trick-pills {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem;
}
.trick-pills div {
  background: #1f6b3a;
  border-radius: 4px;
  text-align: center;
  padding: 0.25rem;
  font-size: 0.7rem;
}
.trick-pills strong { display: block; font-size: 1.1rem; }
.felt-side .side-btns { margin-top: auto; display: flex; flex-direction: column; gap: 0.3rem; }
.felt-side .side-btns .btn { width: 100%; margin: 0; padding: 0.35rem 0.2rem; font-size: 0.72rem; }

/* Green felt */
.felt {
  position: relative;
  flex: 1;
  min-height: 560px;
  background:
    radial-gradient(ellipse at center, #278a4a 0%, var(--felt) 55%, var(--felt-deep) 100%);
  overflow: hidden;
}
.felt::after {
  content: "OBS";
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  font-size: 5rem;
  font-weight: 800;
  color: rgba(255,255,255,0.04);
  pointer-events: none;
  letter-spacing: 0.2em;
}

.seat-slot {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  z-index: 2;
}
/* N: kartlar üstte, isim hemen altında (kartları örtmez) */
.seat-slot.top {
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 94%;
  gap: 0.35rem;
}
.seat-slot.top .hand-row .pcard {
  margin-left: var(--overlap-dummy);
}
.seat-slot.top .hand-row .pcard:first-child { margin-left: 0; }
.seat-slot.top .hand-row .pcard.suit-break {
  margin-left: calc(var(--overlap-dummy) + var(--suit-gap));
}
.seat-slot.top .pcard.dummy-size {
  width: var(--card-w-dummy);
  height: var(--card-h-dummy);
}
/* S: kartlar, isim altta — arada boşluk */
.seat-slot.bottom {
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 96%;
  z-index: 7;
  gap: 0.4rem;
}
.seat-slot.bottom .hand-row .pcard {
  margin-left: var(--overlap-me);
}
.seat-slot.bottom .hand-row .pcard:first-child { margin-left: 0; }
.seat-slot.bottom .hand-row .pcard.suit-break {
  margin-left: calc(var(--overlap-me) + var(--suit-gap));
}
/* B/D: yan kartlar — orta boşluk korunur */
.seat-slot.left {
  left: 8px;
  top: 50%;
  transform: translateY(-42%);
  align-items: flex-start;
  max-width: min(168px, 26%);
  z-index: 3;
}
.seat-slot.right {
  right: 8px;
  top: 50%;
  transform: translateY(-42%);
  align-items: flex-end;
  max-width: min(168px, 26%);
  z-index: 3;
}
/* Geçmiş açıkken masa daralır → E/W daha dar, birbirine değmesin */
.bbo-shell:not(.history-collapsed) .seat-slot.left {
  left: 4px;
  max-width: min(132px, 22%);
}
.bbo-shell:not(.history-collapsed) .seat-slot.right {
  right: 4px;
  max-width: min(132px, 22%);
}
.bbo-shell:not(.history-collapsed) .seat-slot.left .suit-row .pcard,
.bbo-shell:not(.history-collapsed) .seat-slot.right .suit-row .pcard {
  width: 46px;
  height: 66px;
}
.bbo-shell:not(.history-collapsed) .suit-row .pcard {
  margin-left: -30px;
}
.bbo-shell:not(.history-collapsed) .suit-row .pcard:first-child {
  margin-left: 0;
}
.bbo-shell:not(.history-collapsed) .auction-center {
  width: min(240px, 44%);
}
.seat-slot.left .seat-name,
.seat-slot.right .seat-name {
  align-self: stretch;
  max-width: 100%;
  min-width: 0;
}

/* BBO nameplates */
.seat-name {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.18rem 0.35rem 0.18rem 0.18rem;
  border-radius: 3px;
  background: var(--plate);
  color: #222;
  border: 2px solid #6c3a9b;
  white-space: nowrap;
  max-width: 280px;
  min-width: 110px;
  cursor: pointer;
}
.seat-name:hover { filter: brightness(1.06); }
.seat-name .dir {
  display: inline-grid;
  place-items: center;
  width: 1.35rem; height: 1.35rem;
  background: #3a3a3a;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  border-radius: 2px;
  flex-shrink: 0;
}
.seat-name .nm {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}
.seat-name .badge {
  background: #6c3a9b;
  color: #fff;
  font-size: 0.68rem;
  padding: 0.05rem 0.35rem;
  border-radius: 2px;
  font-weight: 800;
  margin-left: 0.25rem;
}
.seat-name .st {
  flex-shrink: 0;
  font-size: 0.58rem;
  font-weight: 800;
  color: #b91c1c;
  letter-spacing: 0;
  max-width: 4.5rem;
  white-space: normal;
  line-height: 1.05;
}
.seat-name.dropped .dir { background: #991b1b; }
.seat-name.me {
  background: var(--plate-me);
  border-color: #6c3a9b;
}
.seat-name.turn {
  background: var(--gold-turn);
  box-shadow: 0 0 0 2px #fff, 0 0 10px rgba(245,213,71,0.55);
}
.seat-name.on .dir { background: #1a7a3c; }

/* Horizontal fan (N/S) */
.hand-row {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  min-height: var(--card-h);
}
.hand-row.compact { min-height: var(--card-h-sm); }
.seat-slot.bottom .hand-row { min-height: var(--card-h-me-vis); }
.seat-slot.top .hand-row { min-height: var(--card-h-dummy); }
.hand-row .pcard {
  margin-left: var(--overlap-x);
  position: relative;
}
.hand-row .pcard:first-child { margin-left: 0; }
.hand-row .pcard.suit-break {
  margin-left: calc(var(--overlap-x) + var(--suit-gap));
}

/* E/W: BBO suit rows — her renk yatay satır */
.hand-suits {
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: flex-start;
}
.seat-slot.right .hand-suits { align-items: flex-end; }
.suit-row {
  display: flex;
  align-items: flex-end;
  min-height: calc(var(--card-h-sm) * 0.72);
}
.suit-row .pcard {
  margin-left: -36px;
  position: relative;
}
.suit-row .pcard:first-child { margin-left: 0; }
.seat-slot.left .suit-row .pcard,
.seat-slot.right .suit-row .pcard {
  width: 56px;
  height: 80px;
}

.pcard {
  width: var(--card-w);
  height: var(--card-h);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  border: none;
  box-shadow: 1px 2px 5px rgba(0,0,0,0.35);
  position: relative;
  flex-shrink: 0;
  user-select: none;
  transition: transform 0.12s ease;
  padding: 0;
  overflow: hidden;
  font-family: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
}
.pcard.sm { width: var(--card-w-sm); height: var(--card-h-sm); }
.pcard.me-size { width: var(--card-w-me); height: var(--card-h-me); }
.pcard.dummy-size { width: var(--card-w-dummy); height: var(--card-h-dummy); }
.pcard.trick-size { width: var(--card-w-trick); height: var(--card-h-trick); }
/* Kendi eli: yarım yükseklik (üst indeks) — deklare paneline yer */
.seat-slot.bottom .pcard.me-size {
  width: var(--card-w-me) !important;
  height: var(--card-h-me-vis) !important;
  overflow: hidden;
}
.seat-slot.bottom .pcard.me-size img {
  width: 100% !important;
  height: auto !important;
  min-height: 185%;
  object-fit: cover;
  object-position: top center;
  transform: translateY(0);
}
.pcard img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}
.pcard .idx { display: none; }
.pcard.playable {
  cursor: pointer;
  box-shadow: 0 0 0 3px var(--gold-turn), 0 6px 14px rgba(0,0,0,0.4);
  z-index: 4;
}
.pcard.playable:hover { transform: translateY(-14px); z-index: 9; }
.pcard.not-legal { pointer-events: none; cursor: default; }
.pcard.back { background: transparent; }

/* Center auction — şık deklare kutusu */
.auction-center {
  position: absolute;
  left: 50%;
  top: 38%;
  transform: translate(-50%, -50%);
  z-index: 6;
  width: min(300px, 56%);
  background: #f4f1ea;
  border: 1px solid #8a9a8a;
  border-radius: 6px;
  box-shadow:
    0 10px 32px rgba(0,0,0,0.45),
    inset 0 1px 0 rgba(255,255,255,0.65);
  overflow: hidden;
  color: #222;
  pointer-events: none;
}
.auction-center .auction-wait {
  display: none;
}
.auction-head {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: #e8ece8;
  border-bottom: 1px solid #9aa89a;
}
.auction-head span {
  text-align: center;
  font-weight: 800;
  font-size: 0.95rem;
  padding: 0.38rem 0.1rem;
  color: #1a1a1a;
  background: #f7f8f6;
  border-right: 1px solid #b8c2b8;
  letter-spacing: 0.02em;
}
.auction-head span:last-child { border-right: none; }
.auction-head span.vuln {
  background: linear-gradient(#a61f1f, #8b1515);
  color: #fff;
  text-shadow: 0 1px 0 rgba(0,0,0,0.25);
}
.auction-head span.turn {
  box-shadow: inset 0 -3px 0 #e8b923;
}
.auction-head span.vuln.turn {
  background: linear-gradient(#7a1212, #5c0c0c);
  box-shadow: inset 0 -3px 0 #f0c14b;
}
.auction-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  padding: 0;
  min-height: 44px;
  background: #f4f1ea;
  border-top: none;
}
.auction-cell {
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid #c5cec5;
  border-bottom: 1px solid #c5cec5;
  background: #faf8f2;
  padding: 0.2rem 0.1rem;
}
.auction-cell:nth-child(4n) { border-right: none; }
.auction-cell.is-turn {
  background: #fff8dc;
  box-shadow: inset 0 0 0 1px rgba(232, 185, 35, 0.45);
}
.auction-cell .bid-wait {
  font-size: 0.68rem;
  font-weight: 700;
  color: #8a7010;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* BBO bid panel — own hand üstünde, kartlara binmez */
.bid-panel {
  position: absolute;
  left: 50%;
  bottom: calc(var(--card-h-me-vis) + 52px);
  transform: translateX(-50%);
  z-index: 8;
  width: min(420px, 88%);
  background: #e8e0d0;
  border: 1px solid #b8a890;
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  padding: 0.45rem 0.5rem 0.4rem;
  pointer-events: auto;
}
.bid-panel .bid-row {
  display: flex;
  align-items: stretch;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
}
.bid-panel .bid-row:last-of-type { margin-bottom: 0.25rem; }
.bid-panel .pass {
  flex: 0 0 72px;
  background: #2e9e4f;
  color: #fff;
  border: 1px solid #1f7a3a;
  border-radius: 4px;
  font-weight: 800;
  font-size: 1rem;
  cursor: pointer;
  font-family: inherit;
}
.bid-panel .dbl {
  flex: 0 0 64px;
  background: #d32f2f;
  color: #fff;
  border: 1px solid #a32020;
  border-radius: 4px;
  font-weight: 800;
  font-size: 0.95rem;
  cursor: pointer;
  font-family: inherit;
}
.bid-panel .rdbl {
  flex: 0 0 58px;
  background: #7b1fa2;
  color: #fff;
  border: 1px solid #5a1678;
  border-radius: 4px;
  font-weight: 800;
  font-size: 0.8rem;
  cursor: pointer;
  font-family: inherit;
}
.bid-panel .alert-btn {
  flex: 0 0 54px;
  background: #ffeb3b;
  color: #222;
  border: 1px solid #c9b820;
  border-radius: 4px;
  font-weight: 800;
  font-size: 0.78rem;
  cursor: pointer;
  font-family: inherit;
}
.bid-panel .alert-btn.on { outline: 3px solid #e67e22; }
.bid-panel .pass:disabled,
.bid-panel .dbl:disabled,
.bid-panel .rdbl:disabled { opacity: 0.35; cursor: not-allowed; }
.bid-panel .levels {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.25rem;
}
.bid-panel .strains {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.25rem;
  min-height: 40px;
  background: #f5efe4;
  border-radius: 4px;
  padding: 0.15rem;
  border: 1px solid #d0c4b0;
}
.bid-panel .levels button,
.bid-panel .strains button {
  padding: 0.45rem 0.1rem;
  border-radius: 4px;
  border: 1px solid #bbb;
  background: #fff;
  font-weight: 800;
  font-size: 1.05rem;
  cursor: pointer;
  font-family: inherit;
}
.bid-panel .levels button.selected { background: #1a5276; color: #fff; border-color: #1a5276; }
.bid-panel .levels button:disabled,
.bid-panel .strains button:disabled { opacity: 0.28; cursor: not-allowed; }
.bid-panel .strain-C, .bid-panel .strain-S { color: #111; }
.bid-panel .strain-D, .bid-panel .strain-H { color: #c41e20; }
.bid-panel .strain-NT { color: #1a5276; font-size: 0.85rem !important; }
.bid-panel .bid-explain { margin: 0; }
.bid-panel .bid-explain input {
  width: 100%;
  padding: 0.3rem 0.45rem;
  border-radius: 4px;
  border: 1px solid #c5b9a5;
  background: #faf7f0;
  font-family: inherit;
  font-size: 0.78rem;
}
@media (max-width: 720px) {
  .bid-panel { bottom: calc(var(--card-h-me-vis) + 44px); width: 94%; }
}
.bid-chip {
  font-weight: 800;
  font-size: 1.05rem;
  line-height: 1.1;
  background: transparent;
  border: none;
  padding: 0;
}
.bid-chip.suit-C, .bid-chip.suit-S { color: #111; }
.bid-chip.suit-D, .bid-chip.suit-H { color: #c41e20; }
.bid-chip.suit-NT { color: #1a5276; }
.bid-chip.pass { color: #1a5c32; font-size: 0.95rem; }
.bid-chip.x { color: #c41e20; }
.bid-chip.xx { color: #6c3483; }
.bid-chip .alert-dot { color: #e67e22; font-size: 0.7rem; margin-left: 2px; }
.bid-chip .alert-dot.clickable {
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.bid-chip .alert-dot.clickable:hover { color: #d35400; }

.dm-panel {
  position: fixed;
  right: 12px;
  bottom: 72px;
  width: min(320px, calc(100vw - 24px));
  max-height: 42vh;
  display: flex;
  flex-direction: column;
  background: #0f172a;
  border: 1px solid #475569;
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.35);
  z-index: 40;
  overflow: hidden;
}
.dm-panel.hidden { display: none !important; }
.dm-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.55rem 0.7rem;
  background: #1e293b;
  color: #e2e8f0;
  font-size: 0.9rem;
}
.dm-head .xbtn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
}
.dm-log {
  flex: 1;
  overflow-y: auto;
  padding: 0.55rem 0.7rem;
  font-size: 0.82rem;
  color: #e2e8f0;
  min-height: 100px;
}
.dm-line { margin-bottom: 0.35rem; line-height: 1.35; }
.dm-compose {
  display: flex;
  gap: 0.35rem;
  padding: 0.5rem;
  border-top: 1px solid #334155;
  background: #111827;
}
.dm-compose input {
  flex: 1;
  border-radius: 8px;
  border: 1px solid #475569;
  background: #0f172a;
  color: #f8fafc;
  padding: 0.4rem 0.55rem;
  font-size: 0.85rem;
}
body.observe-mode .bid-panel,
body.observe-mode #btnClaim,
body.observe-mode #btnUndo,
body.observe-mode #btnDirector {
  display: none !important;
}
body.observe-mode .top-meta::before {
  content: "İZLEME · ";
  color: #fbbf24;
  font-weight: 700;
}

.trick-center {
  position: absolute;
  left: 50%; top: 46%;
  transform: translate(-50%, -50%);
  width: 280px; height: 250px;
  z-index: 5;
}
.trick-center .pcard { position: absolute; }
.trick-center .from-top { top: 0; left: 50%; transform: translateX(-50%); }
.trick-center .from-bottom { bottom: 0; left: 50%; transform: translateX(-50%); }
.trick-center .from-left { left: 0; top: 50%; transform: translateY(-50%); }
.trick-center .from-right { right: 0; top: 50%; transform: translateY(-50%); }
.trick-center .pcard.fly-in.from-top { animation: flyTop 0.4s ease-out; }
.trick-center .pcard.fly-in.from-bottom { animation: flyBottom 0.4s ease-out; }
.trick-center .pcard.fly-in.from-left { animation: flyLeft 0.4s ease-out; }
.trick-center .pcard.fly-in.from-right { animation: flyRight 0.4s ease-out; }
@keyframes flyTop { from { transform: translate(-50%, -90px); opacity: 0; } to { transform: translateX(-50%); opacity: 1; } }
@keyframes flyBottom { from { transform: translate(-50%, 90px); opacity: 0; } to { transform: translateX(-50%); opacity: 1; } }
@keyframes flyLeft { from { transform: translate(-90px, -50%); opacity: 0; } to { transform: translateY(-50%); opacity: 1; } }
@keyframes flyRight { from { transform: translate(90px, -50%); opacity: 0; } to { transform: translateY(-50%); opacity: 1; } }

.claim-toast {
  position: absolute;
  left: 50%; top: 62%;
  transform: translateX(-50%);
  z-index: 8;
  background: #fff;
  color: #222;
  border-radius: 8px;
  padding: 0.7rem 0.9rem;
  box-shadow: 0 10px 28px rgba(0,0,0,0.4);
  text-align: center;
  min-width: 200px;
}
.claim-toast p { margin: 0 0 0.5rem; font-weight: 700; }
.claim-toast .modal-actions { justify-content: center; display: flex; gap: 0.35rem; }

/* Bid box below felt */
.controls-below {
  flex: 0 0 auto;
  background: #0d1218;
  padding: 0.45rem 0.65rem;
  border-top: 1px solid #1a2430;
}
.result-banner {
  margin-top: 0.4rem;
  background: rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 0.55rem;
  text-align: center;
  font-weight: 700;
  font-size: 0.9rem;
}

/* Chat bar */
.chat-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: #f4f4f2;
  color: #222;
  padding: 0.3rem 0.5rem;
  border-top: 1px solid #ccc;
  font-size: 0.78rem;
}
.chat-log {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: #333;
  min-width: 0;
}
.chat-bar input {
  width: 160px;
  padding: 0.3rem 0.45rem;
  border: 1px solid #bbb;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.78rem;
}
.chat-bar .btn { padding: 0.3rem 0.55rem; font-size: 0.75rem; }

/* History panel + fixed center toggle */
.history-toggle {
  align-self: center;
  justify-self: center;
  z-index: 20;
  background: #1a2744;
  border: 1px solid #3a5080;
  color: #cde;
  border-radius: 6px;
  width: 28px;
  height: 44px;
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
  padding: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
}
.history-toggle:hover { background: #243658; }
.history-panel {
  background: #152030;
  border-left: 1px solid #243448;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  width: 100%;
  min-width: 0;
}
.history-panel h3 {
  margin: 0;
  padding: 0.45rem 0.55rem;
  font-size: 0.88rem;
  background: #1a2744;
  border-bottom: 1px solid #243448;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.history-panel h3 .hist-title { flex: 1; }
.bbo-shell.history-collapsed .history-panel {
  opacity: 0;
  pointer-events: none;
  border: none;
}
.history-scroll {
  flex: 1;
  overflow: auto;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.hist-tabs {
  display: flex;
  gap: 0;
  background: #e8e8e8;
  border-bottom: 1px solid #ccc;
  flex-shrink: 0;
}
.hist-tabs.hidden { display: none; }
.hist-tab {
  flex: 1;
  border: none;
  background: transparent;
  padding: 0.45rem 0.3rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: #444;
  cursor: pointer;
  border-bottom: 3px solid transparent;
}
.hist-tab.active {
  color: #5b2d8e;
  border-bottom-color: #7b3fb8;
  background: #fff;
}
.hist-score-wrap {
  max-height: 38%;
  overflow: auto;
  flex-shrink: 0;
  background: #d6d2b8;
}
.fb-score-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.72rem;
  color: #111;
  font-family: "Segoe UI", "Segoe UI Symbol", Tahoma, sans-serif;
}
.fb-score-table thead th {
  position: sticky;
  top: 0;
  background: #1a5c2e;
  color: #fff;
  font-weight: 700;
  padding: 0.3rem 0.2rem;
  text-align: center;
  border-right: 1px solid rgba(255,255,255,0.15);
  z-index: 1;
}
.fb-score-table td {
  padding: 0.2rem 0.2rem;
  text-align: center;
  border-bottom: 1px solid rgba(0,0,0,0.1);
  border-right: 1px solid rgba(0,0,0,0.06);
  background: #e8e2c8;
  vertical-align: middle;
}
.fb-score-table tr:nth-child(even) td { background: #ddd6b6; }
.fb-score-table tr.sel td { background: #c5d8f0; }
.fb-score-table tr.cur td { outline: 1px solid #2b6cb0; }
.fb-score-table tr { cursor: pointer; }
.fb-score-table tr:hover td { filter: brightness(0.97); }
.fb-score-table .col-res {
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: 0.01em;
}
.fb-score-table .res-line {
  color: #111;
  font-weight: 700;
}
.fb-score-table .res-pass { color: #333; font-weight: 600; }
.fb-score-table .sc {
  display: inline;
  font-weight: 900;
  font-size: 1.05em;
  line-height: 1;
}
.fb-score-table .sc.red {
  color: #d40000 !important;
  -webkit-text-fill-color: #d40000;
}
.fb-score-table .sc.blk {
  color: #000 !important;
  -webkit-text-fill-color: #000;
}
.fb-score-table tr.imp-total-row { cursor: default; }
.fb-score-table tr.imp-total-row td {
  background: #d0cbb0 !important;
  border-bottom: none;
  padding: 0.35rem 0.2rem;
}
.fb-score-table td.imp-tot {
  background: #f0c14b !important;
  color: #111;
  font-weight: 900;
  font-size: 0.95rem;
  border: 1px solid #c9a227;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.12);
}
.fb-imp-totals {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  padding: 0.35rem;
  background: #1a5c2e;
  flex-shrink: 0;
}
.fb-imp-totals.hidden { display: none; }
.fb-imp-box {
  background: #f0c14b;
  color: #1a1a1a;
  font-weight: 800;
  font-size: 0.95rem;
  padding: 0.2rem 0.85rem;
  border-radius: 3px;
  min-width: 3.2rem;
  text-align: center;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.12);
}
.other-score-form {
  display: block;
  padding: 0.55rem 0.6rem;
  margin: 0.35rem;
  background: #152030;
  border: 1px solid #3a5080;
  border-radius: 6px;
}
.other-score-form.hidden {
  display: none !important;
}
.osf-title {
  font-weight: 800;
  margin-bottom: 0.35rem;
  color: #f0c14b;
  font-size: 0.75rem;
}
.osf-row {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.3rem;
}
.osf-row label {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  font-size: 0.65rem;
  color: #9ab;
}
.osf-row input, .osf-row select {
  padding: 0.25rem 0.3rem;
  border-radius: 3px;
  border: 1px solid #3a5080;
  background: #152030;
  color: #eee;
  font-size: 0.72rem;
  font-family: inherit;
}
#osfSubmit { width: 100%; margin-top: 0.15rem; font-size: 0.72rem; padding: 0.35rem; }
.osf-msg { min-height: 1em; margin-top: 0.25rem; color: #7dd3fc; font-size: 0.65rem; }
.fb-review {
  flex: 1;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  background: #14522c;
}
.fb-review.hidden { display: none; }
.fb-review-felt {
  position: relative;
  flex: 1;
  min-height: 200px;
  padding: 0.35rem;
  display: grid;
  grid-template-columns: minmax(72px, 1fr) minmax(88px, 1.1fr) minmax(72px, 1fr);
  grid-template-rows: auto 1fr auto;
  gap: 0.35rem 0.45rem;
  align-items: center;
  justify-items: center;
}
.fb-board-no {
  position: absolute;
  left: 6px;
  top: 6px;
  width: 22px;
  height: 22px;
  border-radius: 3px;
  background: #1a2744;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.fb-hand {
  background: #f7f4ea;
  border: 1px solid #c5b98a;
  border-radius: 4px;
  padding: 0.15rem 0.25rem;
  width: 100%;
  max-width: 104px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  overflow: hidden;
}
.fb-hand.fb-n { grid-column: 2; grid-row: 1; max-width: 120px; }
.fb-hand.fb-w { grid-column: 1; grid-row: 2; justify-self: start; max-width: 96px; }
.fb-hand.fb-e { grid-column: 3; grid-row: 2; justify-self: end; max-width: 96px; }
.fb-hand.fb-s { grid-column: 2; grid-row: 3; max-width: 120px; }
.fb-hand-name {
  font-size: 0.58rem;
  font-weight: 700;
  color: #333;
  margin-bottom: 0.08rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fb-dir {
  display: inline-block;
  background: #5b2d8e;
  color: #fff;
  border-radius: 2px;
  padding: 0 0.18rem;
  margin-right: 0.12rem;
  font-size: 0.52rem;
}
.fb-hand-cards {
  font-family: "Segoe UI Symbol", "Apple Color Emoji", "Noto Sans Symbols", sans-serif;
  font-size: 0.6rem;
  line-height: 1.2;
  font-weight: 700;
  overflow: hidden;
}
.fb-suit {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.fb-suit.red, .fb-call.red { color: #c41e3a; }
.fb-suit.blk, .fb-call.blk {
  color: #000 !important;
  -webkit-text-fill-color: #000;
  opacity: 1;
  font-weight: 800;
}
.fb-pip {
  display: inline-block;
  width: 0.8em;
  margin-right: 0.08em;
  font-size: 0.9em;
}
.fb-suit.blk .fb-pip,
.fb-call.blk {
  color: #000 !important;
  -webkit-text-fill-color: #000;
  opacity: 1;
}
.fb-auction {
  grid-column: 2;
  grid-row: 2;
  background: #f0eee6;
  border: 1px solid #bbb;
  border-radius: 3px;
  padding: 0.15rem;
  width: 100%;
  max-width: 118px;
  max-height: 110px;
  overflow: auto;
  z-index: 1;
}
.fb-auction.hidden { display: none !important; }
.fb-trick {
  grid-column: 2;
  grid-row: 2;
  width: 100%;
  max-width: 118px;
  min-height: 72px;
  background: rgba(10, 40, 24, 0.35);
  border: 1px dashed rgba(255,255,255,0.25);
  border-radius: 4px;
  display: grid;
  grid-template-areas:
    ". n ."
    "w . e"
    ". s .";
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 1fr 1fr 1fr;
  place-items: center;
  padding: 0.2rem;
  z-index: 1;
}
.fb-trick[hidden] { display: none !important; }
.fb-trick .ft {
  font-size: 0.78rem;
  font-weight: 900;
  background: #fff;
  border-radius: 3px;
  padding: 0.14rem 0.28rem;
  border: 1px solid #222;
  line-height: 1;
  color: #000;
  -webkit-text-fill-color: #000;
  opacity: 1;
}
.fb-trick .ft.red {
  color: #c41e3a !important;
  -webkit-text-fill-color: #c41e3a;
}
.fb-trick .ft.n { grid-area: n; }
.fb-trick .ft.e { grid-area: e; }
.fb-trick .ft.s { grid-area: s; }
.fb-trick .ft.w { grid-area: w; }
.fb-auc-head {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  font-size: 0.58rem;
  font-weight: 800;
  text-align: center;
  color: #444;
  margin-bottom: 0.1rem;
}
.fb-auc-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
}
.fb-auc-cell {
  min-height: 1.05em;
  font-size: 0.62rem;
  font-weight: 700;
  text-align: center;
  color: #1a1a1a;
}
.fb-auc-empty {
  font-size: 0.65rem;
  color: #666;
  text-align: center;
  padding: 0.4rem;
}
.fb-contract {
  position: absolute;
  right: 6px;
  bottom: 4px;
  background: rgba(26,39,68,0.92);
  color: #f0c14b;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.15rem 0.35rem;
  border-radius: 3px;
  max-width: 55%;
  text-align: right;
}
.fb-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem;
  padding: 0.3rem;
  background: #0f3a1f;
  flex-shrink: 0;
}
.fb-nav .btn {
  font-size: 0.62rem;
  padding: 0.35rem 0.2rem;
  margin: 0;
}
.fb-nav .btn:disabled {
  opacity: 0.45;
  cursor: default;
}
.history-empty {
  padding: 0.8rem 0.4rem;
  color: #555;
  font-size: 0.75rem;
  text-align: center;
  background: #e4dfc4;
}
.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
}
.history-table th {
  text-align: left;
  color: var(--muted);
  font-weight: 600;
  padding: 0.25rem 0.3rem;
  border-bottom: 1px solid #243448;
}
.history-table td {
  padding: 0.3rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.history-table tr.active { background: rgba(43,108,176,0.35); }
.history-empty {
  padding: 1rem 0.5rem;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}
.match-score-line {
  margin: 0.25rem 0.35rem 0.5rem;
  padding: 0.4rem 0.5rem;
  background: rgba(43,108,176,0.25);
  border-radius: 6px;
  font-size: 0.8rem;
  line-height: 1.35;
}
.match-score-line.hidden { display: none; }
.match-boards { color: var(--muted); font-size: 0.72rem; }
.history-list { display: flex; flex-direction: column; gap: 0.45rem; }
.hist-board {
  background: rgba(0,0,0,0.22);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  padding: 0.4rem 0.45rem;
  font-size: 0.72rem;
  line-height: 1.35;
}
.hist-board.active { border-color: rgba(96,165,250,0.55); background: rgba(43,108,176,0.28); }
.hist-board-head {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  margin-bottom: 0.3rem;
  font-size: 0.78rem;
}
.hist-imp { color: #7dd3fc; }
.hist-tables { display: flex; flex-direction: column; gap: 0.35rem; }
.hist-table {
  padding: 0.3rem 0.35rem;
  background: rgba(255,255,255,0.04);
  border-radius: 4px;
}
.hist-table-name {
  font-weight: 700;
  color: #93c5fd;
  margin-bottom: 0.15rem;
  font-size: 0.7rem;
}
.hist-result { font-weight: 600; margin-bottom: 0.15rem; }
.hist-auction, .hist-play {
  color: #cbd5e1;
  word-break: break-word;
  margin-top: 0.12rem;
}
.hist-empty-side { color: var(--muted); font-style: italic; }


.hand-diagram {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  flex-wrap: wrap;
  font-family: Consolas, monospace;
  font-size: 0.95rem;
  font-weight: 700;
  background: rgba(0,0,0,0.28);
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
}
.hand-diagram .sym-C, .hand-diagram .sym-S { color: #ddd; }
.hand-diagram .sym-D, .hand-diagram .sym-H { color: #f1948a; }

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal {
  background: #f7f7f5;
  color: #222;
  border-radius: 10px;
  padding: 1rem 1.1rem;
  width: min(400px, 100%);
  box-shadow: 0 16px 40px rgba(0,0,0,0.45);
}
.modal h3 { margin: 0 0 0.65rem; font-size: 1.05rem; }
.modal label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
  margin-bottom: 0.55rem;
}
.modal label.row-check { flex-direction: row; align-items: center; gap: 0.5rem; }
.modal input[type="text"], .modal input[type="number"], .modal select, .modal textarea {
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  border: 1px solid #bbb;
  font-family: inherit;
}
.modal textarea { min-height: 56px; resize: vertical; }
.modal-actions {
  display: flex;
  gap: 0.4rem;
  justify-content: flex-end;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

/* BBO-style player profile card */
.profile-card {
  width: min(440px, 100%);
  padding: 0;
  overflow: hidden;
  background: #d5e0e0;
  border-radius: 4px;
}
.profile-card-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #4a2d6b;
  color: #fff;
  padding: 0.45rem 0.55rem;
}
.profile-card-head .uname {
  background: #e8ece8;
  color: #222;
  font-weight: 800;
  padding: 0.2rem 0.45rem;
  border-radius: 3px;
  font-size: 0.9rem;
}
.profile-card-head .star { color: #f0c14b; font-size: 0.95rem; }
.profile-card-head .status { flex: 1; font-size: 0.85rem; text-align: center; }
.profile-card-head .xbtn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.5);
  color: #fff;
  width: 28px; height: 28px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}
.profile-card-body {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 0.75rem;
  padding: 0.75rem;
}
.profile-avatar {
  width: 110px; height: 110px;
  background: #9aa8a8;
  border-radius: 2px;
  display: grid;
  place-items: center;
  font-size: 3.2rem;
  color: #eef2f2;
}
.profile-fields {
  font-size: 0.88rem;
  line-height: 1.55;
  color: #222;
}
.profile-fields b { display: inline-block; min-width: 7.5rem; }
.profile-system {
  grid-column: 1 / -1;
  margin-top: 0.15rem;
  padding-top: 0.45rem;
  border-top: 1px solid rgba(0,0,0,0.12);
  font-size: 0.88rem;
  color: #222;
  font-style: italic;
}

.hidden { display: none !important; }
.out { font-size: 0.7rem; opacity: 0.4; max-height: 60px; overflow: auto; margin: 0.3rem 0 0; }
