* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: Arial, Helvetica, sans-serif;
  background: #f2f2f2;
  color: #000000;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
}

.app {
  width: 100%;
  max-width: 390px;
  min-height: 100vh;
  background: #ffffff;
  position: relative;
  overflow: hidden;
}

.screen {
  width: 100%;
  min-height: 100vh;
  display: none;
  background: #ffffff;
  position: relative;
}

.screen.active {
  display: block;
}

.screen-inner {
  width: 100%;
  min-height: 100vh;
  position: relative;
  padding: 38px 34px 0;
}

.topbar {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  position: relative;
  z-index: 30;
}

.brand-logo {
  width: 118px;
  max-width: 42%;
  height: auto;
  display: block;
}

.top-button {
  border: 0;
  outline: 0;
  min-width: 120px;
  height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  background: #2b2b2b;
  color: #ffffff;
  font-size: 15px;
  font-weight: 800;
  line-height: 42px;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.hero-copy {
  text-align: center;
  margin-top: 42px;
  position: relative;
  z-index: 20;
}

.hero-subtitle {
  margin: 0 0 8px;
  font-size: 20px;
  line-height: 1.2;
  font-weight: 400;
}

.hero-title {
  margin: 0;
  font-size: 56px;
  line-height: 0.95;
  letter-spacing: -1.8px;
  font-weight: 900;
}

.hero-index-wrap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0px;
  width: 100%;
  display: flex;
  justify-content: center;
  pointer-events: none;
  z-index: 5;
}

.hero-index {
  width: 100%;
  max-width: 392px;
  height: auto;
  display: block;
  margin: 0 !important;
}

.login-illustration {
  width: 100%;
  height: auto;
  display: block;
  margin: 0px auto 5px;
}

/* =========================================================
   Welcome Back Card
   Mascot: hair outside, feet inside, right aligned
========================================================= */

.welcome-card {
  width: 100%;
  min-height: 118px;
  border-radius: 14px 14px 0 0;
  background: #6b68ad;
  position: relative;
  overflow: visible;
  display: flex;
  align-items: center;
  padding: 18px 16px;
  isolation: isolate;
}

.welcome-card-text {
  position: relative;
  z-index: 4;
  width: 58%;
  max-width: 210px;
}

.welcome-word {
  color: #ffffff;
  font-size: 27px;
  font-weight: 900;
  line-height: 0.9;
}

.back-word {
  color: #ffffff;
  font-size: 50px;
  font-weight: 900;
  line-height: 0.95;
}

.portal-badge {
  margin-top: 8px;
  display: inline-flex;
  background: #ffb01d;
  color: #000000;
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 9px;
  font-weight: 800;
  white-space: nowrap;
}

.welcome-card-mascot {
  position: absolute;
  right: -40px;
  bottom: -7px;
  width: 68%;
  /* max-width: 178px;
  min-width: 150px; */
  height: auto;
  display: block;
  z-index: 3;
  pointer-events: none;
}

.back-word {
  color: #ffffff;
  font-size: 50px;
  font-weight: 900;
  line-height: 0.95;
}

.portal-badge {
  margin-top: 8px;
  display: inline-flex;
  background: #ffb01d;
  color: #000000;
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 9px;
  font-weight: 800;
}

.login-panel {
  width: 100%;
  border: 1px solid #d8d8d8;
  border-top: 0;
  border-radius: 0 0 18px 18px;
  background: #ffffff;
  overflow: hidden;
}

.login-title {
  margin: 0;
  padding: 14px 12px 4px;
  font-size: 21px;
  line-height: 1.02;
  font-weight: 500;
  text-transform: uppercase;
}

.form-area {
  padding: 6px 12px 16px;
}

.form-group {
  margin-bottom: 11px;
}

.form-label {
  display: block;
  margin-bottom: 5px;
  font-size: 13px;
  line-height: 1;
  font-weight: 900;
  text-transform: uppercase;
}

