:root {
  --bg: #14101f;
  --surface: #1f1930;
  --surface-2: #2a2240;
  --text: #f3effa;
  --muted: #a99fc0;
  --accent: #ff7ab8;
  --accent-2: #9d7bff;
  --wood: #4fb37a;
  --fire: #f0624d;
  --earth: #d3a548;
  --metal: #b4bcc8;
  --water: #4d8df0;
  --radius: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: radial-gradient(1200px 600px at 50% -200px, #33235a 0%, var(--bg) 60%) no-repeat var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
}

a { color: var(--accent); }
main, header, footer { max-width: 760px; margin: 0 auto; padding: 0 16px; }

header { display: flex; align-items: center; justify-content: space-between; padding-top: 20px; }
.brand { font-weight: 800; letter-spacing: -0.02em; color: var(--text); text-decoration: none; }
.brand span { color: var(--accent); }

.hero { text-align: center; padding: 40px 0 24px; }
.hero h1 { font-size: clamp(1.8rem, 6vw, 2.8rem); line-height: 1.15; margin: 0 0 12px; letter-spacing: -0.03em; }
.hero p { color: var(--muted); margin: 0 auto; max-width: 520px; }

.card { background: var(--surface); border: 1px solid #ffffff14; border-radius: var(--radius); padding: 20px; margin: 20px 0; }
h2 { letter-spacing: -0.02em; }
h3 { margin: 0 0 4px; }

form { display: grid; gap: 14px; }
.fields { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
label { display: grid; gap: 6px; font-size: 0.85rem; color: var(--muted); }
input, select {
  font: inherit; color: var(--text); background: var(--surface-2);
  border: 1px solid #ffffff22; border-radius: 10px; padding: 10px 12px; width: 100%; color-scheme: dark;
}
button {
  font: inherit; font-weight: 700; color: #1a0f1f; cursor: pointer;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border: 0; border-radius: 999px; padding: 13px 20px;
}
button:hover { filter: brightness(1.08); }

.pillars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; }
.pillar { display: grid; gap: 4px; justify-items: center; }
.pillar-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.pillar-name { font-size: 0.7rem; color: var(--muted); }
.pillar.is-day .pillar-label { color: var(--accent); }
.glyph {
  width: 100%; max-width: 64px; aspect-ratio: 1; display: grid; place-items: center;
  font-size: 1.6rem; font-weight: 700; border-radius: 12px; color: #14101f;
}
.glyph.unknown { background: var(--surface-2); color: var(--muted); }
.el-wood { background: var(--wood); }
.el-fire { background: var(--fire); }
.el-earth { background: var(--earth); }
.el-metal { background: var(--metal); }
.el-water { background: var(--water); }

.bars { display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 90px 1fr 20px; gap: 10px; align-items: center; font-size: 0.9rem; }
.bar-label { text-transform: capitalize; }
.bar-track { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 999px; }
.bar-count { color: var(--muted); text-align: right; }

.result-card { text-align: center; border-color: #ff7ab855; }
.eyebrow { margin: 0; color: var(--accent); font-weight: 700; letter-spacing: 0.04em; }
.score { font-size: 4.5rem; font-weight: 800; line-height: 1.1; letter-spacing: -0.04em; }
.score span { font-size: 1.2rem; color: var(--muted); font-weight: 500; }
.result-card h2 { margin: 0 0 20px; }
.versus { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.dm { margin: 0 0 10px; color: var(--muted); font-size: 0.9rem; }
.breakdown { list-style: none; padding: 0; margin: 24px 0 0; text-align: left; display: grid; gap: 10px; }
.breakdown li { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; }
.breakdown-head { display: flex; justify-content: space-between; }
.breakdown-head span { color: var(--accent); font-weight: 700; }
.breakdown p { margin: 4px 0 0; color: var(--muted); font-size: 0.92rem; }
.note { color: var(--muted); font-size: 0.8rem; margin: 16px 0 0; }

.picker { grid-column: 1 / -1; position: relative; display: grid; gap: 6px; font-size: 0.85rem; color: var(--muted); }
.picker-button {
  font-weight: 400; font-size: 1rem; text-align: left; color: var(--text); background: var(--surface-2);
  border: 1px solid #ffffff22; border-radius: 10px; padding: 10px 12px; width: 100%;
}
.picker-button::after { content: '▾'; float: right; color: var(--muted); }
.picker-panel {
  position: absolute; z-index: 10; top: 100%; left: 0; right: 0; margin-top: 6px; padding: 8px;
  background: var(--surface-2); border: 1px solid #ffffff33; border-radius: 12px; box-shadow: 0 12px 32px #0009;
}
.picker-search { background: var(--surface); margin-bottom: 6px; }
.picker-list { max-height: 300px; overflow-y: auto; }
.picker-group-name { color: var(--earth); font-weight: 700; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; }
.picker-group > .picker-group-name { padding: 10px 8px 4px; }
.picker-list [role="option"] {
  display: block; width: 100%; text-align: left; font-weight: 400; font-size: 1rem; color: var(--text);
  background: none; border-radius: 8px; padding: 8px 8px 8px 18px;
}
.picker-list [role="option"]:hover, .picker-list [role="option"]:focus-visible { background: #ffffff14; filter: none; }
[hidden] { display: none !important; }

.hint { margin: 0; font-size: 0.82rem; color: var(--muted); }
.hint strong { color: var(--text); }
.lead { margin: -12px 0 20px; color: var(--muted); }
.callouts { display: grid; gap: 10px; margin-top: 24px; text-align: left; }
.callout { border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 0 12px 12px 0; padding: 12px 14px; }
.callout-label { font-weight: 700; color: var(--accent); }
.callout p { margin: 4px 0 0; font-size: 0.95rem; }
.actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 24px; }
.actions [data-action="share"], .actions [data-action="copy"] { background: var(--surface-2); color: var(--text); border: 1px solid #ffffff33; }
.section-title { margin: 24px 0 0; text-align: left; }
.breakdown { margin-top: 10px; }
.spark { font-size: 1.15rem; font-style: italic; color: var(--accent) !important; margin: 0 0 8px; }
.group-title { margin: 24px 0 8px; color: var(--muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.08em; }

.idol-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); padding: 0; list-style: none; }
.idol-grid a {
  display: grid; gap: 2px; padding: 14px; border-radius: 14px; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid #ffffff14;
}
.idol-grid a:hover { border-color: var(--accent); }
.idol-grid .emoji { font-size: 1.6rem; }
.idol-grid small { color: var(--muted); }

.idol-head { display: flex; gap: 16px; align-items: center; }
.badge {
  flex: none; width: 84px; height: 84px; border-radius: 24px; display: grid; place-items: center; font-size: 2.4rem;
}
.idol-head h1 { margin: 0; font-size: clamp(1.5rem, 5vw, 2.2rem); line-height: 1.2; letter-spacing: -0.02em; }
.idol-head p { margin: 4px 0 0; color: var(--muted); }
.prose p, .prose li { color: #d9d2ea; }
.prose h1 { margin-top: 0; letter-spacing: -0.02em; line-height: 1.2; }
.prose li { margin-bottom: 6px; }

footer { color: var(--muted); font-size: 0.8rem; padding-top: 24px; padding-bottom: 40px; }
