:root {
  /* surfaces — near-black, separated by light rather than by colour */
  --bg: #050506;
  --bg-deep: #000;
  --bg-elevated: #08080a;
  --panel: #0b0b0d;
  --panel-2: #101013;
  --panel-3: #17171b;
  --raised: #1c1c21;

  /* hairlines instead of heavy borders */
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.12);
  --line-soft: rgba(255, 255, 255, 0.04);

  /* type */
  --text: #f4f4f6;
  --text-dim: #8f8f99;
  --text-mute: #5d5d67;

  /* accents — used sparingly */
  --gold: #c9a961;
  --gold-soft: #e3c98d;
  --gold-deep: #8a6f2e;
  --red: #c8102e;
  --red-bright: #e8304a;
  --red-deep: #8b0a1f;
  --green: #1fa363;
  --green-bright: #35c97f;
  --green-deep: #0d6b40;
  --purple: #7c5cff;
  --blue: #3b82f6;
  --cyan: #22d3ee;

  --felt: #14563b;
  --felt-dark: #07281c;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;

  --shadow: 0 30px 70px rgba(0, 0, 0, 0.7);
  --shadow-soft: 0 12px 32px rgba(0, 0, 0, 0.5);
  --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.04);

  --topbar-h: 72px;
  --sidebar-w: 246px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  overflow-x: hidden;
  background:
    radial-gradient(100% 60% at 50% -20%, rgba(201, 169, 97, 0.05) 0%, transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  background: none;
  border: none;
  cursor: pointer;
}

svg {
  display: block;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #2c2c33;
  border-radius: 8px;
}

::-webkit-scrollbar-thumb:hover {
  background: #3a3a43;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 34px;
  padding: 0 26px;
  min-width: 0;
  background: var(--topbar-bg, rgba(5, 5, 6, 0.86));
  backdrop-filter: blur(18px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -0.4px;
  white-space: nowrap;
  flex: none;
}

.brand-mark {
  height: 54px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
  display: block;
  mix-blend-mode: screen;
  mask-image: radial-gradient(circle at 50% 50%, #000 58%, transparent 82%);
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 58%, transparent 82%);
}

.brand-text span,
.auth-brand .brand-text span {
  color: var(--red);
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  font-size: 33px;
  font-weight: 800;
  letter-spacing: -0.5px;
  text-transform: lowercase;
}

.auth-brand .brand-mark {
  height: 78px;
  max-width: 220px;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 30px;
  height: 100%;
}

.topnav a {
  position: relative;
  display: flex;
  align-items: center;
  height: 100%;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: var(--text-mute);
  transition: color 0.18s;
}

.topnav a:hover {
  color: var(--text);
}

.topnav a.active {
  color: var(--text);
}

.topnav a.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 20px;
  height: 1.5px;
  background: var(--gold);
}

#tables-btn {
  position: relative;
}

#tables-btn .count {
  position: absolute;
  top: 1px;
  right: 1px;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 9.5px;
  font-weight: 800;
  line-height: 15px;
  text-align: center;
}

#tables-btn.open {
  color: var(--gold-soft);
  animation: tableGlow 1.8s ease-in-out infinite;
}

#tables-btn.open .count {
  animation: pulse 1.8s ease-in-out infinite;
}

#tables-btn.live {
  color: var(--green-bright);
  animation: tableGlow 0.9s ease-in-out infinite;
}

#tables-btn.live .count {
  background: var(--green-bright);
  color: #04140c;
  animation: pulse 0.9s ease-in-out infinite;
}

@keyframes tableGlow {
  50% {
    filter: drop-shadow(0 0 8px currentColor);
  }
}

@keyframes pulse {
  50% {
    opacity: 0.55;
  }
}



.table-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.table-menu > button {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 15px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-size: 14.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s, background 0.16s;
}

.table-menu > button:hover {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.06);
}

.table-menu > button span {
  margin-left: auto;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-mute);
}

.table-menu > button.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.table-menu-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.table-menu-title {
  font-size: 11.5px;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--text-mute);
}

.table-menu-list a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 13px;
  border-radius: 11px;
  border: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
  font-size: 13.5px;
}

.table-menu-list a.acting {
  border-color: var(--green-bright);
  box-shadow: 0 0 14px rgba(53, 201, 127, 0.2);
}

.table-menu-list a i {
  font-style: normal;
  font-size: 12.5px;
  color: var(--text-mute);
}

.table-switcher {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.table-switcher a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
}

.table-switcher a.acting {
  border-color: var(--green-bright);
  box-shadow: 0 0 14px rgba(53, 201, 127, 0.18);
}

.table-switcher a span {
  grid-column: 1;
  font-size: 12.5px;
  color: var(--text-mute);
}

.table-switcher a i {
  grid-row: 1 / span 2;
  grid-column: 2;
  align-self: center;
  font-style: normal;
  font-weight: 700;
  color: var(--gold-soft);
}

.wallet-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: none;
  margin-left: -18px;
  padding: 7px 11px 7px 6px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.9px;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s, color 0.18s;
}

