@font-face {
  font-family: "Pretendard";
  src: url("/_sw/fonts/PretendardVariable.woff2") format("woff2-variations"),
       url("/_sw/fonts/PretendardVariable.woff2") format("woff2");
  font-weight: 45 920;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #F9FAFB;
  --text: #191F28;
  --sub: #8B95A1;
  --faint: #B0B8C1;
  --field: #F2F4F6;
  --field-hover: #EAEDF0;
  --charcoal: #181818;
  --charcoal-hover: #2B2B2B;
  --danger: #E5484D;
  --ring: rgba(25, 31, 40, 0.14);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --fast: 160ms;
  --mid: 320ms;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  font-feature-settings: "tnum" 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  word-break: keep-all;
}
button, input { font: inherit; color: inherit; }

/* ---------- 1. Intro ---------- */
.intro {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  transition: opacity 600ms var(--ease), visibility 0s linear 600ms;
}
html[data-intro="off"] .intro { display: none; }
.intro.is-done { opacity: 0; visibility: hidden; pointer-events: none; }

.intro-inner {
  width: min(88vw, 720px);
  text-align: center;
  transform: translateY(-4vh);
}
.intro-line {
  margin: 0;
  min-height: 1.5em;
  font-size: clamp(19px, 2.6vw, 30px);
  line-height: 1.5;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.intro-line + .intro-line { margin-top: 4px; }
.typed.has-caret::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 1.05em;
  margin-left: 3px;
  vertical-align: -0.14em;
  background: currentColor;
  animation: caret 1s steps(1) infinite;
}
@keyframes caret { 50% { opacity: 0; } }

