/* ==============================================
   RatioYT popup — blunt theme
   Solid colours only. No gradients. Chunky strokes.
   Labels sit left in each row; controls align right.
   ============================================== */

:root {
  /* Surfaces */
  --bg:         #000000;
  --surface:    #0e0e0e;
  --surface-2:  #1a1a1a;

  /* Strokes — chunky widths, softened colours so weight doesn't read harsh */
  --line:        #363636;
  --line-strong: #525252;
  --bw:          2px;

  /* Text — off-white, no glare on black */
  --text:  #ededed;
  --muted: #b8b8b8;
  --dim:   #949494;

  /* Solid accents */
  --blue:   #9cccff;
  --purple: #aa55ff;
  --red:    #ec3750;
  --green:  #55ff7f;
  --yellow: #ffd23f;

  /* Radii */
  --r-xs: 10px;
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 20px;

  /* Mirrored gutter is gone — labels sit left again, controls right. */

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

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

body {
  min-height: 100vh;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.4;
  user-select: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Wrapper ── */

.popup {
  width: 320px;
  max-width: 100%;
  padding: 12px 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── Header ── */

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

.header-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.connection-badge {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 2px 7px;
  border-radius: var(--r-xs);
  background: var(--surface-2);
  color: var(--dim);
  border: 1px solid var(--line);
  line-height: 1.2;
}

.connection-badge.connected-ext {
  color: var(--green);
  border-color: rgba(85, 255, 127, 0.4);
  background: rgba(85, 255, 127, 0.08);
}

.connection-badge.connected-user {
  color: var(--yellow);
  border-color: rgba(255, 210, 63, 0.4);
  background: rgba(255, 210, 63, 0.08);
}

.logo {
  height: 34px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
}

h1 {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.subtitle {
  font-size: 13px;
  font-weight: 600;
  color: var(--dim);
  margin-top: 2px;
}

/* ── Cards ── */

.content {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface);
  border: var(--bw) solid var(--line);
  border-radius: var(--r-lg);
  padding: 11px 12px;
  text-align: left;
}

.section-label {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: var(--blue);
}

/* ── Rows ── */

.label {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.hint {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  margin-top: 2px;
}

/* Label left, control right. */
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.row > div {
  min-width: 0;
}

/* ── Select ── */

.select-wrap {
  position: relative;
}

select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background: var(--bg);
  color: var(--text);
  border: var(--bw) solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 7px 30px 7px 14px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  outline: none;
  transition: border-color 140ms ease-out;
}

select:hover { border-color: var(--blue); }
select:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; }
.chevron {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--muted);
}

/* ── Toggle ── */

.toggle {
  position: relative;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
  cursor: pointer;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.track {
  position: absolute;
  inset: 0;
  background: var(--bg);
  border: var(--bw) solid var(--line-strong);
  border-radius: 9px;
  transition: background-color 160ms ease-out, border-color 160ms ease-out;
}

.thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 5px;
  background: var(--line-strong);
  transition: transform 160ms cubic-bezier(.2, .8, .2, 1), background-color 160ms ease-out;
}

.toggle input:checked ~ .track {
  background: var(--green);
  border-color: var(--green);
}

.toggle input:checked ~ .track .thumb {
  transform: translateX(20px);
  background: var(--bg);
}

.toggle input:focus-visible ~ .track {
  outline: 2px solid var(--yellow);
  outline-offset: 2px;
}

/* ── Threshold panel ── */

.nested {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
}

.threshold-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.pill {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--bg);
  background: var(--yellow);
  padding: 3px 10px;
  border-radius: var(--r-xs);
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 24px;
  background: var(--bg);
  border: var(--bw) solid var(--line-strong);
  border-radius: var(--r-xs);
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 100%;
  background: transparent;
  border: none;
  border-radius: inherit;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 6px;
  background: var(--yellow);
  border: none;
  margin-top: 1px;
  cursor: pointer;
}

input[type="range"]::-moz-range-track {
  height: 100%;
  background: transparent;
  border: none;
  border-radius: inherit;
}

input[type="range"]::-moz-range-progress {
  background: transparent;
  border: none;
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  background: var(--yellow);
  border: none;
  cursor: pointer;
}

input[type="range"]:focus-visible {
  outline: 2px solid var(--yellow);
  outline-offset: 3px;
}

.ticks {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 500;
  color: var(--dim);
}

/* ── Footer ── */

.links {
  display: flex;
  gap: 10px;
  width: 100%;
}

.links a {
  flex: 1;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  text-decoration: none;
  padding: 9px 6px;
  border-radius: var(--r-sm);
  background: var(--bg);
  border: var(--bw) solid var(--line-strong);
  transition: color 140ms ease-out, border-color 140ms ease-out, background-color 140ms ease-out;
}

.links a:hover {
  color: var(--blue);
  border-color: var(--blue);
}

.links a.donate {
  background: var(--red);
  border-color: var(--red);
  color: var(--bg);
}

.links a.donate:hover {
  background: var(--bg);
  border-color: var(--red);
  color: var(--red);
}

/* ── Utility ── */

.hidden { display: none !important; }
