:root {
  --bg-0: #0f1519;
  --bg-1: #172026;
  --bg-2: #233038;
  --card: #2a373f;
  --card-soft: #33434c;
  --panel: #3a4c56;
  --text: #ebf2f4;
  --muted: #b6c4ca;
  --border: #53636d;
  --primary: #d1913d;
  --primary-strong: #b97725;
  --accent: #73b4ce;
  --accent-strong: #5f98b0;
  --success: #4cae7a;
  --error: #ce6662;
  --info: #6da5cf;
  --shadow: 0 20px 40px rgba(4, 8, 10, 0.45);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(1000px 520px at -6% -5%, rgba(126, 168, 189, 0.2) 0%, transparent 65%),
    radial-gradient(900px 500px at 110% -10%, rgba(209, 145, 61, 0.2) 0%, transparent 65%),
    linear-gradient(160deg, var(--bg-0) 0%, var(--bg-1) 45%, var(--bg-0) 100%),
    url("./assets/topo-lines.svg"),
    url("./assets/grit.svg");
  background-size: auto, auto, cover, 320px 320px, 120px 120px;
  background-blend-mode: screen, screen, normal, soft-light, overlay;
  color: var(--text);
  font-family: "Rajdhani", "Segoe UI", sans-serif;
  line-height: 1.4;
  padding: 28px 16px 42px;
}

.bg-orb {
  position: fixed;
  border-radius: 50%;
  z-index: -1;
  pointer-events: none;
  filter: blur(6px);
}

.orb-a {
  width: 420px;
  height: 420px;
  left: -120px;
  bottom: -110px;
  background: radial-gradient(circle, rgba(115, 180, 206, 0.22) 0%, rgba(115, 180, 206, 0) 75%);
}

.orb-b {
  width: 420px;
  height: 420px;
  right: -120px;
  top: 28%;
  background: radial-gradient(circle, rgba(209, 145, 61, 0.2) 0%, rgba(209, 145, 61, 0) 75%);
}

.app-shell {
  max-width: 1160px;
  margin: 0 auto;
  background:
    linear-gradient(180deg, rgba(63, 79, 89, 0.35) 0%, rgba(28, 37, 43, 0.35) 100%),
    linear-gradient(140deg, rgba(46, 61, 70, 0.94) 0%, rgba(28, 38, 45, 0.95) 100%);
  border: 1px solid color-mix(in srgb, var(--border) 80%, #8a99a1 20%);
  border-radius: 24px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  padding: 22px;
  animation: rise-in 360ms ease-out both;
}

.edge-links {
  position: fixed;
  bottom: 20px;
  display: flex;
  flex-direction: row;
  gap: 8px;
  z-index: 5;
}

.edge-links-left {
  left: clamp(10px, 1.8vw, 24px);
  align-items: flex-start;
}

.edge-links-right {
  right: clamp(10px, 1.8vw, 24px);
  align-items: flex-end;
}

.edge-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--border) 82%, #8fa0a9 18%);
  background:
    linear-gradient(180deg, rgba(51, 66, 76, 0.9) 0%, rgba(38, 51, 59, 0.9) 100%);
  color: #dfeef5;
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.025em;
  text-decoration: none;
  text-transform: uppercase;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
  transition: transform 140ms ease, border-color 140ms ease, color 140ms ease;
}

.edge-link-icon {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  margin-right: 6px;
  display: inline-block;
}

.edge-link:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 62%, #d8e8ef 38%);
  color: #f2fbff;
}

.edge-link:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 74%, #f0fbff 26%);
  outline-offset: 2px;
}

