@import url("prototype.css") layer(prototype);

:root {
  --illustration-shadow: 0 var(--m) var(--xxl) color-mix(in srgb, var(--on-mint) 16%, transparent);
}

:root[data-font="150"] { --text-scale: 1.5; }

html { scroll-padding-top: var(--xl); }
body { line-height: 1.5; min-width: 0; }
body:has(dialog[open]) { overflow: hidden; }
main { padding: 0; overflow: visible; }
a { color: var(--on-tint); text-underline-offset: .18em; }
button, a { -webkit-tap-highlight-color: transparent; }
button, input { scroll-margin-block: var(--l); }
h1, h2, h3 { text-wrap: balance; }
h2 { line-height: 1.02; letter-spacing: -.05em; font-weight: 900; }
h3 { font-size: 1.23rem; }
p { color: var(--muted); }
em { font-style: normal; }

.button {
  display: inline-flex;
  min-height: var(--tap);
  width: fit-content;
  max-width: 100%;
  align-items: center;
  justify-content: center;
  gap: var(--s);
  padding: var(--s) var(--l);
  border: var(--line) solid transparent;
  border-radius: var(--pill);
  font-size: 1rem;
  font-weight: 800;
  text-decoration: none;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.button.primary { min-height: var(--cta); padding-inline: var(--xl); color: var(--on-accent); box-shadow: var(--shadow); }
.button-outline { color: var(--ink); background: var(--surface); border-color: var(--border); }
.button-text { background: transparent; color: var(--on-tint); padding-inline: var(--m); }
.button-outline:hover, .button-text:hover { background: var(--tint); color: var(--on-tint); }
.button.primary:hover:not(:disabled) { background: var(--accent-end); }
.button[disabled] { opacity: .66; }
.skip-link { position: fixed; z-index: 1; top: var(--s); left: var(--s); background: var(--surface); color: var(--ink); padding: var(--m); transform: translateY(-180%); }
.skip-link:focus { transform: none; }

.theme-toggle span { font-size: 1.3rem; line-height: 1; }
.status-note { font-weight: 800; color: var(--gold-ink); background: var(--gold-surface); border-radius: var(--r-m); padding: var(--m) var(--l); }

.account-dialog {
  box-sizing: border-box;
  width: min(100% - var(--xxl), 34rem);
  max-width: none;
  max-height: calc(var(--dialog-height, 100dvh) - var(--xxl));
  overflow: auto;
  overscroll-behavior: contain;
  border: var(--line) solid var(--border);
  border-radius: var(--r-xl);
  padding: 0;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--illustration-shadow);
}
.account-dialog::backdrop { background: var(--scrim); }
.dialog-header { position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; align-items: center; padding: var(--s) var(--l) var(--s) var(--xl); gap: var(--m); background: var(--surface); border-bottom: var(--line) solid var(--border); }
.dialog-brand { font-size: var(--small); font-weight: 850; color: var(--on-tint); }
.close-button { width: var(--tap); flex: none; background: var(--tint); color: var(--on-tint); font-size: 1.5rem; border-color: transparent; border-radius: var(--pill); }
.dialog-content { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--l); padding: var(--l) var(--xl) var(--xl); overflow-wrap: anywhere; }
.dialog-content h2 { font-size: clamp(1.5rem, 3.6vw, 2.125rem); text-wrap: wrap; }
.dialog-content h2:focus { outline: none; }
.dialog-content .button { min-height: var(--tap); }
.dialog-content .button.primary { width: 100%; min-height: var(--cta); }
.dialog-content .button-text { padding-inline: 0; text-align: left; justify-content: start; }
.dialog-content form { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--m); }
.dialog-content label { min-width: 0; display: grid; gap: var(--xs); font-weight: 800; }
.dialog-content input { min-height: var(--tap); color: var(--ink); background: var(--canvas); }
.dialog-content input:user-invalid { border-color: var(--error); }
.password-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s); }
.password-field button { padding-inline: var(--m); min-width: var(--tap); font-size: var(--small); border-radius: var(--r-m); }
.field-error { color: var(--error); border: var(--line) solid var(--error); border-radius: var(--r-m); padding: var(--m); }
.dialog-links { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: var(--xs) var(--m); }
.balance-chip { display: flex; align-items: center; gap: var(--m); width: fit-content; max-width: 100%; background: var(--gold-surface); color: var(--gold-ink); padding: var(--s) var(--l); border-radius: var(--pill); font-size: 1.2rem; font-weight: 900; }
.balance-chip img { flex: none; }
.packages { display: grid; gap: var(--m); min-width: 0; border: 0; padding: 0; margin: 0; }
.packages legend { margin-bottom: var(--s); font-weight: 850; }
.packages label { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s); min-height: var(--tap); padding: var(--s) var(--m); border: var(--line) solid var(--border); border-radius: var(--r-m); cursor: pointer; }
.packages label:has(:checked) { color: var(--on-tint); background: var(--tint); border-color: var(--on-tint); }
.packages input { width: 1em; min-height: auto; height: 1em; margin: 0; accent-color: var(--on-tint); }
.packages strong { margin-inline-start: auto; }
.spinner { width: 1em; height: 1em; }


@media (max-width: 440px) {
  .account-dialog { width: calc(100% - var(--l)); max-height: calc(var(--dialog-height, 100dvh) - var(--l) - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
  .dialog-content { padding-inline: var(--l); }
  .dialog-header { padding-left: var(--l); }
}

@media (max-height: 480px) {
  .account-dialog { margin-block: max(var(--s), env(safe-area-inset-top)) auto; }
  .dialog-header { padding-block: 0; }
}
