@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@500;600;700&family=Nunito:wght@700;800;900&display=swap');

:root {
  --mf-cyan: #3ec8ff;
  --mf-cyan-deep: #1aa7f0;
  --mf-ink: #ffffff;
  --mf-muted: rgba(255, 255, 255, 0.86);
  --mf-field: rgba(186, 228, 255, 0.42);
  --mf-field-border: rgba(255, 255, 255, 0.55);
  --mf-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --mf-safe-top: env(safe-area-inset-top, 0px);
  --mf-safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

body.mf-auth {
  min-height: 100dvh;
  font-family: 'Nunito', system-ui, sans-serif;
  color: var(--mf-ink);
  background: #063a78 center / cover no-repeat;
  -webkit-font-smoothing: antialiased;
}

body.mf-auth--login {
  background-image:
    linear-gradient(180deg, rgba(8, 70, 150, 0.18) 0%, rgba(4, 28, 78, 0.28) 55%, rgba(3, 18, 52, 0.55) 100%),
    url('memofish-bg-login.png');
}

body.mf-auth--register {
  background-image:
    linear-gradient(180deg, rgba(8, 70, 150, 0.12) 0%, rgba(4, 28, 78, 0.22) 50%, rgba(3, 18, 52, 0.5) 100%),
    url('memofish-bg-register.png');
}

.mf-wrap {
  width: 100%;
  max-width: 430px;
  min-height: 100dvh;
  margin: 0 auto;
  padding:
    calc(8px + var(--mf-safe-top))
    22px
    calc(18px + var(--mf-safe-bottom));
  display: flex;
  flex-direction: column;
}

/* ---- Top bar (register) ---- */
.mf-top {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  margin-bottom: 2px;
  flex-shrink: 0;
}

.mf-back {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  color: #fff;
  text-decoration: none;
  border-radius: 50%;
}

.mf-back svg { width: 22px; height: 22px; }

.mf-top__title {
  flex: 1;
  margin: 0;
  text-align: center;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-shadow: 0 2px 8px rgba(0, 20, 60, 0.55);
  padding-right: 36px;
}

/* ---- Brand / logo area ---- */
.mf-brand {
  position: relative;
  text-align: center;
  flex-shrink: 0;
}

/* Login: mascot on top, logo below */
.mf-brand--login {
  margin: 0 0 4px;
}

.mf-brand--login .mf-mascot {
  width: min(52vw, 200px);
  height: auto;
  margin: 0 auto -18px;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 14px 20px rgba(0, 20, 70, 0.45));
}

.mf-brand--login .mf-logo {
  width: min(88%, 320px);
  height: auto;
  display: block;
  margin: 0 auto;
  object-fit: contain;
  filter: drop-shadow(0 8px 14px rgba(0, 20, 60, 0.45));
}

.mf-brand--login .mf-tag {
  margin-top: 2px;
}

/* Register: logo + mascot side by side */
.mf-brand--register {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 2px;
  margin-bottom: 2px;
}

.mf-brand--register .mf-logo-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 340px;
  margin: 0 auto;
}

.mf-brand--register .mf-logo {
  width: min(72%, 260px);
  height: auto;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 8px 14px rgba(0, 20, 60, 0.45));
}

.mf-brand--register .mf-mascot {
  position: absolute;
  right: -4px;
  top: 50%;
  transform: translateY(-42%);
  width: 88px;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 10px 14px rgba(0, 20, 70, 0.4));
  pointer-events: none;
}

.mf-tag {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #d7f4ff;
  text-shadow: 0 2px 6px rgba(0, 20, 60, 0.55);
}

/* ---- Hero text ---- */
.mf-hero {
  text-align: center;
  margin: 8px 0 14px;
  flex-shrink: 0;
}

.mf-hero__title {
  margin: 0;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: clamp(26px, 7vw, 32px);
  font-weight: 700;
  letter-spacing: 0.01em;
  text-shadow: 0 3px 0 rgba(10, 50, 120, 0.25), 0 8px 18px rgba(0, 20, 60, 0.4);
}

.mf-hero__sub {
  margin: 6px 0 0;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--mf-muted);
  text-shadow: 0 2px 8px rgba(0, 20, 60, 0.5);
  line-height: 1.45;
}

/* ---- Form ---- */
.mf-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mf-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--mf-field);
  border: 1.5px solid var(--mf-field-border);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 8px 18px rgba(0, 20, 60, 0.18);
  backdrop-filter: blur(10px);
}

.mf-field > svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: #eaf8ff;
  filter: drop-shadow(0 1px 2px rgba(0, 30, 80, 0.35));
}

.mf-dial {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  padding-right: 8px;
  border-right: 1px solid rgba(255, 255, 255, 0.35);
}

.mf-dial svg {
  width: 12px;
  height: 12px;
}

.mf-field input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #fff;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 800;
  padding: 14px 0;
}

.mf-field input::placeholder {
  color: rgba(255, 255, 255, 0.78);
  font-weight: 800;
}

.mf-eye {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 6px;
  color: #eaf8ff;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.mf-eye svg { width: 20px; height: 20px; }

.mf-eye .eye-off { display: none; }
.mf-eye.is-on .eye-open { display: none; }
.mf-eye.is-on .eye-off { display: block; }

.mf-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 54px;
  margin-top: 6px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 20px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(180deg, #7de7ff 0%, #3ec8ff 42%, #1aa7f0 100%);
  box-shadow:
    0 10px 0 #0e6fb8,
    0 16px 24px rgba(0, 40, 100, 0.35),
    inset 0 2px 0 rgba(255, 255, 255, 0.5);
  text-shadow: 0 1px 0 rgba(0, 60, 120, 0.25);
  transition: transform 0.12s var(--mf-ease);
}

.mf-btn:active { transform: translateY(3px); box-shadow: 0 7px 0 #0e6fb8, 0 10px 16px rgba(0, 40, 100, 0.3); }
.mf-btn:disabled { opacity: 0.7; cursor: wait; }
.mf-btn svg { width: 22px; height: 22px; }

.mf-foot {
  margin: 14px 0 0;
  text-align: center;
  font-size: 13.5px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.88);
  text-shadow: 0 2px 8px rgba(0, 20, 60, 0.5);
}

.mf-foot a {
  color: #7de7ff;
  text-decoration: none;
  font-weight: 900;
}

.mf-toast {
  position: fixed;
  left: 50%;
  top: calc(16px + var(--mf-safe-top));
  transform: translateX(-50%) translateY(-12px);
  z-index: 40;
  max-width: min(360px, calc(100vw - 32px));
  padding: 12px 16px;
  border-radius: 16px;
  background: rgba(8, 24, 64, 0.92);
  border: 1px solid rgba(126, 231, 255, 0.4);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s var(--mf-ease), transform 0.22s var(--mf-ease);
}

.mf-toast.is-on {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 360px) {
  .mf-wrap { padding-left: 16px; padding-right: 16px; }
  .mf-brand--login .mf-mascot { width: min(48vw, 170px); margin-bottom: -14px; }
  .mf-brand--register .mf-mascot { width: 72px; right: 0; }
  .mf-brand--register .mf-logo { width: min(68%, 230px); }
}

@media (prefers-reduced-motion: reduce) {
  .mf-btn { transition: none; }
}
