:root {
  --slice: 22px;
  --panel-text: #f97316;
  --sub-text: #ffb727;
  --accent: #fbbf24;
  --accent-strong: #f97316;
  --danger: #fca5a5;
  --success: #86efac;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  height: 100%;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--panel-text);
}

body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background-image: linear-gradient(rgba(15, 23, 42, 0.18), rgba(15, 23, 42, 0.18)),
    url("660a8d0c21ec36e4.jpg");
  background-size: cover;
  background-position: center;
}

.page {
  width: 100%;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.card-stage {
  position: relative;
  width: min(100%, 420px);
  min-height: 510px;
  isolation: isolate;
  overflow: visible;
}

.login-window {
  position: relative;
  z-index: 1;
  width: min(100%, 420px);
  min-height: 510px;
  padding: 18px;
  background: transparent;
  border-image-source: url("card_front.png");
  border-image-slice: 20 fill;
  border-image-width: 18px;
  border-image-repeat: stretch;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  overflow: visible;
}

.card-slot {
  --slot-x: 0px;
  position: absolute;
  top: 50%;
  width: 264px;
  height: 396px;
  border-radius: 0;
  box-shadow: none;
  pointer-events: none;
  opacity: 0;
  transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s ease;
  z-index: 0;
  transform: translate(var(--slot-x), -50%);
  perspective: 1200px;
}

.card-slot--left {
  left: 0;
  --slot-x: -120px;
}

.card-slot--right {
  right: 0;
  --slot-x: 120px;
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

.card-back,
.card-front {
  position: absolute;
  inset: 0;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  backface-visibility: hidden;
  border-radius: 0;
}

.card-back {
  background-image: url("card_back.png");
}

.card-front {
  transform: rotateY(180deg);
  opacity: 0;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2);
  background-image: url("card_front.png");
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  filter: saturate(1.15) contrast(1.08);
}

.card-illustration {
  position: absolute;
  inset: 14px 20px 18px;
  background-size: 105% auto;
  background-position: center;
  background-repeat: no-repeat;
  background-color: transparent;
}

.card-slot.is-flipped .card-inner {
  transform: rotateY(180deg);
}

.card-slot.is-flipped .card-front {
  opacity: 1;
}

.card-slot--left.is-shaking {
  animation: card-shake-left 0.4s ease-in-out;
}

.card-slot--right.is-shaking {
  animation: card-shake-right 0.4s ease-in-out;
}

@keyframes card-shake-left {
  0%, 100% { transform: translate(var(--slot-x), -50%) rotate(0deg); }
  20% { transform: translate(calc(var(--slot-x) - 8px), -50%) rotate(-2deg); }
  40% { transform: translate(calc(var(--slot-x) + 10px), -50%) rotate(2deg); }
  60% { transform: translate(calc(var(--slot-x) - 9px), -50%) rotate(-2deg); }
  80% { transform: translate(calc(var(--slot-x) + 8px), -50%) rotate(2deg); }
}

@keyframes card-shake-right {
  0%, 100% { transform: translate(var(--slot-x), -50%) rotate(0deg); }
  20% { transform: translate(calc(var(--slot-x) + 8px), -50%) rotate(2deg); }
  40% { transform: translate(calc(var(--slot-x) - 10px), -50%) rotate(-2deg); }
  60% { transform: translate(calc(var(--slot-x) + 9px), -50%) rotate(2deg); }
  80% { transform: translate(calc(var(--slot-x) - 8px), -50%) rotate(-2deg); }
}

.card-stage:hover .card-slot,
.card-stage:focus-within .card-slot,
.card-stage.is-active .card-slot {
  opacity: 1;
}

.card-stage:hover .card-slot--left,
.card-stage:focus-within .card-slot--left,
.card-stage.is-active .card-slot--left {
  --slot-x: -280px;
}

.card-stage:hover .card-slot--right,
.card-stage:focus-within .card-slot--right,
.card-stage.is-active .card-slot--right {
  --slot-x: 280px;
}

.window-inner {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  padding: 26px 24px 22px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--sub-text);
  text-transform: uppercase;
}

.brand-mark {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  font-weight: 800;
  border-radius: 9px;
}

h1 {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 2.3rem);
  line-height: 1.15;
  color: #ff9f43;

}

.subtitle {
  margin: 8px 0 26px;
  color: var(--sub-text);
  font-size: 0.98rem;
}

form {
  display: grid;
  gap: 18px;
}

.field-group {
  display: grid;
  gap: 8px;
}

.field-group label {
  font-size: 0.82rem;
  color: var(--sub-text);
  font-weight: 600;
}

.input-slice {
  display: flex;
  align-items: center;
  min-height: 52px;
  width: 100%;
  border-image-source: url("BG_inputArea.png");
  border-image-slice: 16 fill;
  border-image-width: 14px;
  border-image-repeat: stretch;
  padding: 0 12px;
  background: transparent;
}

.input-slice input {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--panel-text);
  font-size: 1rem;
  outline: none;
  padding: 10px 0;
}

.input-slice input::placeholder {
  color: rgba(255, 255, 255, 0.72);
}

.password-row {
  gap: 10px;
}

.password-row input {
  flex: 1;
}

.toggle-password {
  border: 0;
  background: transparent;
  color: #fff5d4;
  font-weight: 700;
  cursor: pointer;
  padding: 0 4px 0 0;
}

.options-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--sub-text);
  font-size: 0.82rem;
}

.remember-me {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.remember-me input {
  accent-color: var(--accent-strong);
}

.options-row a {
  color: #bd9b52;
  text-decoration: none;
}

.login-button {
  width: 100%;
  min-height: 56px;
  border: 0;
  background: transparent;
  border-image-source: url("btn_flat.png");
  border-image-slice: 22 fill;
  border-image-width: 18px;
  border-image-repeat: stretch;
  color: #ff9f43;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0 16px;
  transition: transform 0.15s ease, filter 0.15s ease, color 0.12s ease;
}

.login-button:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

.login-button:active,
.login-button.is-active {
  border-image-source: url("btn_active.png");
  color: #ffffff;
  transform: translateY(1px);
  filter: brightness(1.05);
}

.status {
  min-height: 20px;
  margin: 0;
  font-size: 0.85rem;
  color: var(--panel-text);
}

.status.error {
  color: var(--danger);
}

.status.success {
  color: var(--success);
}

@media (max-width: 480px) {
  .login-window {
    min-height: 480px;
    padding: 12px;
  }

  .window-inner {
    padding: 22px 18px 16px;
  }

  .options-row {
    flex-direction: column;
    align-items: flex-start;
  }
}