@keyframes rise-in {
  from {
    transform: translateY(12px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.hero {
  position: relative;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--border) 76%, #9eacb3 24%);
  border-radius: 16px;
  padding: 16px 128px 14px 18px;
  background:
    linear-gradient(110deg, rgba(115, 180, 206, 0.2) 0%, rgba(115, 180, 206, 0) 40%),
    linear-gradient(125deg, rgba(209, 145, 61, 0.26) 0%, rgba(209, 145, 61, 0) 55%),
    linear-gradient(180deg, rgba(53, 68, 78, 0.9) 0%, rgba(35, 46, 54, 0.9) 100%);
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url("./assets/grit.svg");
  opacity: 0.2;
  pointer-events: none;
}

.hero h1 {
  position: relative;
  margin: 0;
  font-size: clamp(1.8rem, 2.9vw, 2.55rem);
  letter-spacing: 0.055em;
  text-transform: uppercase;
  line-height: 1.02;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

.hero p {
  position: relative;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 1rem;
}

.hero-logo-badge {
  position: absolute;
  top: 50%;
  right: 18px;
  transform: translateY(-50%);
  display: block;
  z-index: 2;
  pointer-events: none;
}

.hero-logo {
  width: 86px;
  height: 86px;
  border-radius: 16px;
  display: block;
}

.upload-zone {
  margin-top: 16px;
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}

.upload-card {
  border: 1px solid color-mix(in srgb, var(--border) 84%, #7a8891 16%);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(61, 77, 88, 0.85) 0%, rgba(42, 56, 65, 0.85) 100%);
  padding: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.upload-card h2 {
  margin: 0;
  font-size: 1.08rem;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.upload-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 6px;
}

.upload-card p {
  margin: 0 0 10px;
  color: var(--muted);
}

.upload-card-wide {
  grid-column: 1 / -1;
}

.folder-choice-wrap {
  margin-top: 10px;
}

.folder-choice-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.folder-choice-btn {
  padding: 7px 10px;
  font-size: 0.88rem;
}

.folder-choice-btn.active {
  background: linear-gradient(180deg, rgba(115, 180, 206, 0.4) 0%, rgba(95, 152, 176, 0.3) 100%);
  border-color: color-mix(in srgb, var(--accent) 70%, #d8e8f1 30%);
  color: #f2fbff;
}

.meta {
  margin-top: 10px;
  font-size: 0.88rem;
  color: color-mix(in srgb, var(--muted) 88%, #eaf4f7 12%);
  overflow-wrap: anywhere;
  word-break: break-word;
  font-family: "Space Mono", monospace;
}

.download-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.status {
  margin-top: 12px;
  border-radius: 10px;
  border: 1px solid;
  padding: 10px 12px;
  font-family: "Space Mono", monospace;
  font-size: 0.86rem;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.status.info {
  background: rgba(109, 165, 207, 0.18);
  color: #d7ebfa;
  border-color: rgba(109, 165, 207, 0.56);
}

.status.success {
  background: rgba(76, 174, 122, 0.18);
  color: #d8f6e4;
  border-color: rgba(76, 174, 122, 0.52);
}

.status.error {
  background: rgba(206, 102, 98, 0.2);
  color: #ffe4e2;
  border-color: rgba(206, 102, 98, 0.5);
}

.tab-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.tab-btn {
  flex: 1 1 140px;
  border: 1px solid color-mix(in srgb, var(--border) 88%, #7c8a92 12%);
  background:
    linear-gradient(180deg, rgba(64, 82, 93, 0.88) 0%, rgba(48, 63, 72, 0.88) 100%);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 9px;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease, transform 140ms ease;
}

.tab-btn:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 58%, #d5e5eb 42%);
}

.tab-btn.active {
  background:
    linear-gradient(180deg, rgba(209, 145, 61, 0.38) 0%, rgba(154, 101, 33, 0.36) 100%);
  border-color: color-mix(in srgb, var(--primary) 72%, #f3dec2 28%);
  color: #fff2de;
}

.tab-panel {
  display: none;
  border: 1px solid color-mix(in srgb, var(--border) 86%, #83919a 14%);
  border-radius: 14px;
  margin-top: 12px;
  padding: 16px;
  background:
    linear-gradient(180deg, rgba(60, 77, 88, 0.86) 0%, rgba(44, 57, 66, 0.92) 100%);
  animation: panel-in 220ms ease-out both;
}

.tab-panel.active {
  display: block;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tab-panel h3 {
  margin: 0;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 10px;
  flex-wrap: wrap;
}

.tab-callouts {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tab-note {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.tab-note-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--accent) 66%, #dcebf3 34%);
  background: rgba(93, 145, 169, 0.22);
  color: #e5f5fc;
  font-family: "Space Mono", monospace;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}

.tab-note.is-warning .tab-note-btn {
  border-color: color-mix(in srgb, var(--primary) 64%, #f0d3aa 36%);
  background: rgba(209, 145, 61, 0.24);
  color: #fff0dd;
}

.tab-note-popover {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 230px;
  max-width: min(360px, 82vw);
  border: 1px solid color-mix(in srgb, var(--border) 90%, #7b8a92 10%);
  border-radius: 10px;
  background: rgba(29, 38, 44, 0.97);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.4);
  padding: 9px;
  color: #d9e7ee;
  font-size: 0.82rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: break-word;
  z-index: 6;
}

.tab-note.is-warning .tab-note-popover {
  border-color: color-mix(in srgb, var(--primary) 60%, #897057 40%);
  color: #ffead1;
}

.tab-note:hover .tab-note-popover,
.tab-note:focus-within .tab-note-popover {
  display: block;
}

#panel-money {
  position: relative;
  padding-bottom: 52px;
}

.help {
  margin: 6px 0 0;
  color: var(--muted);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.objectives-search-grid {
  grid-template-columns: 1fr;
  margin-bottom: 8px;
}

.objectives-filter-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-grid label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-weight: 600;
}

.form-grid input[type="number"],
.form-grid input[type="text"],
.form-grid select,
.selector-section input[type="text"] {
  width: 100%;
  border: 1px solid color-mix(in srgb, var(--border) 88%, #6e7d86 12%);
  border-radius: 10px;
  padding: 9px 10px;
  font: inherit;
  background: color-mix(in srgb, var(--bg-1) 72%, #1f2a30 28%);
  color: var(--text);
}

.form-grid input:focus,
.form-grid select:focus,
.selector-section input[type="text"]:focus,
.stat-row input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 70%, #cddde6 30%);
  box-shadow: 0 0 0 2px rgba(115, 180, 206, 0.22);
}

.checkbox-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0 12px;
  font-weight: 600;
  color: var(--muted);
}

.share-optin-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 4px;
  width: fit-content;
}

.share-optin-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: #dbe8ee;
  letter-spacing: 0.01em;
  user-select: none;
  cursor: pointer;
}

.share-optin-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

.share-optin-note {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.share-optin-note-btn {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 72%, #d8ecf7 28%);
  background: rgba(39, 55, 64, 0.94);
  color: #d5edf8;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: help;
}

.share-optin-popover {
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  min-width: 270px;
  max-width: min(360px, 80vw);
  border: 1px solid color-mix(in srgb, var(--border) 76%, #9badb6 24%);
  border-radius: 10px;
  background: rgba(27, 38, 45, 0.96);
  color: #e1edf3;
  font-size: 0.88rem;
  padding: 10px 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: break-word;
  box-shadow: 0 14px 28px rgba(4, 8, 11, 0.45);
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  transition: opacity 130ms ease, transform 130ms ease;
  z-index: 4;
}

.share-optin-note:hover .share-optin-popover,
.share-optin-note:focus-within .share-optin-popover {
  opacity: 1;
  transform: translateY(0);
}

.time-toggle-field {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-weight: 600;
}

.time-toggle-field > span {
  line-height: 1.2;
}

.time-toggle-box {
  min-height: 42px;
  border: 1px solid color-mix(in srgb, var(--border) 88%, #6e7d86 12%);
  border-radius: 10px;
  background: color-mix(in srgb, var(--bg-1) 72%, #1f2a30 28%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
}

.time-toggle-box input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border: 1px solid color-mix(in srgb, var(--border) 85%, #8a979f 15%);
  border-radius: 5px;
  background: color-mix(in srgb, var(--bg-2) 72%, #1f2a30 28%);
  cursor: pointer;
  position: relative;
}

.time-toggle-box input[type="checkbox"]:checked {
  background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 90%, #ffca88 10%) 0%, var(--primary-strong) 100%);
  border-color: color-mix(in srgb, var(--primary-strong) 85%, #efc995 15%);
}

.time-toggle-box input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 2px;
  width: 5px;
  height: 11px;
  border: solid #fff4e4;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.time-toggle-box input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(115, 180, 206, 0.22);
}

.btn {
  appearance: none;
  border: 1px solid color-mix(in srgb, var(--border) 84%, #88959d 16%);
  background:
    linear-gradient(180deg, rgba(91, 109, 120, 0.9) 0%, rgba(68, 84, 95, 0.9) 100%);
  color: #f1f7fa;
  border-radius: 10px;
  padding: 9px 13px;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 140ms ease, filter 140ms ease, border-color 140ms ease;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 5px 12px rgba(0, 0, 0, 0.22);
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.btn:disabled {
  opacity: 0.44;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 90%, #ffca88 10%) 0%, var(--primary-strong) 100%);
  border-color: color-mix(in srgb, var(--primary-strong) 85%, #efc995 15%);
  color: #fff4e4;
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.08);
}

.btn-accent {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 92%, #b9d6e5 8%) 0%, var(--accent-strong) 100%);
  border-color: color-mix(in srgb, var(--accent-strong) 86%, #d5e8f2 14%);
  color: #f3fbff;
}

.selector-root {
  border: 1px solid color-mix(in srgb, var(--border) 84%, #73828b 16%);
  border-radius: 12px;
  background: rgba(45, 59, 68, 0.74);
  padding: 12px;
  margin-bottom: 12px;
}

.selector-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.selector-wrap {
  display: grid;
  gap: 10px;
  grid-template-columns: 2fr 1fr;
}

.selector-section {
  border: 1px solid color-mix(in srgb, var(--border) 88%, #70808a 12%);
  border-radius: 10px;
  padding: 10px;
  background: rgba(35, 46, 53, 0.84);
}

.selector-section h4 {
  margin: 0 0 8px;
  font-size: 0.93rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.checklist-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  margin-bottom: 12px;
}

.checklist-grid label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid color-mix(in srgb, var(--border) 88%, #75858f 12%);
  border-radius: 9px;
  padding: 7px 8px;
  background: rgba(43, 55, 63, 0.84);
  min-height: 38px;
}

.button-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.button-grid.compact {
  margin-bottom: 10px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 10px;
}

.stats-col {
  border: 1px solid color-mix(in srgb, var(--border) 86%, #72828b 14%);
  border-radius: 11px;
  background: rgba(41, 53, 61, 0.82);
  padding: 10px;
}

.stats-col h4 {
  margin: 0 0 8px;
  font-size: 0.95rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stats-list {
  max-height: 380px;
  overflow: auto;
  display: grid;
  gap: 7px;
  padding-right: 4px;
}

.stat-row {
  display: grid;
  grid-template-columns: 1fr 120px;
  gap: 8px;
  align-items: center;
  border: 1px solid color-mix(in srgb, var(--border) 88%, #73828b 12%);
  border-radius: 9px;
  padding: 7px 8px;
  background: rgba(36, 47, 54, 0.88);
}

.stat-row span {
  color: #d4dfe4;
  font-size: 0.92rem;
  word-break: break-word;
}

.stat-row input {
  border: 1px solid color-mix(in srgb, var(--border) 88%, #6e7d86 12%);
  border-radius: 8px;
  padding: 6px 7px;
  font: inherit;
  background: rgba(22, 30, 35, 0.9);
  color: var(--text);
}

.objectives-list {
  margin-top: 10px;
  border: 1px solid color-mix(in srgb, var(--border) 88%, #74838c 12%);
  border-radius: 10px;
  background: rgba(39, 51, 59, 0.82);
  max-height: 430px;
  overflow: auto;
  padding: 8px;
  display: grid;
  gap: 6px;
}

.regions-card {
  border: 1px solid color-mix(in srgb, var(--border) 86%, #73828b 14%);
  border-radius: 12px;
  background: rgba(41, 53, 61, 0.82);
  padding: 12px;
}

.regions-feature-list {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.regions-feature-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid color-mix(in srgb, var(--border) 88%, #75858e 12%);
  border-radius: 9px;
  padding: 8px 10px;
  background: rgba(34, 45, 52, 0.86);
}

.regions-feature-row[hidden] {
  display: none !important;
}

.regions-feature-toggle,
.regions-feature-extra {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.regions-feature-toggle {
  color: #dde9ef;
  font-weight: 700;
}

.regions-feature-extra {
  justify-self: start;
  font-size: 0.88rem;
  color: var(--muted);
}

.regions-info-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--accent) 68%, #dbeaf2 32%);
  background: rgba(93, 145, 169, 0.22);
  color: #e5f5fc;
  font-family: "Space Mono", monospace;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: help;
  line-height: 1;
  padding: 0;
}

.objective-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  border: 1px solid color-mix(in srgb, var(--border) 88%, #74848d 12%);
  border-radius: 8px;
  padding: 7px 8px;
  background: rgba(30, 41, 47, 0.9);
}

.objective-row-no-status {
  grid-template-columns: 1fr auto;
}

.objective-row code {
  font-family: "Space Mono", monospace;
  font-size: 0.82rem;
}

.objective-title {
  color: #f1f7fa;
  font-weight: 700;
}

.pill {
  display: inline-flex;
  border: 1px solid color-mix(in srgb, var(--accent) 74%, #dcecf4 26%);
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 0.8rem;
  color: #e2f4ff;
  background: rgba(84, 137, 164, 0.27);
}

.rank-xp-help {
  position: absolute;
  right: 14px;
  bottom: 12px;
  z-index: 4;
}

.rank-xp-help-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--accent) 68%, #dbeaf2 32%);
  background: rgba(93, 145, 169, 0.22);
  color: #e5f5fc;
  font-family: "Space Mono", monospace;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}

.rank-xp-popover {
  display: none;
  position: absolute;
  right: 0;
  bottom: 30px;
  min-width: 220px;
  max-height: 320px;
  overflow: auto;
  border: 1px solid color-mix(in srgb, var(--border) 90%, #7b8a92 10%);
  border-radius: 10px;
  background: rgba(29, 38, 44, 0.96);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.4);
  padding: 9px;
}

.rank-xp-help:hover .rank-xp-popover,
.rank-xp-help:focus-within .rank-xp-popover {
  display: block;
}

.rank-xp-title {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.rank-xp-table {
  display: grid;
  gap: 3px;
}

.rank-xp-row {
  display: grid;
  grid-template-columns: 30px 12px 1fr;
  font-family: "Space Mono", monospace;
  font-size: 0.8rem;
}

.rules-editor {
  display: grid;
  gap: 8px;
  margin: 10px 0 12px;
}

.rule-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 1fr;
  gap: 10px;
  align-items: center;
  border: 1px solid color-mix(in srgb, var(--border) 88%, #75858e 12%);
  border-radius: 9px;
  padding: 8px;
  background: rgba(41, 53, 60, 0.82);
}

.rule-row label {
  font-weight: 700;
  color: #dde9ef;
}

.rule-row select {
  border: 1px solid color-mix(in srgb, var(--border) 88%, #72828b 12%);
  border-radius: 8px;
  padding: 7px 8px;
  font: inherit;
  background: rgba(20, 28, 33, 0.9);
  color: var(--text);
}

.fog-card {
  border: 1px solid color-mix(in srgb, var(--border) 86%, #73828b 14%);
  border-radius: 12px;
  background: rgba(41, 53, 61, 0.82);
  padding: 12px;
  margin-bottom: 12px;
}

.fog-card h4 {
  margin: 0 0 8px;
  font-size: 0.98rem;
  color: #deeaef;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.fog-editor-controls {
  grid-template-columns: minmax(0, 1.5fr) repeat(2, minmax(0, 1fr));
}

.fog-automation-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.fog-region-grid {
  margin: 8px 0 10px;
}

.fog-canvas-wrap {
  margin-top: 8px;
  border: 1px solid color-mix(in srgb, var(--border) 86%, #76858e 14%);
  border-radius: 10px;
  background:
    linear-gradient(140deg, rgba(6, 9, 12, 0.96) 0%, rgba(18, 23, 28, 0.96) 100%);
  overflow: hidden;
}

#fog-canvas {
  width: 100%;
  height: 520px;
  display: block;
  cursor: crosshair;
  touch-action: none;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-thumb {
  background: rgba(132, 148, 156, 0.45);
  border-radius: 10px;
}

*::-webkit-scrollbar-track {
  background: rgba(20, 27, 32, 0.55);
}

@media (max-width: 980px) {
  .edge-links {
    bottom: 14px;
    gap: 7px;
  }

  .edge-link {
    padding: 7px 10px;
    font-size: 0.8rem;
  }

  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .selector-wrap {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .fog-editor-controls,
  .fog-automation-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  body {
    padding: 14px 10px 28px;
    background: linear-gradient(160deg, var(--bg-0) 0%, var(--bg-1) 45%, var(--bg-0) 100%);
    background-size: cover;
    background-blend-mode: normal;
  }

  .bg-orb {
    display: none;
  }

  .app-shell,
  .tab-panel.active {
    animation: none;
  }


  .app-shell {
    padding: 14px;
    border-radius: 16px;
  }

  .hero {
    padding: 12px 72px 10px 12px;
  }

  .hero h1 {
    font-size: clamp(1.3rem, 7vw, 1.8rem);
  }

  .hero-logo-badge {
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
  }

  .hero-logo {
    width: 50px;
    height: 50px;
    border-radius: 10px;
  }

  .upload-zone {
    grid-template-columns: 1fr;
  }

  .form-grid,
  .checklist-grid {
    grid-template-columns: 1fr;
  }

  .tab-btn {
    font-size: 0.8rem;
    padding: 8px 7px;
    flex-basis: 120px;
  }

  .panel-head {
    align-items: flex-start;
  }

  .tab-note-popover {
    left: 0;
    right: auto;
    min-width: 210px;
    max-width: min(320px, 88vw);
  }

  .share-optin-popover {
    left: 0;
    right: auto;
    min-width: 210px;
    max-width: min(320px, 88vw);
  }

  .edge-links {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 12px;
  }

  .edge-links-left,
  .edge-links-right {
    left: auto;
    right: auto;
    align-items: center;
  }

  .edge-link {
    min-width: 150px;
    text-align: center;
  }

  .rule-row {
    grid-template-columns: 1fr;
  }

  .regions-feature-row {
    grid-template-columns: 1fr;
  }

  .objective-row {
    grid-template-columns: 1fr;
  }

  #fog-canvas {
    height: 380px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