.form-input {
  width: 100%;
  height: 26px;
  border: 1px solid #d6d6d6;
  border-radius: 999px;
  padding: 0 12px;
  background: #ffffff;
  color: #000000;
  font-size: 13px;
  outline: none;
}

.form-input:focus {
  border-color: #56d6ca;
  box-shadow: 0 0 0 3px rgba(86, 214, 202, 0.18);
}

.form-help {
  margin-top: 4px;
  font-size: 8.5px;
  font-weight: 800;
}

.signin-btn {
  width: 100%;
  height: 48px;
  margin-top: 10px;
  border: 0;
  border-radius: 999px;
  background: #56d6ca;
  color: #000000;
  font-size: 20px;
  font-weight: 900;
  cursor: pointer;
}

.signin-btn:disabled {
  opacity: 0.65;
  cursor: wait;
}

.alert-box {
  display: none;
  margin: 8px 0 0;
  padding: 9px 11px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 800;
}

.alert-box.show {
  display: block;
}

.alert-error {
  background: #ffe9e9;
  color: #ad0000;
}

.alert-success {
  background: #e7fff8;
  color: #007865;
}

/* Animation */
.anim-logo {
  animation: slideLogo 0.75s ease-out both;
}

.anim-logo-left {
  animation: slideLogo 0.75s ease-out both;
}

.anim-top-button {
  animation: slideButton 0.75s ease-out 0.12s both;
}

.anim-button-right {
  animation: slideButton 0.75s ease-out 0.12s both;
}

.anim-hero {
  animation: slideHero 0.9s cubic-bezier(0.2, 0.85, 0.25, 1) 0.2s both;
}

.anim-up {
  animation: slideUp 0.75s ease-out both;
}

.anim-card-up {
  animation: slideUp 0.75s ease-out 0.1s both;
}

@keyframes slideLogo {
  from {
    opacity: 0;
    transform: translate(-55px, -22px);
  }

  to {
    opacity: 1;
    transform: translate(0, 0);
  }
}

@keyframes slideButton {
  from {
    opacity: 0;
    transform: translate(55px, -22px);
  }

  to {
    opacity: 1;
    transform: translate(0, 0);
  }
}

