/* Light is the base. Dark kicks in from the system setting or the toggle.
   To change the accent everywhere, change --accent (and --accent-text) in both themes. */
:root {
  --bg: #f5f4f0;
  --surface: #ffffff;
  --surface-2: #efede7;
  --line: #dddad1;
  --text: #16150f;
  --muted: #676458;
  --accent: #b8870f;
  --accent-text: #16150f;
  --on-accent: #16150f;
  --good: #1a7f37;
  --bad: #c62a2a;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0a09;
    --surface: #141412;
    --surface-2: #1c1c19;
    --line: #2b2a26;
    --text: #efede6;
    --muted: #9c998e;
    --accent: #e3b341;
    --accent-text: #e3b341;
    --on-accent: #0a0a09;
    --good: #4cc27a;
    --bad: #f0605d;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0a0a09;
  --surface: #141412;
  --surface-2: #1c1c19;
  --line: #2b2a26;
  --text: #efede6;
  --muted: #9c998e;
  --accent: #e3b341;
  --accent-text: #e3b341;
  --on-accent: #0a0a09;
  --good: #4cc27a;
  --bad: #f0605d;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 500 16px/1.5 "Barlow", system-ui, sans-serif;
}

h1,
legend,
.big-label {
  font-family: "Barlow Condensed", "Barlow", sans-serif;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* header */

.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 16px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 8px;
}

.top h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.01em;
}

.top p {
  margin: 8px 0 0;
  color: var(--muted);
  max-width: 60ch;
}

.theme-toggle {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}

.theme-toggle button {
  border: 0;
  padding: 6px 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
}

.theme-toggle button[aria-pressed="true"] {
  background: var(--surface-2);
  color: var(--text);
}

/* two columns: settings on the left, preview sticks on the right */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 24px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 24px 48px;
  align-items: start;
}

.side {
  position: sticky;
  top: 16px;
  display: grid;
  gap: 16px;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .side {
    position: static;
    order: -1;
  }
}

/* settings groups */

#settings {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.group {
  margin: 0;
  padding: 16px 18px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  min-width: 0;
}

.group legend {
  padding: 0 6px;
  margin-left: -6px;
  font-size: 1.3rem;
  font-weight: 700;
}

.big-label {
  display: block;
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.field {
  display: grid;
  grid-template-columns: 1fr minmax(0, 11rem);
  align-items: center;
  gap: 12px;
  padding: 6px 0;
}

.field.stacked {
  grid-template-columns: 1fr;
  gap: 8px;
}

.field > label,
.field-title {
  font-weight: 600;
}

.field.check {
  display: flex;
  gap: 10px;
  cursor: pointer;
}

input[type="text"],
input[type="number"],
select {
  width: 100%;
  font: inherit;
  color: inherit;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
  border-color: var(--accent);
  outline: none;
}

input[type="color"] {
  width: 100%;
  height: 38px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  cursor: pointer;
}

input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--accent);
  width: 17px;
  height: 17px;
  margin: 0;
}

.hint {
  margin: 8px 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

#link-status[data-ok="yes"] {
  color: var(--good);
  font-weight: 600;
}

#link-status[data-ok="no"] {
  color: var(--bad);
  font-weight: 600;
}

/* stat checkboxes as toggle chips */

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

.pill {
  position: relative;
  cursor: pointer;
}

.pill input {
  position: absolute;
  opacity: 0;
}

.pill span {
  display: inline-block;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.95rem;
  background: var(--surface-2);
  color: var(--muted);
  user-select: none;
}

.pill:hover span {
  color: var(--text);
}

.pill input:checked + span {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.pill input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* color theme buttons show the overlay colors they apply */

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

.preset {
  font: 700 1rem "Barlow Condensed", sans-serif;
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #2a2926;
  color: var(--swatch);
  text-shadow: 1px 2px 0 var(--swatch-shadow);
  cursor: pointer;
}

.preset:hover {
  border-color: var(--accent);
}

/* buttons */

button {
  font: inherit;
  cursor: pointer;
}

.primary {
  font-weight: 700;
  padding: 8px 16px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: var(--on-accent);
  white-space: nowrap;
}

.primary:hover {
  filter: brightness(1.08);
}

.primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: none;
}

.quiet {
  font-weight: 600;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
}

.quiet:hover {
  border-color: var(--accent);
}

#reset {
  margin-top: 16px;
}

/* the preview: overlay on top of a game screenshot */

.stage {
  position: relative;
  aspect-ratio: 16 / 10;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

/* gameplay screenshot, with the old painted field underneath while it loads */
.stage[data-bg="game"] {
  background:
    url("../sample%20gamplay.jpg") center / cover no-repeat,
    radial-gradient(ellipse at 70% 110%, #7d7a3a 0 22%, transparent 45%),
    linear-gradient(180deg, #9fb7c4 0%, #c4cfc6 38%, #7f8a5a 39%, #6c7449 60%, #8a7a55 100%);
}

.stage[data-bg="dark"] {
  background: #111110;
}

.stage[data-bg="light"] {
  background: #f1f1f1;
}

/* the overlay is drawn at real size and shrunk, roughly how it'll look on a 1080p stream */
.stage iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: calc(100% / 0.55);
  height: calc(100% / 0.55);
  transform: scale(0.55);
  transform-origin: top left;
  border: 0;
  background: transparent;
  color-scheme: normal;
}

.stage-tools {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.bg-picker {
  display: flex;
  align-items: center;
  gap: 14px;
  border: 0;
  margin: 0;
  padding: 0;
}

.bg-picker legend {
  float: left;
  margin-right: 4px;
  font: 600 0.95rem "Barlow", sans-serif;
}

.bg-picker label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

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

.copy-row input {
  font-size: 0.9rem;
}

/* thanks + socials box under the OBS link */

.shout h2 {
  margin: 0;
}

.shout p {
  margin: 0 0 12px;
  color: var(--muted);
}

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

/* each link gets a stripe in its brand color */
.social {
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}

.font-pick {
  display: grid;
  gap: 6px;
}

.social:hover {
  border-color: var(--brand);
}

.discord { --brand: #5865f2; }
.twitch { --brand: #9146ff; }
.youtube { --brand: #ff0033; }
