:root {
  --bg: #0b1a14;
  --panel: #12281f;
  --line: rgba(255, 255, 255, .09);
  --text: #eef4f0;
  --muted: rgba(238, 244, 240, .6);
  --gold: #ffcc4d;
  --green: #2fb565;
  --red: #e5544b;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 'Rubik', 'Segoe UI', system-ui, sans-serif;
}

header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 24px;
  background: #0e2119;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}
header h1 { margin: 0 auto 0 0; font-size: 20px; font-weight: 800; }
header h1 span { color: var(--gold); font-weight: 600; }
#who { color: var(--muted); font-weight: 500; }

main { max-width: 1280px; margin: 0 auto; padding: 22px 24px 60px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 9px;
  font: 600 14px inherit;
  font-family: inherit;
  color: #fff;
  background: #24443a;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.15); }
.btn.primary { background: var(--green); }
.btn.danger { background: var(--red); }
.btn.ghost { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.btn.small { height: 30px; padding: 0 10px; font-size: 13px; }

input {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(0, 0, 0, .3);
  color: var(--text);
  font: 15px inherit;
  font-family: inherit;
  outline: none;
  min-width: 0;
}
input:focus { border-color: var(--gold); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.panel.narrow { max-width: 420px; margin: 60px auto 0; display: grid; gap: 12px; }
.panel h2 { margin: 0; font-size: 20px; }
.panel p { margin: 0; color: var(--muted); }
.error { color: #ff9a90 !important; min-height: 20px; }
.row { display: flex; gap: 10px; justify-content: flex-end; }

#tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
#tabs button {
  height: 40px;
  padding: 0 18px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font: 600 15px inherit;
  font-family: inherit;
  cursor: pointer;
}
#tabs button.on { background: var(--panel); color: #fff; box-shadow: inset 0 0 0 1px var(--line); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.card { padding: 16px 18px; border-radius: 12px; background: rgba(0, 0, 0, .25); }
.card b { display: block; font-size: 32px; font-weight: 800; color: var(--gold); line-height: 1.1; }
.card span { color: var(--muted); font-weight: 500; }

.toolbar { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.toolbar input { flex: 1; max-width: 380px; }
.count { font-weight: 600; }
.muted { color: var(--muted); }

.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 8px 10px; text-align: left; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
td { padding: 9px 10px; border-top: 1px solid var(--line); vertical-align: middle; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.actions { white-space: nowrap; text-align: right; }
tr.done td { opacity: .55; }
.tab-count { display: inline-block; min-width: 20px; margin-left: 7px; padding: 1px 6px; border-radius: 10px; background: #d8362e; color: #fff; font-size: 12px; font-weight: 700; line-height: 18px; text-align: center; }
td.actions .btn { margin-left: 5px; }
tr.banned td { background: rgba(229, 84, 75, .1); }
.empty { padding: 30px; text-align: center; color: var(--muted); }

.who { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.who small { display: block; font-weight: 400; color: var(--muted); }
.pic { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: #24443a; flex: none; }
.pic.none { display: grid; place-items: center; font-weight: 700; color: var(--muted); }

.tag { display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: 12px; font-weight: 600; background: rgba(255, 255, 255, .1); white-space: nowrap; }
.tag.red { background: rgba(229, 84, 75, .25); color: #ffb0a9; }
.tag.green { background: rgba(47, 181, 101, .22); color: #8fe3b0; }
.tag.gold { background: rgba(255, 204, 77, .2); color: var(--gold); }
.seat { display: inline-block; margin: 2px 6px 2px 0; padding: 3px 10px; border-radius: 10px; background: rgba(0, 0, 0, .3); font-size: 13px; white-space: nowrap; }
.seat.bot, .seat.empty { color: var(--muted); }
.seat.off { opacity: .55; }
.seat.win { box-shadow: inset 0 0 0 1px var(--gold); }
.plus { color: #8fe3b0; font-weight: 600; }
.minus { color: #ffb0a9; font-weight: 600; }

#edit { position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, .6); display: grid; place-items: start center; padding: 20px; overflow: auto; }
#edit[hidden] { display: none; }
#edit .panel { width: min(640px, 100%); }
#edit .settings-form { margin: 14px 0 12px; }
#edit .settings-form .wide { grid-column: 1 / -1; }
#dialog { position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, .6); display: grid; place-items: start center; padding: 20px; }
#flash {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 30;
  padding: 11px 20px;
  border-radius: 11px;
  background: #1d3a2f;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5), inset 0 0 0 1px var(--line);
  font-weight: 600;
}
#flash.bad { background: #5a2420; }

@media (max-width: 700px) {
  main { padding: 14px 12px 50px; }
  header { padding: 12px 14px; }
  #who { display: none; }
}

/* ------------------------------------------------------------------ watching a table */

#watch h3 { margin: 18px 0 8px; font-size: 15px; color: var(--muted); font-weight: 600; }
.watch-row { display: grid; grid-template-columns: 190px 1fr; gap: 14px; align-items: center; padding: 10px 12px; border-radius: 12px; border: 1px solid transparent; }
.watch-row + .watch-row { margin-top: 6px; }
.watch-row.turn { border-color: var(--gold); background: rgba(255, 204, 77, .07); }
.watch-who b { display: block; font-size: 16px; }
.watch-who small { display: block; color: var(--muted); }
.tiles { display: flex; flex-wrap: wrap; align-items: center; gap: 3px; }
.tiles.pile { margin-top: 6px; opacity: .8; }
.tiles.pile .tile { width: 24px; height: 32px; font-size: 14px; }
.meld { display: inline-flex; gap: 2px; margin-right: 10px; padding: 3px; border-radius: 8px; background: rgba(47, 181, 101, .16); }
.meld.loose { background: transparent; }
.tile {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 46px;
  border-radius: 6px;
  background: linear-gradient(180deg, #fff, #efe9da);
  box-shadow: 0 2px 0 #b9ad91;
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -.04em;
}
.tile.red { color: #cf1722; }
.tile.black { color: #1b1d24; }
.tile.blue { color: #1a47c4; }
.tile.yellow { color: #e58600; }
.tile.joker { color: #12813f; }
.tile.okey { background: linear-gradient(180deg, #fff6cc, #ffdf7a); box-shadow: 0 2px 0 #bf9730, 0 0 0 2px #ffb300; }
#watch-chat { display: grid; gap: 4px; max-height: 220px; overflow-y: auto; padding: 12px; border-radius: 12px; background: rgba(0, 0, 0, .25); overflow-wrap: anywhere; }
@media (max-width: 700px) { .watch-row { grid-template-columns: 1fr; } }

.thumb { display: block; max-width: 160px; max-height: 110px; margin-top: 6px; border-radius: 8px; }
#posts td { max-width: 520px; overflow-wrap: anywhere; white-space: pre-wrap; }

/* settings */
select {
  height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px;
  background: #0d1f18; color: var(--text); font: 15px inherit; font-family: inherit; outline: none; min-width: 0;
}
select:focus { border-color: var(--gold); }
.settings-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; max-width: 760px; margin: 16px 0 26px; }
.settings-form label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.settings-form label input, .settings-form label select { width: 100%; box-sizing: border-box; }
.settings-buttons { grid-column: 1 / -1; }
#tab-settings h3 { margin: 0 0 6px; font-size: 16px; }
#tab-settings .toolbar { margin-top: 12px; }
#smtp-result { min-height: 20px; margin-top: 4px; }
#smtp-result.good { color: #8fe3b0; }
#smtp-result.bad { color: #ffb0a9; }
@media (max-width: 700px) { .settings-form { grid-template-columns: 1fr; } }
.settings-form .wide { grid-column: 1 / -1; }

/* the channels */
.chat-cols { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 22px; margin: 6px 0 20px; }
.chat-log { height: 420px; overflow-y: auto; padding: 8px 10px; border-radius: 12px; background: rgba(0, 0, 0, .28); }
.chat-row { display: flex; align-items: baseline; gap: 8px; padding: 5px 4px; border-bottom: 1px solid rgba(255, 255, 255, .05); font-size: 14.5px; }
.chat-row small { flex: none; color: var(--muted); font-size: 12px; }
.chat-row b { flex: none; }
.chat-row .said { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.chat-row.sys i { flex: 1; color: var(--gold); }
.chat-row .btn { flex: none; opacity: .55; }
.chat-row:hover .btn { opacity: 1; }
#chat-people { max-height: 420px; overflow-y: auto; }
.chat-person { display: flex; align-items: center; gap: 8px; padding: 7px 4px; border-bottom: 1px solid rgba(255, 255, 255, .05); font-size: 14.5px; }
.chat-person .grow { flex: 1; }
.tag.blue { background: rgba(140, 170, 255, .18); color: #b9cdff; }
label.inline { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
@media (max-width: 900px) { .chat-cols { grid-template-columns: 1fr; } }
#chat-bans td small { display: block; color: var(--muted); font-size: 12px; }

.ad-thumb { max-width: 300px; max-height: 250px; border-radius: 10px; vertical-align: middle; box-shadow: 0 0 0 1px rgba(255, 255, 255, .15); }
.settings-form label.check { display: flex; align-items: center; gap: 8px; align-self: end; padding-bottom: 10px; }
.settings-form label.check input { width: auto; }

#radio-links { width: 100%; box-sizing: border-box; resize: vertical; font: 13px/1.5 ui-monospace, Consolas, monospace; }
.radio-list { max-width: 760px; margin: -12px 0 26px; padding-left: 22px; font-size: 14px; color: var(--muted); }
.radio-list li { padding: 2px 0; }

.radio-req-head { display: flex; align-items: center; gap: 12px; max-width: 760px; margin: 0 0 4px; font-size: 16px; }
.radio-requests { max-width: 760px; display: grid; gap: 8px; margin-bottom: 26px; color: var(--muted); }
.radio-req { display: grid; grid-template-columns: 1fr auto auto auto; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: rgba(255, 255, 255, .04); }
.radio-req div { display: grid; gap: 2px; min-width: 0; }
.radio-req b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text, inherit); }
.radio-req small { font-size: 12px; }
.radio-req input { width: 220px; }
