:root {
  color-scheme: light;
  --canvas: #f7f7f5;
  --surface: #ffffff;
  --surface-soft: #f1f3f6;
  --ink: #181b22;
  --muted: #727987;
  --line: #e2e4e8;
  --accent: #315fd5;
  --accent-soft: #edf2ff;
  --green: #24765a;
  --green-soft: #eaf6f0;
  --violet: #7359a6;
  --violet-soft: #f3effa;
  --danger: #ba4545;
  --shadow: 0 18px 54px rgba(23, 28, 38, 0.055);
  font-family: Pretendard, "SUIT Variable", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  background: var(--canvas);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: linear-gradient(115deg, rgba(255, 255, 255, 0.72), transparent 46%), var(--canvas);
  font-size: 16px;
  line-height: 1.6;
  letter-spacing: 0;
}

button,
input {
  color: inherit;
  font: inherit;
  letter-spacing: 0;
}

button {
  border: 0;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
.skip-link:focus-visible {
  outline: 3px solid rgba(49, 95, 213, 0.24);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 10;
  padding: 10px 14px;
  border-radius: 8px;
  color: #fff;
  background: var(--ink);
  transform: translateY(-180%);
}

.skip-link:focus { transform: translateY(0); }

.shell {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 48px 0 72px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.brand {
  font-size: clamp(1.6rem, 3vw, 2.35rem);
  font-weight: 760;
  line-height: 1;
}

.brand-dot { color: var(--accent); }

.status {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  gap: 9px;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.74);
  font-size: 0.82rem;
  font-weight: 650;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #8b93a0;
}

.status[data-state="ready"] .status-dot { background: var(--green); }

.status[data-state="loading"] .status-dot {
  background: var(--accent);
  animation: pulse 1.3s ease-in-out infinite;
}

.status[data-state="warning"] .status-dot,
.status[data-state="error"] .status-dot { background: var(--danger); }

.search-surface,
.results-surface {
  border: 1px solid rgba(216, 219, 224, 0.9);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.search-surface {
  padding: 26px;
  border-radius: 18px;
}

.search-form {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  min-height: 70px;
  padding: 8px 9px 8px 22px;
  border: 1px solid #cfd4dc;
  border-radius: 16px;
  background: var(--surface);
  transition: border-color 0.35s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.search-form:focus-within {
  border-color: rgba(49, 95, 213, 0.68);
  box-shadow: 0 0 0 5px rgba(49, 95, 213, 0.08);
}

.search-icon {
  display: inline-grid;
  color: var(--accent);
  place-items: center;
}

#searchInput {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  font-weight: 650;
}

#searchInput::placeholder {
  color: #a3a9b4;
  opacity: 1;
}

#searchInput::-webkit-search-cancel-button {
  display: none;
  appearance: none;
  -webkit-appearance: none;
}

.search-button,
.icon-button,
.retry-button {
  display: inline-grid;
  min-width: 46px;
  min-height: 46px;
  place-items: center;
  border-radius: 12px;
  transition: color 0.35s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.35s cubic-bezier(0.22, 1, 0.36, 1), transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.search-button {
  padding: 0 22px;
  color: #fff;
  background: var(--ink);
  font-weight: 720;
}

.search-button:hover,
.retry-button:hover {
  background: var(--accent);
  transform: translateY(-1px);
}

.icon-button {
  color: var(--muted);
  background: transparent;
}

.icon-button:hover {
  color: var(--ink);
  background: var(--surface-soft);
}

.results-surface {
  min-height: 490px;
  margin-top: 24px;
  overflow: hidden;
  border-radius: 18px;
}

.results-header {
  display: flex;
  min-height: 102px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 34px;
  border-bottom: 1px solid var(--line);
}

.results-header h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 760;
}

.results-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.copy-button {
  border: 1px solid var(--line);
  background: var(--surface);
}

.results {
  min-height: 387px;
  overflow-x: auto;
}

.state {
  display: grid;
  min-height: 387px;
  padding: 48px 24px;
  text-align: center;
  place-items: center;
}

.state-content { max-width: 420px; }

.state strong,
.state span { display: block; }

