@font-face {
  font-family: Pretendard;
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: local("Pretendard Regular"), url("./fonts/Pretendard-Regular.woff2") format("woff2");
}

@font-face {
  font-family: Pretendard;
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  src: local("Pretendard Medium"), url("./fonts/Pretendard-Medium.woff2") format("woff2");
}

@font-face {
  font-family: Pretendard;
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  src: local("Pretendard Bold"), url("./fonts/Pretendard-Bold.woff2") format("woff2");
}

:root {
  --bh-primary: #ff9f40;
  --bh-primary-deep: #ff8520;
  --bh-ink: #111827;
  --bh-muted: #6b7280;
  --bh-surface: rgba(255, 255, 255, 0.86);
  --bh-border: rgba(17, 24, 39, 0.1);
  --bh-card: #ffffff;
  --bh-card-line: #ffedd5;
  --bh-radius-control: 12px;
  --bh-radius-button: 16px;
  --bh-radius-card: 24px;
  --bh-radius-callout: 20px;
  --bh-shadow-card: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --bh-amber-fg: #b45309;
  --bh-footer: #1f2937;
  --bh-footer-text: #d1d5db;
  --focus: #c2410c;
  --font: Pretendard, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial,
    "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--bh-ink);
  background:
    radial-gradient(1200px 700px at 20% -10%, rgba(255, 159, 64, 0.18), transparent 60%),
    radial-gradient(900px 500px at 90% 0%, rgba(245, 158, 11, 0.12), transparent 55%),
    radial-gradient(700px 500px at 70% 120%, rgba(59, 130, 246, 0.08), transparent 60%),
    linear-gradient(180deg, #ffffff, #fffdf8 55%, #ffffff);
  overflow-x: hidden;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 10px;
  z-index: 60;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--bh-primary);
  color: var(--bh-ink);
  text-decoration: none;
  font-weight: 700;
}

.skip-link:focus {
  left: 12px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: 64px;
  background: var(--bh-surface);
  border-bottom: 1px solid var(--bh-border);
  backdrop-filter: blur(10px);
}

.topbar-inner,
.site-footer-inner,
.shell {
  width: min(720px, 100%);
  margin: 0 auto;
  padding-left: 16px;
  padding-right: 16px;
}

.topbar-inner {
  min-height: 64px;
  padding-top: 8px;
  padding-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--bh-ink);
  text-decoration: none;
  font-size: 1.25rem;
  font-weight: 700;
}

.brand img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.topbar-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.topbar-links a {
  position: relative;
  color: #374151;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.topbar-links a:first-child {
  color: var(--bh-primary);
  font-weight: 700;
}

.topbar-links a:first-child::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 2px;
  background: var(--bh-primary);
  transform: scaleX(0);
  transform-origin: left;
}

.topbar-links a:first-child:hover {
  color: var(--bh-primary-deep);
}

.topbar-links a:first-child:hover::after {
  transform: scaleX(1);
}

.topbar-links a:last-child:hover {
  color: var(--bh-amber-fg);
}

.shell {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-top: 24px;
  padding-bottom: 40px;
  animation: shell-in 0.35s ease;
}

.shell > * {
  min-width: 0;
  width: 100%;
}

.hero {
  margin: 0;
}

.hero-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.hero-copy {
  min-width: 0;
}

.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(1.75rem, 2vw + 1rem, 2.25rem);
  font-weight: 700;
  color: var(--bh-ink);
  text-wrap: balance;
}

.h1-sub {
  font-size: 0.55em;
  font-weight: 700;
  color: var(--bh-muted);
  margin-left: 6px;
}

.sub {
  margin: 0;
  color: #374151;
  line-height: 1.6;
  max-width: 62ch;
}

.hero-mascot {
  flex: 0 0 auto;
  width: 128px;
  height: 128px;
  padding: 8px;
  background: #fff;
  border: 1px solid #f3f4f6;
  border-radius: 24px;
}

.hero-mascot img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.notice {
  margin: 16px 0 0;
  padding: 16px 18px;
  border-radius: var(--bh-radius-callout);
  border: 1px solid #fef08a;
  background: #fefce8;
  color: var(--bh-ink);
  font-size: 0.9rem;
  line-height: 1.55;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.hint {
  margin: 0;
  color: var(--bh-muted);
  font-size: 0.85rem;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin: 0;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--bh-card);
  border: 1px solid var(--bh-card-line);
  border-radius: var(--bh-radius-card);
  padding: 20px;
  box-shadow: var(--bh-shadow-card);
}

h2 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--bh-ink);
}

.row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

label {
  color: #374151;
  font-size: 0.85rem;
  font-weight: 500;
}

input[type="text"],
input[type="url"],
input[type="number"],
input[type="password"],
textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: var(--bh-radius-control);
  border: 1px solid #e5e7eb;
  background: #fff;
  color: var(--bh-ink);
  font: 16px/1.4 var(--font);
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--bh-primary);
  box-shadow: 0 0 0 3px rgba(255, 159, 64, 0.35);
  outline: none;
}

input::placeholder,
textarea::placeholder {
  color: #9ca3af;
}

input.disabled,
textarea.disabled,
input:disabled,
textarea:disabled {
  background: #f9fafb;
  color: #6b7280;
  opacity: 1;
  -webkit-text-fill-color: #6b7280;
}

