/* 확인 화면 공통 (챌린지·퍼즐·오류). CSP상 인라인 스타일을 쓰지 않는다. */
:root {
  color-scheme: light dark;
  --bg: #ffffff; --fg: #1f1f1f; --muted: #5f6368; --line: #dadce0; --panel: #fafafa;
  --accent: #1a73e8; --track: #e3e6ea; --danger: #d93025; --shadow: 0 1px 2px rgba(0, 0, 0, .06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1b1d; --fg: #ececec; --muted: #a0a4a8; --line: #3a3b3e; --panel: #232326;
    --accent: #8ab4f8; --track: #3a3b3e; --danger: #f28b82; --shadow: none;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
body {
  display: flex; flex-direction: column; min-height: 100vh;
  word-break: keep-all; overflow-wrap: anywhere; /* 한국어는 어절 단위로 줄바꿈 */
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Segoe UI", sans-serif;
}
a { color: var(--accent); }
code { font: .95em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.page { width: min(100%, 60rem); margin: 0 auto; padding: clamp(2.5rem, 12vh, 8rem) 1.5rem 2rem; }
.host { margin: 0 0 .4rem; font-size: clamp(1.75rem, 4.5vw, 2.6rem); font-weight: 600; line-height: 1.2; word-break: break-all; }
.lead { margin: 0 0 1.75rem; font-size: clamp(1.05rem, 2.3vw, 1.45rem); font-weight: 500; line-height: 1.45; }
.note { max-width: 42rem; margin: 1.75rem 0 0; color: var(--muted); }
.warn { color: var(--danger); }

/* 확인 상자 */
.widget {
  position: relative; display: inline-flex; align-items: center; gap: .9rem;
  width: min(100%, 400px); min-height: 66px; padding: 1rem 1.25rem; overflow: hidden;
  border: 1px solid var(--line); border-radius: 6px; background: var(--panel); box-shadow: var(--shadow);
}
.icon { position: relative; flex: none; width: 28px; height: 28px; }
.spinner {
  position: absolute; inset: 1px; border-radius: 50%;
  border: 3px solid var(--track); border-top-color: var(--accent);
  animation: spin .85s linear infinite;
}
.cross { position: absolute; inset: 0; width: 28px; height: 28px; display: none;
  fill: none; stroke: var(--danger); stroke-width: 2.6; stroke-linecap: round; }
.label { flex: 1; font-size: .97rem; }
/* 포이 Security 로고: 검은 글자·투명 배경 PNG. 다크 모드에서는 흰색으로 뒤집는다 */
.brand { flex: none; height: 20px; width: auto; margin-left: .75rem; opacity: .9; }
@media (prefers-color-scheme: dark) { .brand { filter: invert(1) brightness(.92); } }
.bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: transparent; }
.fill { display: block; width: 0; height: 100%; background: var(--accent); transition: width .25s ease-out; }
.widget[data-state="sending"] .spinner { animation-duration: .6s; }
.widget[data-state="error"] .spinner { display: none; }
.widget[data-state="error"] .cross { display: block; }
.widget[data-state="error"] .fill { background: var(--danger); }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 3s; }
  .fill { transition: none; }
}

.button {
  display: inline-block; margin-top: 1.25rem; padding: .55rem 1.1rem; border-radius: 6px;
  background: var(--accent); color: var(--bg); text-decoration: none; font-weight: 600;
}

/* 하단 */
.foot {
  margin: auto auto 0; width: min(100%, 60rem); padding: 1rem 1.5rem 1.25rem;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: .4rem 1.5rem;
  border-top: 1px solid var(--line); font-size: .8rem; color: var(--muted);
}
.foot a { color: inherit; }

/* 퍼즐: 스프라이트 340x340 (위 = 배경, 아래 = 조각 층) */
.card { display: inline-block; padding: 1rem; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); box-shadow: var(--shadow); }
.board { position: relative; width: 340px; height: 170px; margin: 0 0 .9rem; border-radius: 6px; overflow: hidden; background: var(--track); }
.layer { position: absolute; inset: 0; background-repeat: no-repeat; background-size: 340px 340px; }
.bg { background-position: 0 0; }
.piece { filter: drop-shadow(0 0 2px rgba(0, 0, 0, .65)); }
.track { position: relative; width: 340px; height: 44px; border-radius: 22px; background: var(--track); touch-action: none; }
.track-hint { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding-left: 60px;
  font-size: .85rem; color: var(--muted); pointer-events: none; user-select: none; }
.handle {
  position: absolute; left: 0; top: 0; width: 60px; height: 44px; border-radius: 22px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); cursor: grab; touch-action: none; box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
}
.handle svg { width: 22px; height: 22px; fill: none; stroke: var(--bg); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.handle:focus-visible { outline: 3px solid var(--fg); outline-offset: 2px; }
.handle:active { cursor: grabbing; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-top: .7rem; }
.pstatus { min-height: 1.6em; margin: 0; font-size: .9rem; color: var(--muted); }
@media (max-width: 400px) {
  .widget { gap: .7rem; padding: .9rem 1rem; }
  .brand { height: 16px; margin-left: .4rem; }
  .card { padding: .6rem; }
  .board, .track { transform: scale(.88); transform-origin: top left; }
  .board { margin-bottom: -.6rem; }
}
