/* ============================================================================
   WordSeek — Telegram dashboard styles
   Builds on the tokens defined in style.css (pastel panda theme).
   Lightweight: no libraries, CSS-only motion, mobile-first grid.
   ========================================================================== */

.page.dash { gap: 22px; }

/* the [hidden] attribute must always win, even over display:grid/flex elements */
[hidden] { display: none !important; }

/* ---- login ---- */
.login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: min(400px, 100%); padding: 30px 28px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.login-panda { width: 68px; height: 68px; animation: bob 4s var(--ease) infinite; }
.login-panda .brand-panda { width: 100%; height: 100%; }
.login-title { margin: 10px 0 0; font-size: 24px; font-weight: 700; }
.login-sub { margin: 6px 0 16px; color: var(--ink-soft); font-size: 14px; }
.login-input {
  width: 100%; height: 46px; padding: 0 16px; margin-bottom: 12px;
  border-radius: 14px; border: 2px solid var(--line); background: #fff;
  font-size: 15px; outline: 0; transition: border-color .25s var(--ease), box-shadow .25s var(--ease);
}
.login-input:focus { border-color: var(--sky); box-shadow: 0 0 0 5px rgba(124,199,255,.18); }
.login-btn {
  width: 100%; height: 46px; border: 0; border-radius: 14px; cursor: pointer;
  background: var(--grad); color: #fff; font-size: 15px; font-weight: 700;
  box-shadow: var(--clay); transition: transform .25s var(--bounce), box-shadow .25s var(--ease);
}
.login-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: var(--clay-lg); }
.login-btn:disabled, .login-input:disabled { opacity: .55; cursor: not-allowed; }
.login-back { margin-top: 16px; color: var(--muted); font-size: 13px; }
.login-back:hover { color: var(--ink); }
.login-error { color: #e2557f; background: rgba(255,158,196,.14); border-radius: 12px; padding: 10px 14px; font-size: 13.5px; font-weight: 600; margin: 0 0 12px; width: 100%; }
.login-warn { color: #b8862f; background: rgba(255,215,106,.16); border-radius: 12px; padding: 10px 14px; font-size: 13px; margin: 0 0 12px; width: 100%; }
.login-warn code, .notice code { font-family: ui-monospace, monospace; font-size: .92em; }

/* ---- status pill ---- */
.pill {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 15px;
  border-radius: 999px; border: 1px solid var(--line-soft); background: var(--card);
  box-shadow: var(--clay); font-size: 13px; font-weight: 600; color: var(--ink-soft);
}
.pill i { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); }
.pill-ok    i { background: var(--mint); box-shadow: 0 0 0 4px rgba(94,224,176,.22); animation: pulse-dot 1.8s infinite; }
.pill-warn  i { background: var(--sun); box-shadow: 0 0 0 4px rgba(255,215,106,.25); }
.pill-err   i { background: var(--peach); box-shadow: 0 0 0 4px rgba(255,181,158,.28); }
.pill-idle  i { background: var(--faint); }

/* ---- notice ---- */
.notice { padding: 16px 20px; font-size: 13.5px; color: var(--ink-soft); line-height: 1.55; }
.notice b { color: var(--ink); }

/* ---- grid ---- */
.dash-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; align-items: start;
}
.dash-card { padding: 20px; animation: rise .6s var(--ease-out) both; }
.dash-card.wide { grid-column: span 2; }

.dash-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.dash-card-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.tag {
  display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 8px;
  background: rgba(167,139,250,.14); color: var(--lav); font-size: 12px; font-weight: 600;
}

/* ---- key/value ---- */
.kv { margin: 0; display: flex; flex-direction: column; gap: 9px; }
.kv > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.kv dt { color: var(--muted); font-size: 12.5px; margin: 0; }
.kv dd { margin: 0; font-size: 13.5px; font-weight: 600; text-align: right; word-break: break-word; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }

/* ---- buttons ---- */
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.btn {
  border: 1px solid var(--line); border-radius: 12px; padding: 9px 15px;
  background: #fff; color: var(--ink-soft); cursor: pointer; font-size: 13.5px; font-weight: 600;
  box-shadow: 0 2px 6px rgba(120,95,190,.08);
  transition: transform .2s var(--bounce), box-shadow .2s var(--ease), color .2s;
}
.btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: var(--clay); color: var(--ink); }
.btn:active:not(:disabled) { transform: translateY(0) scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--grad); color: #fff; border-color: transparent; }

/* ---- fields ---- */
.field-row { margin-top: 6px; }
.select, .num {
  width: 100%; height: 42px; padding: 0 12px; border-radius: 12px;
  border: 2px solid var(--line); background: #fff; font-size: 14px; outline: 0;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.select:focus, .num:focus { border-color: var(--sky); box-shadow: 0 0 0 4px rgba(124,199,255,.16); }
.field-inline { display: flex; align-items: center; gap: 8px; margin: 12px 0; }
.field-inline label { font-size: 13px; color: var(--ink-soft); }
.num { width: 110px; height: 38px; }

/* ---- switch ---- */
.switch { position: relative; display: inline-block; width: 50px; height: 28px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0; cursor: pointer; border-radius: 999px;
  background: #d9d3ea; transition: background .3s var(--ease);
}
.slider::before {
  content: ""; position: absolute; height: 22px; width: 22px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; box-shadow: 0 2px 5px rgba(0,0,0,.18);
  transition: transform .3s var(--bounce);
}
.switch input:checked + .slider { background: var(--grad); }
.switch input:checked + .slider::before { transform: translateX(22px); }
.switch input:focus-visible + .slider { box-shadow: 0 0 0 4px rgba(124,199,255,.3); }

/* ---- board view ---- */
.board-view {
  margin: 0; padding: 14px; border-radius: 14px; min-height: 92px;
  background: rgba(245,242,255,.7); border: 1px solid var(--line);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 15px; line-height: 1.5;
  color: var(--ink); white-space: pre-wrap; word-break: break-word; overflow-x: auto;
}

/* ---- result ---- */
.best-line { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.best-guess {
  font-size: clamp(30px, 6vw, 44px); font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.best-actions { display: flex; gap: 8px; }
.conf { display: flex; align-items: center; gap: 10px; margin: 14px 0; }
.conf-track { position: relative; flex: 1; height: 8px; border-radius: 999px; background: rgba(167,139,250,.16); overflow: hidden; min-width: 60px; }
.conf-fill { position: absolute; inset: 0; width: 0; border-radius: 999px; background: var(--grad); transition: width .7s var(--bounce); }
.conf-pct { font-size: 13px; font-weight: 700; color: var(--ink-soft); min-width: 42px; text-align: right; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.chip {
  border: 1px solid var(--line-soft); border-radius: 12px; padding: 9px 14px; cursor: pointer;
  background: linear-gradient(160deg,#fff,#faf7ff); box-shadow: var(--clay);
  font-size: 15px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink);
  transition: transform .2s var(--bounce), box-shadow .2s var(--ease);
}
.chip:hover:not(:disabled) { transform: translateY(-3px); box-shadow: var(--clay-lg); }
.chip:disabled { opacity: .55; cursor: not-allowed; }
.chip .rk { color: var(--lav); font-size: 11px; margin-right: 6px; }

/* ---- metrics ---- */
.metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.metric {
  padding: 12px; border-radius: 14px; background: rgba(245,242,255,.6); border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 2px;
}
.metric b { font-size: 17px; font-weight: 700; }
.metric small { color: var(--muted); font-size: 11.5px; }

/* ---- logs ---- */
.log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; }
.log::-webkit-scrollbar { width: 7px; }
.log::-webkit-scrollbar-thumb { background: rgba(167,139,250,.28); border-radius: 999px; }
.log li {
  display: flex; gap: 10px; padding: 8px 10px; border-radius: 10px;
  background: rgba(245,242,255,.6); font-size: 12.5px; color: var(--ink-soft);
  animation: fade .3s var(--ease) both;
}
.log li .t { color: var(--muted); font-variant-numeric: tabular-nums; flex: none; }
.log li .m { word-break: break-word; }
.log-error li { background: rgba(255,181,158,.14); color: #b65a44; }
.log .empty { background: none; color: var(--muted); justify-content: center; }

.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ---- connect / login-with-telegram ---- */
.connect-card { padding: 24px; max-width: 620px; margin: 0 auto; width: 100%; }
.consent {
  font-size: 12.5px; line-height: 1.55; color: var(--ink-soft);
  background: rgba(255,215,106,.14); border: 1px solid rgba(255,215,106,.3);
  border-radius: 14px; padding: 12px 14px; margin: 0 0 18px;
}
.consent b { color: var(--ink); }
.login-step { margin-bottom: 6px; }
.fld-label { display: block; font-size: 13px; color: var(--ink-soft); margin-bottom: 8px; font-weight: 600; }
.txt {
  flex: 1; min-width: 0; height: 44px; padding: 0 14px; border-radius: 13px;
  border: 2px solid var(--line); background: #fff; font-size: 15px; outline: 0;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.txt:focus { border-color: var(--sky); box-shadow: 0 0 0 4px rgba(124,199,255,.16); }
.small-txt { height: 38px; max-width: 160px; }
.login-msg { margin: 14px 0 0; padding: 10px 14px; border-radius: 12px; font-size: 13px; font-weight: 600; }
.login-msg.err { background: rgba(255,158,196,.16); color: #d2557f; }
.login-msg.ok  { background: rgba(94,224,176,.16); color: #1eb381; }

/* ---- autoplay panel ---- */
.state-badge {
  display: inline-block; padding: 8px 16px; border-radius: 12px; margin-bottom: 14px;
  font-weight: 700; font-size: 15px; letter-spacing: .04em;
  background: rgba(167,139,250,.14); color: var(--lav);
}
.state-badge.run  { background: rgba(94,224,176,.16); color: #1eb381; }
.state-badge.wait { background: rgba(124,199,255,.16); color: #3a97e8; }
.state-badge.won  { background: rgba(94,224,176,.2); color: #159c70; }
.state-badge.lost, .state-badge.err { background: rgba(255,158,196,.18); color: #d2557f; }
.state-badge.paused { background: rgba(255,215,106,.2); color: #b8862f; }
.ap-metrics { margin-bottom: 14px; }
.metrics.ap-metrics { grid-template-columns: repeat(4, 1fr); }
.btn-danger { background: linear-gradient(140deg,#ff9ec4,#ffb59e); color: #6b2338; border-color: transparent; }
.switch.small { width: 44px; height: 25px; }
.switch.small .slider::before { height: 19px; width: 19px; }
.switch.small input:checked + .slider::before { transform: translateX(19px); }

/* ---- config grid ---- */
.cfg-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 16px; }
.cfg-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--ink-soft); font-weight: 600; }
.cfg-grid .num { width: 100%; }
.cfg-checks { display: flex; flex-direction: column; gap: 10px; margin: 16px 0 12px; }
.chk { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-soft); cursor: pointer; }
.chk input { width: 18px; height: 18px; accent-color: var(--lav); }
.state-badge, .metric b { font-variant-numeric: tabular-nums; }

/* ---- responsive ---- */
@media (max-width: 900px) {
  .dash-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .dash-card.wide { grid-column: span 2; }
}
@media (max-width: 620px) {
  .dash-grid { grid-template-columns: 1fr; }
  .dash-card.wide { grid-column: span 1; }
  .metrics.ap-metrics { grid-template-columns: repeat(2, 1fr); }
  .cfg-grid { grid-template-columns: 1fr; }
  #connPill .pill, .pill { height: 34px; }
  .brand-sub { display: none; }
  .field-inline { flex-wrap: wrap; }
}

/* ============================================================================
   App shell — sidebar + pages (premium desktop-app layout)
   ========================================================================== */
.app { display: flex; min-height: 100dvh; }

.sidebar {
  width: 244px; flex: none; position: sticky; top: 0; height: 100dvh;
  display: flex; flex-direction: column; gap: 6px; padding: 18px 14px;
  background: rgba(255,255,255,.66); backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border-right: 1px solid var(--line-soft); z-index: 30;
}
.side-brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 14px; }
.side-brand .brand-mark { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center;
  background: linear-gradient(150deg,#fff,#f2ecff); box-shadow: var(--clay), var(--inset-hi); border: 1px solid var(--line-soft); }
.side-brand .brand-panda { width: 29px; height: 29px; }
.side-name { font-weight: 700; font-size: 18px; letter-spacing: -.01em; }

.side-nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 10px 12px; border: 0; border-radius: 12px; background: transparent;
  color: var(--ink-soft); font-size: 14px; font-weight: 600; cursor: pointer; text-align: left;
  transition: background .18s var(--ease), color .18s var(--ease), transform .18s var(--bounce);
}
.nav-item .ni { font-size: 16px; width: 20px; text-align: center; }
.nav-item:hover { background: rgba(167,139,250,.1); color: var(--ink); }
.nav-item.active { background: var(--grad); color: #fff; box-shadow: var(--clay); }
.nav-item .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); margin-left: auto; }
.nav-item .dot.on { background: var(--mint); box-shadow: 0 0 0 3px rgba(94,224,176,.25); }
.nav-item .dot.warn { background: var(--sun); }

.side-foot { display: flex; align-items: center; gap: 8px; padding: 10px 6px 2px; border-top: 1px solid var(--line); }
.user-chip { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0; }
.avatar { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center;
  background: var(--grad); color: #fff; font-weight: 700; font-size: 14px; flex: none; }
.uc-name { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-logout { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  border: 1px solid var(--line); color: var(--muted); font-size: 16px; transition: all .2s var(--ease); }
.side-logout:hover { color: var(--pink); border-color: rgba(255,158,196,.4); background: rgba(255,158,196,.08); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 14px 22px; background: rgba(255,255,255,.55); backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px); border-bottom: 1px solid var(--line-soft);
}
.page-title { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: -.01em; flex: 1; }
.hamburger { display: none; width: 38px; height: 38px; border-radius: 11px; border: 1px solid var(--line);
  background: #fff; font-size: 17px; cursor: pointer; }
.content { padding: 22px; display: flex; flex-direction: column; }
.page { display: flex; flex-direction: column; gap: 18px; animation: fade .3s var(--ease) both; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; align-items: start; }

/* overview tiles */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.tile { display: flex; align-items: center; gap: 12px; padding: 16px; }
.tile .tl-ico { font-size: 24px; }
.tile b { font-size: 17px; display: block; }
.tile small { color: var(--muted); font-size: 12px; }

.head-actions { display: flex; gap: 8px; }
.small-btn { padding: 7px 12px; font-size: 12.5px; }

/* custom messages list */
.msg-list, .rule-list, .action-list { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.msg-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 12px;
  border: 1px solid var(--line-soft); background: #fff; box-shadow: 0 2px 8px rgba(120,95,190,.06);
}
.msg-item.dragging { opacity: .5; }
.msg-item.drop-over { border-color: var(--lav); box-shadow: 0 0 0 3px rgba(167,139,250,.2); }
.drag-handle { cursor: grab; color: var(--faint); font-size: 16px; user-select: none; }
.msg-text { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 14px; color: var(--ink); outline: 0; }
.msg-text:focus { background: rgba(167,139,250,.08); border-radius: 8px; padding: 4px 6px; }
.icon-btn { width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--line); background: #fff;
  color: var(--muted); cursor: pointer; font-size: 13px; transition: all .18s var(--ease); flex: none; }
.icon-btn:hover { color: var(--pink); border-color: rgba(255,158,196,.4); }

.seg { display: inline-flex; padding: 4px; gap: 4px; border-radius: 12px; background: rgba(167,139,250,.1); margin: 4px 0 12px; }
.seg-opt { position: relative; padding: 7px 16px; border-radius: 9px; font-size: 13px; font-weight: 600;
  color: var(--muted); cursor: pointer; transition: all .2s var(--ease); }
.seg-opt input { position: absolute; opacity: 0; }
.seg-opt:has(input:checked) { background: #fff; color: var(--ink); box-shadow: var(--clay); }
.preview-out { margin: 12px 0 0; padding: 12px 14px; border-radius: 12px; background: rgba(94,224,176,.12);
  color: #1a8f68; font-size: 13.5px; }

/* automation rules */
.rule-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px;
  border: 1px solid var(--line-soft); background: #fff; box-shadow: 0 2px 8px rgba(120,95,190,.06); }
.rule-info { flex: 1; min-width: 0; }
.rule-name { font-weight: 700; font-size: 14.5px; }
.rule-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.rule-trig { display: inline-block; padding: 1px 8px; border-radius: 7px; font-size: 11px; font-weight: 600;
  background: rgba(124,199,255,.16); color: #3a97e8; margin-right: 6px; }
.action-row { display: flex; gap: 8px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 11px; background: rgba(245,242,255,.5); }
.action-row select, .action-row input { height: 36px; border-radius: 9px; border: 1px solid var(--line); background: #fff; padding: 0 10px; font-size: 13px; }
.action-row .a-type { flex: none; min-width: 130px; }
.action-row .a-param { flex: 1; min-width: 0; }
.modal-actions { margin-top: 16px; }

/* users table */
.user-add { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 12px 0 16px; }
.user-add .txt { max-width: 200px; height: 40px; }
.table-wrap { overflow-x: auto; }
.utable { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.utable th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.utable td { padding: 10px; border-bottom: 1px solid var(--line); }
.utable tr:last-child td { border-bottom: 0; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 8px; font-size: 11px; font-weight: 600; }
.badge.admin { background: rgba(167,139,250,.16); color: var(--lav); }
.badge.user { background: rgba(124,199,255,.14); color: #3a97e8; }
.badge.on { background: rgba(94,224,176,.16); color: #1eb381; }
.badge.off { background: rgba(255,158,196,.16); color: #d2557f; }
.badge.live { background: rgba(94,224,176,.2); color: #159c70; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

.remember { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-soft); margin: 4px 0 14px; cursor: pointer; }
.remember input { width: 16px; height: 16px; accent-color: var(--lav); }

/* modal (rule editor) */
.modal { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(120,100,180,.24); backdrop-filter: blur(6px); }
.modal-card { position: relative; width: min(520px,100%); max-height: 88vh; overflow-y: auto; padding: 22px;
  background: var(--card-solid); animation: pop-in .4s var(--bounce) both; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modal-head h3 { margin: 0; font-size: 18px; }
.modal-card .fld-label { margin-top: 12px; }

/* responsive: sidebar becomes a drawer */
@media (max-width: 860px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%);
    transition: transform .3s var(--ease); box-shadow: var(--clay-lg); }
  .sidebar.open { transform: translateX(0); }
  .hamburger { display: grid; place-items: center; }
  .grid-2 { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
  .content { padding: 14px; }
  .app-top { padding: 12px 14px; }
  .user-add .txt { max-width: none; flex: 1; }
}

/* ============================================================================
   New pages: groups, history/replay, statistics, logs, themes
   ========================================================================== */
/* groups */
.grp-target { margin: 6px 0 14px; padding: 10px 14px; border-radius: 12px; background: var(--grad-soft, rgba(167,139,250,.12)); font-size: 13.5px; color: var(--ink-soft); }
.grp-list, .hist-games, .log-rows { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.grp-item { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 14px; border: 1px solid var(--line-soft); background: var(--card-solid); box-shadow: 0 2px 8px rgba(120,95,190,.06); }
.grp-item.active { border-color: var(--lav); box-shadow: 0 0 0 3px rgba(167,139,250,.18); }
.grp-av { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: #fff; font-weight: 700; background: var(--grad); flex: none; }
.grp-info { flex: 1; min-width: 0; }
.grp-nm { font-weight: 600; font-size: 14px; }
.grp-id { font-size: 12px; color: var(--muted); font-family: ui-monospace, monospace; }

/* history / replay */
.hist-game { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 13px; border: 1px solid var(--line-soft); background: var(--card-solid); box-shadow: 0 2px 8px rgba(120,95,190,.06); }
.hist-word { font-family: ui-monospace, monospace; text-transform: uppercase; letter-spacing: .06em; }
.hist-game .muted { flex: 1; }
.replay-guesses { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* statistics */
.stat-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.stat-tile { padding: 16px; display: flex; flex-direction: column; gap: 3px; }
.stat-tile b { font-size: 24px; font-weight: 700; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat-tile small { color: var(--muted); font-size: 12px; }
.stat-chart { height: 160px; }
.chart-svg { width: 100%; height: 160px; display: block; }

/* logs */
.log-controls { display: flex; gap: 10px; margin: 10px 0 14px; flex-wrap: wrap; }
.log-controls .select { max-width: 190px; }
.log-controls .txt { flex: 1; min-width: 160px; height: 42px; }
.log-row { display: flex; align-items: baseline; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--card-solid); border: 1px solid var(--line); font-size: 12.5px; }
.log-row .t { color: var(--muted); flex: none; font-variant-numeric: tabular-nums; }
.log-row .m { color: var(--ink-soft); word-break: break-word; }
.logcat { flex: none; padding: 1px 8px; border-radius: 7px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.cat-login { background: rgba(124,199,255,.18); color: #3a97e8; }
.cat-telegram { background: rgba(94,224,176,.18); color: #1eb381; }
.cat-guess { background: rgba(167,139,250,.18); color: var(--lav); }
.cat-autoplay { background: rgba(255,215,106,.2); color: #b8862f; }
.cat-automation { background: rgba(255,158,196,.18); color: #d2557f; }
.cat-settings { background: rgba(148,163,184,.2); color: #64748b; }
.cat-error { background: rgba(255,120,120,.2); color: #d64545; }
.cat-warning { background: rgba(255,181,158,.24); color: #b65a44; }
.cat-system { background: rgba(148,163,184,.16); color: #7a8699; }

/* message weight */
.msg-weight { width: 46px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: var(--card-solid); text-align: center; font-size: 13px; color: var(--ink); flex: none; }
.wlbl { color: var(--faint); font-size: 12px; }

/* theme swatches */
.theme-swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { width: 92px; height: 58px; border-radius: 12px; border: 2px solid var(--line); cursor: pointer; position: relative; overflow: hidden; padding: 0; }
.swatch span { position: absolute; left: 7px; bottom: 5px; font-size: 11px; font-weight: 600; color: #fff; text-transform: capitalize; text-shadow: 0 1px 3px rgba(0,0,0,.5); }
.swatch.active { border-color: var(--lav); box-shadow: 0 0 0 3px rgba(167,139,250,.25); }
.swatch.t-cute { background: linear-gradient(140deg,#c3b0ff,#ffd3c4); }
.swatch.t-dark { background: linear-gradient(140deg,#1a1a22,#3a3550); }
.swatch.t-glass { background: linear-gradient(140deg,#e6e9ff,#f7f0ff); }
.swatch.t-purple { background: linear-gradient(140deg,#a78bfa,#f0abfc); }
.swatch.t-blue { background: linear-gradient(140deg,#60a5fa,#38bdf8); }
.swatch.t-cyber { background: linear-gradient(140deg,#0a0f1e,#22d3ee); }
.swatch.t-minimal { background: linear-gradient(140deg,#e2e8f0,#94a3b8); }

/* ============================================================================
   THEME VARIANTS (override tokens on :root[data-theme])
   ========================================================================== */
:root[data-theme="purple"] { --grad: linear-gradient(120deg,#a78bfa,#c084fc 50%,#f0abfc); --lav:#a78bfa; }
:root[data-theme="blue"]   { --grad: linear-gradient(120deg,#60a5fa,#7cc7ff 50%,#38bdf8); --lav:#3a97e8; --sky:#60a5fa; }
:root[data-theme="minimal"]{ --grad: linear-gradient(120deg,#94a3b8,#64748b); --lav:#64748b; --bg-1:#f7f8fa; --bg-2:#eef1f5; }
:root[data-theme="glass"]  { --card: rgba(255,255,255,.42); --line-soft: rgba(255,255,255,.7); }

:root[data-theme="dark"], :root[data-theme="cyber"] {
  --ink:#f2f2f7; --ink-soft:#c4c4d0; --muted:#8b8b9a; --faint:#5a5a68;
  --card: rgba(28,28,36,.6); --card-solid:#1a1a22;
  --line: rgba(255,255,255,.08); --line-soft: rgba(255,255,255,.12);
  --clay: 0 18px 40px -18px rgba(0,0,0,.5); --clay-lg: 0 30px 70px -26px rgba(0,0,0,.6);
  --inset-hi: inset 0 1px 0 rgba(255,255,255,.05);
  color-scheme: dark;
}
:root[data-theme="dark"]  { --bg-1:#0d0d12; --bg-2:#151019; --grad: linear-gradient(120deg,#a78bfa,#7cc7ff 55%,#ff9ec4); }
:root[data-theme="cyber"] { --bg-1:#070b16; --bg-2:#0a1226; --grad: linear-gradient(120deg,#22d3ee,#7c5cff 55%,#ff5c8a);
  --lav:#7cc7ff; --card-solid:#0f1830; --line: rgba(120,170,255,.14); }

:root[data-theme="dark"] body, :root[data-theme="cyber"] body {
  background:
    radial-gradient(1000px 700px at 12% -8%, rgba(124,92,255,.16), transparent 60%),
    radial-gradient(900px 700px at 100% 0%, rgba(34,211,238,.10), transparent 55%),
    radial-gradient(900px 800px at 50% 120%, rgba(255,92,138,.08), transparent 60%),
    linear-gradient(160deg, var(--bg-1), var(--bg-2));
}
/* dark surface overrides for components that hardcode light backgrounds */
:root[data-theme="dark"] .sidebar, :root[data-theme="cyber"] .sidebar,
:root[data-theme="dark"] .app-top, :root[data-theme="cyber"] .app-top { background: rgba(18,18,26,.72); }
:root[data-theme="dark"] .btn, :root[data-theme="cyber"] .btn,
:root[data-theme="dark"] .txt, :root[data-theme="cyber"] .txt,
:root[data-theme="dark"] .select, :root[data-theme="cyber"] .select,
:root[data-theme="dark"] .num, :root[data-theme="cyber"] .num,
:root[data-theme="dark"] .login-input, :root[data-theme="cyber"] .login-input,
:root[data-theme="dark"] .msg-item, :root[data-theme="cyber"] .msg-item,
:root[data-theme="dark"] .msg-weight, :root[data-theme="cyber"] .msg-weight,
:root[data-theme="dark"] .rule-item, :root[data-theme="cyber"] .rule-item,
:root[data-theme="dark"] .hist-item, :root[data-theme="cyber"] .hist-item,
:root[data-theme="dark"] .hist-game, :root[data-theme="cyber"] .hist-game,
:root[data-theme="dark"] .grp-item, :root[data-theme="cyber"] .grp-item,
:root[data-theme="dark"] .fav-item, :root[data-theme="cyber"] .fav-item,
:root[data-theme="dark"] .action-row, :root[data-theme="cyber"] .action-row,
:root[data-theme="dark"] .tile, :root[data-theme="cyber"] .tile,
:root[data-theme="dark"] .stat-tile, :root[data-theme="cyber"] .stat-tile,
:root[data-theme="dark"] .metric, :root[data-theme="cyber"] .metric,
:root[data-theme="dark"] .log-row, :root[data-theme="cyber"] .log-row,
:root[data-theme="dark"] .icon-btn, :root[data-theme="cyber"] .icon-btn,
:root[data-theme="dark"] kbd, :root[data-theme="cyber"] kbd,
:root[data-theme="dark"] .avatar, :root[data-theme="cyber"] .avatar {
  background: rgba(255,255,255,.05); color: var(--ink); border-color: var(--line);
}
:root[data-theme="dark"] .btn-primary, :root[data-theme="cyber"] .btn-primary,
:root[data-theme="dark"] .avatar, :root[data-theme="cyber"] .avatar,
:root[data-theme="dark"] .grp-av, :root[data-theme="cyber"] .grp-av { background: var(--grad); color: #fff; }
:root[data-theme="dark"] .board-view, :root[data-theme="cyber"] .board-view,
:root[data-theme="dark"] .metric, :root[data-theme="cyber"] .metric,
:root[data-theme="dark"] .seg, :root[data-theme="cyber"] .seg { background: rgba(255,255,255,.04); }
:root[data-theme="dark"] .seg-opt:has(input:checked), :root[data-theme="cyber"] .seg-opt:has(input:checked),
:root[data-theme="dark"] .tab-indicator, :root[data-theme="cyber"] .tab-indicator { background: rgba(255,255,255,.1); }
:root[data-theme="dark"] .board-view { color: var(--ink); }

/* animation speed control (global) */
:root[data-anim="off"] *, :root[data-anim="off"] *::before, :root[data-anim="off"] *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
:root[data-anim="slow"] * { transition-duration: .5s; }
:root[data-anim="fast"] * { transition-duration: .12s; }

/* auth extras */
.pw-meter { width: 100%; height: 6px; border-radius: 999px; background: rgba(167,139,250,.14); overflow: hidden; margin: 0 0 10px; }
.pw-meter span { display: block; height: 100%; width: 0; border-radius: 999px; background: #e5e0f0; transition: width .25s var(--ease), background .25s var(--ease); }
.pw-msg { margin: 0 0 8px; font-size: 12px; min-height: 15px; color: var(--muted); width: 100%; }
.pw-msg.bad { color: #d2557f; }
.login-links { display: flex; gap: 10px; justify-content: center; align-items: center; margin-top: 14px; font-size: 13px; }
.login-links a { color: var(--lav); font-weight: 600; }
.login-links a:hover { text-decoration: underline; }
.login-links span { color: var(--faint); }
.reset-link { display: block; width: 100%; word-break: break-all; padding: 10px 12px; border-radius: 10px; background: rgba(167,139,250,.1); color: var(--lav); font-size: 12.5px; margin: 8px 0; font-family: ui-monospace, monospace; }

/* admin / profile extras */
.nav-sep { padding: 12px 12px 4px; font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.mini-select { height: 30px; border-radius: 8px; border: 1px solid var(--line); background: var(--card-solid); color: var(--ink); font-size: 12.5px; padding: 0 6px; }
.soft-hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.badge.warn { background: rgba(255,215,106,.22); color: #b8862f; }
.logwho { flex: none; font-size: 12px; color: var(--lav); }
:root[data-theme="dark"] .mini-select, :root[data-theme="cyber"] .mini-select { background: rgba(255,255,255,.05); }
