* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--green-dark); }
a:hover { color: var(--ink); }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* Layout */
.page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
}

.left {
  display: flex;
  flex-direction: column;
  padding: 40px 56px;
}

.login-top {
  position: relative;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--ink);
}
.mark { width: 36px; height: 36px; }
.wordmark { font-size: 20px; font-weight: 700; letter-spacing: 0.06em; }
.wordmark span { color: var(--green-dark); }

.form-area {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 48px 0;
}

.step {
  width: 100%; max-width: 400px;
  display: flex; flex-direction: column;
}
.step[hidden] { display: none; }

h1 {
  margin: 0 0 32px;
  font-size: 28px; font-weight: 700; letter-spacing: -0.2px; line-height: 1.15;
}
#code-step h1 { margin-bottom: 8px; }

label { font-size: 14px; font-weight: 600; margin-bottom: 8px; }

input {
  height: 52px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 0 16px;
  font: inherit; font-size: 16px; color: var(--ink);
  background: var(--surface);
}
input::placeholder { color: var(--placeholder); }
input:focus {
  outline: none;
  border-color: var(--green-dark);
  box-shadow: 0 0 0 3px rgba(20, 163, 94, 0.18);
}
input.invalid { border-color: var(--error); }

.btn {
  margin-top: 20px;
  height: 52px;
  border: 0; border-radius: var(--radius);
  background: var(--accent); color: var(--on-accent);
  font: inherit; font-size: 16px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer;
}
.btn:hover { background: var(--accent-hover); }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn svg, .back svg {
  width: 18px; height: 18px;
  fill: none; stroke: currentColor; stroke-width: 2.2;
  stroke-linecap: round; stroke-linejoin: round;
}

.muted { color: var(--muted); font-size: 15px; margin: 0; }
.sent { margin-bottom: 28px; }
.otp.pin input { font-size: 22px; }
.btn-ghost { background: var(--surface); color: var(--ink); border: 1.5px solid var(--border); }
.btn-ghost:hover { background: var(--soft); }
#pin-step h1, #pin-new-step h1, #bio-step h1 { margin-bottom: 8px; }

.error { color: var(--error); font-size: 13px; margin: 8px 0 0; }
.success { color: var(--green-dark); font-weight: 600; }

.back {
  align-self: flex-start;
  display: flex; align-items: center; gap: 6px;
  height: 44px; padding: 0 12px 0 0; margin-bottom: 16px;
  border: 0; background: none;
  font: inherit; font-size: 15px; font-weight: 500; color: var(--ink);
  cursor: pointer;
}

fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }

.otp { display: flex; gap: 10px; }
.otp input {
  flex: 1 1 0; min-width: 0; max-width: 58px; height: 58px; padding: 0;
  text-align: center; font-size: 18px; font-weight: 600;
}

.resend { margin-top: 18px; font-size: 14px; display: flex; gap: 6px; align-items: center; }
.link {
  border: 0; background: none; padding: 0;
  font: inherit; font-weight: 600; color: var(--green-dark);
  cursor: pointer;
}
.link:disabled { color: var(--muted); font-weight: 500; cursor: default; }

.footer {
  display: flex; flex-wrap: wrap; gap: 8px 20px;
  font-size: 13px;
}

