:root {
  --color-navy: #f1ebdb; --color-cyan: #2ba0e0; --color-cyan-bright: #1f8fce; --color-ice: #bfe6f5;
  --color-orange: #6cbf3c; --color-text: #34302a; --color-muted: #6c6350; --color-faint: #8a7d63;
  --color-border: rgba(150,125,90,0.3); --color-border-2: rgba(150,125,90,0.4); --color-border-strong: rgba(108,191,60,0.5);
  --rate: #2ba0e0; --back: #46c86a;
  --shadow-card: 0 20px 46px rgba(60,78,112,0.13); --radius-md: 16px; --radius-xl: 26px; --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --pal-glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 3c-4.4 0-8 3.2-8 7.2 0 2.5 1.4 4.7 3.5 6 .5.3.8.9.7 1.5l-.2 1c-.2.9.5 1.7 1.4 1.6 1-.1 1.7-.9 1.7-1.9v-.6c0-.3.2-.5.5-.5h.6c.3 0 .5.2.5.5v.6c0 1 .7 1.8 1.7 1.9.9.1 1.6-.7 1.4-1.6l-.2-1c-.1-.6.2-1.2.7-1.5 2.1-1.3 3.5-3.5 3.5-6C20 6.2 16.4 3 12 3Z'/%3E%3C/svg%3E");
}
* { box-sizing: border-box; }
html {
  scrollbar-gutter: stable; min-height: 100%; background: var(--color-navy); color-scheme: light; }