.wallet-pill:hover {
  border-color: rgba(255, 255, 255, 0.24);
}

.wallet-pill-track {
  position: relative;
  width: 30px;
  height: 17px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  transition: background 0.18s;
}

.wallet-pill-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: transform 0.18s ease, background 0.18s;
}

.wallet-pill.real {
  color: var(--green-bright);
  border-color: rgba(53, 201, 127, 0.4);
  background: rgba(53, 201, 127, 0.1);
}

.wallet-pill.real .wallet-pill-track {
  background: rgba(53, 201, 127, 0.32);
}

.wallet-pill.real .wallet-pill-knob {
  background: var(--green-bright);
  transform: translateX(13px);
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
  flex: none;
}

.icon-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: var(--text-dim);
  transition: background 0.15s, color 0.15s;
}

.icon-btn:hover {
  background: var(--panel-2);
  color: var(--text);
}

.icon-btn .dot {
  position: absolute;
  top: 9px;
  right: 10px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
  border: 2px solid #0b0b0d;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 5px 12px 5px 5px;
  border-radius: 30px;
  cursor: pointer;
  transition: background 0.15s;
}

.user-chip:hover {
  background: var(--panel-2);
}

.user-chip img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid #2e2e35;
  object-fit: cover;
}

.user-chip .meta {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.user-chip .name {
  font-size: 13.5px;
  font-weight: 600;
}

.user-chip .balance {
  font-size: 14px;
  font-weight: 650;
  color: var(--gold-soft);
  font-variant-numeric: tabular-nums;
}

.user-chip .chev {
  color: var(--text-mute);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 22px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
  white-space: nowrap;
  transition: background 0.18s, color 0.18s, border-color 0.18s, transform 0.08s;
}

.btn:active {
  transform: translateY(1px);
}

.btn-red {
  background: var(--red);
  color: #fff;
  box-shadow: var(--shadow-inset);
}

.btn-red:hover {
  background: var(--red-bright);
}

.btn-green {
  background: var(--green);
  color: #fff;
  font-weight: 650;
  box-shadow: var(--shadow-inset);
}

.btn-green:hover {
  background: var(--green-bright);
  color: #05100a;
}

.btn-gold {
  background: var(--gold);
  color: #17130a;
  font-weight: 650;
  box-shadow: var(--shadow-inset);
}

.btn-gold:hover {
  background: var(--gold-soft);
}

.btn-purple {
  background: var(--purple);
  color: #fff;
  box-shadow: var(--shadow-inset);
}

.btn-purple:hover {
  filter: brightness(1.12);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--text-dim);
}

.btn-ghost:hover {
  background: var(--panel-2);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text);
}

.btn-danger-ghost {
  background: transparent;
  border: 1px solid #3a2224;
  color: var(--red-bright);
}

.btn-danger-ghost:hover {
  background: rgba(211, 47, 47, 0.12);
}

.btn-lg {
  height: 50px;
  padding: 0 28px;
  font-size: 15px;
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
  align-items: start;
}

.shell > * {
  min-width: 0;
}

.sidebar {
  position: sticky;
  top: calc(var(--topbar-h) + 18px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.side-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}

.profile-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
}

.profile-card .row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
}

.profile-card img {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 2px solid #2b2b32;
  object-fit: cover;
}

.profile-card .hello {
  font-size: 12.5px;
  color: var(--text-dim);
}

.profile-card .uname {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.profile-card .bal {
  font-size: 19px;
  font-weight: 650;
  color: var(--gold-soft);
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
}

.vip-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding: 4px 12px;
  border-radius: 4px;
  border: 1px solid rgba(201, 169, 97, 0.32);
  background: rgba(201, 169, 97, 0.08);
  color: var(--gold-soft);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.sidenav {
  display: flex;
  flex-direction: column;
  padding: 6px;
}

.sidenav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 13px;
  height: 46px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 14.5px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.sidenav a svg {
  width: 19px;
  height: 19px;
  flex: none;
}

.sidenav a:hover {
  background: var(--panel-2);
  color: var(--text);
}

.sidenav a.active {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-weight: 600;
}

.sidenav a.active::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 10px;
  bottom: 10px;
  width: 2px;
  background: var(--gold);
}

.online-card {
  position: relative;
  overflow: hidden;
  padding: 16px 18px 22px;
}

.online-card .label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--text-dim);
}

.online-card .pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(53, 180, 90, 0.6);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  70% {
    box-shadow: 0 0 0 8px rgba(53, 180, 90, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(53, 180, 90, 0);
  }
}

.online-card .count {
  font-size: 26px;
  font-weight: 700;
  margin-top: 6px;
}

.online-card .ghost {
  position: absolute;
  right: -6px;
  bottom: -14px;
  opacity: 0.16;
  color: #fff;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-head h2 {
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-dim);
}

.section-head .link {
  font-size: 12px;
  color: var(--gold);
  font-weight: 600;
  letter-spacing: 0.4px;
}

