body.login-page {
  --font-body: 1rem;
  --font-meta: .8125rem;
  --font-title: clamp(2rem, 1.4rem + 1.5vw, 2.75rem);
  --paper: #f6f3fb;
  --paper-deep: #e8e2f1;
  --ink: #342d42;
  --muted: #675c74;
  --line: #e5ddec;
  --white: #fffefa;
  --accent: #74519a;
  --accent-deep: #533d73;
  --accent-soft: #f0eaf7;
  --accent-blue: #76a9d0;
  --stage-one: #e5d9f1;
  --stage-two: #d8e9f5;
  --serif: "Songti SC", "Noto Serif CJK SC", Georgia, serif;
  position: relative;
  isolation: isolate;
  min-width: 320px;
  min-height: 100svh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  font-size: var(--font-body);
  line-height: 1.65;
  background:
    radial-gradient(ellipse at 5% 5%, rgb(222 211 239 / 72%), transparent 33rem),
    radial-gradient(ellipse at 96% 88%, rgb(211 231 245 / 75%), transparent 34rem),
    var(--paper);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.login-page[data-theme="kuromi"] {
  --accent: #70459b;
  --accent-deep: #4f3474;
  --accent-soft: #eee5f8;
  --accent-blue: #a991cc;
  --stage-one: #e7d8f4;
  --stage-two: #e4dcf2;
  background:
    radial-gradient(ellipse at 8% 4%, rgb(220 203 241 / 76%), transparent 34rem),
    radial-gradient(ellipse at 92% 91%, rgb(232 220 244 / 72%), transparent 34rem),
    var(--paper);
}

body.login-page[data-theme="cinnamoroll"] {
  --accent: #326f95;
  --accent-deep: #315f83;
  --accent-soft: #e4f0f8;
  --accent-blue: #78a9d2;
  --stage-one: #dbeafa;
  --stage-two: #cfe5f3;
  background:
    radial-gradient(ellipse at 8% 4%, rgb(202 224 245 / 78%), transparent 34rem),
    radial-gradient(ellipse at 92% 91%, rgb(216 237 245 / 76%), transparent 34rem),
    var(--paper);
}

body.login-page *,
body.login-page *::before,
body.login-page *::after {
  box-sizing: border-box;
}

body.login-page button,
body.login-page input {
  font-family: inherit;
  color: inherit;
}

body.login-page button:focus-visible,
body.login-page input:focus-visible,
body.login-page a:focus-visible {
  outline: 3px solid var(--accent-blue);
  outline-offset: 4px;
}

.login-atmosphere {
  position: fixed;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgb(97 76 128 / 9%) .65px, transparent .8px);
  background-size: 15px 15px;
  mask-image: linear-gradient(135deg, rgb(0 0 0 / 45%), transparent 70%);
}

.login-shell {
  display: flex;
  width: min(100%, 1280px);
  min-height: 100svh;
  flex-direction: column;
  margin-inline: auto;
  padding: 27px clamp(16px, 4vw, 46px) 19px;
}

.login-header,
.login-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.login-wordmark {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 15px;
  text-decoration: none;
}

.wordmark-seal {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgb(116 81 154 / 24%);
  border-radius: 50%;
  color: var(--accent);
  font-family: var(--serif);
  font-size: 15px;
}

.login-wordmark i {
  color: var(--accent);
  font-style: normal;
}

.header-caption,
.login-footer span:last-child {
  color: #8a8494;
  font-size: 9px;
  letter-spacing: .17em;
}

.login-main {
  display: grid;
  flex: 1;
  place-items: center;
  padding-block: clamp(22px, 4.8vh, 52px);
}

.welcome-card {
  display: grid;
  width: min(100%, 1060px);
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 88%);
  border-radius: 32px;
  background: var(--white);
  box-shadow: 0 32px 90px rgb(61 48 86 / 13%), 0 4px 14px rgb(73 57 95 / 6%);
}

.character-stage {
  position: relative;
  min-height: 234px;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 19% 83%, rgb(255 255 255 / 56%) 0 2px, transparent 3px),
    radial-gradient(circle at 80% 24%, rgb(255 255 255 / 72%) 0 3px, transparent 4px),
    linear-gradient(128deg, var(--stage-one), var(--stage-two));
}

.character-stage::before,
.character-stage::after {
  position: absolute;
  z-index: -1;
  border: 1px solid rgb(255 255 255 / 62%);
  border-radius: 50%;
  content: "";
}

.character-stage::before {
  top: -134px;
  left: 10%;
  width: 350px;
  height: 350px;
}

.character-stage::after {
  right: -102px;
  bottom: -186px;
  width: 370px;
  height: 370px;
}

.stage-label,
.stage-caption {
  position: absolute;
  z-index: 2;
  color: rgb(81 66 108 / 72%);
  font-size: 8px;
  letter-spacing: .18em;
}

.stage-label-top {
  top: 18px;
  left: 21px;
}

.stage-caption {
  right: 20px;
  bottom: 14px;
  left: 20px;
  text-align: center;
}

