:root {
  --bg: #101214;
  --surface: #181c20;
  --surface-2: #20262b;
  --line: #2f373e;
  --text: #f4f7f9;
  --muted: #99a6b2;
  --accent: #3cc28a;
  --blue: #5aa9ff;
  --yellow: #ffc857;
  --red: #ff5c5c;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(120deg, rgba(60, 194, 138, 0.12), transparent 28%),
    linear-gradient(240deg, rgba(90, 169, 255, 0.12), transparent 26%),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.shell {
  width: min(1360px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.topbar {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.language-toggle {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
}

[hidden] {
  display: none !important;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 34px;
  line-height: 1.1;
}

h2 {
  font-size: 18px;
}

h3 {
  font-size: 15px;
  margin-bottom: 10px;
}

p {
  color: var(--muted);
  line-height: 1.5;
}

.grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 18px;
  align-items: start;
}

.auth-wrap {
  min-height: calc(100vh - 140px);
  display: grid;
  place-items: center;
}

.auth-panel {
  width: min(440px, 100%);
  display: grid;
  gap: 16px;
}

.auth-form {
  display: grid;
  gap: 12px;
}

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

.hint {
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 12px;
  line-height: 1.5;
}

.main-col,
.split {
  display: grid;
  gap: 18px;
}

.split {
  grid-template-columns: 1fr 1fr;
}

.panel {
  background: rgba(24, 28, 32, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.setup-panel {
  position: sticky;
  top: 18px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  margin-bottom: 16px;
}

.status,
.counter {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  white-space: nowrap;
}

.status.ok {
  color: #9ff0c9;
  border-color: rgba(60, 194, 138, 0.5);
}

.status.fail {
  color: #ffaaaa;
  border-color: rgba(255, 92, 92, 0.5);
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.field span,
.secret-box span,
dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #11161a;
  color: var(--text);
  padding: 0 12px;
  outline: 0;
}

input:focus {
  border-color: var(--blue);
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  padding-right: 48px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 5px;
  width: 36px;
  height: 34px;
  transform: translateY(-50%);
  border-radius: 5px;
  background: transparent;
}

.password-toggle::before {
  content: "";
  position: absolute;
  top: 10px;
  left: 8px;
  width: 18px;
  height: 12px;
  transform: rotate(-1deg);
  border: 2px solid var(--muted);
  border-radius: 70% 20% / 70% 20%;
}

.password-toggle::after {
  content: "";
  position: absolute;
  top: 14px;
  left: 15px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
}

.password-toggle.visible::before {
  border-color: var(--blue);
}

.password-toggle.visible::after {
  background: var(--blue);
}

.primary,
.secondary,
.chip,
.color-button {
  min-height: 40px;
  border-radius: 6px;
  padding: 0 14px;
  color: var(--text);
  font-weight: 700;
}

.primary {
  background: var(--accent);
  color: #06130d;
}

.secondary,
.chip {
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.danger {
  background: rgba(255, 92, 92, 0.13);
  border: 1px solid rgba(255, 92, 92, 0.45);
  color: #ffb5b5;
}

.full {
  width: 100%;
}

.facts {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}

.facts div,
.secret-box,
.item {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  border-radius: 8px;
  padding: 12px;
}

dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
}

code {
  color: #d7fbe8;
  background: #0b0f12;
  border: 1px solid #263036;
  border-radius: 5px;
  padding: 2px 6px;
}

hr {
  height: 1px;
  border: 0;
  background: var(--line);
  margin: 18px 0;
}

.secret-box {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.secret-box code {
  display: block;
  overflow-wrap: anywhere;
}

.steps {
  margin-top: 18px;
}

.pairing-launcher {
  display: grid;
  gap: 12px;
}

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

.pairing-wizard-head h3 {
  margin: 0;
}

.service-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #66717a;
  box-shadow: 0 0 0 4px rgba(102, 113, 122, 0.16);
}

.service-dot.ready {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(60, 194, 138, 0.16);
}

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

.pairing-progress div {
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.pairing-progress span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #11161a;
  font-size: 12px;
  font-weight: 800;
}

.pairing-progress div.active span {
  border-color: var(--blue);
  color: #dcebff;
}

.pairing-progress div.done {
  color: #bff4d9;
}

.pairing-progress div.done span {
  border-color: var(--accent);
  background: var(--accent);
  color: #06130d;
}

.pairing-expiry {
  min-height: 18px;
  font-size: 12px;
  text-align: center;
}

body.modal-open {
  overflow: hidden;
}

.modal-backdrop {
  position: fixed;
  z-index: 50;
  inset: 0;
  padding: 18px;
  display: grid;
  place-items: center;
  background: rgba(3, 6, 8, 0.82);
}

.pairing-modal {
  width: min(920px, 100%);
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.58);
}

.pairing-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.pairing-modal-head h2 {
  font-size: 24px;
}

.icon-button {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text);
  font-size: 26px;
  line-height: 1;
}

.settings-trigger {
  font-size: 21px;
}

.settings-modal {
  width: min(1100px, 100%);
}

.pairing-modal .pairing-progress {
  margin-bottom: 18px;
}

.pairing-video-stage {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b0f12;
}

.pairing-modal-body {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(250px, 0.75fr);
  gap: 20px;
  align-items: stretch;
}

.pairing-modal-side {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.pairing-video-stage video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.pairing-video-placeholder {
  padding: 24px;
  display: grid;
  justify-items: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
}

.pairing-video-placeholder strong {
  color: var(--text);
  font-size: 18px;
}

.pairing-step-copy {
  min-height: 130px;
  padding-left: 14px;
  display: grid;
  align-content: center;
  gap: 6px;
  border-left: 3px solid var(--blue);
}

.pairing-step-copy strong {
  font-size: 18px;
}

.pairing-step-copy p {
  margin: 0;
}

.pairing-modal-actions {
  margin-top: auto;
  display: flex;
  align-items: stretch;
  flex-direction: column;
  justify-content: flex-end;
  gap: 10px;
}

ol {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.65;
}

.color-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-top: 1px solid var(--line);
}

.settings-grid-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.settings-group {
  min-width: 0;
  padding: 20px 22px 4px 0;
  display: grid;
  align-content: start;
  gap: 16px;
}

.settings-group + .settings-group {
  padding-right: 0;
  padding-left: 22px;
  border-left: 1px solid var(--line);
}

.settings-group h3 {
  margin: 0 0 5px;
  font-size: 16px;
}

.control-label {
  color: var(--text);
  font-size: 13px;
}

.setting-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.setting-title-row h3 {
  margin: 0;
}

#idleModeControls {
  display: grid;
  gap: 16px;
  transition: opacity 160ms ease;
}

#idleModeControls.disabled {
  opacity: 0.4;
  pointer-events: none;
}

.switch {
  position: relative;
  width: 42px;
  height: 24px;
  flex: 0 0 42px;
}

.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch span {
  position: absolute;
  inset: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #11161a;
  cursor: pointer;
}

.switch span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 160ms ease, background 160ms ease;
}

