:root {
  color-scheme: dark;
  --room-dark: oklch(0.145 0.02 252);
  --room-mid: oklch(0.21 0.03 252);
  --wall-lit: oklch(0.78 0.025 82);
  --warm: oklch(0.86 0.13 82);
  --warm-strong: oklch(0.78 0.16 68);
  --ink: oklch(0.16 0.022 252);
  --paper: oklch(0.97 0.012 84);
  --muted: oklch(0.54 0.025 252);
  --danger: oklch(0.63 0.17 28);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  font-family:
    "Aptos",
    "Segoe UI",
    "Microsoft YaHei",
    sans-serif;
  background: var(--room-dark);
}

button,
input {
  font: inherit;
}

.login-scene {
  min-height: 100svh;
  background:
    linear-gradient(180deg, oklch(0.11 0.018 252), transparent 22%),
    linear-gradient(115deg, var(--room-mid), var(--room-dark) 52%, oklch(0.1 0.018 252));
  color: var(--paper);
  transition:
    background 420ms ease,
    color 420ms ease;
}

body.lights-on .login-scene {
  background:
    linear-gradient(180deg, oklch(0.68 0.045 82), transparent 34%),
    linear-gradient(115deg, var(--wall-lit), oklch(0.67 0.035 86) 54%, oklch(0.48 0.032 92));
  color: var(--ink);
}

.room {
  position: relative;
  display: grid;
  min-height: 100svh;
  place-items: center;
  padding: 32px;
  isolation: isolate;
}

.ceiling-line {
  position: absolute;
  top: 88px;
  left: 0;
  right: 0;
  height: 1px;
  background: oklch(0.92 0.015 84 / 0.16);
  opacity: 0.42;
}

.lamp {
  position: absolute;
  top: 0;
  left: 50%;
  z-index: 0;
  width: min(560px, 78vw);
  height: 62svh;
  transform: translateX(-50%);
  pointer-events: none;
}

.lamp-cord {
  position: absolute;
  top: 0;
  left: 50%;
  width: 2px;
  height: 96px;
  background: oklch(0.86 0.02 84 / 0.38);
}

.lamp-shade {
  position: absolute;
  top: 88px;
  left: 50%;
  width: 176px;
  height: 74px;
  transform: translateX(-50%);
  border-radius: 36px 36px 10px 10px;
  background:
    linear-gradient(180deg, oklch(0.4 0.03 252), oklch(0.2 0.02 252));
  box-shadow: inset 0 -14px 0 oklch(0.06 0.014 252 / 0.42);
}

body.lights-on .lamp-shade {
  background:
    linear-gradient(180deg, oklch(0.96 0.032 82), oklch(0.66 0.06 82));
}

.light-beam {
  position: absolute;
  top: 136px;
  left: 50%;
  width: min(560px, 86vw);
  height: min(470px, 60svh);
  transform: translateX(-50%);
  clip-path: polygon(39% 0, 61% 0, 100% 100%, 0 100%);
  background:
    linear-gradient(180deg, oklch(0.94 0.12 82 / 0.58), oklch(0.92 0.08 82 / 0.12) 68%, transparent);
  opacity: 0;
  transition:
    opacity 360ms ease,
    transform 420ms ease;
}

body.lights-on .light-beam {
  opacity: 1;
  transform: translateX(-50%) translateY(8px);
}

.desk-light {
  position: absolute;
  left: 50%;
  bottom: 32px;
  width: min(720px, 92vw);
  height: 90px;
  transform: translateX(-50%);
  clip-path: ellipse(50% 38% at 50% 50%);
  background: oklch(0.9 0.08 82 / 0.28);
  opacity: 0;
  transition: opacity 420ms ease;
}

body.lights-on .desk-light {
  opacity: 1;
}

.login-panel {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 16px;
  width: min(400px, calc(100vw - 48px));
  min-height: 460px;
  align-content: center;
  border: 1px solid oklch(0.96 0.012 84 / 0.14);
  border-radius: 8px;
  padding: 34px;
  background: oklch(0.12 0.018 252 / 0.72);
  box-shadow: 0 28px 90px oklch(0.04 0.014 252 / 0.52);
  transform: translateY(10px);
  transition:
    background 420ms ease,
    border-color 420ms ease,
    box-shadow 420ms ease,
    transform 420ms ease;
}

body.lights-on .login-panel {
  border-color: oklch(0.68 0.034 84 / 0.55);
  background: oklch(0.96 0.014 84 / 0.92);
  box-shadow: 0 26px 70px oklch(0.24 0.04 84 / 0.26);
  transform: translateY(0);
}

