/* VoltiQuest website. Visual direction from the reviewed prototype (prototype/style.css): warm ivory canvas, deep ink, electric blue,
   pale sage and yellow sparks; rounded controls, quiet borders. Changes from the prototype are noted inline. */
:root {
  --ink: #172d46;
  --blue: #2263ec;
  --blue-dark: #1747b0;
  --cream: #faf8f1;
  --muted: #5b6875; /* prototype #687683 was 4.4:1 on cream; darkened for WCAG AA small text */
  --line: #dedfd7;
  --sage: #e5eddf;
  --strip: #f0f2e9;
  --danger: #a33838;
  --focus: #e89b19;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--cream); color: var(--ink); font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif; overflow-wrap: anywhere; }
button, a, input { font: inherit; }
button, a { touch-action: manipulation; }
button { cursor: pointer; color: inherit; border: 0; background: none; }
button:disabled { cursor: not-allowed; opacity: .55; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, input:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
[hidden] { display: none !important; }
.skip-link { position: absolute; left: 12px; top: -60px; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 10; }
.skip-link:focus { top: 12px; }
main:focus, main[tabindex]:focus-visible { outline: none; }

header, main, footer { max-width: 1240px; margin: auto; }
header { display: flex; justify-content: space-between; align-items: center; padding: 30px 40px; gap: 16px; flex-wrap: wrap; }
.brand { font-weight: 800; font-size: 26px; letter-spacing: -1px; display: flex; align-items: center; gap: 6px; }
.bolt { font-size: 38px; color: var(--blue); }
.brand-dot { font-size: 8px; color: var(--blue); align-self: end; margin-bottom: 10px; }
.env-badge { font-size: 11px; font-weight: 650; padding: 6px 10px; border: 1px dashed #8d9a8a; border-radius: 8px; color: var(--ink); background: #fff8e3; margin-right: auto; }
nav { display: flex; gap: 24px; align-items: center; font-size: 14px; font-weight: 600; }
nav a[aria-current='page'] { color: var(--blue); }

.primary { background: var(--blue); color: white; border-radius: 16px; padding: 18px 24px; font-weight: 650; box-shadow: 0 4px 0 var(--blue-dark); transition: transform .2s; }
.primary:hover:not(:disabled) { transform: translateY(-3px); }
.primary span[aria-hidden] { padding-left: 12px; }
.primary.small { padding: 12px 22px; border-radius: 12px; }
.secondary { border: 1px solid #bfc8c1; background: #fff; border-radius: 14px; padding: 14px 18px; font-weight: 600; text-align: left; }
.secondary:hover:not(:disabled) { border-color: var(--blue); }
.danger { color: var(--danger); }
.danger-fill { background: var(--danger) !important; box-shadow: 0 4px 0 #7a2626 !important; }
.link-button { color: var(--blue); font-weight: 600; font-size: 14px; padding: 8px 0; text-align: left; text-decoration: underline; text-underline-offset: 3px; }

main { padding: 0 40px; }
.hero { display: grid; grid-template-columns: 1.08fr 1fr; align-items: center; min-height: 600px; }
.eyebrow { font-size: 11px; font-weight: 750; letter-spacing: 1.8px; display: inline-flex; align-items: center; gap: 8px; text-transform: uppercase; }
.eyebrow > b { font-weight: 750; }
.eyebrow > span:empty { width: 7px; height: 7px; border-radius: 50%; background: #3eb5a2; }
h1 { font-size: clamp(40px, 5.1vw, 69px); line-height: 1.07; letter-spacing: -3px; margin: 24px 0; }
h1 em { font-style: normal; color: var(--blue); }
p { font-size: 17px; line-height: 1.65; color: var(--muted); }
.hero-copy > p { font-size: 20px; line-height: 1.65; }
.actions { display: flex; gap: 20px; align-items: center; margin-top: 32px; flex-wrap: wrap; }
.text-button { font-size: 14px; font-weight: 650; padding: 10px 0; }
.hero-foot { display: flex; gap: 10px; align-items: center; font-size: 12px; color: var(--muted); margin-top: 36px; }
.mini-orbit { border: 1px solid #bdc9bd; border-radius: 50%; padding: 5px 9px; color: var(--ink); }

.mascot-scene { height: 535px; position: relative; display: grid; place-items: center; }
.mascot-scene picture { display: contents; }
.volti { width: 95%; max-width: 465px; height: auto; z-index: 2; filter: drop-shadow(0 20px 16px #173f6520); }
.floaty { animation: float 5s ease-in-out infinite; }
.motion-paused .floaty, .motion-paused .spark { animation-play-state: paused; }
.orbit { position: absolute; border-radius: 50%; width: 430px; height: 430px; background: #e9f0e6; }
.orbit-two { width: 490px; height: 490px; background: none; border: 1px dashed #c7d9cf; }
.bubble { position: absolute; top: 20px; right: 50px; z-index: 3; background: white; padding: 14px 20px; border-radius: 20px 20px 20px 0; transform: rotate(6deg); font-weight: 650; }
.spark { position: absolute; color: #ebba3c; font-size: 50px; z-index: 3; animation: twinkle 4s ease-in-out infinite; }
.s1 { left: 20px; top: 80px; }
.s2 { right: 0; bottom: 120px; font-size: 32px; animation-delay: 1.5s; }
.float-chip { position: absolute; background: white; padding: 14px 18px; border-radius: 14px; z-index: 4; box-shadow: 0 8px 30px #173f6510; font-size: 12px; }
.code-chip { left: -10px; top: 185px; transform: rotate(-7deg); font-family: ui-monospace, Consolas, monospace; color: var(--blue); }
.gem-chip { right: 0; bottom: 20px; display: flex; align-items: center; gap: 10px; transform: rotate(4deg); }
.gem-chip img { width: 32px; height: 32px; }
/* New: pause control for the ongoing decorative motion (WCAG 2.2.2). */
.motion-toggle { position: absolute; left: 6px; bottom: 14px; z-index: 5; width: 44px; height: 44px; border-radius: 50%; background: #fff; border: 1px solid var(--line); font-size: 13px; color: var(--ink); }

.play-strip { border: 1px solid var(--line); border-radius: 26px; padding: 30px 36px; display: flex; align-items: center; justify-content: space-between; background: var(--strip); gap: 25px; }
h2 { font-size: 29px; letter-spacing: -1px; margin: 10px 0; }
.play-strip p { font-size: 14px; margin: 0; }
.play-strip .demo-note { font-size: 12px; margin-top: 6px; }
.circuit { display: flex; align-items: center; }
.battery { height: 85px; width: 45px; border: 3px solid var(--ink); border-radius: 7px; display: flex; flex-direction: column; align-items: center; justify-content: space-around; font-weight: 800; }
.battery .volts { font-size: 12px; }
.wire { width: 45px; height: 3px; background: #93a8a9; }
.circuit button { padding: 5px; background: #c9d4ce; border-radius: 25px; width: 75px; min-height: 44px; text-align: left; }
.circuit button span { display: block; width: 30px; height: 30px; background: white; border-radius: 50%; box-shadow: 0 2px 5px #0002; transition: transform .3s; }
.bulb { border-radius: 50%; width: 68px; height: 68px; background: #dce1d5; display: grid; place-items: center; color: #9caa98; font-size: 40px; transition: all .4s; }
.circuit.on .bulb { background: #ffe077; color: #a67100; box-shadow: 0 0 40px #f9ce5280; }
.circuit.on button { background: var(--blue); }
.circuit.on button span { transform: translateX(35px); }
.circuit.on .wire { background: #e8b736; }
.circuit-result { font-size: 13px; max-width: 160px; }
.circuit-result .arrow { font-size: 28px; display: block; }

.journey { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 32px; padding: 75px 0; }
.journey h2 { font-size: 31px; }
.tile-icon { font-size: 38px; width: 70px; height: 70px; border-radius: 22px; background: #e3ebfb; color: var(--blue); display: grid; place-items: center; transform: rotate(-5deg); }
.tile-icon.yellow { background: #f9ecc6; color: #b57a00; transform: rotate(5deg); }
.tile-icon.mint { background: #dbeee4; color: #23896e; }
h3 { font-size: 17px; margin-bottom: 0; }
.journey p { font-size: 13px; }

footer { display: flex; align-items: center; justify-content: space-between; padding: 28px 40px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); gap: 16px; flex-wrap: wrap; }
footer .brand { font-size: 19px; color: var(--ink); }
.noscript { text-align: center; font-size: 13px; }

/* --- Account ------------------------------------------------------------------------------------------------------------------ */
.dashboard-heading { display: flex; justify-content: space-between; align-items: center; padding: 40px 0 25px; }
.dashboard-heading h1 { font-size: 48px; margin: 15px 0; }
.dashboard-heading .name { max-width: 100%; }
.tz-note { font-size: 12px; margin: 0; }
.blue { color: var(--blue); }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; }
.stats { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.stat { background: white; border: 1px solid var(--line); border-radius: 22px; padding: 24px; display: grid; grid-template-columns: 60px 1fr; gap: 8px 20px; text-align: left; align-items: center; min-width: 0; }
button.stat:hover { border-color: var(--blue); }
.stat img, .xp-icon { width: 58px; height: 58px; grid-row: span 2; }
.xp-icon { background: #e5ebff; border-radius: 18px; display: grid; place-items: center; font-size: 38px; color: var(--blue); }
.stat strong { font-size: 30px; }
.stat small { font-size: 14px; font-weight: 500; }
.stat > span:last-child { font-size: 12px; color: var(--muted); }

.chart-card { border: 1px solid var(--line); border-radius: 25px; background: white; padding: 32px; min-width: 0; }
.chart-card[aria-busy='true'] .bars { opacity: .5; }
.chart-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.chart-title h2 { font-size: 32px; }
.chart-title small { font-size: 14px; color: var(--muted); font-weight: 400; }
.week-controls { display: flex; align-items: center; gap: 6px; }
.week-range { font-size: 12px; color: var(--muted); min-width: 7em; text-align: center; }
.week-nav { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: #fff; font-size: 22px; line-height: 1; }
/* Fixed physical height (brief): the scale changes with the data, the chart never does. */
.chart { height: 220px; display: flex; gap: 16px; margin-top: 36px; }
.axis { display: flex; flex-direction: column; justify-content: space-between; font-size: 11px; color: var(--muted); padding-bottom: 26px; width: 42px; text-align: right; }
.axis span { line-height: 1; transform: translateY(-50%); }
.axis span:last-child { transform: translateY(50%); }
.bars { list-style: none; margin: 0; padding: 0; display: flex; justify-content: space-around; flex: 1; gap: 15px; position: relative; min-width: 0; }
.bars::before { content: ''; position: absolute; inset: 0 0 26px; border-top: 1px solid #eef0eb; border-bottom: 1px solid #eef0eb; background: linear-gradient(transparent calc(50% - 1px), #eef0eb calc(50% - 1px), #eef0eb 50%, transparent 50%); pointer-events: none; }
.bars > li { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; flex: 1; position: relative; padding-bottom: 26px; min-width: 0; }
.bar { height: var(--height); width: 100%; max-width: 55px; background: linear-gradient(#85b7ff, #3478ec); border-radius: 9px 9px 4px 4px; position: relative; min-height: 4px; animation: rise .8s ease-out; }
.bar b { position: absolute; top: -22px; left: 50%; transform: translateX(-50%); font-size: 11px; white-space: nowrap; }
.bar.zero { height: 4px; background: #e9ede7; }
.bar.future { height: 4px; background: repeating-linear-gradient(90deg, #e3e7df 0 6px, transparent 6px 10px); animation: none; }
.day-label { position: absolute; bottom: 0; font-size: 11px; color: var(--muted); white-space: nowrap; }
.bars > li.today .day-label { color: var(--blue); font-weight: 700; }
.chart-note { font-size: 12px; margin-bottom: 0; }
.periods { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 18px 0 0; }
.periods div { background: var(--cream); border-radius: 12px; padding: 10px 12px; }
.periods dt { font-size: 11px; color: var(--muted); }
.periods dd { margin: 4px 0 0; font-weight: 700; font-size: 15px; }

.pro-card { background: var(--sage); border-radius: 25px; padding: 25px; position: relative; overflow: hidden; min-width: 0; }
.pro-badge { font-size: 10px; letter-spacing: 2px; font-weight: 750; }
.pro-card img { width: 170px; height: auto; display: block; margin: 10px auto -10px; }
.pro-card h2 { font-size: 28px; }
.pro-card p { font-size: 13px; }
.pro-card button { width: 100%; font-size: 13px; padding: 13px; }
.account-tools { display: flex; align-items: center; gap: 25px; margin: 26px 0 60px; padding: 20px 0; font-size: 13px; flex-wrap: wrap; }
.account-tools .who { flex: 1; min-width: 200px; }
.account-tools .who span { display: block; color: var(--muted); font-size: 12px; margin-top: 5px; }
.account-tools button { padding: 10px 0; font-weight: 600; }

.loading { font-size: 14px; color: var(--muted); }
.state-box { border: 1px dashed #c6b39a; background: #fff8ec; border-radius: 16px; padding: 16px; }
.state-box p { margin: 0 0 10px; font-size: 14px; color: var(--ink); }
.page-state { margin: 40px 0 80px; max-width: 560px; }

/* --- Dialogs ------------------------------------------------------------------------------------------------------------------ */
dialog { border: 0; border-radius: 28px; padding: 40px; width: min(480px, calc(100% - 24px)); max-height: calc(100% - 24px); overflow: auto; background: var(--cream); color: var(--ink); box-shadow: 0 25px 100px #172d4633; }
dialog::backdrop { background: #172d466b; backdrop-filter: blur(6px); }
.close { position: absolute; top: 8px; right: 10px; font-size: 28px; width: 44px; height: 44px; border-radius: 50%; }
dialog h2 { font-size: 30px; margin-right: 30px; }
dialog h2:focus, dialog h2[tabindex]:focus-visible { outline: none; }
dialog p { font-size: 14px; }
.modal-robot { width: 100px; height: auto; display: block; margin: auto; }
.modal-robot.small { width: 70px; }
.form { display: grid; }
.field { margin-top: 15px; }
.form label { display: block; font-size: 13px; margin: 0 0 7px; font-weight: 650; }
.form input { width: 100%; padding: 13px; border: 1px solid #8f9a91; border-radius: 10px; background: white; color: var(--ink); min-width: 0; }
.form input[aria-invalid='true'] { border-color: var(--danger); }
.password-row { display: flex; gap: 6px; }
.reveal { width: 48px; flex: none; border: 1px solid #8f9a91; border-radius: 10px; background: #fff; }
.reveal[aria-pressed='true'] { background: #e3ebfb; }
.hint { font-size: 12px !important; margin: 6px 0 0; color: var(--muted); }
.form-error { color: var(--danger); font-size: 13px !important; font-weight: 600; margin: 12px 0 0; min-height: 1em; }
.form-error:empty { margin: 0; min-height: 0; }
.form .primary { width: 100%; margin: 18px 0 10px; }
.notice { background: #ecefe6; color: var(--ink) !important; padding: 12px; border-radius: 10px; font-size: 13px !important; }
.modal-actions { display: grid; gap: 12px; margin-top: 16px; }
.details { display: grid; gap: 8px; margin: 12px 0; }
.details div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding: 8px 0; font-size: 14px; }
.details dt { color: var(--muted); }
.details dd { margin: 0; font-weight: 650; text-align: right; }

.month-nav { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; }
.calendar-head { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 14px; font-size: 11px; text-align: center; color: var(--muted); }
.calendar-head abbr { text-decoration: none; }
.calendar { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin: 8px 0 16px; }
.calendar li { min-height: 42px; padding: 6px 0; text-align: center; border-radius: 10px; background: #e5eade; font-size: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.calendar li.blank { background: none; }
.calendar .mark { font-size: 11px; line-height: 1; }
.calendar .fire, .calendar .today-fire { background: #ffe2aa; }
.calendar .ice { background: #e4edf6; }
.calendar .today { background: #fff; outline: 2px dashed var(--blue); outline-offset: -2px; }
.calendar .today-fire { outline: 2px solid var(--blue); outline-offset: -2px; }
.calendar .future { background: none; border: 1px dashed #d6dbd1; color: var(--muted); }
.calendar .before { background: none; color: #9aa39a; }
.calendar.gems .earned { background: #e3ebfb; font-weight: 650; }
.calendar.gems .mark { color: var(--blue-dark); font-weight: 700; }
.legend { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 12px; color: var(--muted); }
.legend li::before { content: ''; display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 6px; vertical-align: -1px; }
.legend .fire::before { background: #ffe2aa; }
.legend .ice::before { background: #e4edf6; }
.legend .today::before { background: #fff; outline: 2px dashed var(--blue); outline-offset: -2px; }
.legend .future::before { border: 1px dashed #b9c0b5; }
.gem-display { width: 90px; height: auto; display: block; margin: 10px auto; animation-duration: 3s; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 140%); background: var(--ink); color: #fff; padding: 14px 20px; border-radius: 14px; font-size: 14px; max-width: calc(100% - 32px); transition: transform .3s; z-index: 20; }
.toast.show { transform: translate(-50%, 0); }
.toast:empty { display: none; }

@keyframes float { 50% { transform: translateY(-13px) rotate(2deg); } }
@keyframes twinkle { 50% { opacity: .55; transform: scale(.9); } }
@keyframes rise { from { transform: scaleY(.1); transform-origin: bottom; } to { transform: scaleY(1); transform-origin: bottom; } }

@media (max-width: 850px) {
  header, main, footer { padding-left: 24px; padding-right: 24px; }
  .hero { min-height: 510px; }
  .mascot-scene { height: 420px; }
  .orbit { width: 290px; height: 290px; }
  .orbit-two { width: 330px; height: 330px; }
  .bubble { right: 0; top: 5px; }
  .code-chip { display: none; }
  .actions { flex-direction: column; align-items: flex-start; }
  .journey { gap: 20px; grid-template-columns: 1fr 1fr; }
  .play-strip { flex-wrap: wrap; }
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
  .pro-card img { float: right; margin: 0 0 0 10px; width: 130px; }
  .stats { gap: 10px; }
  .stat { padding: 17px; display: flex; flex-direction: column; align-items: flex-start; }
  .stat strong { font-size: 24px; }
  .dashboard-heading { align-items: flex-start; gap: 15px; }
  .periods { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  header { padding-top: 16px; padding-bottom: 16px; }
  .brand { font-size: 21px; }
  .env-badge { order: 3; margin: 0; }
  nav { gap: 14px; }
  nav .nav-explore { display: none; }
  nav > * { font-size: 12px; }
  .primary.small { padding: 10px 14px; }
  .hero { display: flex; flex-direction: column; padding-top: 20px; align-items: stretch; min-height: 0; }
  .hero h1 { font-size: 44px; letter-spacing: -2px; }
  .hero-copy > p { font-size: 17px; }
  .actions { flex-direction: row; gap: 12px; align-items: center; }
  .actions .primary { font-size: 13px; padding: 16px; }
  .hero-foot { font-size: 11px; margin-top: 25px; line-height: 1.5; }
  .mascot-scene { height: 360px; margin-top: 20px; }
  .volti { width: 300px; max-width: 100%; }
  .orbit { width: 250px; height: 250px; }
  .orbit-two { width: 290px; height: 290px; }
  .bubble { right: 10px; }
  .gem-chip { bottom: 5px; }
  .play-strip { padding: 22px; gap: 18px; }
  .wire { width: 22px; }
  .circuit-result { max-width: none; }
  .circuit-result .arrow { display: inline; }
  .journey { padding: 45px 0; grid-template-columns: 1fr; }
  .journey h2 { font-size: 28px; }
  .dashboard-heading { flex-direction: column; padding-top: 20px; }
  .dashboard-heading h1 { font-size: 36px; letter-spacing: -1.5px; }
  .stats { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .stat { display: grid; grid-template-columns: 44px 1fr; padding: 12px 14px; border-radius: 16px; gap: 2px 12px; }
  .stat img, .xp-icon { width: 40px; height: 40px; font-size: 26px; }
  .stat strong { font-size: 21px; }
  .pro-card img { float: none; margin: 4px auto 0; width: 120px; }
  .chart-card { padding: 20px 14px; }
  .chart-title h2 { font-size: 26px; }
  .chart { gap: 6px; height: 190px; }
  .axis { width: 34px; font-size: 10px; }
  .bars { gap: 5px; }
  .bar b { font-size: 9px; }
  .week-range { font-size: 11px; }
  dialog { padding: 28px 20px; border-radius: 22px; }
  dialog h2 { font-size: 26px; }
  .calendar, .calendar-head { gap: 4px; }
  .calendar li { min-height: 38px; font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .motion-toggle { display: none; }
}