/* Right panel */
.panel {
  position: relative; overflow: hidden;
  background: var(--panel);
  margin: 16px; border-radius: 12px;
  padding: 56px;
  display: flex; flex-direction: column; justify-content: space-between;
  color: var(--panel-text);
}
/* Left side: faint dot pattern + perks */
.left { position: relative; isolation: isolate; }
.left::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: radial-gradient(circle, var(--border) 1.2px, transparent 1.4px); background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 50%, transparent 30%, #000 75%); mask-image: radial-gradient(ellipse 70% 60% at 50% 50%, transparent 30%, #000 75%); opacity: .9; }
.perks { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.perks span { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 8px; background: var(--soft); color: var(--muted); font-size: 13px; font-weight: 600; }
.perks svg { width: 15px; height: 15px; fill: none; stroke: var(--green-dark); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* Campus map with price bubbles */
.map-panel { padding: 0; justify-content: flex-end; }
.login-map { position: absolute; inset: 0; z-index: 0; background: var(--panel); }
.login-map .tiles-dark { filter: grayscale(1) invert(1) brightness(.62) contrast(1.15); }
.login-map .tiles-light { filter: grayscale(1) brightness(1.04) contrast(.92); }
.login-map .leaflet-control-attribution { font-size: 9px; background: rgba(0, 0, 0, .4); color: #aaa; }
.login-map .leaflet-control-attribution a { color: #ccc; }
.bubble { background: none; border: 0; }
.bubble div {
  position: absolute; left: 0; bottom: 0; translate: -50% 0;
  padding: 7px 12px; border-radius: 8px; background: #fff; color: #16181D;
  font: 600 14px var(--font); white-space: nowrap;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .35);
  opacity: 0; animation: pop .5s cubic-bezier(.2, 1.4, .4, 1) forwards;
}
.bubble div::after {
  content: ""; position: absolute; left: 50%; bottom: -5px; width: 10px; height: 10px;
  background: #fff; translate: -50% 0; rotate: 45deg; border-radius: 2px;
}
.bubble.hot div, .bubble.hot div::after { background: #14A35E; color: #fff; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.7); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .bubble div { animation: none; opacity: 1; } }
.map-fade { position: absolute; inset: 0; z-index: 1; pointer-events: none; background: linear-gradient(to bottom, transparent 55%, var(--panel) 92%); }
.map-panel .panel-title { z-index: 2; padding: 0 40px 40px; font-size: 30px; letter-spacing: 0.02em; }

/* Light mode: a light map instead of the dark one */
[data-theme="light"] .map-panel { background: #EEF0EC; color: var(--ink); }
[data-theme="light"] .login-map { background: #EEF0EC; }
[data-theme="light"] .login-map .leaflet-control-attribution { background: rgba(255, 255, 255, .7); color: var(--muted); }
[data-theme="light"] .login-map .leaflet-control-attribution a { color: var(--muted); }
[data-theme="light"] .map-fade { background: linear-gradient(to bottom, transparent 55%, #EEF0EC 92%); }
[data-theme="light"] .bubble div { box-shadow: 0 6px 16px rgba(0, 0, 0, .18); }
[data-theme="light"] .bubble div:not(.x) { border: 1px solid rgba(0, 0, 0, .06); }
.mob-map-wrap { display: none; }

.panel-title {
  position: relative;
  font-size: 32px; font-weight: 700; letter-spacing: -0.2px; line-height: 1.05;
}

/* Phone and small tablet */
@media (max-width: 900px) {
  .page { grid-template-columns: minmax(0, 1fr); }
  .panel { display: none; }
  .left { padding: 24px; }
  .form-area { align-items: flex-start; padding-top: 28px; }
  .mob-map-wrap { display: block; position: relative; height: 170px; margin: 24px -24px 0; overflow: hidden; }
  .mob-map-wrap::after { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; background: linear-gradient(to bottom, transparent 60%, var(--bg) 100%); }
  h1 { font-size: 22px; margin-bottom: 28px; }
  #code-step h1 { margin-bottom: 8px; }
}

@media (max-width: 380px) {
  .otp { gap: 6px; }
  .otp input { height: 54px; }
}

.shake { animation: shake .32s ease; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@media (prefers-reduced-motion: reduce) { .shake { animation: none; } }

/* Signed in: the pandan grows, then we go */
.success-anim { width: 100%; display: flex; justify-content: center; }
.success-anim[hidden] { display: none; }
.success-anim svg { width: 120px; height: 120px; overflow: visible; }
.sa-circle { transform-origin: 50px 50px; animation: saPop .7s cubic-bezier(.2, 1.3, .4, 1) both; }
.sa-leaf { transform-box: fill-box; transform-origin: 50% 100%; animation: saGrow .9s cubic-bezier(.2, 1.2, .4, 1) both; }
.sa-l0 { animation-delay: .3s; }
.sa-l1 { animation-delay: .4s; }
.sa-l2 { animation-delay: .6s; }
.sa-l3 { animation-delay: .8s; }
.success-anim.leaving svg { animation: saOut .45s ease-in forwards; }
@keyframes saPop { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes saGrow { from { transform: scaleY(0) rotate(0); opacity: 0; } 60% { opacity: 1; } to { transform: scaleY(1); opacity: 1; } }
@keyframes saOut { to { transform: scale(.9); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sa-circle, .sa-leaf, .success-anim.leaving svg { animation: none; } }
.link-note { margin: 4px 0 20px; font-size: 15px; line-height: 1.5; color: var(--ink); }
