/* Layout: one card, two halves. Left, a graphite panel where the 3D logo is the only moving thing;
   right, the sign-in form. Tokens come from the project's design system (Apéndice A). */
:root {
  color-scheme: light;
  --graf: #2E3238; --graf-d: #22262B; --ink-dark: #141B1E;
  --acero: #5C7A95; --acero-l: #7FA0B8; --acero-d: #4D6680; --ice: #A9C0D2;
  --fog-dark: #93A7B0; --fog-2: #C4D2D8;
  --page: #F5F5F7; --card: #FFFFFF; --text: #1D1D1F; --muted: #6E6E73;
  --line: rgba(0, 0, 0, .08); --field: #FAFAFA; --field-line: rgba(0, 0, 0, .12);
  --primary: #2E3238; --on-primary: #FFFFFF; --focus: #5C7A95; --link: #4D6680; --err: #A63A4B; --ok: #3F7A5F;
  --seg: #F5F5F7; --shadow: 0 26px 60px rgba(0, 0, 0, .13);
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
  --ease: cubic-bezier(.2, .7, .2, 1);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #141B1E; --card: #1B2225; /* ink-dark + superficie rgba(255,255,255,.03) */
    --text: #F5F8F9; --muted: #93A7B0;
    --line: rgba(147, 167, 176, .16); --field: rgba(255, 255, 255, .03); --field-line: rgba(147, 167, 176, .32);
    --primary: #7FA0B8; --on-primary: #141B1E; --focus: #7FA0B8; --link: #A9C0D2; --err: #E59AA6; --ok: #7FD3A6;
    --seg: rgba(255, 255, 255, .03); --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #141B1E; --card: #1B2225;
  --text: #F5F8F9; --muted: #93A7B0;
  --line: rgba(147, 167, 176, .16); --field: rgba(255, 255, 255, .03); --field-line: rgba(147, 167, 176, .32);
  --primary: #7FA0B8; --on-primary: #141B1E; --focus: #7FA0B8; --link: #A9C0D2; --err: #E59AA6; --ok: #7FD3A6;
  --seg: rgba(255, 255, 255, .03); --shadow: none;
}
* { box-sizing: border-box; }
html { height: 100%; }
body {
  min-height: 100%; margin: 0; background: var(--page); color: var(--text);
  font: 400 15px/1.55 var(--font-sans);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px;
  padding: clamp(16px, 4vw, 40px);
}
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.card {
  flex: none; width: 100%; max-width: 1000px; display: grid; grid-template-columns: minmax(0, .86fr) minmax(0, 1fr);
  background: var(--card); border-radius: 24px; overflow: hidden; box-shadow: 0 0 0 1px var(--line), var(--shadow);
}

