[hidden] {
  display: none !important;
}

.small {
  font-size: 0.875rem;
}

.error {
  color: var(--red);
  margin: 0;
  font-weight: 600;
}

/* ---------------- lobby */

.lobby-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.back {
  text-decoration: none;
  font-weight: 600;
}

.back::before {
  content: "‹ ";
}

.lang {
  width: auto;
  min-height: 40px;
}

h1 {
  margin: 16px 0 4px;
}

.stack {
  display: grid;
  gap: 12px;
}

.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--border);
}

.join {
  display: flex;
  gap: 8px;
}

#code {
  text-transform: uppercase;
  letter-spacing: 0.3em;
  font-weight: 700;
  font-size: 1.2rem;
}

/* ---------------- top bar */

.bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  padding-top: max(8px, env(safe-area-inset-top));
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

#seats .bar {
  margin: -16px -16px 16px;
}

.bar-title {
  flex: 1;
  font-weight: 700;
  text-align: center;
}

.chip {
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 999px;
  min-height: 36px;
  padding: 0 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.icon-btn {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 1.1rem;
  font-weight: 700;
}

.help-btn.on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

.board-info {
  flex: 1;
  min-width: 0;
  font-size: 0.85rem;
  line-height: 1.25;
}

.board-info b {
  font-size: 1rem;
}

.board-info .vul-yes {
  color: var(--red);
  font-weight: 700;
}

/* ---------------- seat picker */

.compass {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  grid-template-areas:
    ". n ."
    "w m e"
    ". s .";
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}

.compass [data-seat="N"] { grid-area: n; }
.compass [data-seat="S"] { grid-area: s; }
.compass [data-seat="E"] { grid-area: e; }
.compass [data-seat="W"] { grid-area: w; }

.compass-mid {
  grid-area: m;
}

.seat-btn {
  min-height: 84px;
  border-radius: 14px;
  border: 2px solid var(--border);
  background: var(--surface);
  padding: 6px;
  display: grid;
  align-content: center;
  gap: 2px;
  box-shadow: var(--shadow);
}

.seat-btn .seat-name {
  font-weight: 800;
  font-size: 1.1rem;
}

.seat-btn .seat-who {
  font-size: 0.8rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seat-btn.taken {
  background: var(--surface-2);
}

.seat-btn.mine {
  border-color: var(--accent);
}

.btn.wide {
  width: 100%;
}

/* ---------------- table view */

.table-view {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.status {
  padding: 8px 12px;
  text-align: center;
  font-weight: 700;
  min-height: 40px;
}

.status.my-turn {
  background: var(--turn);
}

.auction-wrap {
  padding: 0 12px;
  max-height: 34dvh;
  overflow-y: auto;
}

.auction {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  background: var(--surface);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.auction th {
  padding: 6px 2px;
  font-size: 0.85rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.auction th.vul {
  background: var(--red);
  color: #fff;
}

.auction th.me {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.auction th .who {
  display: block;
  font-weight: 400;
  font-size: 0.7rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auction td {
  text-align: center;
  padding: 6px 2px;
  height: 36px;
  font-weight: 700;
  font-size: 1.05rem;
}

.auction td.next {
  background: var(--turn);
}

.auction td.next::after {
  content: "?";
  color: var(--muted);
}

.auction td.tappable {
  cursor: pointer;
}

.auction td.selected {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  border-radius: 6px;
}

.call-pass {
  color: var(--pass);
}

.call-x {
  color: var(--dbl);
}

.call-xx {
  color: var(--rdbl);
}

.help {
  margin: 8px 12px 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--accent);
  display: grid;
  gap: 8px;
}

.help-text {
  font-size: 0.92rem;
}

.help-text b {
  margin-right: 4px;
}

.box {
  margin-top: auto;
  padding: 10px 12px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  display: grid;
  gap: 8px;
}

.bids {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.call-btn {
  min-height: 46px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-weight: 800;
  font-size: 1.1rem;
  box-shadow: var(--shadow);
  padding: 0;
}

.call-btn:disabled {
  opacity: 0.25;
  box-shadow: none;
  cursor: default;
}

.call-btn.selected {
  outline: 3px solid var(--accent);
  outline-offset: 1px;
}

.specials {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.3fr;
  gap: 6px;
}

.call-btn.pass {
  background: var(--pass);
  border-color: var(--pass);
  color: #fff;
}

.call-btn.dbl {
  background: var(--dbl);
  border-color: var(--dbl);
  color: #fff;
}

.call-btn.rdbl {
  background: var(--rdbl);
  border-color: var(--rdbl);
  color: #fff;
}

.call-btn.undo {
  font-size: 0.95rem;
  font-weight: 700;
}

.call-btn.pass .suit-H,
.call-btn.pass .suit-D {
  color: inherit;
}

.done {
  margin-top: auto;
  padding: 16px 12px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  text-align: center;
  display: grid;
  gap: 8px;
}

.contract {
  font-size: 1.8rem;
  font-weight: 800;
}

.done-actions {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 8px;
  margin-top: 8px;
}

/* ---------------- dialogs */

.sheet {
  border: none;
  border-radius: 18px;
  padding: 20px;
  width: min(420px, calc(100vw - 32px));
  background: var(--surface);
  color: var(--text);
}

.sheet::backdrop {
  background: rgba(0, 0, 0, 0.5);
}

.invite {
  display: grid;
  justify-items: center;
  gap: 10px;
  text-align: center;
}

.big-code {
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: 0.2em;
  margin-left: 0.2em;
}

#invite-qr {
  background: #fff;
  border-radius: 12px;
  padding: 8px;
  max-width: 100%;
  height: auto;
}

#invite-url {
  word-break: break-all;
  font-weight: 600;
  color: var(--text);
}

.row {
  display: flex;
  gap: 8px;
  width: 100%;
}

.row .btn {
  flex: 1;
}

.menu {
  display: grid;
  gap: 10px;
}

.menu .lang {
  width: 100%;
}

.menu p {
  margin: 0;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-weight: 600;
}

.toggle input {
  width: 22px;
  height: 22px;
  accent-color: var(--accent);
}

/* ---------------- banners */

.conn {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  background: var(--red);
  color: #fff;
  text-align: center;
  font-weight: 700;
  padding: 6px;
  padding-top: max(6px, env(safe-area-inset-top));
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 50%;
  transform: translateX(-50%);
  z-index: 10;
  max-width: calc(100vw - 32px);
  background: var(--text);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 12px;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.confirm .suit-H,
.confirm .suit-D {
  color: inherit;
}

.players {
  display: grid;
  gap: 8px;
}

.player-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 6px;
  align-items: center;
}

.player-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.small-btn {
  min-height: 40px;
  padding: 0 10px;
  font-size: 0.85rem;
}