.section-head .link:hover {
  text-decoration: underline;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.flag {
  width: 15px;
  height: 11px;
  border-radius: 2px;
  object-fit: cover;
  flex: none;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field label {
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 500;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrap > span:first-child,
.input-wrap > svg:first-child {
  position: absolute;
  left: 15px;
  display: grid;
  place-items: center;
  color: var(--text-mute);
  pointer-events: none;
}

.input-wrap .trail {
  position: absolute;
  right: 14px;
  color: var(--text-mute);
  cursor: pointer;
}

.input-wrap .trail:hover {
  color: var(--text-dim);
}

input.control,
select.control,
textarea.control {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input-wrap > span:first-child ~ input.control,
.input-wrap > svg:first-child ~ input.control {
  padding-left: 46px;
}

.input-wrap .trail {
  z-index: 1;
}

input.control::placeholder {
  color: #55555f;
}

input.control:focus,
select.control:focus,
textarea.control:focus {
  border-color: rgba(201, 169, 97, 0.5);
  box-shadow: 0 0 0 3px rgba(201, 169, 97, 0.1);
}

select.control {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236d6d78' stroke-width='2'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
  cursor: pointer;
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  font-size: 13.5px;
  color: var(--text-dim);
  user-select: none;
}

.checkbox input {
  appearance: none;
  width: 17px;
  height: 17px;
  border: 1.5px solid #3a3a44;
  border-radius: 4px;
  background: #101013;
  cursor: pointer;
  position: relative;
  flex: none;
  transition: background 0.15s, border-color 0.15s;
}

.checkbox input:checked {
  background: var(--red);
  border-color: var(--red);
}

.checkbox input:checked::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 1.5px;
  width: 4px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  color: var(--text-dim);
}

.pill.red {
  background: rgba(224, 27, 38, 0.18);
  border: 1px solid rgba(255, 59, 59, 0.3);
  color: #ff7a72;
}

.pill.green {
  background: rgba(25, 209, 106, 0.16);
  border: 1px solid rgba(43, 240, 133, 0.3);
  color: var(--green-bright);
}

.pill.gold {
  background: rgba(245, 184, 61, 0.16);
  border: 1px solid rgba(245, 184, 61, 0.32);
  color: var(--gold-soft);
}

.pill.purple {
  background: rgba(168, 85, 247, 0.18);
  border: 1px solid rgba(168, 85, 247, 0.34);
  color: #c9a6ff;
}

.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  min-width: 240px;
  max-width: 340px;
  padding: 13px 16px;
  border-radius: var(--radius);
  background: linear-gradient(170deg, #1a1c25, #101116);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  font-size: 13.5px;
  animation: toast-in 0.25s ease;
}

.toast.error {
  border-color: #4a2226;
  color: #f08b88;
}

.toast.success {
  border-color: #234a2e;
  color: #7fd89a;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(3px);
  animation: fade 0.15s ease;
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

.modal {
  width: min(440px, calc(100vw - 40px));
  max-height: min(88dvh, calc(100dvh - 32px));
  display: flex;
  flex-direction: column;
  background: linear-gradient(170deg, #14151c, #0b0c11);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.modal header {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 16px;
  font-weight: 700;
}

.modal .body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.modal footer {
  flex: none;
  display: flex;
  gap: 10px;
  padding: 0 20px 20px;
}

.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-mute);
  font-size: 13.5px;
}

.skeleton {
  background: linear-gradient(90deg, #17171b 25%, #1f1f25 50%, #17171b 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

@media (max-width: 1180px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
  }
  .sidebar {
    display: none;
  }
}

@media (max-width: 1380px) {
  .topbar {
    gap: 18px;
  }

  .topnav {
    gap: 18px;
  }

  /* кнопка темы добавила ширины — на средних экранах касса живёт иконкой */
  .cashier-btn .btn-label {
    display: none;
  }

  .cashier-btn {
    padding: 0 14px;
  }
}

@media (max-width: 1240px) {
  .topbar {
    gap: 20px;
    padding: 0 16px;
  }
  .topnav {
    gap: 20px;
  }
  .topnav a {
    font-size: 13.5px;
  }
  .topbar-right {
    gap: 10px;
  }
}

@media (max-width: 1180px) {
  .topnav {
    display: none;
  }
}

@media (max-width: 860px) {
  .user-chip .meta {
    display: none;
  }
}

@media (max-width: 560px) {
  :root {
    --topbar-h: 64px;
  }

  .wallet-pill {
    margin-left: -2px;
    padding: 7px 8px 7px 5px;
    gap: 5px;
    font-size: 10.5px;
    letter-spacing: 0.4px;
  }

  .wallet-pill-track {
    width: 26px;
    height: 15px;
  }

  .wallet-pill-knob {
    width: 11px;
    height: 11px;
  }

  .wallet-pill.real .wallet-pill-knob {
    transform: translateX(11px);
  }

  .user-chip .meta {
    display: none;
  }

  .user-chip .chev {
    display: none;
  }

  .cashier-btn {
    padding: 0 12px;
  }

  .brand {
    gap: 7px;
  }

  .brand-text {
    display: inline;
    font-size: 17px;
  }

  .brand-mark {
    height: 36px;
  }
  .topbar {
    padding: 0 12px;
    gap: 10px;
  }
  .topbar-right {
    gap: 6px;
  }
  .brand {
    font-size: 19px;
  }
  .user-chip {
    padding: 3px;
    gap: 0;
  }
  .user-chip img {
    width: 36px;
    height: 36px;
  }
  .user-chip .chev {
    display: none;
  }
  .icon-btn {
    width: 34px;
    height: 34px;
  }
  .topbar-right .btn {
    height: 34px;
    padding: 0 13px;
    font-size: 13px;
  }
  .shell {
    padding: 12px;
  }
}

@media (max-width: 460px) {
  #bell-btn {
    display: none;
  }
}

@media (max-width: 344px) {
  .wallet-pill-text {
    display: none;
  }

  .wallet-pill {
    gap: 0;
    padding: 8px 7px;
  }
}

@media (max-width: 440px) {
  .cashier-btn .btn-label {
    display: none;
  }

  .cashier-btn {
    padding: 0;
    width: 42px;
    min-width: 42px;
  }
}

@media (max-width: 380px) {
  .topbar {
    padding: 0 8px;
    gap: 6px;
  }

  .brand-text {
    font-size: 15px;
  }

  .brand-mark {
    height: 30px;
  }

  .cashier-btn .btn-label {
    display: none;
  }

  .cashier-btn {
    padding: 0;
    width: 42px;
    min-width: 42px;
  }

  .topbar-right {
    gap: 4px;
  }

  .user-chip {
    padding: 2px;
  }

  .user-chip img {
    width: 34px;
    height: 34px;
  }

  .icon-btn {
    min-width: 38px;
    min-height: 38px;
    width: 38px;
    height: 38px;
  }

  .shell {
    padding: 10px 8px;
  }

  .page-head h1 {
    font-size: 19px;
  }
}

.user-menu {
  position: fixed;
  z-index: 120;
  width: 236px;
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 3px;
  animation: toast-in 0.14s ease;
}

.user-menu a,
.user-menu button {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--text-dim);
  text-align: left;
  width: 100%;
  transition: background 0.14s, color 0.14s;
}

.user-menu a:hover,
.user-menu button:hover {
  background: var(--panel-2);
  color: var(--text);
}

.wallet-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: #101013;
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
}

.wallet-switch button {
  justify-content: center;
  padding: 8px;
  font-weight: 600;
  font-size: 13px;
  border-radius: 5px;
}

.wallet-switch button.on {
  background: var(--red);
  color: #fff;
}

.wallet-switch button.on:hover {
  background: var(--red);
  color: #fff;
}

.wallet-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 12px 12px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 6px;
}

