@font-face { font-family: Selawik; src: url(/assets/fonts/selawik_semilight.ttf); font-weight: 350; }
@font-face { font-family: Selawik; src: url(/assets/fonts/selawik_regular.ttf);   font-weight: 400; }
@font-face { font-family: Selawik; src: url(/assets/fonts/selawik_semibold.ttf);  font-weight: 600; }

:root {
  /* generic.xaml Light dictionary */
  --base-high: #000000;
  --base-medium-high: rgba(0,0,0,.8);
  --base-medium: rgba(0,0,0,.6);
  --base-medium-low: rgba(0,0,0,.4);
  --base-low: rgba(0,0,0,.2);
  --card: #FFFFFF;                 /* SystemAltHigh */
  --error: #C50500;                /* SystemErrorText */

  /* Palintropic gold #D4A754, sampled from the logo. */
  --accent-text: #8A6116;          /* by eye: logo gold darkened for 5.5:1 on white */
  --accent-fill: #D4A754;          /* black label, 9:1 */
  --on-accent: #000000;
}
:root[data-client="sekai-times"] {
  /* Nightcord purple, community value #9933FF (SITE_1_CHARACTER_COLORS_RESEARCH). */
  --accent-text: #9933FF;          /* 4.9:1 on white */
  --accent-fill: #9933FF;
  --on-accent: #FFFFFF;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --base-high: #FFFFFF;
    --base-medium-high: rgba(255,255,255,.8);
    --base-medium: rgba(255,255,255,.6);
    --base-medium-low: rgba(255,255,255,.4);
    --base-low: rgba(255,255,255,.2);
    --card: #1F1F1F;               /* SystemChromeMedium */
    --error: #FF8A8A;              /* by eye; Default dictionary has no SystemErrorText */
    --accent-text: #D4A754;        /* logo gold; 7.4:1 on #1F1F1F */
    --accent-fill: #D4A754;
    --on-accent: #000000;
  }
  :root[data-client="sekai-times"]:not([data-theme="light"]) {
    --accent-text: #B87AFF;        /* by eye, lifted purple; 5.7:1 on #1F1F1F */
    --accent-fill: #B87AFF;
    --on-accent: #000000;
  }
}
:root[data-theme="dark"] {
  --base-high: #FFFFFF;
  --base-medium-high: rgba(255,255,255,.8);
  --base-medium: rgba(255,255,255,.6);
  --base-medium-low: rgba(255,255,255,.4);
  --base-low: rgba(255,255,255,.2);
  --card: #1F1F1F;
  --error: #FF8A8A;
  --accent-text: #D4A754;
  --accent-fill: #D4A754;
  --on-accent: #000000;
}
:root[data-theme="dark"][data-client="sekai-times"] {
  --accent-text: #B87AFF;
  --accent-fill: #B87AFF;
  --on-accent: #000000;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: Selawik, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: 15px; line-height: 20px;           /* Body */
  color: var(--base-high);
  background: #0A0A0C;                          /* logo background */
  display: flex; flex-direction: column; min-height: 100%;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--base-high); outline-offset: 2px; }

