/* mobile-first */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0f1419;
  color: #e6e6e6;
  font-size: 16px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

.sync-bar {
  padding: 6px 14px;
  font-size: 12px;
  text-align: center;
  border-bottom: 1px solid #2a3038;
  transition: background .2s;
}
.sync-bar.sync-ok      { background: #1a3320; color: #8be59a; }
.sync-bar.sync-off     { background: #3a1a1a; color: #f5a3a3; }
.sync-bar.sync-pending { background: #3a3220; color: #ffd980; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: #232a33;
  border: 1px solid #2a3038;
  color: #fff;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 14px;
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
  z-index: 100;
  max-width: 90vw;
}

/* === header / nav === */
header {
  background: #1a2028;
  border-bottom: 1px solid #2a3038;
  padding: 10px 14px;
  position: sticky;
  top: 0;
  z-index: 10;
}
nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
nav a {
  color: #e6e6e6;
  text-decoration: none;
  padding: 12px 10px;
  border-radius: 8px;
  background: #232a33;
  text-align: center;
  font-size: 14px;
}
nav a.primary {
  background: #2d7a2d;
  grid-column: 1 / -1;
  font-weight: 600;
}
nav a:active { opacity: 0.7; }

.beer-banner {
  background: linear-gradient(90deg, #5a3a0e, #7a4e15);
  color: #ffe9b8;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
  font-size: 13px;
  border-bottom: 1px solid #2a3038;
}
.beer-banner b { color: #fff; }
.beer-banner button {
  background: #ffb84d;
  border-color: #ffb84d;
  color: #2a1a00;
  font-weight: 700;
  width: 100%;
  min-height: 38px;
}
@media (min-width: 700px) {
  .beer-banner { flex-direction: row; align-items: center; justify-content: center; gap: 14px; font-size: 14px; }
  .beer-banner button { width: auto; }
}

/* === main === */
main { padding: 16px 14px 80px; }
h1 { margin: 0 0 16px; font-size: 22px; }
h2 { margin: 24px 0 12px; font-size: 18px; border-bottom: 1px solid #2a3038; padding-bottom: 6px; }
h3 { margin: 0 0 12px; font-size: 16px; }
a { color: #6db4ff; }
p { margin: 8px 0; }

/* === forms === */
input, select, button, textarea {
  font-family: inherit;
  font-size: 16px; /* >=16px чтобы iOS не зумил */
  padding: 12px 12px;
  border-radius: 8px;
  border: 1px solid #2a3038;
  background: #0f1419;
  color: #e6e6e6;
  width: 100%;
}
input:focus, select:focus { outline: none; border-color: #6db4ff; }
button {
  cursor: pointer;
  background: #2a3038;
  border-color: #2a3038;
  font-weight: 500;
  min-height: 44px;
}
button:active { opacity: 0.75; }
button.primary { background: #2d7a2d; border-color: #2d7a2d; color: #fff; }
button.danger  { background: #7a2d2d; border-color: #7a2d2d; color: #fff; }
button.small   { padding: 8px 12px; min-height: 36px; font-size: 14px; width: auto; }

label {
  display: block;
  margin-bottom: 12px;
  font-size: 14px;
  color: #b8c0c8;
}
label input { margin-top: 6px; }

.card {
  background: #1a2028;
  border: 1px solid #2a3038;
  border-radius: 10px;
  padding: 14px;
  margin: 14px 0;
}

.row { display: flex; flex-direction: column; gap: 10px; }

/* === списки карточек (универсально вместо таблиц) === */
.list { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }

.item {
  background: #1a2028;
  border: 1px solid #2a3038;
  border-radius: 10px;
  padding: 14px;
}
.item-title { font-weight: 600; font-size: 16px; margin-bottom: 4px; }
.item-meta  { color: #8a949e; font-size: 13px; }
.item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

/* поля внутри карточки участника */
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.fields label { margin: 0; font-size: 12px; color: #8a949e; }
.fields label input { margin-top: 4px; padding: 10px; font-size: 15px; }
.fields .full { grid-column: 1 / -1; }

.item-actions { display: flex; gap: 8px; margin-top: 10px; }
.item-actions button { flex: 1; }

.quick-rebuy { display: flex; gap: 8px; margin-top: 10px; }
.quick-rebuy form { flex: 1; }
.quick-rebuy button {
  width: 100%;
  background: #2a4a6e;
  border-color: #2a4a6e;
  color: #fff;
  font-weight: 600;
}
.quick-rebuy button:active { opacity: 0.75; }

/* === цвета итогов === */
.pos { color: #4ade80; font-weight: 700; }
.neg { color: #f87171; font-weight: 700; }
.warn {
  color: #fbbf24;
  background: rgba(251,191,36,.08);
  border: 1px solid rgba(251,191,36,.25);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
}
.note  { color: #8a949e; font-style: italic; }
.empty { color: #8a949e; padding: 12px 0; }

/* === переводы === */
.transfers { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.transfer {
  background: #1a2028;
  border: 1px solid #2a3038;
  border-left: 4px solid #4ade80;
  border-radius: 10px;
  padding: 14px;
}
.t-amount { font-size: 24px; font-weight: 800; color: #4ade80; margin-bottom: 8px; }
.t-from { color: #f87171; margin-bottom: 8px; font-size: 14px; }
.t-to b { font-size: 16px; }
.t-to div { font-size: 14px; color: #b8c0c8; margin-top: 4px; }

/* === leaderboard === */
.leader-head { display: flex; align-items: center; gap: 12px; }
.leader-rank {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: #2a3038;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 18px;
  flex-shrink: 0;
}
.leader-rank.rank-1 { background: linear-gradient(135deg, #ffd700, #b8860b); }
.leader-rank.rank-2 { background: linear-gradient(135deg, #c0c0c0, #808080); }
.leader-rank.rank-3 { background: linear-gradient(135deg, #cd7f32, #8b4513); }
.leader-name { flex: 1; min-width: 0; }
.leader-net { font-size: 20px; font-weight: 800; flex-shrink: 0; }

/* === poker combinations === */
.combo { padding: 14px; }
.combo-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.combo-rank {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: #2d7a2d;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}
.combo-cards {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.pcard {
  background: #fff;
  border-radius: 6px;
  padding: 6px 4px;
  min-width: 38px;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
  box-shadow: 0 1px 3px rgba(0,0,0,.4);
  font-weight: 700;
}
.pcard .cr { font-size: 16px; }
.pcard .cs { font-size: 18px; margin-top: 2px; }
.pcard.red { color: #d12c2c; }
.pcard.black { color: #1a1a1a; }
.combo-desc { margin: 0; font-size: 14px; color: #b8c0c8; }

.summary {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  background: #1a2028;
  border: 1px solid #2a3038;
  border-radius: 10px;
  padding: 12px 14px;
  margin: 12px 0;
  font-size: 14px;
}
.summary div { display: flex; flex-direction: column; }
.summary span { color: #8a949e; font-size: 12px; }

/* === tablet / desktop === */
@media (min-width: 700px) {
  main { max-width: 760px; margin: 0 auto; padding: 24px; }
  nav { grid-template-columns: auto auto auto auto 1fr; }
  nav a.primary { grid-column: auto; justify-self: end; }
  h1 { font-size: 26px; }
  .fields { grid-template-columns: 1fr 1fr 1fr; }
  .transfers { display: grid; grid-template-columns: 1fr 1fr; }
}