.wallet-rows div {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--text-mute);
}

.wallet-rows b {
  color: var(--text);
}

.notif-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 420px;
  overflow-y: auto;
}

.notif {
  display: flex;
  gap: 12px;
  padding: 13px;
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  border: 1px solid transparent;
}

.notif.unread {
  border-color: #35232a;
  background: #1a1418;
}

.notif .ic {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 50%;
  background: rgba(211, 47, 47, 0.12);
  color: var(--red-bright);
}

.notif b {
  font-size: 13.5px;
}

.notif p {
  font-size: 12.5px;
  color: var(--text-dim);
  margin: 3px 0 4px;
}

.notif span {
  font-size: 11px;
  color: var(--text-mute);
}


.scroll-x {
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.scroll-x::-webkit-scrollbar {
  height: 0;
}


/* ---- touch targets: every control reaches at least 44px on coarse pointers ---- */

@media (pointer: coarse), (max-width: 900px) {
  .icon-btn,
  .tool-btn {
    min-width: 44px;
    min-height: 44px;
  }

  .btn {
    min-height: 44px;
  }

  .btn-lg {
    min-height: 52px;
  }

  .checkbox {
    min-height: 44px;
    gap: 12px;
  }

  .checkbox input {
    width: 22px;
    height: 22px;
  }

  .checkbox input:checked::after {
    left: 7px;
    top: 2px;
    width: 5px;
    height: 11px;
  }

  .sidenav a,
  .user-menu a,
  .user-menu button {
    min-height: 48px;
  }

  .tabs button,
  .chip-row button,
  .bet-presets button,
  .buyin-quick button,
  .move-nav button {
    min-height: 44px;
  }

  input.control,
  select.control {
    min-height: 48px;
    font-size: 16px;
  }

  .chat-input input {
    min-height: 42px;
    font-size: 16px;
  }

  .address-line button,
  .table-info .gid button,
  .chat-input button,
  .game-chat header button,
  .move-panel header button,
  .info-panel header button {
    display: grid;
    place-items: center;
    min-width: 44px;
    min-height: 44px;
    margin: -10px;
    padding: 10px;
  }

  .view-toggle button {
    min-height: 40px;
    padding: 0 18px;
  }

  .avatar-picker img {
    min-width: 44px;
    min-height: 44px;
  }
}

@media (max-width: 560px) {
  .modal {
    width: calc(100vw - 24px);
  }

  .modal .body {
    padding: 16px;
  }

  .modal footer {
    flex-direction: column;
    padding: 0 16px 16px;
  }

  .toast-stack {
    right: 12px;
    left: 12px;
    bottom: 12px;
  }

  .toast {
    min-width: 0;
    max-width: none;
  }

  .user-menu {
    width: calc(100vw - 24px);
    right: 12px !important;
  }
}

.switch-row {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 6px;
}

.switch-row a {
  flex: 1;
  min-width: 0;
}

.switch-quit {
  flex: none;
  width: 38px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-mute);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: color 0.15s, border-color 0.15s;
}