.stage-spark {
  position: absolute;
  z-index: 1;
  color: rgb(255 255 255 / 92%);
  text-shadow: 0 2px 12px rgb(255 255 255 / 80%);
}

.stage-spark-one {
  top: 23%;
  left: 17%;
  font-size: 20px;
}

.stage-spark-two {
  top: 18%;
  right: 15%;
  font-size: 26px;
}

.stage-orbit {
  position: absolute;
  border: 1px solid rgb(255 255 255 / 45%);
  border-radius: 50%;
}

.stage-orbit-one {
  top: 21%;
  left: 19%;
  width: 67px;
  height: 67px;
}

.stage-orbit-two {
  right: 18%;
  bottom: 23%;
  width: 40px;
  height: 40px;
}

.character {
  position: absolute;
  z-index: 2;
  bottom: 29px;
  display: grid;
  width: 54%;
  justify-items: center;
  gap: 4px;
  margin: 0;
  animation: character-float 7s ease-in-out infinite;
}

.character-kuromi {
  left: 0;
  transform: rotate(-3deg);
}

.character-cinnamoroll {
  right: 0;
  transform: rotate(3deg);
  animation-delay: -3.4s;
}

@keyframes character-float {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -7px; }
}

.character img {
  display: block;
  width: 100%;
  height: clamp(140px, 43vw, 185px);
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 13px 10px rgb(68 56 91 / 13%));
}

.character figcaption {
  color: rgb(75 62 100 / 68%);
  font-size: 7px;
  font-weight: 600;
  letter-spacing: .15em;
}

.welcome-content {
  min-width: 0;
  padding: 31px clamp(25px, 6vw, 45px) 26px;
}

.welcome-copy {
  max-width: 430px;
  margin-inline: auto;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .2em;
}

.welcome-copy h1 {
  margin: 0;
  color: #30283c;
  font-family: var(--serif);
  font-size: var(--font-title);
  font-weight: 500;
  letter-spacing: .015em;
  line-height: 1.28;
}

.welcome-copy h1 span {
  color: var(--accent);
  font-weight: 400;
}

.description {
  margin: 12px 0 22px;
  color: var(--muted);
  font-size: var(--font-body);
  letter-spacing: .04em;
  line-height: 1.8;
}

.password-form {
  max-width: 430px;
  margin-inline: auto;
}

.password-form label,
.theme-picker legend {
  display: block;
  padding: 0;
  color: #4d4658;
  font-size: .875rem;
  font-weight: 600;
}

.password-field {
  position: relative;
  margin-top: 9px;
}

.password-field input {
  display: block;
  width: 100%;
  height: 51px;
  padding: 0 16px 0 43px;
  border: 1px solid #ddd5e5;
  border-radius: 12px;
  outline: 0;
  color: var(--ink);
  background: #fff;
  font-size: 16px;
  transition: border-color 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.password-field input::placeholder {
  color: #aaa4b0;
}

.password-field input:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent);
}

.password-field input:focus-visible {
  outline: 3px solid var(--accent-blue);
  outline-offset: 2px;
}

.field-lock {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 16px;
  color: var(--accent);
  font-size: 15px;
  transform: translateY(-50%);
  pointer-events: none;
}