.collect-actions button,
#maxCount {
  width: 100%;
  max-width: none;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: var(--bh-radius-button);
  padding: 10px 16px;
  font: 700 1rem/1 var(--font);
  cursor: pointer;
  touch-action: manipulation;
  background: var(--bh-primary);
  color: var(--bh-ink);
}

button:not(.ghost):hover {
  background: var(--bh-primary-deep);
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.ghost {
  background: #fff;
  color: #1f2937;
  border: 1px solid #e5e7eb;
}

.ghost:hover {
  background: #f3f4f6;
  transform: none;
}

.ghost.danger {
  color: #b91c1c;
  border-color: #fecaca;
}

.ghost.danger:hover {
  background: #fef2f2;
}

.status-line {
  margin: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  color: #4b5563;
  font-size: 0.92rem;
}

.badge {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge.neutral {
  background: #f3f4f6;
  color: #374151;
}

.badge.ok {
  background: #ecfdf5;
  color: #047857;
}

.badge.warn {
  background: #fef3c7;
  color: #92400e;
}

.badge.bad {
  background: #fef2f2;
  color: #b91c1c;
}

.post-list {
  display: grid;
  gap: 12px;
  margin: 0;
}

.post-card {
  background: #fffdf8;
  border: 1px solid #f3f4f6;
  border-radius: 16px;
  padding: 14px 16px;
}

.post-card h3 {
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--bh-ink);
}

.post-card a {
  color: #b45309;
  text-decoration: underline;
  text-underline-offset: 3px;
  word-break: break-all;
  overflow-wrap: anywhere;
}

.post-card a:hover {
  color: #9a3412;
}

.post-card p {
  margin: 8px 0 0;
  color: #4b5563;
  font-size: 0.92rem;
  line-height: 1.55;
}

.post-images {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.thumb {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 8px;
  background: #f3f4f6;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
}

.thumb[data-state="ready"] img {
  opacity: 1;
}

.thumb[data-state="failed"] .thumb-label {
  color: #b91c1c;
}

.thumb-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #6b7280;
  padding: 4px;
}

.more-images {
  margin: 8px 0 0;
  color: #6b7280;
  font-size: 0.85rem;
  font-weight: 700;
}

.results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.results-head h2 {
  margin: 0;
}

.mode {
  display: flex;
  gap: 8px;
  margin: 0;
}

.mode-option {
  flex: 1;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  background: #fff;
  font-weight: 500;
  cursor: pointer;
}

.mode-option:has(input:checked) {
  border: 2px solid var(--bh-primary);
  font-weight: 700;
}

.mode-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

details.notice p {
  margin: 8px 0 0;
}

.empty {
  margin: 8px 0 0;
  color: #6b7280;
}

summary {
  display: list-item;
  min-height: 44px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 700;
  color: var(--bh-ink);
  margin: 0;
}

details[open] summary {
  margin-bottom: 12px;
}

summary::marker {
  color: #ff9f40;
}

pre {
  margin: 0;
  max-width: 100%;
  min-width: 0;
  overflow: auto;
  background: #111827;
  border: 1px solid #1f2937;
  border-radius: 16px;
  padding: 12px;
  color: #f9fafb;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.83rem;
}

pre {
  max-height: 260px;
}



.site-footer {
  background: var(--bh-footer);
  color: var(--bh-footer-text);
  font-size: 0.875rem;
  padding: 28px 0;
}

.site-footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  align-items: center;
  justify-content: space-between;
}

.site-footer p {
  margin: 0;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.site-footer a {
  color: var(--bh-footer-text);
  text-decoration: none;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.site-footer a:hover {
  color: #fff;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

@keyframes shell-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 389px) {
  .post-images {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  .shell {
    padding: 20px 16px 40px;
  }

  .card {
    padding: 16px;
    gap: 14px;
  }

  .hero-mascot {
    display: none;
  }

  #loginBtn,
  #jobBtn {
    flex: 1 1 100%;
  }

  #session:not(.is-in) #loginBtn {
    flex: 1 1 100%;
  }

  #session:not(.is-in) #meBtn,
  #session:not(.is-in) #logoutBtn {
    flex: 1 1 calc(50% - 8px);
  }

  #session.is-in #switchUserBtn,
  #session.is-in #logoutBtn {
    flex: 1 1 calc(50% - 8px);
  }

  #keyword,
  #urls,
  #maxCount {
    scroll-margin-bottom: calc(72px + env(safe-area-inset-bottom));
  }

  .collect-actions {
    position: sticky;
    bottom: 0;
    z-index: 40;
    margin: 0;
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--bh-card);
  }

  #collect.keyboard-open .collect-actions {
    position: static;
  }

  .result-actions {
    flex-direction: column;
  }

  .result-actions button {
    width: 100%;
  }

  #logs {
    max-height: 160px;
  }
}

@media (min-width: 768px) {
  .topbar-inner,
  .site-footer-inner,
  .shell {
    padding-left: 24px;
    padding-right: 24px;
  }

  .shell {
    padding-top: 32px;
    padding-bottom: 48px;
  }
}

@media (max-width: 400px) {
  .topbar-inner {
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .shell,
  summary,
  .topbar a {
    animation: none;
    transition: none;
    transform: none;
  }
}
