:root {
  --bg: #0b0f14;
  --panel: #121826;
  --panel-2: #0f1522;
  --text: #e6eef9;
  --muted: #a7b3c7;
  --border: rgba(255, 255, 255, 0.08);
  --shadow: rgba(0, 0, 0, 0.35);
  --primary: #5ee4ff;
  --danger: #ff4d4d;
  --focus: #ffd166;
  --radius: 14px;
  --gap: 14px;
  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji",
    "Segoe UI Emoji";
}

html.theme-light {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-2: #f0f4ff;
  --text: #111827;
  --muted: #4b5563;
  --border: rgba(17, 24, 39, 0.12);
  --shadow: rgba(17, 24, 39, 0.12);
  --primary: #0066ff;
  --danger: #d81b1b;
  --focus: #7c3aed;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: var(--font);
  background: radial-gradient(1200px 700px at 20% 0%, rgba(94, 228, 255, 0.08), transparent 50%),
    radial-gradient(900px 600px at 80% 10%, rgba(255, 77, 77, 0.06), transparent 55%), var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text);
}
.skip-link:focus {
  left: 12px;
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  gap: var(--gap);
  padding: 14px 16px;
  background: rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar__left,
.topbar__right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0.3px;
}

.badge {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
}
.badge--ok {
  color: var(--text);
  border-color: rgba(94, 228, 255, 0.35);
}
.badge--warn {
  color: var(--text);
  border-color: rgba(255, 209, 102, 0.45);
}

.container {
  max-width: 1100px;
  margin: 18px auto;
  padding: 0 14px 50px;
}

.panel {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 14px 40px var(--shadow);
}

.panel__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.muted {
  color: var(--muted);
}
.small {
  font-size: 12px;
}

.form {
  display: grid;
  gap: 12px;
  max-width: 420px;
}

.field {
  display: grid;
  gap: 6px;
}

input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.18);
  color: var(--text);
}
html.theme-light input {
  background: rgba(255, 255, 255, 0.9);
}
input:focus {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.btn {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.08s ease, background 0.12s ease, border-color 0.12s ease;
}
.btn:focus {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.10);
}
.btn:active {
  transform: translateY(0);
}

.btn--primary {
  border-color: rgba(94, 228, 255, 0.45);
  background: rgba(94, 228, 255, 0.12);
}
.btn--danger {
  border-color: rgba(255, 77, 77, 0.45);
  background: rgba(255, 77, 77, 0.10);
}
.btn--ghost {
  background: transparent;
}

.grid {
  display: grid;
  gap: var(--gap);
  grid-template-columns: 1fr;
}

@media (min-width: 900px) {
  .grid {
    grid-template-columns: 420px 1fr;
    align-items: start;
  }
  .grid > section:last-child {
    grid-column: 1 / -1;
  }
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 8px;
}

.stat {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.10);
}
html.theme-light .stat {
  background: rgba(255, 255, 255, 0.7);
}
.stat__label {
  color: var(--muted);
  font-size: 12px;
}
.stat__value {
  font-size: 20px;
  margin-top: 6px;
}
.stat__hint {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.cards {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.10);
  display: grid;
  gap: 6px;
}
html.theme-light .card {
  background: rgba(255, 255, 255, 0.7);
}
.card--selected {
  border-color: rgba(94, 228, 255, 0.45);
  box-shadow: 0 0 0 2px rgba(94, 228, 255, 0.12) inset;
}
html.theme-light .card--selected {
  border-color: rgba(0, 102, 255, 0.55);
  box-shadow: 0 0 0 2px rgba(0, 102, 255, 0.10) inset;
}

.card__title {
  font-weight: 650;
}
.card__meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}
.card__row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}
.card__row button {
  flex-shrink: 0;
}

.sub {
  margin: 0 0 8px 0;
  font-size: 14px;
  color: var(--muted);
}

.two-col {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}
@media (min-width: 900px) {
  .two-col {
    grid-template-columns: 1fr 1fr;
  }
}

kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
}

.help summary {
  cursor: pointer;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 14px;
  box-shadow: 0 18px 60px var(--shadow);
  max-width: min(720px, calc(100vw - 24px));
}

/* Life Dashboard */
.meter {
  margin-top: 6px;
}
.meter__track {
  height: 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.meter__fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  transition: width 0.25s ease;
}
.meter__meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-top: 6px;
  font-size: 12px;
}

.meter--health .meter__fill {
  background: linear-gradient(90deg, rgba(47, 255, 160, 0.85), rgba(94, 228, 255, 0.55));
}
.meter--addiction .meter__fill {
  background: linear-gradient(90deg, rgba(255, 209, 102, 0.85), rgba(255, 77, 77, 0.75));
}
.meter--stress .meter__fill {
  background: linear-gradient(90deg, rgba(124, 58, 237, 0.70), rgba(255, 209, 102, 0.55));
}
.meter--morality .meter__fill {
  background: linear-gradient(90deg, rgba(255, 77, 77, 0.65), rgba(94, 228, 255, 0.75));
}

.segmented {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 10px;
}
@media (min-width: 900px) {
  .segmented {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.segmented__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.10);
  cursor: pointer;
}
html.theme-light .segmented__item {
  background: rgba(255, 255, 255, 0.7);
}
.segmented__item input {
  width: 18px;
  height: 18px;
}
.segmented__item input[type="radio"] {
  appearance: none;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  display: inline-grid;
  place-items: center;
}
.segmented__item input[type="radio"]::after {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  transform: scale(0);
  transition: transform 0.12s ease;
  background: rgba(94, 228, 255, 0.9);
}
html.theme-light .segmented__item input[type="radio"]::after {
  background: rgba(0, 102, 255, 0.9);
}
.segmented__item input[type="radio"]:checked {
  border-color: rgba(94, 228, 255, 0.45);
}
html.theme-light .segmented__item input[type="radio"]:checked {
  border-color: rgba(0, 102, 255, 0.55);
}
.segmented__item input[type="radio"]:checked::after {
  transform: scale(1);
}
.segmented__item:focus-within {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.warnings {
  list-style: none;
  padding: 0;
  margin: 10px 0 0 0;
  display: grid;
  gap: 8px;
}
.warning {
  border-radius: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
}
.warning--warn {
  border-color: rgba(255, 209, 102, 0.45);
  background: rgba(255, 209, 102, 0.12);
}
.warning--danger {
  border-color: rgba(255, 77, 77, 0.45);
  background: rgba(255, 77, 77, 0.10);
}

/* City / Mapbox */
.map {
  margin-top: 12px;
  height: 320px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  background: rgba(0, 0, 0, 0.10);
}
@media (min-width: 900px) {
  .map {
    height: 420px;
  }
}
html.theme-light .map {
  background: rgba(255, 255, 255, 0.7);
}
