/* PLO5 веб-рум: десктоп — стол + панель справа; <1024px — панель = нижний лист. */
:root {
  --felt: #1b6b45;
  --felt-dark: #145436;
  --bg: #12181b;
  --panel-bg: #1a2226;
  --line: #2c383d;
  --text: #e8eef0;
  --dim: #93a5ab;
  --green: #37b26c;
  --red: #e05252;
  --accent: #d9a441;
  --card-w: 62px;
  --card-h: 90px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
}

/* ---------- шапка ---------- */
#hdr {
  display: flex; align-items: center; gap: 16px;
  height: 52px; padding: 0 14px;
  background: var(--panel-bg); border-bottom: 1px solid var(--line);
}
.hdr-brand { font-weight: 800; font-size: 18px; letter-spacing: .5px; }
.hdr-brand span { color: var(--dim); font-weight: 400; font-size: 13px; }
.hdr-info { display: flex; gap: 14px; align-items: center; font-size: 15px; }
.hdr-info .dim { color: var(--dim); }
#hdr-net { font-weight: 700; font-variant-numeric: tabular-nums; }
#hdr-net.pos { color: var(--green); }
#hdr-net.neg { color: var(--red); }
.hdr-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.on { background: var(--green); box-shadow: 0 0 6px var(--green); }
.dot.off { background: var(--red); }
.dot.wait { background: var(--accent); box-shadow: 0 0 6px var(--accent); }

/* ---------- каркас ---------- */
#main {
  display: grid; grid-template-columns: 1fr 400px;
  height: calc(100% - 52px);
}
#table-wrap { display: flex; flex-direction: column; min-width: 0; }
#table {
  position: relative; flex: 1;
  margin: 14px; border-radius: 24px;
  background: radial-gradient(ellipse at center, var(--felt) 0%, var(--felt-dark) 78%);
  border: 6px solid #241d16; box-shadow: inset 0 0 60px rgba(0,0,0,.45);
  display: flex; flex-direction: column; align-items: center;
  padding: 10px 14px; overflow: hidden;
}

/* ---------- индикатор улиц ---------- */
#street-dots { display: flex; gap: 10px; margin: 2px 0 4px; }
#street-dots .st {
  font-size: 11px; letter-spacing: 1px; color: var(--dim);
  padding: 3px 10px; border-radius: 12px; border: 1px solid rgba(255,255,255,.15);
}
#street-dots .st.done { color: #cfe6d8; border-color: rgba(255,255,255,.35); }
#street-dots .st.current {
  color: #fff; background: var(--accent); border-color: var(--accent);
  font-weight: 700;
}

