:root {
  --bg: #f9fafb;
  --text: #0f172a;
  --muted: #475569;
  --card: #ffffff;
  --brand: #6d28d9;
  --accent: #0ea5e9;
  --ring: rgba(109, 40, 217, 0.3);
  --border: #e5e7eb;
  --zodiac-bg: #ede9fe;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1020;
    --text: #e5e7eb;
    --muted: #94a3b8;
    --card: #0f172a;
    --brand: #a78bfa;
    --accent: #38bdf8;
    --ring: rgba(167, 139, 250, 0.35);
    --border: #1f2a44;
    --zodiac-bg: #1e1b4b;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; padding: 0;
  background: radial-gradient(1000px 1000px at 100% -10%, var(--zodiac-bg), transparent 60%), var(--bg);
  color: var(--text);
  font: 17px/1.55 system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  /* Keep the radial gradient static while scrolling */
  background-attachment: fixed, scroll;
  background-repeat: no-repeat, no-repeat;
}

.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10;
  display: flex; gap: 16px; align-items: center; justify-content: space-between;
  padding: 10px 16px; border-bottom: 1px solid var(--border);
  background: color-mix(in oklab, var(--bg) 94%, transparent);
  backdrop-filter: saturate(180%) blur(6px);
}
.brand { font-weight: 800; letter-spacing: 0.4px; color: var(--brand); }
.nav { display: flex; gap: 6px; }
.nav-btn { border: 0; background: transparent; color: var(--text); padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.nav-btn.active, .nav-btn:hover { background: var(--zodiac-bg); }
.right { display: flex; gap: 8px; align-items: center; }
.ghost { background: transparent; border: 1px solid var(--border); color: var(--text); padding: 6px 10px; border-radius: 8px; cursor: pointer; }

main { max-width: 1100px; margin: 24px auto; padding: 64px 16px 0; }
.view { display: none; }
.view.visible { display: block; }
h1 { margin: 8px 0 16px; font-size: 28px; }
.hint { color: var(--muted); font-size: 15px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  margin: 12px 0;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

label { display: block; margin: 8px 0; }
input, select, button { font: inherit; }
input, select, textarea {
  width: 100%; padding: 10px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text);
  outline: none; box-shadow: 0 0 0 0px var(--ring);
}
textarea {
  background: var(--card);
}
input:focus, select:focus, textarea:focus { box-shadow: 0 0 0 4px var(--ring); }
button { padding: 10px 14px; border-radius: 10px; border: 0; cursor: pointer; background: var(--brand); color: white; }

.species-list { display: block; }
/* Horizontal species slider */
.slider-wrap { position: relative; width: 100%; max-width: 100%; overflow: hidden; }
.slider {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(300px, 1fr);
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 8px;
}
.slider::-webkit-scrollbar { height: 8px; }
.slider::-webkit-scrollbar-thumb { background: color-mix(in oklab, var(--zodiac-bg) 70%, transparent); border-radius: 8px; }
.species-card { scroll-snap-align: start; min-width: 320px; }
.slider-btn { position: absolute; top: 50%; transform: translateY(-50%); }
.slider-btn.left { left: 4px; }
.slider-btn.right { right: 4px; }
.slider-btn .icon { width: 22px; height: 22px; }
.species-card { padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); }
.species-head { display:flex; align-items:center; gap: 8px; margin-bottom:8px; }
.species-emoji { font-size: 22px; }
.grid-signs { display:grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.grid-signs.vertical { grid-template-columns: 1fr; }
.sign { display:flex; gap:10px; align-items:flex-start; padding:10px; border-radius: 10px; background: color-mix(in oklab, var(--zodiac-bg) 70%, transparent); }
.sign.vertical { flex-direction: column; gap: 8px; }
.sign .ico { width: 36px; height: 36px; display:grid; place-items:center; border-radius: 10px; background: var(--zodiac-bg); color: var(--brand); font-size: 20px; }
.sign.vertical .ico { align-self: center; width: auto; height: auto; background: transparent; border-radius: 0; padding-top: 6px; }
.sign .meta { font-weight: 600; }
.sign .txt { color: var(--text); font-size: 14px; }

.pets-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.pet-card { padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); }
.pet-head { display:flex; justify-content:space-between; align-items:center; margin-bottom:8px; }
.pet-name { font-weight:700; }
.pet-name .z-wrap { vertical-align: middle; margin-right: 6px; }
.pet-head-right { display:flex; align-items:center; gap:8px; }
.pet-actions button.ghost { padding: 6px 8px; }
/* Large zodiac in pet card */
.pet-hero { display:flex; justify-content:center; margin: 8px 0; }

/* Icons */
.icon { width: 18px; height: 18px; display: inline-block; vertical-align: middle; }
.icon-btn { display:inline-flex; align-items:center; justify-content:center; width:28px; height:28px; border-radius:8px; padding:0 !important; line-height:0; }
.icon-btn .icon { display:block; }
.icon-btn svg { width:18px; height:18px; transition: transform 160ms ease; }
/* Rotate only the share button when open */
.btn-share.toggled svg { transform: rotate(180deg); }

/* Avatars */
.avatar { width: 28px; height: 28px; border-radius: 50%; display:inline-flex; align-items:center; justify-content:center; font-weight:700; font-size:12px; background: var(--zodiac-bg); color: var(--brand); }
.avatar-row { display:flex; align-items:center; justify-content:space-between; gap:8px; padding:4px 0; }
.avatar-info { display:flex; align-items:center; gap:8px; }

.footer { text-align:center; color: var(--muted); padding: 24px 0 40px; }

/* Language switch for static legal pages */
.lang-switch { display:flex; gap:8px; justify-content:center; margin: 64px 0 0; font-size:14px; }
.lang-switch a { color: var(--text); text-decoration: none; padding: 2px 6px; border-radius: 6px; }
.lang-switch a:hover { background: var(--zodiac-bg); }
.lang-switch .active { font-weight: 700; }