.switch-quit:hover {
  color: var(--red-bright);
  border-color: rgba(232, 48, 74, 0.5);
}

.btn-exit {
  border-color: rgba(232, 48, 74, 0.4);
  color: #ff8a97;
}

.btn-exit:hover {
  border-color: rgba(232, 48, 74, 0.75);
  color: #fff;
}

body.immersive .topbar {
  display: none;
}

body.immersive .game-shell {
  height: 100dvh;
}

body.immersive .game-hud {
  padding-top: env(safe-area-inset-top, 6px);
}

/* ---- reactions & throwables ---- */

.reactions-btn {
  font-size: 18px;
  line-height: 1;
}

.reactions-btn.on {
  border-color: var(--gold);
  color: #ffe6a8;
}

.rx-backdrop {
  position: fixed;
  inset: 0;
  z-index: 118;
  background: rgba(0, 0, 0, 0.35);
}

.rx-backdrop[hidden],
.rx-sheet[hidden] {
  display: none;
}

.rx-sheet {
  position: fixed;
  z-index: 120;
  right: 14px;
  top: calc(var(--topbar-h, 56px) + 62px);
  width: 320px;
  max-height: min(70vh, 560px);
  overflow-y: auto;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, rgba(16, 17, 22, 0.98), rgba(9, 9, 12, 0.98));
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(12px);
}

.rx-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.rx-title {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--gold-soft);
}

.rx-close {
  border: 0;
  background: transparent;
  color: var(--text-mute);
  font-size: 15px;
  cursor: pointer;
}

.rx-to,
.rx-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 8px;
}

.rx-to button,
.rx-tabs button {
  max-width: 120px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-dim);
  font-size: 11.5px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.rx-to button.on,
.rx-tabs button.on {
  border-color: var(--gold);
  color: #ffe6a8;
  background: rgba(201, 169, 97, 0.12);
}

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

.rx-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 3px 6px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-dim);
  cursor: pointer;
  position: relative;
  transition: transform 0.12s, border-color 0.15s, background 0.15s;
}

.rx-item:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.07);
}

.rx-item .rx-glyph {
  font-size: 24px;
  line-height: 1;
}

.rx-item .rx-name {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.2px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.rx-item.rare {
  border-color: rgba(93, 158, 255, 0.45);
}

.rx-item.epic {
  border-color: rgba(186, 104, 255, 0.5);
}

.rx-item.premium {
  border-color: rgba(201, 169, 97, 0.6);
}

.rx-item.legendary {
  border-color: rgba(255, 122, 61, 0.65);
}

.rx-item.locked {
  opacity: 0.45;
  cursor: not-allowed;
}

.rx-lock,
.rx-price {
  position: absolute;
  top: 3px;
  right: 4px;
  font-size: 9px;
}

.rx-hint {
  margin-top: 8px;
  font-size: 10.5px;
  color: var(--text-mute);
  text-align: center;
}

.rx-fly {
  position: fixed;
  z-index: 130;
  font-size: 40px;
  line-height: 1;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.6);
  transition: transform var(--rx-time, 1000ms) cubic-bezier(0.22, 0.8, 0.3, 1), opacity 0.25s ease;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.75));
}

.rx-fly.motion-spin {
  animation: rx-spin var(--rx-time, 1000ms) linear;
}

.rx-fly.motion-float {
  transition-timing-function: cubic-bezier(0.3, 0.9, 0.4, 1);
}

.rx-fly.motion-bounce {
  animation: rx-bounce 0.5s ease-in-out infinite;
}

.rx-fly.motion-wave {
  animation: rx-wave 0.6s ease-in-out infinite;
}

.rx-fly.epic,
.rx-fly.legendary {
  font-size: 52px;
}

.rx-fly.land {
  opacity: 0;
  transition: transform 0.6s ease, opacity 0.6s ease;
}

.rx-fly.motion-splat.land,
.rx-fly.motion-burst.land {
  animation: rx-splat 0.5s ease forwards;
}

.rx-hit {
  animation: rx-shake 0.5s ease;
}