/* ---------- места ---------- */
.seat { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.seat-info {
  display: flex; align-items: center; gap: 8px;
  background: rgba(0,0,0,.35); border-radius: 16px;
  padding: 4px 12px; font-size: 14px;
}
.seat.to-act .seat-info {
  box-shadow: 0 0 0 2px var(--accent), 0 0 18px var(--accent);
}
.seat-name { font-weight: 700; }
.seat-stack { font-variant-numeric: tabular-nums; color: #dfe9ec; }
.seat-stack small { color: var(--dim); font-weight: 400; }
.pos-chip {
  background: #fff; color: #222; border-radius: 50%;
  min-width: 22px; height: 22px; font-size: 10px; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 4px;
}
.seat-bet { min-height: 22px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.seat-bet:empty::before { content: ""; }
.seat-bet .chip::before { content: "◉ "; }

/* ---------- карты ---------- */
.seat-cards { display: flex; gap: 8px; min-height: var(--card-h); align-items: center; }
#hero-cards { --card-w: 74px; --card-h: 106px; }
#bot-cards { --card-w: 46px; --card-h: 66px; min-height: 66px; }
.card {
  width: var(--card-w); height: var(--card-h);
  background: #f7f4ec; color: #1c1c1c;
  border-radius: 7px; border: 1px solid #b9b3a5;
  box-shadow: 0 3px 8px rgba(0,0,0,.45);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-weight: 800; font-size: calc(var(--card-h) * .34); line-height: 1;
  position: relative; user-select: none;
}
.card .suit { font-size: calc(var(--card-h) * .4); }
.card.red { color: #cf2b2b; }
.card.back {
  background:
    repeating-linear-gradient(45deg, #274a8f 0 6px, #1e3c73 6px 12px);
  border-color: #14264d;
}
#board { display: flex; gap: 10px; min-height: var(--card-h); --card-w: 62px; --card-h: 90px; }
.slot {
  width: var(--card-w); height: var(--card-h); border-radius: 7px;
  border: 1.5px dashed rgba(255,255,255,.25);
}

/* ---------- центр ---------- */
#center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
#pot { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
#pot small { font-size: 13px; color: var(--dim); font-weight: 400; }

/* ---------- баннеры ---------- */
#banners { position: absolute; left: 0; right: 0; top: 44px; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.banner {
  pointer-events: auto; max-width: 90%;
  background: rgba(10,14,16,.92); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 18px; font-size: 16px; text-align: center;
}
.banner.ok { border-color: var(--green); font-weight: 800; font-size: 18px; }
.banner.warn { border-color: var(--red); }
.banner .btn { margin-top: 8px; }
.hidden { display: none !important; }

/* ---------- кнопки ---------- */
.btn {
  cursor: pointer; border: none; border-radius: 12px;
  font-size: 16px; font-weight: 800; padding: 12px 20px; color: #fff;
  background: #3a4a52; transition: filter .15s;
}
.btn:hover:not(:disabled) { filter: brightness(1.15); }
.btn:disabled { opacity: .45; cursor: default; }
.btn kbd { font-size: 10px; opacity: .7; font-weight: 400; margin-left: 4px; }
.btn.fold { background: #a63232; }
.btn.call { background: #2c8f5a; }
.btn.raise { background: #b3842e; }
.btn.allin { background: #7a2fa6; }
.btn.ghost { background: transparent; border: 1px solid var(--line); font-weight: 600; }
.btn.small { font-size: 13px; padding: 7px 12px; border-radius: 9px; }
.btn.go { min-width: 150px; }

/* ---------- действия ---------- */
#actions {
  margin: 0 14px 14px; padding: 12px;
  background: var(--panel-bg); border: 1px solid var(--line); border-radius: 16px;
  display: flex; flex-direction: column; gap: 10px;
}
#action-buttons { display: flex; gap: 10px; }
#action-buttons .btn { flex: 1; padding: 14px 10px; font-size: 17px; }
#action-hint { text-align: center; color: var(--dim); padding: 10px; }
#raise-panel { display: flex; flex-direction: column; gap: 8px; }
.raise-row { display: flex; gap: 8px; align-items: center; }
.preset {
  flex: 1; cursor: pointer; padding: 8px; font-weight: 700;
  background: #243138; color: var(--text); border: 1px solid var(--line);
  border-radius: 9px;
}
.preset.active { border-color: var(--accent); color: var(--accent); }
#raise-input {
  width: 110px; padding: 8px; font-size: 16px; font-weight: 700;
  background: #0f1518; color: var(--text); border: 1px solid var(--line);
  border-radius: 9px; text-align: right;
}
#raise-slider { flex: 1; accent-color: var(--accent); height: 28px; }

/* ---------- панель статистики ---------- */
#panel {
  background: var(--panel-bg); border-left: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0;
}
#sheet-handle { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
#sheet-grip { margin-left: auto; color: var(--dim); font-size: 12px; }
.tabbtn {
  cursor: pointer; background: none; border: none; color: var(--dim);
  font-size: 15px; font-weight: 700; padding: 6px 10px; border-radius: 9px;
}
.tabbtn.active { color: var(--text); background: #243138; }
#panel-body { flex: 1; overflow-y: auto; padding: 12px 14px 24px; }
.tab { display: none; }
.tab.active { display: block; }
.stat-block { margin-bottom: 18px; }
.stat-block h3 {
  font-size: 12px; letter-spacing: 1px; text-transform: uppercase;
  color: var(--dim); margin-bottom: 8px; border-bottom: 1px solid var(--line); padding-bottom: 4px;
}
.empty { color: var(--dim); font-style: italic; font-size: 13px; }

/* ход раздачи */
.hist-street { margin-bottom: 10px; }
.hist-street .hs-title { font-weight: 800; font-size: 13px; letter-spacing: 1px; }
.hist-street .hs-title .hc { letter-spacing: 2px; }
.hist-street .hs-title .red { color: #ff7d7d; }
.hist-street .hs-pot { color: var(--dim); font-size: 13px; }
.hist-street .hs-acts { font-size: 13.5px; }
.hist-street .hs-acts b { color: #fff; }

/* решения бота */
.bd-item { margin-bottom: 10px; font-size: 13.5px; }
.bd-item .bd-street { font-weight: 700; }
.bd-item .bd-played { color: var(--accent); font-weight: 800; }
.bd-item .bd-src { color: var(--dim); font-size: 12.5px; }
.bd-item .bd-deg { color: var(--dim); font-size: 12px; font-style: italic; }
.dist { display: inline; }
.dist .d { margin-right: 8px; white-space: nowrap; }
.dist .d.chosen { font-weight: 800; color: var(--accent); }
.dist .d.chosen::before { content: "▶ "; }

/* твои решения */
.yd-item { margin-bottom: 6px; font-size: 13.5px; }
.yd-item .no { color: var(--dim); margin-right: 6px; }
.yd-item .core { color: var(--dim); }

/* матч */
#net-graph { width: 100%; height: 160px; background: #10171a; border-radius: 9px; border: 1px solid var(--line); }
#match-score { font-size: 15px; line-height: 1.7; }
#export-link { display: inline-block; text-decoration: none; color: var(--text); }

/* ---------- тост ---------- */
#toast {
  position: fixed; top: 60px; left: 50%; transform: translateX(-50%);
  background: rgba(10,14,16,.95); border: 1px solid var(--red);
  padding: 10px 18px; border-radius: 10px; z-index: 60; font-weight: 600;
}

/* ---------- мобильный нижний лист (<1024px) ---------- */
@media (max-width: 1023px) {
  body { overflow: auto; }
  #main { grid-template-columns: 1fr; height: auto; min-height: calc(100% - 52px); display: block; }
  #hdr { font-size: 13px; gap: 8px; padding: 0 10px; }
  .hdr-brand span { display: none; }
  .hdr-info { gap: 8px; flex-wrap: wrap; }
  #table {
    margin: 8px; padding: 6px; min-height: 380px;
    border-width: 4px; border-radius: 16px;
  }
  #board { --card-w: 48px; --card-h: 70px; gap: 6px; }
  #hero-cards { --card-w: 62px; --card-h: 88px; }
  #bot-cards { --card-w: 40px; --card-h: 58px; min-height: 58px; }
  #pot { font-size: 18px; }
  #actions { margin: 0 8px 8px; padding: 8px; }
  #action-buttons { gap: 6px; }
  #action-buttons .btn { font-size: 15px; padding: 14px 4px; }
  #action-buttons .btn kbd { display: none; }

  /* панель = нижний лист */
  #panel {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    border-left: none; border-top: 1px solid var(--line);
    border-radius: 16px 16px 0 0;
    transform: translateY(calc(100% - 46px));
    transition: transform .25s ease;
    max-height: 62vh;
    box-shadow: 0 -6px 24px rgba(0,0,0,.5);
  }
  #panel.open { transform: translateY(0); }
  #sheet-handle { cursor: pointer; padding: 10px 14px; }
  #sheet-grip::before { content: "▲ панель"; }
  #panel-body { max-height: calc(62vh - 46px); }
  #actions { margin-bottom: 46px; }
}
@media (min-width: 1024px) {
  #sheet-grip::before { content: ""; }
}
