* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  font-family: 'Outfit', 'Segoe UI', sans-serif;
  color: #fff;
  background: #050505;
}

html, body { width: 100%; height: 100%; overflow: hidden; }

body { background: #050505; }

button, input { font: inherit; }

.room {
  position: relative;
  width: 100vw;
  height: 100vh;
  min-height: 500px;
  display: flex;
  overflow: hidden;
  background: #050505;
  transition: background-color .8s ease;
}

.room.on { background: #111; }

.room-light {
  position: absolute;
  top: -30%;
  left: 0;
  width: 1000px;
  height: 1000px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transform: scale(.5);
  background: radial-gradient(circle, rgba(255,220,100,.15) 0%, rgba(255,214,0,.05) 30%, transparent 70%);
  transition: opacity .8s ease, transform .8s ease;
}

.room.on .room-light { opacity: 1; transform: scale(1.5); }

.fireflies {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 15;
  overflow: hidden;
}

.firefly {
  position: absolute;
  border-radius: 50%;
  background: #FFEA00;
  box-shadow: 0 0 10px 3px rgba(255,234,0,.9), 0 0 20px rgba(255,179,0,.6);
  animation: fireflyMove var(--duration) ease-in-out var(--delay) infinite alternate;
}

@keyframes fireflyMove {
  0% { transform: translate(var(--x1), var(--y1)); opacity: .45; }
  25% { transform: translate(var(--x2), var(--y2)); opacity: 1; }
  50% { transform: translate(var(--x3), var(--y3)); opacity: .65; }
  75% { transform: translate(var(--x4), var(--y4)); opacity: 1; }
  100% { transform: translate(var(--x5), var(--y5)); opacity: .5; }
}

.lamp-side {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 5;
}

.lamp-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 10;
  transform: scale(1.1);
  -webkit-tap-highlight-color: transparent;
}

.lamp-head {
  width: 140px;
  height: 50px;
  background: #151515;
  border-radius: 140px 140px 4px 4px;
  box-shadow: inset 0 2px 5px rgba(255,255,255,.1), 0 10px 20px rgba(0,0,0,.9);
  position: relative;
  z-index: 6;
  transition: box-shadow .4s ease;
  border-bottom: 2px solid #050505;
}

.room.on .lamp-head {
  box-shadow: inset 0 -3px 10px rgba(255,220,150,.4), inset 0 2px 5px rgba(255,255,255,.1);
}

.lamp-glow {
  position: absolute;
  top: 40px;
  width: 90px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 0 40px 20px rgba(255,230,150,.9), 0 0 80px 40px rgba(255,200,100,.6);
  opacity: 0;
  transition: opacity .4s ease-in-out;
  z-index: 5;
  pointer-events: none;
}

.room.on .lamp-glow { opacity: 1; }

.light-beam {
  position: absolute;
  top: 45px;
  width: 500px;
  height: 350px;
  clip-path: polygon(40% 0, 60% 0, 100% 100%, 0 100%);
  background: linear-gradient(to bottom, rgba(255,230,140,.8) 0%, rgba(255,200,80,.2) 60%, transparent 100%);
  opacity: 0;
  transition: opacity .4s ease-in-out;
  z-index: 3;
  pointer-events: none;
  filter: blur(8px);
}

.room.on .light-beam { opacity: 1; }

.lamp-stem {
  width: 6px;
  height: 290px;
  background: linear-gradient(to right, #050505 0%, #2a2a2a 50%, #050505 100%);
  position: relative;
  z-index: 4;
  transition: background .4s ease, box-shadow .4s ease;
}

.room.on .lamp-stem {
  background: linear-gradient(to right, #050505 0%, #2a2010 50%, #050505 100%);
  box-shadow: 0 0 10px rgba(255,200,100,.15);
}

.lamp-base {
  width: 100px;
  height: 16px;
  background: #151515;
  border-radius: 30px 30px 4px 4px;
  box-shadow: inset 0 2px 5px rgba(255,255,255,.1), 0 10px 20px rgba(0,0,0,.9);
  position: relative;
  z-index: 5;
  transition: box-shadow .4s ease;
  border-bottom: 2px solid #050505;
}

.room.on .lamp-base {
  box-shadow: inset 0 2px 6px rgba(255,220,150,.3), 0 10px 20px rgba(0,0,0,.9);
}

.desk-surface {
  position: absolute;
  bottom: -40px;
  width: 550px;
  height: 100px;
  background: radial-gradient(ellipse at center, rgba(255,220,120,.25) 0%, rgba(255,180,50,.05) 50%, transparent 70%);
  border-radius: 50%;
  opacity: 0;
  transition: opacity .4s ease-in-out;
  z-index: 1;
  pointer-events: none;
}

.room.on .desk-surface { opacity: 1; }

.string-svg {
  position: absolute;
  top: 45px;
  left: calc(50% + 55px);
  width: 2px;
  height: 2px;
  overflow: visible;
  z-index: 5;
  pointer-events: none;
}

.string-svg path {
  stroke: #222;
  stroke-width: 2;
  stroke-linecap: round;
  fill: none;
}

.string-handle {
  position: absolute;
  top: 125px;
  left: calc(50% + 49px);
  width: 10px;
  height: 20px;
  background: linear-gradient(to bottom, #ebd17a, #aa8529);
  border-radius: 5px;
  box-shadow: inset 0 2px 3px rgba(255,255,255,.5), 0 3px 5px rgba(0,0,0,.7);
  cursor: grab;
  z-index: 6;
  touch-action: none;
  user-select: none;
  transition: transform .35s cubic-bezier(.2,.8,.2,1);
}

.string-handle.dragging { cursor: grabbing; transition: none; }

.login-side {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  padding-right: 10%;
}

.login-panel {
  padding: 48px;
  border-radius: 24px;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: translateX(50px);
  filter: blur(10px);
  pointer-events: none;
  transition: opacity .6s ease .0s, transform .6s cubic-bezier(.2,.8,.2,1), filter .6s ease;
  background: rgba(255,255,255,.05);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,.1);
  box-shadow: 0 8px 32px rgba(0,0,0,.3);
}

.room.on .login-panel {
  opacity: 1;
  transform: translateX(0);
  filter: blur(0);
  pointer-events: auto;
  transition-delay: .2s;
}

.glass-line {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.3), transparent);
}

.login-logo {
  height: 56px;
  margin-bottom: 4px;
}

.login-heading {
  text-align: center;
  margin-bottom: 8px;
}

.login-heading h2 {
  font-size: 30px;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: -.5px;
}

.login-heading .brand-name { color: #fff; }
.login-heading .product-name { color: #ffd600; }

.login-heading p { color: #aaa; font-size: 14px; }

.error-message {
  width: 100%;
  background: rgba(220, 38, 38, .15);
  border: 1px solid rgba(248, 113, 113, .4);
  color: #fecaca;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
}

.azure-login-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 16px;
  border-radius: 16px;
  border: none;
  background: #ffd600;
  color: #000;
  text-decoration: none;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .2s, background-color .3s, box-shadow .3s;
}

.azure-login-btn:hover {
  transform: scale(1.02);
  background: #ffdc64;
  box-shadow: 0 0 20px rgba(255,220,100,.4);
}

.azure-login-btn:active { transform: scale(.98); }

.azure-login-btn.loading {
  pointer-events: none;
  background: #ffdc64;
}

.azure-login-btn.loading .ms-icon { opacity: 0; width: 0; }
.azure-login-btn.loading .btn-text { opacity: .7; }

.btn-spinner {
  display: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #fffbe8, #ffd600 45%, #a87700 100%);
  box-shadow: inset -3px -3px 5px rgba(0,0,0,.4), inset 2px 2px 4px rgba(255,255,255,.7);
  animation: btnOrbSpin .9s linear infinite;
}

.azure-login-btn.loading .btn-spinner { display: inline-block; }

@keyframes btnOrbSpin {
  from { transform: rotate(0deg) scaleX(1); }
  50%  { transform: rotate(180deg) scaleX(.78); }
  to   { transform: rotate(360deg) scaleX(1); }
}

.auth-flash {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 18% 28%, rgba(255,255,255,.5), rgba(255,227,122,.25) 35%, transparent 65%);
  opacity: 0;
  pointer-events: none;
  z-index: 999;
  transition: opacity .5s ease;
}

.room.leaving .auth-flash { opacity: 1; }

.room.leaving .login-panel {
  transition: transform .5s ease, box-shadow .5s ease;
  transform: scale(1.01);
  box-shadow: 0 0 0 1px rgba(255,214,0,.25), 0 8px 32px rgba(0,0,0,.3), 0 0 40px rgba(255,214,0,.25);
}

.room.leaving .lamp-glow,
.room.leaving .light-beam {
  transition: filter .5s ease;
  filter: brightness(1.6);
}

/* ===== Authorisation success screen (3D orb + checkmark) ===== */

.auth-panel {
  align-items: center;
  text-align: center;
}

.auth-orb-wrap {
  position: relative;
  width: 90px;
  height: 90px;
  margin: 8px auto 4px;
  perspective: 600px;
}

.auth-orb {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #fffbe8, #ffd600 45%, #a87700 100%);
  box-shadow: inset -10px -10px 22px rgba(0,0,0,.45), inset 8px 8px 16px rgba(255,255,255,.55), 0 0 40px rgba(255,214,0,.45);
  transform-style: preserve-3d;
  animation: authOrbSpin 1.8s linear infinite;
  transition: opacity .4s ease, transform .4s ease;
}

.auth-ring {
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  border: 3px solid rgba(255,214,0,.5);
  transform: rotateX(75deg) rotateZ(0deg);
  animation: authRingSpin 1.3s linear infinite;
  transition: opacity .4s ease;
}

@keyframes authOrbSpin {
  from { transform: rotateY(0deg) scaleX(1); }
  50%  { transform: rotateY(180deg) scaleX(.82); }
  to   { transform: rotateY(360deg) scaleX(1); }
}

@keyframes authRingSpin {
  from { transform: rotateX(75deg) rotateZ(0deg); }
  to   { transform: rotateX(75deg) rotateZ(360deg); }
}

.auth-check {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(.5);
  transition: opacity .4s ease, transform .4s cubic-bezier(.2,.8,.2,1);
}

.auth-check svg { width: 72px; height: 72px; }

.auth-check circle {
  stroke: #4ade80;
  stroke-width: 3;
  stroke-dasharray: 151;
  stroke-dashoffset: 151;
}

.auth-check path {
  stroke: #4ade80;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 36;
  stroke-dashoffset: 36;
}

.auth-orb-wrap.authorised .auth-orb,
.auth-orb-wrap.authorised .auth-ring {
  opacity: 0;
  transform: scale(.6);
}

.auth-orb-wrap.authorised .auth-check {
  opacity: 1;
  transform: scale(1);
}

.auth-orb-wrap.authorised .auth-check circle {
  animation: checkCircle .5s ease forwards;
}

.auth-orb-wrap.authorised .auth-check path {
  animation: checkMark .35s ease .35s forwards;
}

@keyframes checkCircle { to { stroke-dashoffset: 0; } }
@keyframes checkMark { to { stroke-dashoffset: 0; } }

.prompt {
  position: absolute;
  top: 15%;
  left: 18%;
  transform: translateX(-50%);
  color: #555;
  font-size: 18px;
  font-weight: 500;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  opacity: 1;
  transition: opacity .5s ease, transform .5s ease;
}

.room.on .prompt { opacity: 0; transform: translate(-50%, -20px); }

.prompt i {
  width: 2px;
  height: 40px;
  background: linear-gradient(to bottom, #555, transparent);
  animation: promptArrow 2s infinite;
}

@keyframes promptArrow {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(10px); }
}

@media (max-width: 900px) {
  .room { flex-direction: column; overflow-y: auto; }
  .lamp-side { flex: 0 0 55vh; min-height: 430px; }
  .login-side { padding: 30px 24px 50px; flex: 0 0 auto; }
  .login-panel { max-width: 440px; }
  .prompt { left: 50%; top: 7%; font-size: 14px; text-align: center; }
}

@media (max-height: 650px) and (min-width: 901px) {
  .lamp-container { transform: scale(.8); }
  .login-panel { padding: 30px; gap: 16px; }
}
