/* ============================================================
   카카오맵 캡쳐 · Claude-inspired theme
   ============================================================ */

:root {
  /* warm paper palette */
  --bg: #f5f1e8;
  --bg-soft: #faf7ef;
  --card: #ffffff;
  --border: rgba(20, 18, 14, 0.08);
  --border-strong: rgba(20, 18, 14, 0.14);

  /* ink */
  --ink: #1a1915;
  --ink-2: #3a3833;
  --ink-3: #6b6962;
  --ink-4: #9a988f;

  /* accent (Claude coral) */
  --accent: #cc785c;
  --accent-hover: #b85f45;
  --accent-soft: rgba(204, 120, 92, 0.08);
  --accent-ring: rgba(204, 120, 92, 0.22);

  /* semantic */
  --ok: #2f7a4f;
  --ok-bg: rgba(47, 122, 79, 0.08);
  --fail: #b9442b;
  --fail-bg: rgba(185, 68, 43, 0.08);

  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(20, 18, 14, 0.04);
  --shadow-md: 0 4px 16px rgba(20, 18, 14, 0.06);

  --font-sans: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont,
    system-ui, 'Apple SD Gothic Neo', 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'Iowan Old Style', 'Apple Garamond', 'Baskerville', Georgia,
    'Times New Roman', 'Pretendard Variable', serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
  font-feature-settings: 'ss01', 'cv11';
}

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-ring);
  transition: color 0.15s ease, border-color 0.15s ease;
}
a:hover {
  color: var(--accent-hover);
  border-color: var(--accent-hover);
}

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: rgba(20, 18, 14, 0.05);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

/* ============================================================
   Layout
   ============================================================ */
.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 64px 24px 80px;
}

/* ============================================================
   Hero
   ============================================================ */
.hero {
  text-align: center;
  margin-bottom: 48px;
}

.hero-eyebrow {
  display: inline-block;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 6px 12px;
  border-radius: 999px;
  margin-bottom: 20px;
  font-weight: 500;
}

.hero-title {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(28px, 5vw, 42px);
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0 0 18px;
  color: var(--ink);
}

.hero-title .serif {
  font-style: italic;
  color: var(--accent);
}

.hero-sub {
  color: var(--ink-3);
  font-size: 15px;
  line-height: 1.65;
  margin: 0 auto;
  max-width: 520px;
}

/* ============================================================
   Card
   ============================================================ */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 18px;
}

.card-header.tight {
  margin-bottom: 14px;
  align-items: center;
  justify-content: space-between;
}

.step-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  display: grid;
  place-items: center;
  font-feature-settings: 'tnum';
}

.card-title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.card-title.small {
  font-size: 15px;
}

.card-sub {
  margin: 4px 0 0;
  font-size: 13.5px;
  color: var(--ink-3);
  line-height: 1.55;
}

/* ============================================================
   Inputs
   ============================================================ */
input[type='text'],
input[type='password'],
input[type='number'],
select,
textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='none' stroke='%236b6962' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5l5 5 5-5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
  cursor: pointer;
}

input::placeholder,
textarea::placeholder {
  color: var(--ink-4);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  background-color: #fff;
  box-shadow: 0 0 0 3px var(--accent-ring);
}