@keyframes rx-spin {
  from {
    rotate: 0deg;
  }
  to {
    rotate: 540deg;
  }
}

@keyframes rx-bounce {
  0%,
  100% {
    rotate: -8deg;
  }
  50% {
    rotate: 8deg;
  }
}

@keyframes rx-wave {
  0%,
  100% {
    rotate: -14deg;
  }
  50% {
    rotate: 14deg;
  }
}

@keyframes rx-splat {
  0% {
    filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.75));
  }
  40% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    filter: blur(2px);
  }
}

@keyframes rx-shake {
  0%,
  100% {
    translate: 0 0;
  }
  20% {
    translate: -4px 1px;
  }
  45% {
    translate: 4px -1px;
  }
  70% {
    translate: -3px 0;
  }
}

@media (max-width: 620px) {
  .rx-sheet {
    right: 0;
    left: 0;
    bottom: 0;
    top: auto;
    width: auto;
    max-height: 62vh;
    border-radius: 20px 20px 0 0;
    padding: 12px 12px 18px;
  }

  .rx-grid {
    grid-template-columns: repeat(5, 1fr);
  }

  .rx-fly {
    font-size: 34px;
  }

  .rx-fly.epic,
  .rx-fly.legendary {
    font-size: 44px;
  }
}

.hud-cube {
  display: flex;
  gap: 6px;
}

.hud-cube:empty {
  display: none;
}

.hud-cube .btn {
  height: 34px;
  padding: 0 12px;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .hud-cube .btn {
    height: 28px;
    padding: 0 9px;
    font-size: 11px;
  }
}

/* ---- светлая тема: переопределяем только токены ---- */

:root[data-theme="light"] {
  /* светлая тема серебристая, а не белая: поверхности с холодным серым отливом */
  --bg: #dfe2ea;
  --bg-deep: #d2d6e0;
  --bg-elevated: #f1f2f6;
  --panel: #eceef4;
  --panel-2: #e3e6ee;
  --panel-3: #d9dce6;
  --raised: #cfd3df;

  --line: rgba(16, 18, 27, 0.14);
  --line-strong: rgba(16, 18, 27, 0.24);
  --line-soft: rgba(16, 18, 27, 0.08);

  --text: #12141b;
  --text-dim: #454b59;
  --text-mute: #646b7c;

  --gold: #9a7c34;
  --gold-soft: #7d6426;
  --gold-deep: #c9a961;
  --red: #c8102e;
  --red-bright: #d81f3c;
  --green: #12804c;
  --green-bright: #0f9a5a;

  --shadow: 0 24px 60px rgba(16, 18, 27, 0.16);
  --shadow-soft: 0 10px 26px rgba(16, 18, 27, 0.1);
  --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.7);

  color-scheme: light;
}

/* фон страницы не затираем целиком — у игровых столов свои картинки */
:root[data-theme="light"] body {
  background-color: var(--bg);
  color: var(--text);
  /* шапка светлеет вместе с сайтом, в том числе на игровых страницах */
  --topbar-bg: rgba(240, 242, 247, 0.92);
}

:root[data-theme="light"] body:not(.game) {
  background-image: radial-gradient(100% 60% at 50% -20%, rgba(201, 169, 97, 0.16) 0%, transparent 60%);
}

/* сам игровой стол всегда тёмный: тёмную палитру держим внутри игровой оболочки,
   а шапка, меню и окна снаружи переключаются вместе со всем сайтом */
:root[data-theme="light"] body.game .game-shell,
:root[data-theme="light"] body.game .modal-backdrop,
:root[data-theme="light"] body.game .toast-stack,
:root[data-theme="light"] body.game .user-menu,
:root[data-theme="light"] body.game .nav-drawer,
:root[data-theme="light"] body.game .rx-sheet,
:root[data-theme="light"] body.game .rx-backdrop {
  --bg: #050506;
  --bg-deep: #000;
  --bg-elevated: #08080a;
  --panel: #0b0b0d;
  --panel-2: #101013;
  --panel-3: #17171b;
  --raised: #1c1c21;

  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.12);
  --line-soft: rgba(255, 255, 255, 0.04);

  --text: #f4f4f6;
  --text-dim: #8f8f99;
  --text-mute: #5d5d67;

  --gold: #c9a961;
  --gold-soft: #e3c98d;
  --gold-deep: #8a6f2e;
  --green: #1fa363;
  --green-bright: #35c97f;

  --shadow: 0 30px 70px rgba(0, 0, 0, 0.7);
  --shadow-soft: 0 12px 32px rgba(0, 0, 0, 0.5);
  --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.04);

  color-scheme: dark;
  color: var(--text);
}

/* логотип нарисован на чёрном — в светлой теме берём версию без фона (src меняется в app.js) */
:root[data-theme="light"] .brand-mark {
  mix-blend-mode: normal;
  mask-image: none;
  -webkit-mask-image: none;
}