.submit-button {
  display: flex;
  width: 100%;
  min-height: 51px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 13px;
  padding: 0 18px;
  border: 1px solid var(--accent);
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(110deg, var(--accent-deep), var(--accent));
  box-shadow: 0 9px 18px color-mix(in srgb, var(--accent) 21%, transparent);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .08em;
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.submit-button:hover:not(:disabled) {
  box-shadow: 0 12px 23px color-mix(in srgb, var(--accent) 29%, transparent);
  filter: brightness(1.06);
  transform: translateY(-2px);
}

.submit-button:active:not(:disabled) {
  transform: translateY(1px) scale(.99);
}

.submit-button:disabled {
  cursor: wait;
  opacity: .72;
}

.submit-arrow {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid rgb(255 255 255 / 38%);
  border-radius: 50%;
  font-size: 13px;
  line-height: 1;
}

.login-error {
  margin: 11px 0 0;
  padding: 10px 12px;
  border: 1px solid #efd6df;
  border-radius: 9px;
  color: #8a3550;
  background: #fff4f7;
  font-size: 12px;
  line-height: 1.65;
}

.login-page [hidden] {
  display: none !important;
}

.login-preferences {
  display: flex;
  max-width: 430px;
  align-items: end;
  justify-content: space-between;
  gap: 15px;
  margin: 22px auto 0;
  padding-top: 16px;
  border-top: 1px solid #eee9f1;
}

.theme-picker {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.theme-picker legend {
  margin-bottom: 9px;
}

.theme-options {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.theme-choice {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: #746d7d;
  background: transparent;
  cursor: pointer;
  font-size: var(--font-meta);
  transition: border-color 160ms ease, color 160ms ease, background-color 160ms ease;
}

.theme-choice:hover {
  border-color: #e2d9eb;
  color: var(--accent-deep);
}

.theme-choice[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--accent) 29%, white);
  color: var(--accent-deep);
  background: var(--accent-soft);
  font-weight: 600;
}

.theme-swatch {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgb(255 255 255 / 80%);
}

.swatch-duet {
  background: linear-gradient(135deg, #835caa 0 50%, #79add2 50%);
}

.swatch-kuromi {
  background: #8059a7;
}

.swatch-cinnamoroll {
  background: #74a9d1;
}

.motion-toggle {
  position: relative;
  display: inline-flex;
  min-height: 44px;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  color: #746d7d;
  background: transparent;
  cursor: pointer;
  font-size: var(--font-meta);
}

.motion-toggle::before {
  order: 2;
  width: 30px;
  height: 17px;
  border-radius: 999px;
  background: #d7d1dc;
  content: "";
  transition: background-color 180ms ease;
}

.motion-toggle::after {
  position: absolute;
  top: 50%;
  right: 2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgb(40 33 51 / 20%);
  content: "";
  transform: translateY(-50%);
  transition: right 180ms ease;
}

.motion-toggle[aria-pressed="true"]::before {
  background: var(--accent);
}

.motion-toggle[aria-pressed="true"]::after {
  right: 15px;
}

.note {
  margin: 20px 0 0;
  color: #96909d;
  font-family: var(--serif);
  font-size: 11px;
  letter-spacing: .08em;
  text-align: center;
}

.login-footer {
  min-height: 28px;
  color: #88818f;
  font-family: var(--serif);
  font-size: 10px;
}

@media (min-width: 560px) and (max-width: 859px) {
  .character-stage {
    min-height: 285px;
  }

  .character {
    bottom: 33px;
    width: 42%;
  }

  .character img {
    height: 212px;
  }

  .character-kuromi {
    left: 10%;
  }

  .character-cinnamoroll {
    right: 10%;
  }

  .welcome-content {
    padding: 35px clamp(40px, 11vw, 90px) 28px;
  }
}

@media (min-width: 860px) {
  .login-shell {
    padding-top: 30px;
    padding-bottom: 24px;
  }

  .welcome-card {
    grid-template-columns: minmax(330px, .94fr) minmax(410px, 1.06fr);
  }

  .character-stage {
    min-height: 565px;
  }

  .character {
    bottom: 57px;
    width: 68%;
    gap: 8px;
  }

  .character img {
    height: min(39vw, 345px);
  }

  .character-kuromi {
    left: -2%;
  }

  .character-cinnamoroll {
    right: -2%;
  }

  .stage-label-top {
    top: 25px;
    left: 29px;
  }

  .stage-caption {
    bottom: 24px;
  }

  .welcome-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 55px clamp(38px, 5vw, 64px) 43px;
  }

  .welcome-copy,
  .password-form,
  .login-preferences {
    width: 100%;
  }

  .welcome-copy h1 {
    font-size: clamp(36px, 3.1vw, 43px);
  }

  .description {
    margin-bottom: 28px;
  }

  .login-preferences {
    margin-top: 26px;
  }
}

@media (max-width: 420px) {
  .login-shell {
    padding: 17px 12px 14px;
  }

  .login-header {
    gap: 8px;
  }

  .login-wordmark {
    gap: 8px;
    font-size: 13px;
  }

  .header-caption {
    font-size: .625rem;
    letter-spacing: .11em;
  }

  .wordmark-seal {
    width: 30px;
    height: 30px;
  }

  .login-main {
    padding-block: 22px;
  }

  .welcome-card {
    border-radius: 25px;
  }

  .character-stage {
    min-height: 210px;
  }

  .character {
    bottom: 25px;
    width: 55%;
  }

  .character img {
    height: 151px;
  }

  .stage-label-top {
    top: 15px;
    left: 17px;
    font-size: .6875rem;
  }

  .stage-caption {
    bottom: 11px;
    font-size: .625rem;
  }

  .welcome-content {
    padding: 25px 22px 21px;
  }

  .welcome-copy h1 {
    font-size: var(--font-title);
  }

  .description {
    margin: 9px 0 20px;
    font-size: var(--font-body);
  }

  .login-preferences {
    align-items: start;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
    padding-top: 14px;
  }

  .theme-options {
    gap: 2px;
  }

  .theme-choice {
    gap: 4px;
    padding-inline: 5px;
    font-size: var(--font-meta);
  }

  .motion-toggle {
    gap: 5px;
    font-size: var(--font-meta);
  }

  .note {
    margin-top: 17px;
  }

  .login-footer span:last-child {
    font-size: .625rem;
    letter-spacing: .1em;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.login-page *,
  body.login-page *::before,
  body.login-page *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

body.login-page[data-motion="off"] *,
body.login-page[data-motion="off"] *::before,
body.login-page[data-motion="off"] *::after {
  scroll-behavior: auto !important;
  animation: none !important;
  transition: none !important;
}
.wordmark-logo { width: 40px; height: 40px; border-radius: 12px; object-fit: cover; flex-shrink: 0; }