/* ---- background art ---- */
.art { position: fixed; inset: 0; z-index: -1; width: 100%; height: 100%; }
.art .st { display: none; }
:root[data-client="sekai-times"] body { background: #140B1F; }     /* by eye */
:root[data-client="sekai-times"] .art .pal { display: none; }
:root[data-client="sekai-times"] .art .st { display: inline; }
#stars { fill: #EAE6DD; }                                          /* logo ivory */
:root[data-client="sekai-times"] #stars { fill: #DCC2FF; }
/* All background motion below is decorative and by eye. */
.tw { animation: twinkle 4s ease-in-out infinite; }
.tw.b { animation-duration: 3s; animation-delay: -1.5s; }
.tw.c { animation-duration: 5.5s; animation-delay: -3s; }
@keyframes twinkle { 50% { opacity: .15; } }
.flow { animation: flow 2.4s linear infinite; }
@keyframes flow { to { stroke-dashoffset: -32; } }
.beat { transform-box: fill-box; transform-origin: center; animation: beat 4.5s ease-in-out infinite; }
.beat.late { animation-delay: 2.25s; }
@keyframes beat { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(.82); opacity: .8; } }
.shoot { opacity: 0; animation: shoot 11s linear 2s infinite; }
.shoot.two { animation-duration: 17s; animation-delay: 8s; }
@keyframes shoot {
  0%   { transform: translate(1350px, 40px);  opacity: 0; }
  1%   { opacity: 1; }
  7%   { transform: translate(900px, 197px); opacity: 0; }
  100% { transform: translate(900px, 197px); opacity: 0; }
}
.shoot.two { animation-name: shoot2; }
@keyframes shoot2 {
  0%   { transform: translate(760px, 60px);  opacity: 0; }
  1%   { opacity: .8; }
  5%   { transform: translate(420px, 179px); opacity: 0; }
  100% { transform: translate(420px, 179px); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .tw, .flow, .beat, .shoot { animation: none; } }

/* ---- layout ---- */
main { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 16px 16px; gap: 12px; }
.card { width: 100%; max-width: 440px; background: var(--card); }
.signin { padding: 44px; min-height: 338px; }   /* by eye, from the account-page skeleton */
.options { display: flex; align-items: center; gap: 12px; padding: 12px 44px; border: 0; color: inherit; font: inherit; cursor: pointer; text-align: left; }
.options:hover { background: linear-gradient(var(--base-low), var(--base-low)), var(--card); }
.options svg { flex: none; }
.options[hidden] { display: none; }

/* ---- brand ---- */
.brand { display: flex; align-items: center; gap: 8px; height: 28px; font-weight: 600; font-size: 18px; letter-spacing: .01em; }
.relying { display: flex; align-items: center; gap: 8px; margin-top: 16px; font-size: 13px; color: var(--base-medium); }
.relying[hidden] { display: none; }
.relying .tile { width: 20px; height: 20px; background: var(--accent-fill); color: var(--on-accent); font-size: 10px; font-weight: 600; display: grid; place-items: center; }

/* ---- steps ---- */
.step[hidden] { display: none; }
h1 { font-size: 24px; line-height: 28px; font-weight: 600; margin: 16px 0 12px; }  /* Title size; weight by eye (skeleton uses semibold) */
.identity { display: flex; align-items: center; gap: 8px; margin-top: 16px; color: var(--base-medium-high); }
.identity button { width: 24px; height: 24px; padding: 0; border: 0; background: none; color: inherit; cursor: pointer; display: grid; place-items: center; }
.identity button:hover { background: var(--base-low); }

.field { display: block; width: 100%; height: 36px; padding: 6px 0; margin: 4px 0 0;
  border: 0; border-bottom: 1px solid var(--base-medium); border-radius: 0;
  background: transparent; color: var(--base-high); font: inherit; outline: none; }   /* underline field: skeleton, by eye */
.field:hover { border-bottom-color: var(--base-medium-high); }
.field:focus { border-bottom: 2px solid var(--accent-text); padding-bottom: 5px; }   /* 2 = ButtonBorderThemeThickness */
.field[aria-invalid="true"] { border-bottom-color: var(--error); }
.field::placeholder { color: var(--base-medium); }
.error { color: var(--error); font-size: 13px; min-height: 20px; margin-top: 8px; }

.hint { font-size: 13px; color: var(--base-medium-high); margin-top: 8px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-top: 8px; color: var(--base-medium-high); cursor: pointer; }
.check input { margin: 0; accent-color: var(--accent-fill); }
.links a[aria-disabled="true"] { color: var(--base-medium); pointer-events: none; }

.links { font-size: 13px; display: grid; gap: 8px; margin-top: 8px; }
.links span { color: var(--base-medium-high); }

.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }
.btn { min-width: 108px; height: 32px; padding: 4px 12px 5px; border: 2px solid transparent; border-radius: 0;
  font: inherit; font-size: 14px; cursor: pointer;
  background: var(--base-low); color: var(--base-high);
  transition: transform 200ms; }               /* press feedback: 200 ms up, by eye */
.btn:hover { border-color: var(--base-medium-low); }
.btn:active { background: var(--base-medium-low); transform: scale(.97); transition-duration: 90ms; }
.btn.accent { background: var(--accent-fill); color: var(--on-accent); }
.btn.accent:hover { border-color: var(--base-medium-low); }
.btn.accent:active { filter: brightness(.9); }

.done-mark { width: 48px; height: 48px; margin-top: 24px; color: var(--accent-text); }
.muted { color: var(--base-medium-high); }

/* page-refresh entrance: 28 px, 300 ms, 30 ms stagger, curve from reference (numbers by eye) */
.enter > * { animation: enter 300ms cubic-bezier(.1,.9,.2,1) both; }
.enter > :nth-child(2) { animation-delay: 30ms; }
.enter > :nth-child(3) { animation-delay: 60ms; }
.enter > :nth-child(4) { animation-delay: 90ms; }
.enter > :nth-child(5) { animation-delay: 120ms; }
.enter > :nth-child(6) { animation-delay: 150ms; }
.enter > :nth-child(7) { animation-delay: 180ms; }
.enter > :nth-child(8) { animation-delay: 210ms; }
@keyframes enter { from { opacity: 0; transform: translateY(28px); } }
@media (prefers-reduced-motion: reduce) { .enter > * { animation: none; } }
/* ---- footer ---- */
footer { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 16px; padding: 8px 16px; font-size: 12px; line-height: 14px; }
footer a, footer span { color: rgba(255,255,255,.8); }
footer .proto { color: #D4A754; }
/* phone width: the card becomes the page, as the skeleton does */
@media (max-width: 600px) {
  main { justify-content: flex-start; padding: 48px 0 0; gap: 0; }
  .card { max-width: none; }
  .signin { padding: 24px 16px; min-height: 0; }
  .options { padding: 12px 16px; border-top: 1px solid var(--base-low); }
  footer { justify-content: flex-start; }
  body { background: var(--card) !important; }
  .art { display: none; }
  footer a, footer span { color: var(--base-medium-high); }
  footer .proto { color: var(--accent-text); }
}

/* ---- server-rendered flows ---- */
.notice { margin-top: 8px; color: var(--base-medium-high); }
.notice.error { color: var(--error); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.field-wrap + .field-wrap { margin-top: 12px; }
.actions form { margin: 0; }
.btn.link { min-width: 0; background: none; color: var(--accent-text); padding: 4px 0; }