/* left: the logo panel. Everything is centred; the spin counter stays hidden until someone flings the logo. */
.play {
  --cx: 50%; --cy: 40%;
  position: relative; overflow: hidden; min-height: 580px; padding: 28px;
  display: grid; grid-template-rows: minmax(48px, .88fr) auto minmax(0, 1.12fr); justify-items: center; text-align: center;
  background: linear-gradient(160deg, var(--graf), var(--graf-d)); color: #FFFFFF;
}
.glow, .play canvas { position: absolute; inset: 0; }
.glow { background: radial-gradient(circle at var(--cx) var(--cy), rgba(127, 160, 184, .14) 0, rgba(127, 160, 184, 0) 250px); }
.play canvas { width: 100%; height: 100%; display: block; touch-action: pan-y; opacity: 0; transition: opacity .7s var(--ease); }
.play canvas.is-on { opacity: 1; }
.play > :not(canvas):not(.glow) { position: relative; z-index: 1; pointer-events: none; }
.anchor { grid-row: 2; width: 184px; height: 184px; }            /* the logo sits at the panel's vertical centre */
.caption { grid-row: 3; align-self: start; margin-top: 26px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.eyebrow { margin: 0; min-height: 16px; white-space: nowrap; font: 500 11px/1.4 var(--font-mono); letter-spacing: .18em; text-transform: uppercase; color: var(--acero-l); }
.title { margin: 0; font: 800 clamp(22px, 2.3vw, 26px)/1.18 var(--font-sans); letter-spacing: -0.025em; }
.title em { font-style: normal; color: var(--acero-l); }
.logo-msg { position: absolute !important; left: 28px; right: 28px; top: var(--cy); margin: -10px 0 0; font-size: 13px; color: var(--fog-dark); }
.meter {
  position: absolute !important; top: 22px; right: 24px; margin: 0; display: flex; gap: 16px;
  font: 500 11px/1.4 var(--font-mono); letter-spacing: .16em; text-transform: uppercase; color: var(--fog-dark);
  font-variant-numeric: tabular-nums; opacity: 0; transition: opacity .6s var(--ease);
}
.play.is-playing .meter { opacity: 1; }
.meter b { font-weight: 500; color: var(--ice); }
.meter .is-new b { animation: nuevo 1.4s var(--ease); }
@keyframes nuevo { 0% { color: #FFFFFF; } 100% { color: var(--ice); } }

/* right: the form */
.signin { position: relative; padding: clamp(24px, 4vw, 44px); display: flex; flex-direction: column; justify-content: center; gap: 14px; }
.signin form { display: flex; flex-direction: column; gap: 14px; }
.lbl, .field label { font-size: 12.5px; font-weight: 600; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: var(--seg); }
.seg button { border: 0; background: transparent; border-radius: 10px; padding: 10px; font-weight: 600; cursor: pointer; color: var(--text); transition: background .2s var(--ease), color .2s var(--ease); }
.seg button[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); }
.seg button:disabled { opacity: .4; cursor: not-allowed; }       /* creating an account is only for the "Personal" account type */
.head { margin-top: 10px; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 20px; }
.signin h1 { margin: 0; font: 800 26px/1.15 var(--font-sans); letter-spacing: -0.02em; }
.lead { margin: 0; color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field input {
  width: 100%; background: var(--field); border: 1.5px solid var(--field-line); border-radius: 12px; padding: 12px 15px;
  transition: border-color .2s var(--ease), background .2s var(--ease);
}
.field input::placeholder { color: var(--muted); opacity: .8; }
.field input:focus { outline: none; border-color: var(--focus); background: var(--card); }
.pass { position: relative; height: 47px; transition: height .32s var(--ease); }
.pass.is-long { height: 124px; }                               /* grows on its own past 20 characters */
.pass textarea {
  display: block; width: 100%; height: 100%; resize: none; overflow: hidden; white-space: nowrap; line-height: 20px;
  background: var(--field); border: 1.5px solid var(--field-line); border-radius: 12px; padding: 12px 88px 12px 15px;
  -webkit-text-security: disc; transition: border-color .2s var(--ease), background .2s var(--ease);
}
.pass.is-long textarea { white-space: pre-wrap; word-break: break-all; padding-bottom: 26px; }
.pass.is-shown textarea { -webkit-text-security: none; }
.pass textarea::placeholder { color: var(--muted); opacity: .8; }
.pass textarea:focus { outline: none; border-color: var(--focus); background: var(--card); }
.pass .count { position: absolute; right: 13px; bottom: 7px; font: 400 11px/1 var(--font-mono); color: var(--muted); opacity: 0; transition: opacity .2s var(--ease); }
.pass.is-long .count { opacity: 1; }
.back {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; margin-bottom: 6px; padding: 7px 12px 7px 9px;
  border-radius: 10px; background: var(--seg); border: 1px solid var(--line); color: var(--muted); font-size: 13px; font-weight: 600; text-decoration: none;
}
.back:hover { color: var(--text); }
.back svg { width: 15px; height: 15px; }
.links { display: flex; justify-content: space-between; align-items: baseline; gap: 8px 20px; flex-wrap: wrap; }
/* Sign in <-> create account. The view opens as a sign-in; the other action is only a text link beside the
   heading. Pressing it swaps the roles: the heading, the main button and the link trade places, and the fields that
   only an account creation needs (confirmation and password rules) unfold under the password. Creating an account
   is only for the "Personal" account type and is not open yet (ALTA_DISPONIBLE in the script): the account type locks on "Personal"
   and the main button reads "Próximamente", disabled. */
.swap { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; font-size: 13px; color: var(--muted); }
.swap .linkish { align-self: auto; }
/* support: one faint line in the bottom right corner of the form panel, outside the flow of the form */
.support { position: absolute; right: 24px; bottom: 14px; margin: 0; font-size: 12px; line-height: 1.4; color: var(--muted); }
.support a { color: inherit; text-decoration: none; }
.extra {
  display: grid; grid-template-rows: 0fr; margin-top: -14px; visibility: hidden;
  transition: grid-template-rows .32s var(--ease), margin-top .32s var(--ease), visibility 0s .32s;
}
.extra-in { min-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: 14px; }
.is-alta .extra { grid-template-rows: 1fr; margin-top: 0; visibility: visible; transition-delay: 0s; }
.shift { transition: opacity .16s var(--ease); }
.shift.is-out { opacity: 0; }
.pass button { position: absolute; right: 6px; top: 8px; border: 0; background: transparent; font-weight: 600; font-size: 13px; padding: 6px 9px; cursor: pointer; border-radius: 8px; }
.enter {
  background: var(--primary); color: var(--on-primary); border: 0; border-radius: 11px; padding: 13px 22px; font-weight: 600; cursor: pointer;
  transition: background-color .15s var(--ease), box-shadow .15s var(--ease), opacity .15s var(--ease);
}
.enter:hover { opacity: .92; box-shadow: 0 4px 12px rgba(0, 0, 0, .08); }
.enter:active:not(:disabled) { transform: scale(0.985); }
.enter:disabled, .enter:disabled:hover {                         /* not available yet: flat, grey and still */
  background: var(--seg); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); transform: none; cursor: not-allowed;
}
.err { margin: 0; color: var(--err); font-size: 13px; font-weight: 600; }
.info { margin: 0; font-size: 12px; color: var(--muted); }
.linkish { align-self: flex-start; background: none; border: 0; padding: 0; text-decoration: underline; text-underline-offset: 3px; font-weight: 600; font-size: 13px; color: var(--link); cursor: pointer; }
.done { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.done svg { width: 44px; height: 44px; color: var(--ok); }
.done h2 { margin: 0; font: 800 24px/1.15 var(--font-sans); letter-spacing: -0.02em; }
.done p { margin: 0; color: var(--muted); max-width: 40ch; }
.ghost { background: transparent; border: 1.5px solid var(--field-line); border-radius: 11px; padding: 11px 20px; font-weight: 600; cursor: pointer; }

/* theme switch */
.theme { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.theme button { width: 34px; height: 30px; display: grid; place-items: center; border: 0; background: transparent; border-radius: 9px; cursor: pointer; color: var(--muted); }
.theme button[aria-pressed="true"] { background: var(--seg); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.theme svg { width: 16px; height: 16px; }
svg.ico { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

@media (max-width: 820px) {
  body { justify-content: flex-start; }
  .card { grid-template-columns: 1fr; }
  .play { min-height: 0; padding: 22px 22px 44px; grid-template-rows: 56px auto auto; }
  .anchor { width: 150px; height: 150px; }
  .signin { padding-bottom: 46px; }                              /* room for the support line in the corner */
}
@media (prefers-reduced-motion: reduce) {
  .play canvas, .meter, .seg button, .field input, .enter, .pass, .pass textarea, .extra, .shift { transition: none; }
  .meter .is-new b { animation: none; }
  .enter:hover { transform: none; }
}
