/* ===== Theme ===== */
:root{
  --purple: #8f61a5;
  --purple-dark:#7a4e91;
  --panel:#aaaaaa;
  --peach:#efc0a8;
  --ink:#111;
  --ink-invert:#fff;
  --top-h: 200px;
  --bottom-h: 135px;
  --btn-h: clamp(44px, 6vh, 60px);
  --peach-h: calc(var(--btn-h) + 10px);
  --logo-d: clamp(110px, 18vw, 160px);
  --card-w: clamp(300px, 88vw, 420px);
  --radius-xl: 32px;
  --radius-pill: 999px;
  --shadow: 0 10px 30px rgba(0,0,0,.10);
}

* { box-sizing: border-box; }
html, body {
  height: 100%;
  overscroll-behavior: none;
  background: var(--purple); 
}

body{
  margin: 0;
  background: var(--purple);
  color: var(--ink);
  font: 16px/1.4 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  min-height: 100svh;
}

/* ===== Layout shell (allow page to grow) ===== */
.shell{
  min-height: 100svh;  /* fill screen initially */
  height: auto;        /* allow growth beyond viewport */
  display: grid;
  grid-template-rows:
    minmax(140px, var(--top-h))                 /* top purple */
    auto                                        /* grey panel grows with content */
    minmax(var(--peach-h), max-content)         /* peach band */
    minmax(80px, var(--bottom-h));              /* bottom purple */
  overflow: visible;                            /* do not clip children */
}

.band{
  display: grid;
  place-items: center;
  color: var(--ink-invert);
}

/* Top band with mid-point title placement */
.band--top{
  background: var(--purple);
  position: relative;
  display: block;
  height: var(--top-h);
  padding-top: env(safe-area-inset-top);
}

/* Center title between viewport top and top of logo circle */
.band--top .appTitle{
  position: absolute;
  left: 0; right: 0;
  top: calc((var(--top-h) - (var(--logo-d) / 2)) / 2);
  transform: translateY(-50%);
  margin: 0;
  text-align: center;
  line-height: 1;
}

.band--peach{
  background: var(--peach);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(var(--btn-h) * 3 + 40px);
  padding: 12px 0;
  padding-bottom: max(env(safe-area-inset-bottom), 12px);

  /* Match grey panel curve on the bottom */
  border-bottom-left-radius: var(--radius-xl);
  border-bottom-right-radius: var(--radius-xl);
}

.band--bottom{
  background: var(--purple);
  padding-bottom: max(env(safe-area-inset-bottom), 0px);
}

.appTitle{
  padding: 0 16px;
  font-size: clamp(24px, 4.6vw, 40px);
  letter-spacing: .5px;
  font-weight: 800;
  text-align: center;
}

/* ===== Grey panel ===== */
.panel{
  background: var(--panel);
  position: relative;
  border-top-left-radius: var(--radius-xl);
  border-top-right-radius: var(--radius-xl);
  box-shadow: var(--shadow) inset;
  display: grid;
  place-items: start center;     /* top-center content */
  padding-top: calc(var(--logo-d) / 2 + 20px); /* clear overlapping logo */
  padding-bottom: 24px;          /* breathing room above peach band */
}

.logoBadge{
  position:absolute;
  top:calc(-1 * var(--logo-d) / 2);
  left:0; right:0;
  display:grid;
  place-items:center;
  pointer-events:none;
}

.logoCircle{
  width:var(--logo-d);
  height:var(--logo-d);
  background:#fff;
  border-radius:50%;
  overflow:hidden;                 
  /*box-shadow:0 10px 24px rgba(0,0,0,.12)*/
  display:flex;
  align-items:center;
  justify-content:center;
}

.logoCircle img{
  width:100%;
  height:100%;
  object-fit:cover;              
  display:block;
}


.card{
  width: var(--card-w);
  margin: 0 auto;
  padding: 8px 8px 0;
}

.cardTitle{
  margin: 0 0 14px;
  color: #fff;
  font-size: clamp(24px, 4.5vw, 34px);
  font-weight: 800;
}

.label{
  display: block;
  font-size: 14px;
  color: #f5f5f5;
  margin: 10px 2px 6px;
}