.brand-logo {
  width: 150px;
  height: auto;
  padding: 7px 9px;
  border-radius: 6px;
  background: oklch(0.96 0.006 245);
}

.eyebrow {
  margin: 8px 0 0;
  color: var(--warm);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

body.lights-on .eyebrow {
  color: oklch(0.45 0.12 28);
}

h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: 0;
}

.hint {
  margin: 0 0 4px;
  color: oklch(0.78 0.018 252);
  font-size: 14px;
}

body.lights-on .hint {
  color: var(--muted);
}

.password-field {
  display: grid;
  gap: 7px;
  color: oklch(0.8 0.018 252);
  font-size: 12px;
  font-weight: 800;
  opacity: 0.42;
  transform: translateY(6px);
  transition:
    opacity 260ms ease,
    transform 260ms ease,
    color 260ms ease;
}

body.lights-on .password-field {
  color: var(--muted);
  opacity: 1;
  transform: translateY(0);
}

.password-field input {
  width: 100%;
  height: 44px;
  border: 1px solid oklch(0.84 0.02 84);
  border-radius: 6px;
  padding: 0 12px;
  outline: none;
  background: oklch(0.99 0.008 84);
  color: var(--ink);
  font-size: 16px;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.password-field input:focus {
  border-color: var(--warm-strong);
  box-shadow: 0 0 0 3px oklch(0.78 0.16 68 / 0.2);
}

.login-button {
  height: 44px;
  border: 0;
  border-radius: 6px;
  background: var(--warm-strong);
  color: oklch(0.98 0.012 84);
  font-weight: 800;
  cursor: pointer;
  opacity: 0.45;
  transform: translateY(6px);
  transition:
    opacity 220ms ease,
    transform 220ms ease,
    background 160ms ease;
}

body.lights-on .login-button {
  opacity: 1;
  transform: translateY(0);
}

.login-button:hover {
  background: oklch(0.7 0.18 58);
}

.login-error {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
  font-size: 13px;
  font-weight: 750;
}

.wall-switch {
  position: absolute;
  right: clamp(24px, 8vw, 120px);
  top: min(42svh, 360px);
  z-index: 3;
  display: grid;
  gap: 10px;
  justify-items: center;
  border: 1px solid oklch(0.92 0.012 84 / 0.18);
  border-radius: 8px;
  padding: 16px 14px;
  background: oklch(0.14 0.018 252 / 0.72);
  color: oklch(0.84 0.018 84);
  cursor: pointer;
  transition:
    background 260ms ease,
    color 260ms ease,
    transform 160ms ease;
}

.wall-switch:hover {
  transform: translateY(-1px);
}

body.lights-on .wall-switch {
  background: oklch(0.96 0.012 84 / 0.88);
  color: var(--ink);
}

.switch-track {
  position: relative;
  width: 54px;
  height: 88px;
  border-radius: 999px;
  background: oklch(0.08 0.015 252);
  box-shadow:
    inset 0 0 0 1px oklch(0.95 0.012 84 / 0.12),
    inset 0 12px 18px oklch(0.02 0.01 252 / 0.52);
}

body.lights-on .switch-track {
  background: oklch(0.82 0.04 84);
  box-shadow:
    inset 0 0 0 1px oklch(0.52 0.04 84 / 0.42),
    inset 0 -10px 18px oklch(0.42 0.04 84 / 0.2);
}

.switch-thumb {
  position: absolute;
  left: 8px;
  top: 9px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: oklch(0.3 0.024 252);
  box-shadow: 0 10px 18px oklch(0.03 0.012 252 / 0.48);
  transition:
    top 260ms cubic-bezier(0.2, 0.8, 0.2, 1),
    background 260ms ease;
}

body.lights-on .switch-thumb {
  top: 41px;
  background: oklch(0.98 0.024 82);
}

.switch-label {
  font-size: 12px;
  font-weight: 800;
}

@media (max-width: 760px) {
  body {
    overflow: auto;
  }

  .room {
    align-content: center;
    gap: 22px;
    padding: 28px 20px;
  }

  .lamp {
    width: 100vw;
  }

  .login-panel {
    padding: 28px;
    min-height: 430px;
  }

  .wall-switch {
    position: relative;
    top: auto;
    right: auto;
    grid-auto-flow: column;
    align-items: center;
    padding: 12px 16px;
  }

  .switch-track {
    width: 78px;
    height: 42px;
  }

  .switch-thumb {
    top: 6px;
    left: 7px;
    width: 30px;
    height: 30px;
  }

  body.lights-on .switch-thumb {
    top: 6px;
    left: 41px;
  }
}
