*,
*::before,
*::after { box-sizing: border-box; }

:root {
  --fg: #111;
  --muted: #8a8a8f;
  --line: #e5e5ea;
  --bg: #fff;
  --accent: #111;
  --on: #111;
  --danger: #d33;
}

html, body { margin: 0; padding: 0; background: var(--bg); color: var(--fg); }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", "Malgun Gothic", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
  min-height: 100dvh;
}

input, textarea {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

[hidden] { display: none !important; }

.app {
  max-width: 420px;
  margin: 0 auto;
  padding: max(48px, env(safe-area-inset-top)) 24px max(32px, env(safe-area-inset-bottom));
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition: filter .15s ease;
}

.step { width: 100%; }

.title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 28px;
}

.note {
  margin: -12px 0 20px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f4f4f6;
  font-size: 14px;
}

.field { display: block; margin-bottom: 16px; }
.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%;
  height: 52px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font: inherit;
  font-size: 17px;
  color: var(--fg);
  background: #fff;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.field input:focus { border-color: var(--fg); }
#phone4 { letter-spacing: .3em; }

.error { min-height: 20px; margin: 0 0 8px; color: var(--danger); font-size: 14px; }

.btn {
  display: block;
  width: 100%;
  height: 52px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
.btn:active { opacity: .8; }
.btn.small { display: inline-block; width: auto; height: 36px; padding: 0 14px; font-size: 14px; margin-left: 8px; }

.links { display: flex; justify-content: center; gap: 20px; margin-top: 16px; }
.link {
  border: 0;
  background: none;
  padding: 4px 2px;
  font: inherit;
  font-size: 14px;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.link.danger { color: var(--danger); }

.who { display: flex; justify-content: center; align-items: center; gap: 8px; color: var(--muted); font-size: 15px; }

.progress {
  text-align: center;
  margin: 20px 0 28px;
  font-size: 22px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.progress strong { font-size: 56px; color: var(--fg); font-weight: 700; }
.progress .slash { margin: 0 6px; }

.stamps {
  list-style: none;
  padding: 0;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  max-width: 320px;
}
.stamp {
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  border: 2px dashed #c7c7cc;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: #c7c7cc;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.stamp.on { background: var(--on); border: 2px solid var(--on); color: #fff; }

.hint { text-align: center; color: var(--muted); font-size: 14px; margin: 28px 0 0; }

#step-done { text-align: center; }
.done-title {
  font-size: clamp(48px, 15vw, 72px);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 14px;
  line-height: 1.1;
}
.done-guide {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.55;
  color: var(--fg);
  word-break: keep-all;
  margin: 0 auto 24px;
  max-width: 300px;
}
.done-who { font-size: 22px; font-weight: 600; margin: 0 0 6px; }
.done-time { font-size: 15px; color: var(--muted); margin: 0; font-variant-numeric: tabular-nums; }
.live-clock { font-size: 13px; color: var(--muted); margin: 4px 0 0; font-variant-numeric: tabular-nums; }
.sync { margin-top: 28px; font-size: 13px; color: var(--muted); display: flex; justify-content: center; align-items: center; }
.sync[data-status="failed"] { color: var(--danger); }

.toast {
  position: fixed;
  left: 50%;
  bottom: max(28px, env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  max-width: calc(100% - 40px);
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(17, 17, 17, .9);
  color: #fff;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* 화면 보호: 창을 벗어나거나 탭을 바꾸면 가린다 */
.shield {
  position: fixed;
  inset: 0;
  display: none;
  background: rgba(255, 255, 255, .55);
  -webkit-backdrop-filter: blur(22px);
  backdrop-filter: blur(22px);
  z-index: 100;
}
body.is-shielded .shield { display: block; }
body.is-shielded .app,
body.is-shielded .toast { filter: blur(18px); }

.noscript { text-align: center; padding: 40px 20px; }

@media print {
  html, body { background: #fff !important; }
  body * { display: none !important; }
  body::after {
    content: "인쇄할 수 없는 화면입니다.";
    display: block;
    padding: 40px;
    text-align: center;
    font-size: 16px;
  }
}