.inputWrap{
  position: relative;
  margin-bottom: 12px;
}

input{
  width: 100%;
  height: 50px;
  border-radius: var(--radius-pill);
  border: none;
  padding: 0 18px;
  font-size: 16px;
  background: #fff;
  color: var(--ink);
  outline: 2px solid transparent;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.06);
}

input::placeholder{ color:#777; }
input:focus{ outline-color:#ddd; }

/* Optional: extra bottom padding for password field */
#password{ padding-bottom: 8px; }

.peek{
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  height: 36px;
  min-width: 36px;
  border-radius: 18px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 16px;
  opacity: .6;
  transition: opacity .2s ease;
}

.peek:hover{
  opacity: 1;
}

/* Inline message: keeps layout stable even when empty */
#loginMsg{
  min-height: 18px;
  color: #fff;
  margin: 6px 2px 0;
  padding-bottom: 8px;
}

/* ===== Buttons in peach band ===== */
.loginBtn{
  height: var(--btn-h);
  width: 200px;
  line-height: 1;
  padding: 0 28px;
  border-radius: var(--radius-pill);
  border: 2px solid #fff;
  background: transparent;
  color: #fff;
  font-weight: 700;
  font-size: clamp(16px, 2.4vw, 18px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.peachActions{
  display: flex;
  flex-direction: column;  /* stacked on mobile */
  align-items: center;
  gap: 10px;
}

.peachActions a{
  height: var(--btn-h);
  width: 200px;
  line-height: 1;
  padding: 0 28px;
  border-radius: var(--radius-pill);
  border: 2px solid #fff;
  background: transparent;
  color: #fff;
  font-weight: 700;
  font-size: clamp(16px, 2.4vw, 18px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
  pointer-events: auto;
  cursor: pointer;
}

/* Hover/focus states */
.loginBtn:hover,
.peachActions a:hover{
  background: #fff;
  color: var(--purple);
}

.loginBtn:focus-visible,
.peachActions a:focus-visible{
  outline: 3px solid rgba(255,255,255,.85);
  outline-offset: 2px;
  border-color: #fff;
}

/* ===== Side-by-side inputs on desktop ===== */
.formRow{
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.inputBlock{ flex: 1; }

/* ===== Desktop adjustments ===== */
@media (min-width: 900px){
  :root{
    --top-h: 160px;
    --bottom-h: 110px;
  }

  .card{ padding: 12px 10px 0; }
  input{ height: 54px; font-size: 17px; }

  .formRow{
    flex-direction: row;
    gap: 20px;
  }

  .peachActions{ flex-direction: row; }

  .band--peach{
    min-height: calc(var(--btn-h) + 24px);
    padding: 16px 0;
    border-bottom-left-radius: var(--radius-xl);
    border-bottom-right-radius: var(--radius-xl);
  }
}

/* ===== Height-driven tweaks ===== */
@media (max-height: 860px){
  :root{
    --top-h: 180px;
    --bottom-h: 131px;
    --btn-h: clamp(42px, 6vh, 56px);
    --logo-d: clamp(100px, 15vh, 150px);
  }
  .panel{ padding-top: calc(var(--logo-d) / 2 + 16px); }
}

@media (max-height: 780px){
  :root{
    --top-h: 160px;
    --bottom-h: 125px;
    --btn-h: 48px;
    --logo-d: 120px;
    --card-w: clamp(300px, 70vw, 400px);
  }
  input{ height: 48px; font-size: 16px; }
}

@media (max-height: 700px){
  :root{
    --top-h: 140px;
    --bottom-h: 121px;
    --btn-h: 44px;
    --logo-d: 108px;
  }
  .cardTitle{ margin-bottom: 10px; }
  .card{ padding: 6px 8px 0; }
  input{ height: 44px; font-size: 15px; }
}

.actions{
  display:flex;
  flex-direction:column;
  justify-content:flex-start;
  align-items:center;
}

/* ===== Legal footer ===== */
.legal{
  margin-top: 4px;
  padding: 4px 14px 6px;
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  font-size: 12px;
  color: rgba(255,255,255,.85);
  opacity: .9;
}

.legal a{
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.legal a:focus,
.legal a:hover{
  text-decoration-thickness: 2px;
}