/* поверхности, заданные полупрозрачным белым, на светлом фоне не читаются */
:root[data-theme="light"] body:not(.game) .panel,
:root[data-theme="light"] body:not(.game) .card,
:root[data-theme="light"] body:not(.game) .topbar,
:root[data-theme="light"] body:not(.game) .sidebar,
:root[data-theme="light"] body:not(.game) .modal {
  background: var(--panel);
  border-color: var(--line);
}

:root[data-theme="light"] body:not(.game) .icon-btn,
:root[data-theme="light"] body:not(.game) .btn-ghost,
:root[data-theme="light"] body:not(.game) .control,
:root[data-theme="light"] body:not(.game) .chip-row button,
:root[data-theme="light"] body:not(.game) .filter-grid button {
  background: var(--bg-elevated);
  border-color: var(--line);
  color: var(--text);
}

:root[data-theme="light"] body:not(.game) .seg-row {
  background: var(--panel-2);
  border-color: var(--line);
}

:root[data-theme="light"] body:not(.game) .icon-btn:hover,
:root[data-theme="light"] body:not(.game) .btn-ghost:hover,
:root[data-theme="light"] body:not(.game) .seg-row button:hover,
:root[data-theme="light"] body:not(.game) .chip-row button:hover {
  background: var(--panel-3);
  color: var(--text);
}

:root[data-theme="light"] body:not(.game) .seg-row button {
  background: none;
  color: var(--text);
}

:root[data-theme="light"] body:not(.game) .seg-row button.on,
:root[data-theme="light"] body:not(.game) .chip-row button.on,
:root[data-theme="light"] body:not(.game) .filter-grid button.on {
  color: #fff;
  background: linear-gradient(180deg, #d81f3c, #b60e29);
  border-color: transparent;
}

/* светлая тема: поверхности, у которых цвет задан напрямую */

:root[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: rgba(16, 18, 27, 0.2);
}

:root[data-theme="light"] body:not(.game) .checkbox input,
:root[data-theme="light"] body:not(.game) .switch input,
:root[data-theme="light"] body:not(.game) .wallet-switch,
:root[data-theme="light"] body:not(.game) .notif.unread,
:root[data-theme="light"] body:not(.game) .data-table thead th,
:root[data-theme="light"] body:not(.game) .seats-track,
:root[data-theme="light"] body:not(.game) .qr-block,
:root[data-theme="light"] body:not(.game) .address-line,
:root[data-theme="light"] body:not(.game) .progress,
:root[data-theme="light"] body:not(.game) .auth-card,
:root[data-theme="light"] body:not(.game) .social {
  background: var(--panel-2);
  color: var(--text);
}

:root[data-theme="light"] body:not(.game) .checkbox input:checked {
  background: var(--red);
  border-color: var(--red);
}

:root[data-theme="light"] body:not(.game) .data-table tbody tr:hover,
:root[data-theme="light"] body:not(.game) .social:hover {
  background: var(--panel-3);
}

:root[data-theme="light"] body:not(.game) .wallet-tile,
:root[data-theme="light"] body:not(.game) .balance-tile,
:root[data-theme="light"] body:not(.game) .stat-tile,
:root[data-theme="light"] body:not(.game) .info-card,
:root[data-theme="light"] body:not(.game) .empty {
  background: var(--panel);
  border-color: var(--line);
  color: var(--text);
}

/* --- мобильное меню --- */
.nav-btn {
  display: none;
}

.nav-drawer {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(0, 0, 0, 0.62);
  opacity: 0;
  transition: opacity 0.18s ease;
}

.nav-drawer.open {
  opacity: 1;
}

.nav-sheet {
  position: absolute;
  top: 0;
  right: 0;
  width: min(320px, 86vw);
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow);
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.2s ease;
}

.nav-drawer.open .nav-sheet {
  transform: translateX(0);
}

.nav-sheet header {
  display: flex;
  align-items: center;
  gap: 11px;
}

.nav-sheet header img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
}

.nav-sheet header b {
  display: block;
  font-size: 14.5px;
}

.nav-sheet header span {
  font-size: 12.5px;
  color: var(--gold-soft);
}

.nav-sheet header .icon-btn {
  margin-left: auto;
}

.nav-sheet nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-sheet nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px;
  border-radius: 10px;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 550;
}

.nav-sheet nav a.active {
  color: var(--text);
  background: var(--panel-2);
  box-shadow: inset 3px 0 0 var(--red);
}

.nav-sheet nav a:active {
  background: var(--panel-3);
}

.nav-sheet > .btn {
  margin-top: auto;
}

@media (max-width: 1180px) {
  .nav-btn {
    display: grid;
  }
}