@keyframes slideHero {
  from {
    opacity: 0;
    transform: translateY(130px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(45px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}
/* =========================================================
   MOBILE BASELINE: Design from iPhone SE first
   Mascot full width, no text overlap
========================================================= */

@media (max-width: 767px) {
  html,
  body {
    width: 100%;
    min-height: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    background: #ffffff;
  }

  body {
    display: block;
  }

  .app {
    width: 100%;
    max-width: none;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: #ffffff;
    border-radius: 0;
    box-shadow: none;
  }

  .screen,
  .screen-inner {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    background: #ffffff;
    overflow: hidden;
  }

  .screen-inner {
    position: relative;
    padding: 54px 28px 0;
  }

  .topbar {
    position: relative;
    z-index: 30;
  }

  .brand-logo {
    width: 108px;
    max-width: 42%;
  }

  .top-button {
    min-width: 126px;
    height: 39px;
    padding: 0 18px;
    font-size: 15px;
    line-height: 39px;
    border-radius: 999px;
  }

  .hero-copy {
    position: relative;
    z-index: 20;
    text-align: center;
    margin-top: 36px;
  }

  .hero-subtitle {
    margin: 0 0 6px;
    font-size: 18px;
    line-height: 1.15;
    font-weight: 400;
  }

  .hero-title {
    margin: 0;
    font-size: 42px;
    line-height: 0.92;
    letter-spacing: -1.4px;
    font-weight: 900;
  }

  .hero-index-wrap {
    position: absolute;
    left: 50%;
    /* top: 292px; */
    bottom: auto;
    z-index: 5;
    width: 100vw;
    transform: translateX(-50%);
    display: block;
    pointer-events: none;
  }

  .hero-index {
    display: block;
    width: 100vw;
    max-width: none;
    height: auto;
    margin: 0 !important;
  }

  .hero-index.anim-hero {
    margin: 0 !important;
  }
}
/* =========================================================
   iPhone SE / Small Height
   375 x 667
========================================================= */
/* =========================================================
   iPhone SE / Small Height
   375 x 667
   Keep mascot symmetric, reduce text spacing instead
========================================================= */
/* =========================================================
   iPhone SE / Small Height
   375 x 667
   Keep mascot full width and symmetric
========================================================= */
/* =========================================================
   iPhone SE: 375 x 667
========================================================= */

/* =========================================================
   iPhone SE: 375 x 667
   Fine tune layout balance
========================================================= */

@media (max-width: 380px) and (max-height: 700px) {
  .screen-inner {
    padding-top: 25px;
    padding-left: 40px;
    padding-right: 29px;
    padding-bottom: 0;
  }

  .brand-logo {
    width: 108px;
  }

  .top-button {
    min-width: 134px;
    height: 39px;
    padding: 0 19px;
    font-size: 16px;
    line-height: 39px;
  }

  .hero-copy {
    margin-top: 34px;
    position: relative;
    z-index: 20;
  }

  .hero-subtitle {
    font-size: 17px;
    line-height: 1.12;
    margin-bottom: 5px;
  }

  .hero-title {
    font-size: 36px;
    line-height: 0.92;
    letter-spacing: -1.2px;
  }

  .hero-index-wrap {
    bottom: 0px;
    width: 100vw;
    z-index: 5;
  }

  .hero-index {
    width: 100vw;
    max-width: none;
    height: auto;
  }

  .welcome-card {
    min-height: 118px;
    padding: 17px 14px;
  }

  .welcome-card-text {
    width: 57%;
  }

  .welcome-word {
    font-size: 25px;
  }

  .back-word {
    font-size: 46px;
  }

  .portal-badge {
    padding: 7px 10px;
    font-size: 8.5px;
  }

  .welcome-card-mascot {
    right: -20px;
    bottom: -7px;
    width: 68%;
    /* max-width: 172px;
    min-width: 146px; */
  }
}
/* =========================================================
   iPhone 12 Pro / iPhone XR / Tall Mobile
========================================================= */
/* =========================================================
   iPhone 12 Pro / iPhone XR / Tall Mobile
========================================================= */

@media (min-width: 381px) and (max-width: 430px) and (min-height: 701px) {
  .screen-inner {
    padding-top: 30px;
    padding-left: 28px;
    padding-right: 28px;
  }

  .brand-logo {
    width: 108px;
  }

  .top-button {
    min-width: 126px;
    height: 39px;
    padding: 0 19px;
    font-size: 15px;
    line-height: 39px;
  }

  .hero-copy {
    margin-top: 20px;
  }

  .hero-subtitle {
    font-size: 20px;
    line-height: 1.2;
    margin-bottom: 8px;
  }

  .hero-title {
    font-size: 38px;
    line-height: 0.98;
    letter-spacing: -1.8px;
  }

  .hero-index-wrap {
    bottom: 0px;
  }

  .hero-index {
    width: 100vw;
    max-width: none;
  }
}

/* =========================================================
   Very Short Mobile Fallback
========================================================= */
@media (max-height: 620px) {
  .screen-inner {
    padding-top: 44px;
  }

  .hero-copy {
    margin-top: 28px;
  }

  .hero-subtitle {
    font-size: 18px;
  }

  .hero-title {
    font-size: 45px;
  }

  .hero-index-wrap {
    bottom: 0px;
  }

  .hero-index {
    width: 100vw;
    max-width: none;
  }
}

/* =========================================================
   Desktop / Tablet
========================================================= */
/* =========================================================
   Desktop / Tablet Layout Fix for index.php
   Clean split layout: text left, mascot right
========================================================= */
/* =========================================================
   Desktop / Tablet Layout
   Welcome: text left, image right
   Login: image left, form right
========================================================= */
@media (min-width: 768px) {
  html,
  body {
    width: 100%;
    min-height: 100%;
    margin: 0;
    padding: 0;
    background: #f2f2f2;
  }

  body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 34px;
  }

  .app {
    width: min(100%, 1180px);
    max-width: 1180px;
    height: min(820px, calc(100vh - 68px));
    min-height: 720px;
    max-height: 860px;
    background: #ffffff;
    border-radius: 28px;
    box-shadow: 0 22px 65px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    position: relative;
  }

  .screen {
    width: 100%;
    height: 100%;
    min-height: 0;
    background: #ffffff;
    position: relative;
  }

  .screen-inner {
    width: 100%;
    height: 100%;
    min-height: 0;
    position: relative;
    padding: 52px 64px 44px;
    overflow: hidden;
  }

  .topbar {
    position: relative;
    z-index: 30;
    width: 100%;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .brand-logo {
    width: 150px;
    max-width: none;
    height: auto;
  }

  .top-button {
    min-width: 150px;
    height: 44px;
    padding: 0 26px;
    border-radius: 999px;
    font-size: 16px;
    line-height: 44px;
  }

  /* =====================================================
     WELCOME SCREEN DESKTOP
     Anywhere Anytime left / Image right
  ===================================================== */

  .welcome-inner {
    display: grid;
    grid-template-columns: 0.9fr 1.15fr;
    grid-template-rows: auto 1fr;
    column-gap: 36px;
    align-items: center;
    padding: 52px 64px 44px;
  }

  .welcome-inner .topbar {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .welcome-inner .hero-copy {
    grid-column: 1;
    grid-row: 2;
    position: relative;
    z-index: 20;
    width: 100%;
    max-width: 470px;
    margin-top: -20px;
    text-align: left;
    align-self: center;
  }

  .welcome-inner .hero-subtitle {
    margin: 0 0 16px;
    font-size: 30px;
    line-height: 1.2;
    font-weight: 400;
  }

  .welcome-inner .hero-title {
    margin: 0;
    font-size: 82px;
    line-height: 0.96;
    letter-spacing: -2.6px;
    font-weight: 900;
  }

  .welcome-inner .hero-index-wrap {
    grid-column: 2;
    grid-row: 2;
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    width: 100%;
    height: 100%;
    transform: none;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    pointer-events: none;
  }

  .welcome-inner .hero-index {
    width: 100%;
    max-width: 620px;
    height: auto;
    max-height: 560px;
    object-fit: contain;
    object-position: center center;
    margin: 0 !important;
  }

  /* =====================================================
     LOGIN SCREEN DESKTOP
     Illustration left / Login form right
  ===================================================== */

  .login-inner {
    display: grid;
    grid-template-columns: 0.95fr 1.05fr;
    grid-template-rows: auto auto auto;
    column-gap: 56px;
    row-gap: 0;
    align-items: start;
    padding: 52px 64px 44px;
  }

  .login-inner .topbar {
    grid-column: 1 / -1;
    grid-row: 1;
    margin-bottom: 42px;
  }

  .login-illustration {
    grid-column: 1;
    grid-row: 2 / span 2;
    width: 100%;
    max-width: 470px;
    height: auto;
    display: block;
    align-self: center;
    justify-self: center;
    margin: 10px auto 0;
  }

  .welcome-card {
    grid-column: 2;
    grid-row: 2;
    width: 100%;
    max-width: 520px;
    min-height: 150px;
    margin: 0;
    padding: 24px 26px;
    border-radius: 18px 18px 0 0;
  }

  .welcome-card-text {
    width: 58%;
    max-width: 280px;
  }

  .welcome-word {
    font-size: 36px;
    line-height: 0.9;
  }

  .back-word {
    font-size: 66px;
    line-height: 0.9;
  }

  .portal-badge {
    margin-top: 10px;
    padding: 8px 14px;
    font-size: 10px;
  }

  .welcome-card-mascot {
    right: -20px;
    bottom: -8px;
    width: 52%;
    max-width: 285px;
    min-width: 0;
  }

  .login-panel {
    grid-column: 2;
    grid-row: 3;
    width: 100%;
    max-width: 520px;
    margin: 0;
    border-radius: 0 0 20px 20px;
  }

  .login-title {
    padding: 22px 20px 8px;
    font-size: 30px;
    line-height: 1;
  }

  .form-area {
    padding: 12px 20px 24px;
  }

  .form-group {
    margin-bottom: 16px;
  }

  .form-label {
    margin-bottom: 7px;
    font-size: 14px;
  }

  .form-input {
    height: 38px;
    padding: 0 16px;
    font-size: 15px;
  }

  .form-help {
    margin-top: 5px;
    font-size: 10px;
  }

  .signin-btn {
    height: 52px;
    margin-top: 14px;
    font-size: 21px;
  }

  .alert-box {
    font-size: 13px;
  }
}

/* =========================================================
   iPhone SE Compact Fix for index.php
   Target: 375 x 667
   Keep original UI, only reduce size/spacing
========================================================= */

@media (max-width: 380px) and (max-height: 700px) {
  html,
  body {
    width: 100%;
    height: 100%;
    min-height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: #ffffff;
  }

  body {
    display: block;
  }

  .app {
    width: 100%;
    max-width: none;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
    background: #ffffff;
  }

  .screen,
  .screen-inner {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
    background: #ffffff;
  }

  .screen-inner {
    padding: 22px 28px 0;
  }

  /* Header */
  .topbar {
    height: 36px;
    gap: 10px;
  }

  .brand-logo {
    width: 104px;
    max-width: 42%;
  }

  .top-button {
    min-width: 112px;
    height: 34px;
    padding: 0 15px;
    font-size: 13px;
    line-height: 34px;
  }

  /* Welcome screen text */
  .hero-copy {
    margin-top: 24px;
  }

  .hero-subtitle {
    font-size: 16px;
    line-height: 1.12;
    margin-bottom: 5px;
  }

  .hero-title {
    font-size: 34px;
    line-height: 0.92;
    letter-spacing: -1.1px;
  }

  /* Welcome mascot full width */
  .hero-index-wrap {
    left: 50%;
    right: auto;
    bottom: 0;
    width: 100vw;
    transform: translateX(-50%);
    z-index: 5;
  }

  .hero-index {
    width: 100vw;
    max-width: none;
    height: auto;
  }

  /* Login illustration */
  .login-illustration {
    width: 100%;
    max-width: 205px;
    margin: 4px auto 6px;
  }

  /* Welcome Back purple card */
  .welcome-card {
    min-height: 82px;
    padding: 11px 13px 9px;
    border-radius: 12px 12px 0 0;
  }

  .welcome-card-text {
    width: 58%;
    max-width: none;
  }

  .welcome-word {
    font-size: 21px;
    line-height: 0.9;
  }

  .back-word {
    font-size: 36px;
    line-height: 0.9;
  }

  .portal-badge {
    margin-top: 5px;
    padding: 5px 8px;
    font-size: 7.8px;
  }

  .welcome-card-mascot {
    right: -16px;
    bottom: -6px;
    width: 58%;
    max-width: none;
    min-width: 0;
  }

  /* Login panel */
  .login-panel {
    border-radius: 0 0 16px 16px;
  }

  .login-title {
    padding: 10px 11px 3px;
    font-size: 18px;
    line-height: 0.98;
  }

  .form-area {
    padding: 6px 11px 12px;
  }

  .form-group {
    margin-bottom: 7px;
  }

  .form-label {
    margin-bottom: 4px;
    font-size: 10px;
    line-height: 1;
  }

  .form-input {
    height: 24px;
    padding: 0 10px;
    font-size: 10.5px;
  }

  .form-help {
    margin-top: 3px;
    font-size: 7.5px;
  }

  .signin-btn {
    height: 38px;
    margin-top: 8px;
    font-size: 16px;
  }

  .alert-box {
    margin-top: 5px;
    padding: 7px 9px;
    font-size: 10px;
    line-height: 1.2;
  }
}