.state strong {
  font-size: 1.08rem;
  font-weight: 760;
}

.state span {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.retry-button {
  margin-top: 22px;
  padding: 0 18px;
  color: #fff;
  background: var(--ink);
  font-weight: 700;
}

.result-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.result-table th,
.result-table td {
  padding: 18px 28px;
  border-bottom: 1px solid #eceef1;
  text-align: left;
  vertical-align: middle;
}

.result-table th {
  color: #8a919e;
  background: #fafafa;
  font-size: 0.76rem;
  font-weight: 720;
}

.result-table td {
  font-size: 0.95rem;
  font-weight: 640;
}

.result-table tr:last-child td { border-bottom: 0; }

.result-table tbody tr {
  transition: background-color 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.result-table tbody tr:hover { background: #fbfcfe; }

.result-table th:first-child,
.result-table td:first-child { width: 20%; }

.result-table th:nth-child(2),
.result-table td:nth-child(2),
.result-table th:nth-child(3),
.result-table td:nth-child(3) { width: 18%; }

.badge {
  display: inline-flex;
  min-width: 48px;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 740;
}

.badge-seat {
  color: var(--accent);
  background: var(--accent-soft);
}

.badge-sol {
  color: var(--green);
  background: var(--green-soft);
}

.badge-ban {
  color: var(--violet);
  background: var(--violet-soft);
}

mark {
  padding: 0 2px;
  border-radius: 4px;
  color: inherit;
  background: #fff0a8;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 5;
  max-width: min(360px, calc(100vw - 44px));
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: #fff;
  background: var(--ink);
  box-shadow: 0 16px 40px rgba(20, 24, 32, 0.16);
  font-size: 0.86rem;
  font-weight: 650;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

[hidden] { display: none !important; }

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

@media (max-width: 680px) {
  .shell {
    width: min(100% - 28px, 620px);
    padding: 28px 0 44px;
  }

  .topbar {
    align-items: flex-start;
    margin-bottom: 18px;
  }

  .brand { font-size: 1.7rem; }

  .status {
    min-height: 34px;
    padding: 6px 10px;
    font-size: 0.74rem;
  }

  .search-surface {
    padding: 12px;
    border-radius: 14px;
  }

  .search-form {
    grid-template-columns: auto minmax(0, 1fr) auto;
    min-height: 60px;
    padding: 6px 7px 6px 15px;
    border-radius: 12px;
  }

  #searchInput { font-size: 1rem; }

  .search-button {
    grid-column: 1 / -1;
    min-height: 46px;
    margin-top: 2px;
  }

  .results-surface {
    min-height: 430px;
    margin-top: 14px;
    border-radius: 14px;
  }

  .results-header {
    min-height: 88px;
    padding: 19px 20px;
  }

  .results,
  .state { min-height: 340px; }

  .result-table,
  .result-table tbody,
  .result-table tr,
  .result-table td {
    display: block;
    width: 100%;
  }

  .result-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .result-table tbody {
    display: grid;
    gap: 10px;
    padding: 12px;
  }

  .result-table tbody tr {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 7px 14px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
  }

  .result-table td,
  .result-table td:first-child,
  .result-table td:nth-child(2),
  .result-table td:nth-child(3) {
    width: auto;
    padding: 0;
    border: 0;
  }

  .result-table td::before {
    display: block;
    margin-bottom: 2px;
    color: #9299a5;
    content: attr(data-label);
    font-size: 0.68rem;
    font-weight: 700;
  }

  .result-table td:first-child {
    grid-row: 1 / span 2;
    align-self: center;
  }

  .result-table td:first-child::before { display: none; }

  .result-table td:nth-child(4) {
    grid-column: 2;
    grid-row: 1;
    font-size: 1rem;
  }

  .result-table td:nth-child(2),
  .result-table td:nth-child(3) {
    display: inline-block;
    grid-row: 2;
  }

  .result-table td:nth-child(2) {
    grid-column: 2;
    padding-right: 70px;
  }

  .result-table td:nth-child(3) {
    grid-column: 2;
    justify-self: end;
  }

  .result-table td:nth-child(2)::before,
  .result-table td:nth-child(3)::before { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