.switch input:checked + span {
  border-color: var(--accent);
  background: rgba(60, 194, 138, 0.18);
}

.switch input:checked + span::after {
  transform: translateX(18px);
  background: var(--accent);
}

.color-picker-field {
  min-height: 52px;
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 12px;
}

.color-picker-field input[type="color"] {
  width: 48px;
  height: 48px;
  padding: 3px;
  border-radius: 6px;
  cursor: pointer;
}

.color-picker-field span {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  text-transform: none;
}

.color-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.color-presets button {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 2px solid #11161a;
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--line);
}

.color-presets button.active {
  box-shadow: 0 0 0 2px var(--blue);
}

.effect-control {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.effect-control button {
  min-width: 0;
  min-height: 42px;
  padding: 6px 8px;
  border: 0;
  border-left: 1px solid var(--line);
  background: #11161a;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.effect-control button:first-child {
  border-left: 0;
}

.effect-control button.active {
  background: var(--blue);
  color: #06111d;
}

.effect-control-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.settings-footer {
  display: flex;
  justify-content: flex-end;
  padding-top: 20px;
  margin-top: 18px;
  border-top: 1px solid var(--line);
}

.settings-footer .primary {
  min-width: 260px;
}

.color-button.green {
  background: var(--accent);
  color: #06130d;
}

.color-button.yellow {
  background: var(--yellow);
  color: #151006;
}

.color-button.red {
  background: var(--red);
  color: #210707;
}

.color-button.off {
  background: #56616b;
}

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

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

.device-card.online {
  border-color: rgba(60, 194, 138, 0.7);
}

.device-card.offline {
  border-color: rgba(255, 92, 92, 0.7);
}

.item-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

#espSetupFields {
  margin-top: 12px;
}