/* --- каркас страницы на время загрузки --- */
.skeleton-page {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sk {
  border-radius: var(--radius);
  background: linear-gradient(100deg, var(--panel) 20%, var(--panel-3) 40%, var(--panel) 60%);
  background-size: 220% 100%;
  animation: sk-sweep 1.3s ease-in-out infinite;
}

.sk-title {
  width: min(280px, 60%);
  height: 28px;
  border-radius: 9px;
}

.sk-line {
  width: min(420px, 80%);
  height: 14px;
  border-radius: 7px;
  margin-bottom: 6px;
}

.sk-card {
  height: 128px;
}

.sk-card:nth-child(3) {
  height: 190px;
}

@keyframes sk-sweep {
  from {
    background-position: 180% 0;
  }
  to {
    background-position: -40% 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sk {
    animation: none;
  }
  .nav-sheet,
  .nav-drawer {
    transition: none;
  }
}

/* --- шапка на телефонах: всё лишнее уезжает в меню, чтобы страница не ехала вбок --- */
@media (max-width: 620px) {
  .topbar {
    padding: 0 12px;
    gap: 10px;
  }

  .topbar-right {
    gap: 4px;
  }

  .topbar-right .icon-btn {
    width: 38px;
    min-width: 38px;
    height: 38px;
    min-height: 38px;
  }

  /* профиль уезжает в меню, а переключатель темы остаётся под рукой в шапке */
  .user-chip {
    display: none;
  }

  .wallet-pill {
    margin-left: -8px;
  }

  .brand-mark {
    height: 34px;
  }

  .brand-text {
    font-size: 17px;
  }

  .cashier-btn {
    height: 38px;
  }
}

@media (max-width: 400px) {
  .brand-text {
    font-size: 15px;
  }

  .brand-mark {
    height: 30px;
  }

  .topbar-right .icon-btn {
    width: 34px;
    min-width: 34px;
    height: 34px;
    min-height: 34px;
  }

  .topbar-right {
    gap: 2px;
  }
}

.nav-theme {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text-dim);
  font-size: 13.5px;
  font-weight: 550;
  width: 100%;
  cursor: pointer;
}

.nav-theme b {
  color: var(--text);
  font-weight: 600;
}

.nav-sheet nav .nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  background: none;
  border: 0;
  color: var(--text-dim);
  font: inherit;
  font-size: 14px;
  font-weight: 550;
  text-align: left;
  width: 100%;
  cursor: pointer;
}

/* мелкие ссылки-заголовки на тач-экранах получают нормальную зону нажатия */
@media (pointer: coarse) {
  .section-head .link {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 4px;
    margin-right: -4px;
  }
}

/* в светлой теме логотип остаётся на своей тёмной подложке — так он читается */
:root[data-theme="light"] .brand-mark {
  border-radius: 10px;
}

/* выбор языка в выезжающем меню */
.nav-langs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text-dim);
  font-size: 13.5px;
  font-weight: 550;
}

.nav-lang-row {
  display: flex;
  gap: 4px;
}

.nav-lang-row button {
  min-width: 38px;
  height: 30px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-3);
  color: var(--text-dim);
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}

.nav-lang-row button.on {
  color: var(--text);
  border-color: var(--red);
  background: linear-gradient(180deg, rgba(224, 32, 62, 0.2), rgba(224, 32, 62, 0.06));
}

/* значки в мобильном меню: каждая иконка на своей плашке, активный раздел светится */
.nav-sheet nav a,
.nav-sheet nav .nav-link {
  gap: 11px;
  padding: 7px 10px;
  transition: background 0.16s ease, color 0.16s ease;
}

.nav-ic {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 11px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.015));
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
  transition: color 0.16s ease, border-color 0.16s ease, box-shadow 0.2s ease, transform 0.12s ease;
}

.nav-sheet nav a:active .nav-ic,
.nav-sheet nav .nav-link:active .nav-ic {
  transform: scale(0.93);
}

.nav-sheet nav a:active,
.nav-sheet nav .nav-link:active {
  background: var(--panel-2);
  color: var(--text);
}

.nav-sheet nav a:active .nav-ic,
.nav-sheet nav .nav-link:active .nav-ic {
  color: var(--gold-soft);
  border-color: rgba(201, 169, 97, 0.45);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 14px rgba(201, 169, 97, 0.28);
}

.nav-sheet nav a.active .nav-ic {
  color: #fff;
  border-color: rgba(232, 48, 74, 0.6);
  background: linear-gradient(160deg, rgba(232, 48, 74, 0.85), rgba(139, 10, 31, 0.9));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    0 0 16px rgba(224, 32, 62, 0.45);
}

.nav-sheet nav a.active {
  color: var(--text);
  background: linear-gradient(90deg, rgba(224, 32, 62, 0.14), transparent 70%);
  box-shadow: none;
}

@media (hover: hover) {
  .nav-sheet nav a:hover .nav-ic,
  .nav-sheet nav .nav-link:hover .nav-ic {
    color: var(--gold-soft);
    border-color: rgba(201, 169, 97, 0.4);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.08),
      0 0 12px rgba(201, 169, 97, 0.22);
  }

  .nav-sheet nav a:hover,
  .nav-sheet nav .nav-link:hover {
    background: var(--panel-2);
    color: var(--text);
  }
}

:root[data-theme="light"] .nav-ic {
  background: linear-gradient(160deg, rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.015));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