.intro-brand {
  margin-top: clamp(48px, 9vh, 88px);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.intro-brand > span {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 700ms var(--ease), transform 700ms var(--ease);
}
.intro-brand > span.is-in { opacity: 1; transform: none; }
.b-ko { font-size: clamp(32px, 3.4vw, 40px); font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.b-en { margin-top: 16px; font-size: 13px; font-weight: 500; letter-spacing: 0.42em; padding-left: 0.42em; color: var(--sub); }
.b-sub { margin-top: 36px; font-size: 13px; font-weight: 600; letter-spacing: 0.08em; padding-left: 0.08em; color: var(--text); }

.intro-skip {
  position: absolute;
  bottom: max(28px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: var(--faint);
  opacity: 0;
  transition: opacity 600ms var(--ease) 1200ms;
}
.intro.is-playing .intro-skip { opacity: 1; }

/* ---------- 2. Login ---------- */
.login {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 24px;
}
.login-inner {
  width: 100%;
  max-width: 400px;
  margin: auto 0;
  padding: 72px 0 40px;
}
html[data-intro="on"] .login-inner {
  opacity: 0;
  transform: translateY(12px);
}
.login-inner.is-in {
  opacity: 1 !important;
  transform: none !important;
  transition: opacity 600ms var(--ease) 120ms, transform 600ms var(--ease) 120ms;
}

.logo { display: flex; flex-direction: column; gap: 4px; margin-bottom: 48px; }
.logo-ko { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.logo-en { font-size: 11px; font-weight: 500; letter-spacing: 0.3em; color: var(--sub); }

/* greeting on the left, the day's emoji on the right, centred on the two lines */
.greet {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 40px;
}
.greet-text { min-width: 0; }
.greet .welcome-sub { margin-bottom: 0; }
/* the day's emoji; tap it and it slides up while the date rises from below */
.greet-badge {
  position: relative;
  flex: none;
  width: 80px;
  height: 80px;
  margin-right: -8px;            /* the image has a little empty space around the object */
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  overflow: hidden;
  border-radius: 20px;
  -webkit-tap-highlight-color: transparent;
}
.greet-badge[hidden] { display: none; }
.badge-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  transition: transform 640ms var(--ease), opacity 640ms var(--ease);
}
.badge-back {
  align-content: center;
  gap: 4px;
  text-align: center;
  color: var(--text);
  transform: translateY(100%);
  opacity: 0;
}
.greet-badge.is-flipped .badge-front { transform: translateY(-100%); opacity: 0; }
.greet-badge.is-flipped .badge-back { transform: none; opacity: 1; }
.badge-month { font-size: 30px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; font-feature-settings: "tnum" 1; }
.badge-line { font-size: 12px; font-weight: 600; color: var(--sub); line-height: 1.2; white-space: nowrap; }
.badge-week.is-sat { color: #3182F6; }
.badge-week.is-sun, .badge-week.is-holiday { color: var(--danger); }
.badge-line.is-holiday .badge-day { color: var(--danger); }
.greet-badge:focus-visible { box-shadow: 0 0 0 4px var(--ring); }
.greet-emoji { display: block; width: 80px; height: 80px; }
@media (max-width: 400px) {
  .greet-badge { width: 64px; height: 64px; margin-right: -6px; }
  .greet-emoji { width: 64px; height: 64px; }
  .badge-month { font-size: 24px; }
  .badge-line { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  .badge-face { transform: none !important; }
}

.welcome {
  margin: 0;
  font-size: 28px;
  line-height: 1.35;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.welcome-sub {
  margin: 8px 0 40px;
  font-size: 17px;
  line-height: 1.5;
  color: var(--sub);
  font-weight: 400;
}

.form { display: flex; flex-direction: column; }
.field { margin-bottom: 20px; }
.label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #4E5968;
}
.input {
  width: 100%;
  height: 56px;
  padding: 0 16px;
  border: 0;
  border-radius: 14px;
  background: var(--field);
  font-size: 16px;
  color: var(--text);
  outline: none;
  box-shadow: inset 0 0 0 1.5px transparent;
  transition: background-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.input:hover { background: var(--field-hover); }
.input:focus { background: #FFFFFF; box-shadow: inset 0 0 0 1.5px var(--text), 0 0 0 4px var(--ring); }
.input::placeholder { color: var(--faint); }
.field.is-invalid .input { box-shadow: inset 0 0 0 1.5px var(--danger); background: #FFFFFF; }

.pw { position: relative; }
.pw .input { padding-right: 56px; }
.pw-toggle {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--sub);
  cursor: pointer;
  transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease);
}
.pw-toggle:hover { background: rgba(25, 31, 40, 0.06); color: var(--text); }
.pw-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.pw-toggle .i-hide { display: none; }
.pw-toggle[aria-pressed="true"] .i-show { display: none; }
.pw-toggle[aria-pressed="true"] .i-hide { display: block; }

.caps {
  margin: 8px 2px 0;
  font-size: 13px;
  color: #B7791F;
  height: 0;
  opacity: 0;
  overflow: hidden;
  transition: opacity var(--fast) var(--ease);
}
.caps.is-on { height: auto; opacity: 1; }

.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 4px 0 24px;
  font-size: 14px;
}
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: #4E5968; user-select: none; }
.check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.check .box {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: var(--field);
  box-shadow: inset 0 0 0 1.5px #D1D6DB;
  display: grid;
  place-items: center;
  transition: background-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.check .box svg { width: 14px; height: 14px; fill: none; stroke: #FFFFFF; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; opacity: 0; transform: scale(0.8); transition: opacity var(--fast) var(--ease), transform var(--fast) var(--ease); }
.check input:checked + .box { background: var(--charcoal); box-shadow: none; }
.check input:checked + .box svg { opacity: 1; transform: none; }
.check input:focus-visible + .box { box-shadow: 0 0 0 4px var(--ring); }

.link { color: var(--sub); text-decoration: none; border-radius: 6px; padding: 4px 2px; transition: color var(--fast) var(--ease); }
.link:hover { color: var(--text); }

.error {
  margin: 0;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.5;
  color: var(--danger);
  transition: max-height var(--mid) var(--ease), opacity var(--mid) var(--ease), margin var(--mid) var(--ease);
}
.error.is-on { max-height: 64px; opacity: 1; margin: -8px 0 16px; }

.submit {
  position: relative;
  height: 56px;
  border: 0;
  border-radius: 14px;
  background: var(--charcoal);
  color: #FFFFFF;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color var(--fast) var(--ease), transform 120ms var(--ease);
}
.submit:hover { background: var(--charcoal-hover); }
.submit:active { transform: scale(0.98); }
.submit:disabled { cursor: progress; }
.submit .spinner {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.28);
  border-top-color: #FFFFFF;
  opacity: 0;
  animation: spin 0.8s linear infinite;
  transition: opacity var(--fast) var(--ease);
}
.submit.is-loading .submit-label { opacity: 0; }
.submit.is-loading .spinner { opacity: 1; }
.submit-label { transition: opacity var(--fast) var(--ease); }
@keyframes spin { to { transform: rotate(360deg); } }

:focus-visible { outline: none; }
.submit:focus-visible, .link:focus-visible, .pw-toggle:focus-visible { box-shadow: 0 0 0 4px var(--ring); }

.foot {
  padding: 24px 0 max(32px, env(safe-area-inset-bottom));
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.24em;
  color: var(--faint);
  padding-left: 0.24em;
}

/* tablet and up: a little more air */
@media (min-width: 768px) {
  .login-inner { padding-top: 96px; }
  .welcome { font-size: 30px; }
}
/* small phones */
@media (max-width: 360px) {
  .welcome { font-size: 25px; }
  .welcome-sub { font-size: 16px; margin-bottom: 32px; }
  .row { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; transition-delay: 0ms !important; }
  .submit .spinner { animation: none; border-top-color: rgba(255, 255, 255, 0.9); }
  .typed.has-caret::after { animation: none; }
}

/* ---------- 3. Recovery and first-login change ---------- */
.pane[hidden] { display: none; }
.pane .welcome-sub .strong { color: var(--text); font-weight: 600; word-break: break-all; }
.help { margin: 8px 2px 0; font-size: 13px; color: var(--sub); }
.input-code { font-size: 22px; font-weight: 600; letter-spacing: 0.32em; font-feature-settings: "tnum" 1; }
.input-code::placeholder { font-size: 16px; font-weight: 400; letter-spacing: 0; }
.row-center { justify-content: center; margin: 20px 0 0; }
.row-split { margin: 20px 0 0; }
.link[aria-disabled="true"] { color: var(--faint); pointer-events: none; }
.note { margin: 24px 0 0; font-size: 13px; color: var(--faint); text-align: center; }
.pane .form + .row { margin-bottom: 0; }
.pane > .submit { width: 100%; }