.meta {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.device-status {
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  padding: 5px 9px;
}

.device-status.online {
  color: #3cc28a;
}

.device-status.offline {
  color: #ff5c5c;
}

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.server-data {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.slot-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.slot-card {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 8px;
  min-width: 0;
}

.slot-card.ready {
  border-color: rgba(60, 194, 138, 0.55);
}

.slot-badge {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  display: inline-block;
}

.slot-badge.green {
  background: var(--accent);
}

.slot-badge.yellow {
  background: var(--yellow);
}

.slot-badge.red {
  background: var(--red);
}

.slot-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
}

.chip.active {
  outline: 2px solid var(--blue);
}

.chip.green {
  color: #9ff0c9;
}

.chip.yellow {
  color: #ffe08b;
}

.chip.red {
  color: #ffaaaa;
}

.empty {
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  text-align: center;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 36px));
  border-radius: 8px;
  background: #eefaf4;
  color: #092016;
  padding: 14px 16px;
  box-shadow: var(--shadow);
  font-weight: 700;
}

@media (max-width: 980px) {
  .grid,
  .split {
    grid-template-columns: 1fr;
  }

  .setup-panel {
    position: static;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .settings-group,
  .settings-group + .settings-group {
    padding: 20px 0;
    border-left: 0;
  }

  .settings-group + .settings-group {
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 620px) {
  .shell {
    width: min(100vw - 20px, 1360px);
    padding-top: 12px;
  }

  .topbar {
    align-items: center;
  }

  .top-actions {
    flex: 0 0 auto;
  }

  .topbar h1 {
    font-size: 28px;
  }

  .topbar .eyebrow {
    font-size: 10px;
  }

  .color-actions {
    grid-template-columns: 1fr 1fr;
  }

  .effect-control {
    grid-template-columns: 1fr 1fr;
  }

  .effect-control button:nth-child(3) {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .effect-control button:nth-child(4) {
    border-top: 1px solid var(--line);
  }

  .effect-control-three button:nth-child(3) {
    grid-column: 1 / -1;
  }

  .settings-footer .primary {
    width: 100%;
    min-width: 0;
  }

  .slot-grid {
    grid-template-columns: 1fr;
  }

  .modal-backdrop {
    padding: 0;
    place-items: end center;
  }

  .pairing-modal {
    width: 100%;
    max-height: 94vh;
    padding: 18px 14px;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 8px 8px 0 0;
  }

  .pairing-modal .pairing-progress {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .pairing-modal-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .pairing-modal-body {
    grid-template-columns: 1fr;
  }

  .pairing-step-copy {
    min-height: 76px;
  }

  .pairing-modal-actions {
    margin-top: 18px;
  }
}

.rustplus-profile-card {
  margin: 14px 0 18px;
  padding: 14px;
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
}

.rustplus-profile-card.ready {
  border-color: rgba(60, 194, 138, 0.55);
}

.rustplus-profile-card strong {
  display: block;
  margin-bottom: 4px;
}

.rustplus-profile-card p,
.rustplus-profile-card small {
  margin: 0;
  color: var(--muted);
}

/* Rust+ Steam authorization rendered inside the personal account. */
.rustplus-browser {
  width: 100%;
  height: 100%;
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  background: #080b0e;
}

.rustplus-browser[hidden] {
  display: none;
}

.rustplus-browser-toolbar {
  min-height: 42px;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: #11161a;
  color: var(--muted);
  font-size: 12px;
}

.rustplus-browser-toolbar > div {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
}

.rustplus-browser-toolbar strong {
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.service-dot.error {
  background: #ff5f57;
  box-shadow: 0 0 0 4px rgba(255, 95, 87, 0.16);
}

.rustplus-browser-screen {
  position: relative;
  touch-action: none;
  min-height: 0;
  overflow: hidden;
  outline: none;
  background: #fff;
  cursor: default;
}

.rustplus-browser-screen:focus-visible {
  box-shadow: inset 0 0 0 2px var(--blue);
}

.rustplus-browser-screen canvas {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #fff;
  user-select: none;
}

.rustplus-browser-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #0b0f12;
  color: var(--muted);
  text-align: center;
}

.rustplus-browser-loading[hidden] {
  display: none;
}


.rustplus-mobile-input {
  display: none;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  padding: 9px;
  border-top: 1px solid var(--line);
  background: #11161a;
}

.rustplus-mobile-input input {
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #080b0e;
  color: var(--text);
}

.rustplus-browser-note {
  margin: 0;
  padding: 8px 12px;
  border-top: 1px solid var(--line);
  background: #0d1216;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.rustplus-profile-card .row-actions {
  flex-wrap: wrap;
}

@media (max-width: 720px) {
  .rustplus-browser {
    grid-template-rows: auto minmax(340px, 1fr) auto auto;
  }

  .rustplus-mobile-input {
    display: grid;
  }

  .rustplus-browser-toolbar {
    min-height: 38px;
    padding: 7px 9px;
  }

  .rustplus-browser-note {
    display: none;
  }
}