textarea {
  resize: vertical;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.7;
  min-height: 160px;
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

@media (min-width: 540px) {
  .options-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  .option-wide {
    grid-column: span 4;
  }
}

.option {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.option-wide {
  grid-column: 1 / -1;
}

.option select {
  font-size: 14px;
  padding: 10px 34px 10px 12px;
}

.option-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
}

.hint-inline {
  color: var(--ink-4);
  font-weight: 400;
  font-size: 11.5px;
}

.option input {
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  padding: 10px 12px;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
}

.meta-pill {
  font-size: 12px;
  color: var(--ink-3);
  background: var(--bg);
  padding: 4px 10px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   Buttons
   ============================================================ */
.primary-btn,
.secondary-btn,
.ghost-btn {
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease,
    transform 0.05s ease, box-shadow 0.15s ease;
  border: 1px solid transparent;
}

.primary-btn {
  position: relative;
  background: var(--accent);
  color: #fff;
  padding: 14px 28px;
  font-size: 15px;
  letter-spacing: -0.005em;
  box-shadow: 0 1px 2px rgba(204, 120, 92, 0.3),
    0 2px 8px rgba(204, 120, 92, 0.18);
  min-width: 180px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.primary-btn:hover:not(:disabled) {
  background: var(--accent-hover);
}
.primary-btn:active:not(:disabled) {
  transform: translateY(1px);
}
.primary-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.primary-btn .btn-spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.primary-btn.is-loading .btn-spinner {
  display: inline-block;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.secondary-btn {
  background: var(--card);
  color: var(--ink-2);
  padding: 14px 24px;
  font-size: 14.5px;
  border: 1px solid var(--border-strong);
}
.secondary-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}
.secondary-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Attention burst when the zip finishes — pulses the button once and
   pops it with the accent color so it doesn't get missed.            */
@keyframes ready-burst {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 var(--accent-ring), 0 0 0 0 var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
  }
  35% {
    transform: scale(1.09);
    box-shadow: 0 0 0 14px rgba(204, 120, 92, 0), 0 8px 24px rgba(204, 120, 92, 0.25);
    border-color: var(--accent);
    color: var(--accent);
  }
  60% {
    transform: scale(0.97);
  }
  80% {
    transform: scale(1.03);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(204, 120, 92, 0);
    border-color: var(--accent);
    color: var(--accent);
  }
}

.secondary-btn.is-ready:not(:disabled) {
  animation: ready-burst 1.6s cubic-bezier(0.16, 1, 0.3, 1) 1;
  border-color: var(--accent);
  color: var(--accent);
}

@media (prefers-reduced-motion: reduce) {
  .secondary-btn.is-ready:not(:disabled) {
    animation: none;
  }
}

.ghost-btn {
  background: transparent;
  color: var(--ink-3);
  padding: 6px 12px;
  font-size: 12.5px;
  border: 1px solid var(--border);
}
.ghost-btn:hover {
  background: var(--bg);
  color: var(--ink);
}

.action-bar {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin: 28px 0;
  flex-wrap: wrap;
}

/* ============================================================
   Hint / Details
   ============================================================ */
.hint {
  margin-top: 12px;
  font-size: 13px;
  color: var(--ink-3);
}
.hint summary {
  cursor: pointer;
  color: var(--ink-3);
  user-select: none;
  list-style: none;
  padding: 6px 0;
}
.hint summary::-webkit-details-marker {
  display: none;
}
.hint summary::before {
  content: '›';
  display: inline-block;
  margin-right: 6px;
  transition: transform 0.15s ease;
  color: var(--ink-4);
}
.hint[open] summary::before {
  transform: rotate(90deg);
}
.hint-body {
  margin-top: 8px;
  padding: 12px 14px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  line-height: 1.7;
}

/* ============================================================
   Progress
   ============================================================ */
.progress-card {
  background: var(--bg-soft);
}

.progress-text {
  font-size: 13px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.progress-bar {
  height: 6px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 18px;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  width: 0;
  transition: width 0.3s ease;
  border-radius: 999px;
}

.result-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 280px;
  overflow-y: auto;
}

.result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--ink-2);
  transition: background 0.15s ease;
}
.result-item:hover {
  background: var(--bg);
}

.result-item .status {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 600;
}
.result-item.ok .status {
  background: var(--ok-bg);
  color: var(--ok);
}
.result-item.fail .status {
  background: var(--fail-bg);
  color: var(--fail);
}
.result-item.pending .status {
  background: var(--accent-soft);
  color: var(--accent);
  animation: pulse 1.4s ease-in-out infinite;
}
.result-item .addr {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.result-item .note {
  font-size: 12px;
  color: var(--ink-4);
  flex-shrink: 0;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
  }
}

/* ============================================================
   Footer
   ============================================================ */
.footer {
  text-align: center;
  margin-top: 48px;
  font-size: 12.5px;
  color: var(--ink-4);
  line-height: 1.7;
}

.footer .bug-link {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  cursor: pointer;
}

.footer .bug-link:hover {
  color: var(--ink-3);
}

/* ============================================================
   Hidden capture stage
   ============================================================ */
#captureStage {
  position: fixed;
  left: 0;
  top: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 1;
}