body { min-height: 100vh; margin: 0; color: var(--color-text); font-family: "Manrope", system-ui, sans-serif; font-size: 15px; line-height: 1.5;
  background: radial-gradient(1200px 620px at 50% -8%, rgba(108,191,60,0.13), transparent 62%), radial-gradient(900px 520px at 88% 4%, rgba(108,191,60,0.09), transparent 60%), linear-gradient(180deg, #fbf5ea 0%, #f1ebdb 46%, #f1ebdb 100%); background-attachment: fixed; }
button, input { font: inherit; } button, a { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
.wrap { position: relative; z-index: 1; width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 40px 0 64px; }

.hero { max-width: 760px; margin-bottom: 24px; animation: rise 0.5s var(--ease) both; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 14px; padding: 5px 12px 5px 10px; border: 1px solid var(--color-border-2); border-radius: 999px; color: var(--color-cyan-bright); background: rgba(108,191,60,0.08); font-size: 0.68rem; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; }
.eyebrow::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--color-cyan); box-shadow: 0 0 10px rgba(108,191,60,0.8); }
.hero h1 { font-family: "Baloo 2", "Manrope", system-ui, sans-serif;  margin: 0; font-size: clamp(2.1rem, 5vw, 3.4rem); line-height: 1.14; letter-spacing: -0.012em; font-weight: 800; }
.hero h1 .grad { color: transparent; background: linear-gradient(120deg, #2494d6, #5aa62e); -webkit-background-clip: text; background-clip: text; font-weight: 700; }
.tagline { max-width: 640px; margin: 14px 0 0; color: var(--color-muted); font-size: clamp(0.95rem, 2vw, 1.04rem); }

.panel { padding: clamp(16px, 2.4vw, 22px); border: 1px solid var(--color-border); border-radius: var(--radius-xl); background: linear-gradient(150deg, rgba(255,254,249,0.98), rgba(247,240,225,0.98)); box-shadow: var(--shadow-card); }
.cr-layout { display: grid; grid-template-columns: 340px 1fr; gap: 18px; align-items: start; animation: rise 0.55s var(--ease) 0.05s both; }

/* controls */
.controls { display: grid; gap: 18px; }
.ctrl-block { display: grid; gap: 9px; }
.cb-label { display: flex; justify-content: space-between; align-items: baseline; color: var(--color-muted); font-size: 0.82rem; font-weight: 650; }
.cb-label b { color: var(--color-text); font-size: 1rem; font-weight: 800; }
.worldrate { padding: 12px 14px; border: 1px solid var(--color-border-2); border-radius: 13px; background: rgba(255,255,255,0.4); }

input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 9px; border-radius: 999px; background: #d5deea; border: 1px solid rgba(60,78,112,0.16); box-shadow: inset 0 1px 3px rgba(60,78,112,0.14); outline: none; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; background: var(--color-cyan); border: 3px solid #ffffff; box-shadow: 0 2px 7px rgba(60,78,112,0.28), 0 0 0 1px rgba(43,160,224,0.5); cursor: pointer; }
input[type="range"]::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: var(--color-cyan); border: 3px solid #ffffff; box-shadow: 0 2px 7px rgba(60,78,112,0.28); cursor: pointer; }
.hp-range { background: linear-gradient(90deg, #f0913e, #2ba0e0); border-color: rgba(60,78,112,0.14); }
input[type="range"]:focus-visible { outline: 2px solid var(--color-cyan); outline-offset: 3px; }

.pal-pick { display: grid; justify-items: center; gap: 12px; padding: 16px; border: 1px solid var(--color-border-2); border-radius: 16px; background: rgba(255,255,255,0.4); }
.bn-toggle { display: inline-flex; gap: 4px; padding: 4px; border: 1px solid var(--color-border); border-radius: 11px; background: rgba(60,78,112,0.1); }
.bn-toggle button { min-width: 74px; min-height: 32px; padding: 0 12px; border: 0; border-radius: 8px; color: var(--color-muted); background: transparent; cursor: pointer; font-weight: 700; font-size: 0.82rem; transition: 140ms; }
.bn-toggle button.on { color: #f5efe2; background: linear-gradient(135deg, var(--color-cyan-bright), var(--color-cyan)); }
.pal-name { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border: 1px solid var(--color-border-strong); border-radius: 999px; color: var(--color-cyan-bright); background: rgba(108,191,60,0.1); cursor: pointer; font-weight: 750; font-size: 1rem; transition: 150ms; }
.pal-name:hover { background: rgba(108,191,60,0.18); transform: translateY(-1px); }
.pal-name svg { width: 16px; height: 16px; }

.pf { --s: 110px; position: relative; width: var(--s); height: var(--s); display: grid; place-items: center; overflow: hidden; border-radius: 50%; border: 1px solid rgba(150,125,90,0.3); background: radial-gradient(circle at 50% 34%, #fffefa 0%, #faf4e8 58%, #f7f1e4 100%); box-shadow: inset 0 0 0 1px rgba(60,78,112,0.08), 0 0 26px rgba(108,191,60,0.1); cursor: pointer; }
.pf img { width: 100%; height: 100%; object-fit: contain; transform: scale(1.16); filter: drop-shadow(0 4px 7px rgba(60,78,112,0.12)); }
.pf.failed::before { content: ""; width: 44%; height: 44%; background: var(--color-faint); opacity: 0.5; -webkit-mask: var(--pal-glyph) center / contain no-repeat; mask: var(--pal-glyph) center / contain no-repeat; }

.stepper-block { gap: 9px; }
.stepper { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px; border: 1px solid var(--color-border-2); border-radius: 13px; background: rgba(255,255,255,0.5); }
.stepper button { width: 40px; height: 40px; border: 1px solid var(--color-border-2); border-radius: 10px; color: var(--color-text); background: rgba(60,78,112,0.1); cursor: pointer; font-size: 1.2rem; font-weight: 700; }
.stepper button:hover { border-color: var(--color-border-strong); color: var(--color-cyan-bright); }
.stepper span { flex: 1; text-align: center; font-size: 1.15rem; font-weight: 800; color: var(--color-cyan-bright); }

/* results */
.results { display: grid; gap: 16px; }
.legend { display: flex; flex-wrap: wrap; gap: 18px; }
.lg { display: inline-flex; align-items: center; gap: 8px; color: var(--color-muted); font-size: 0.84rem; font-weight: 650; }
.lg i { width: 14px; height: 14px; border-radius: 4px; }
.lg.rate i { background: var(--rate); } .lg.back i { background: var(--back); }
.sphere-list { display: grid; gap: 14px; }
.sphere-row { display: grid; grid-template-columns: 48px 1fr; grid-template-rows: auto auto; gap: 4px 14px; align-items: center; }
.sp-ic { grid-row: 1 / 3; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 12px; border: 1px solid var(--color-border); background: radial-gradient(circle at 50% 34%, #fefdf7 0%, #fbf5ea 60%, #f5efe2 100%); }
.sp-ic img { width: 82%; height: 82%; object-fit: contain; }
.sp-bars { display: grid; gap: 6px; }
.bar { position: relative; height: 20px; border-radius: 999px; background: rgba(60, 78, 112, 0.16); overflow: hidden; }
.bar .fill { position: absolute; inset: 0 auto 0 0; border-radius: 999px; transition: width 200ms var(--ease); }
.bar.rate .fill { background: linear-gradient(90deg, #3f8fe0, var(--rate)); }
.bar.back .fill { background: linear-gradient(90deg, #3aad5b, var(--back)); }
.bar b { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 0.72rem; font-weight: 800; color: #26313f; text-shadow: 0 1px 2px rgba(255,255,255,0.6), 0 0 3px rgba(255,255,255,0.5); }
.sp-name { grid-column: 2; grid-row: 3; color: var(--color-faint); font-size: 0.72rem; font-weight: 650; }
.muted { color: var(--color-faint); font-size: 0.86rem; }

.foot { margin: 26px 0 0; color: rgba(125,115,96,0.5); font-size: 0.72rem; text-align: center; }

/* pal picker modal */
.modal { position: fixed; inset: 0; z-index: 12000; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(60, 78, 112, 0.15); backdrop-filter: blur(6px); }
.modal-card { position: relative; width: min(920px, 100%); max-height: 86vh; overflow: auto; padding: clamp(16px, 2.5vw, 24px); border: 1px solid var(--color-border-strong); border-radius: var(--radius-xl); background: linear-gradient(160deg, #fbf6ec, #f7f1e4); box-shadow: 0 40px 90px rgba(60,78,112,0.15); animation: pop 0.22s var(--ease); }
.modal-close { position: sticky; float: right; top: 0; width: 36px; height: 36px; margin: -4px -4px 0 0; border: 1px solid var(--color-border-2); border-radius: 10px; color: var(--color-muted); background: rgba(255,255,255,0.7); cursor: pointer; z-index: 2; }
.pick-search { position: relative; margin: 0 0 16px; }
.pick-search input { width: 100%; min-height: 48px; padding: 12px 16px 12px 46px; border: 1px solid var(--color-border-2); border-radius: 13px; outline: none; color: var(--color-text); background: rgba(255,255,255,0.72); }
.pick-search input:focus { border-color: var(--color-cyan); box-shadow: 0 0 0 3px rgba(108,191,60,0.14); }
.pick-search .ico { position: absolute; left: 16px; top: 50%; width: 18px; height: 18px; color: var(--color-muted); transform: translateY(-50%); pointer-events: none; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.pick-card { padding: 12px 8px; display: grid; justify-items: center; gap: 8px; border: 1px solid var(--color-border); border-radius: 14px; background: rgba(255,255,255,0.55); color: var(--color-text); cursor: pointer; transition: 150ms var(--ease); }
.pick-card:hover { border-color: var(--color-border-strong); transform: translateY(-2px); background: rgba(255,255,255,0.8); }
.pick-card .pf { --s: 64px; cursor: pointer; }
.pk-name { font-size: 0.78rem; font-weight: 700; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

:focus-visible { outline: 2px solid var(--color-cyan); outline-offset: 3px; }
* { scrollbar-width: thin; scrollbar-color: rgba(108,191,60,0.4) transparent; }
::-webkit-scrollbar { width: 11px; height: 11px; } ::-webkit-scrollbar-thumb { border: 3px solid transparent; border-radius: 999px; background-clip: padding-box; background-color: rgba(150,125,90,0.28); }

@media (max-width: 820px) { .cr-layout { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(0.99); } to { opacity: 1; transform: none; } }

/* Result summary in the hero. The calculator's answer used to sit below the
   whole input mask, so on mobile the first screen showed only sliders. */
.cr-summary { margin-top: 18px; padding: 14px 18px; border: 1px solid var(--color-border);
  border-radius: var(--radius-xl); background: linear-gradient(150deg, rgba(255,254,249,0.98), rgba(247,240,225,0.98));
  box-shadow: var(--shadow-card); max-width: 460px; }
.cr-summary p { margin: 0; }
.crs-label { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-muted); }
.crs-main { display: flex; align-items: baseline; gap: 10px; margin-top: 2px; flex-wrap: wrap; }
.crs-main b { font-family: "Baloo 2", "Manrope", system-ui, sans-serif; font-size: clamp(1.9rem, 4.4vw, 2.6rem);
  line-height: 1.1; font-weight: 800; color: transparent; background: linear-gradient(120deg, #2494d6, #5aa62e);
  -webkit-background-clip: text; background-clip: text; }
.crs-sphere { font-weight: 700; font-size: 1.02rem; }
.crs-meta { margin-top: 4px; font-size: 0.88rem; color: var(--color-muted); }
.crs-meta b { color: var(--color-text); font-weight: 700; }
@media (max-width: 820px) { .cr-summary { max-width: none; } }
