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

:root {
  --gold: #c9a052;
  --gold-light: #e8c97a;
  --gold-dim: rgba(201, 160, 82, 0.12);
  --ink: #090b0d;
  --ink-mid: #111418;
  --ink-soft: #1a1f26;
  --ink-raised: #20262e;
  --text: #e8dcc8;
  --text-strong: #f3ebd9;
  --text-muted: #a89b86;
  --border: rgba(201, 160, 82, 0.22);
  --border-strong: rgba(201, 160, 82, 0.48);
  --content-width: 1120px;
}

html { scroll-behavior: smooth; }

body {
  min-width: 0;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--ink);
  color: var(--text);
  font-family: 'Noto Sans KR', sans-serif;
}

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  background-image:
    radial-gradient(ellipse 80% 42% at 50% -8%, rgba(201,160,82,0.09), transparent 62%),
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23c9a052' fill-opacity='0.025'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/svg%3E");
  content: '';
  pointer-events: none;
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }

:focus-visible {
  outline: 3px solid var(--gold-light);
  outline-offset: 3px;
}

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

.wrap {
  width: min(calc(100% - 2rem), var(--content-width));
  margin-inline: auto;
}

.hero {
  padding: 3.4rem 1rem 2.5rem;
  text-align: center;
}

.hero__deco {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.hero__line {
  width: clamp(32px, 7vw, 72px);
  height: 1px;
  background: linear-gradient(to right, transparent, var(--gold));
}

.hero__line:last-child { transform: rotate(180deg); }

.hero__diamond {
  width: 7px;
  height: 7px;
  transform: rotate(45deg);
  background: var(--gold);
}

.site-label {
  margin: 0 0 0.75rem;
  color: var(--gold);
  font-family: 'Noto Serif KR', serif;
  font-size: 0.78rem;
  letter-spacing: 0.24em;
}

.hero h1 {
  max-width: 820px;
  margin: 0 auto 0.85rem;
  color: var(--text-strong);
  font-family: 'Noto Serif KR', serif;
  font-size: clamp(1.7rem, 4.5vw, 3rem);
  line-height: 1.3;
  letter-spacing: -0.025em;
}

.hero__description {
  margin: 0;
  color: var(--text-muted);
  font-size: clamp(0.87rem, 2vw, 1rem);
  font-weight: 300;
}

.discovery {
  position: relative;
  z-index: 2;
  margin-bottom: 2.2rem;
  padding: 1.1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(17, 20, 24, 0.94);
  box-shadow: 0 16px 48px rgba(0,0,0,0.2);
}

.course-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.35rem;
  max-width: 440px;
  margin: 0 auto 0.9rem;
  padding: 0.3rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--ink);
}

.course-tab {
  min-height: 42px;
  padding: 0.55rem 0.7rem;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 500;
}

.course-tab[aria-selected="true"] {
  border-color: var(--border-strong);
  background: var(--gold-dim);
  color: var(--gold-light);
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.6rem;
}

.search-box { position: relative; min-width: 0; }

.search-box svg {
  position: absolute;
  top: 50%;
  left: 1rem;
  width: 18px;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 0.75rem 1rem 0.75rem 2.8rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--ink-soft);
  color: var(--text-strong);
  font-size: 0.92rem;
}

.search-input::placeholder { color: #887e6d; }

.search-input:focus {
  border-color: var(--gold);
  outline: none;
  box-shadow: 0 0 0 3px var(--gold-dim);
}

.filter-open {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.7rem 1.05rem;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--ink-soft);
  color: var(--text-strong);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 500;
  white-space: nowrap;
}

.filter-count {
  min-width: 1.35rem;
  padding: 0.08rem 0.38rem;
  border-radius: 999px;
  background: var(--gold);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
}

.active-row,
.result-summary,
.era-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.active-row { margin-top: 0.85rem; }

.active-filters {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  gap: 0.45rem;
  min-width: 0;
}

.active-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  max-width: 100%;
  min-height: 30px;
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--gold-dim);
  color: var(--gold-light);
  cursor: pointer;
  font-size: 0.74rem;
}

.active-chip__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.active-chip__x { font-size: 1rem; line-height: 1; }

.reset-link {
  min-height: 32px;
  padding: 0.2rem 0;
  border: 0;
  border-bottom: 1px solid currentColor;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.76rem;
  white-space: nowrap;
}

.result-summary {
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px solid rgba(201,160,82,0.12);
}

.result-count {
  margin: 0;
  color: var(--text-strong);
  font-family: 'Noto Serif KR', serif;
  font-size: 0.92rem;
  font-weight: 600;
}

.era-navigation {
  display: flex;
  gap: 0.45rem;
  margin-bottom: 2.8rem;
  padding: 0.2rem 0 0.75rem;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
}

.era-navigation a {
  flex: 0 0 auto;
  padding: 0.5rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  font-family: 'Noto Serif KR', serif;
  font-size: 0.76rem;
  text-decoration: none;
  white-space: nowrap;
}

.era-navigation a:hover {
  border-color: var(--border-strong);
  color: var(--gold-light);
}

.era-section {
  scroll-margin-top: 1rem;
  margin-bottom: 4.2rem;
}

.era-heading {
  align-items: baseline;
  margin-bottom: 1.15rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--border);
}

.era-heading h2 {
  margin: 0;
  color: var(--text-strong);
  font-family: 'Noto Serif KR', serif;
  font-size: clamp(1.35rem, 3vw, 1.8rem);
}

.era-heading p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.game-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.game-card {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 100%;
  flex-direction: column;
  padding: 1.25rem;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--ink-soft);
  color: inherit;
  text-decoration: none;
  transition: transform 0.2s, border-color 0.2s, background 0.2s;
}

.game-card::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(to right, transparent, var(--gold), transparent);
  content: '';
  opacity: 0;
}

.game-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  background: var(--ink-raised);
}

.game-card:hover::before { opacity: 1; }

.card-eyebrow {
  margin: 0 0 0.6rem;
  color: var(--gold);
  font-size: 0.7rem;
  font-weight: 500;
}

.card-title {
  margin: 0 0 0.6rem;
  color: var(--text-strong);
  font-family: 'Noto Serif KR', serif;
  font-size: 1.08rem;
  line-height: 1.45;
}

.card-description {
  flex: 1;
  margin: 0 0 1rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 300;
  line-height: 1.68;
  overflow-wrap: anywhere;
}

.card-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.card-chip {
  padding: 0.24rem 0.55rem;
  border: 1px solid rgba(201,160,82,0.15);
  border-radius: 999px;
  background: rgba(255,255,255,0.035);
  color: var(--text-muted);
  font-size: 0.66rem;
  line-height: 1.35;
}

.card-chip--primary { background: var(--gold-dim); color: var(--gold-light); }
.card-chip--variant { border-color: rgba(232,201,122,0.42); color: var(--text-strong); }

.card-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 600;
}

.game-card:hover .card-cta { color: var(--gold-light); }

.special-group {
  margin-top: 1.25rem;
  padding: 1.1rem;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: rgba(201,160,82,0.045);
}

.special-group__label {
  margin: 0 0 0.25rem;
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
}

.special-group h3 {
  margin: 0 0 1rem;
  color: var(--text-strong);
  font-family: 'Noto Serif KR', serif;
  font-size: 1.05rem;
}

.state-panel {
  margin: 1.5rem auto 4rem;
  padding: 2.5rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--ink-mid);
  text-align: center;
}

.state-panel h2 {
  margin: 0 0 0.65rem;
  color: var(--text-strong);
  font-family: 'Noto Serif KR', serif;
  font-size: 1.25rem;
}

.state-panel p {
  max-width: 520px;
  margin: 0 auto;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.7;
}

.state-panel button {
  min-height: 42px;
  margin-top: 1.1rem;
  padding: 0.55rem 1rem;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--gold-dim);
  color: var(--gold-light);
  cursor: pointer;
}

.filter-dialog {
  width: min(calc(100% - 2rem), 460px);
  max-height: min(76vh, 680px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--ink-mid);
  color: var(--text);
  box-shadow: 0 24px 80px rgba(0,0,0,0.58);
}

.filter-dialog::backdrop { background: rgba(0,0,0,0.66); backdrop-filter: blur(2px); }

.filter-dialog__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--border);
}

.filter-dialog__header h2 {
  margin: 0;
  color: var(--text-strong);
  font-family: 'Noto Serif KR', serif;
  font-size: 1.05rem;
}

.filter-close {
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.2rem;
}

.filter-dialog__body {
  max-height: calc(min(76vh, 680px) - 126px);
  padding: 0.2rem 1.1rem 1rem;
  overflow-y: auto;
}

.filter-group {
  margin: 0;
  padding: 1rem 0;
  border: 0;
  border-bottom: 1px solid rgba(201,160,82,0.12);
}

.filter-group legend {
  margin-bottom: 0.7rem;
  color: var(--text-strong);
  font-family: 'Noto Serif KR', serif;
  font-size: 0.86rem;
  font-weight: 600;
}

.filter-options { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.filter-option { position: relative; }

.filter-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.filter-option label {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--ink-soft);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.78rem;
}

.filter-option input:checked + label {
  border-color: var(--gold);
  background: var(--gold-dim);
  color: var(--gold-light);
}

.filter-option input:focus-visible + label { outline: 3px solid var(--gold-light); outline-offset: 3px; }

.filter-dialog__footer {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 0.6rem;
  padding: 0.8rem 1.1rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--ink-mid);
}

.filter-dialog__footer button {
  min-height: 44px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
}

.filter-reset { background: transparent; color: var(--text-muted); }
.filter-apply { background: var(--gold); color: var(--ink); }

footer {
  margin-top: 1rem;
  padding: 2.5rem 1rem 3rem;
  border-top: 1px solid var(--border);
  text-align: center;
}

.footer-logo { margin: 0 0 0.5rem; color: var(--gold); font: 0.86rem 'Noto Serif KR', serif; }
.footer-link { color: var(--text-muted); font-size: 0.78rem; text-decoration: none; }
.footer-link:hover { color: var(--gold-light); }
[hidden] { display: none !important; }

@media (min-width: 650px) {
  .discovery { padding: 1.25rem; }
  .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .special-group { padding: 1.35rem; }
}

@media (min-width: 980px) {
  .game-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 649px) {
  .wrap { width: min(calc(100% - 1.25rem), var(--content-width)); }
  .hero { padding: 2rem 0.7rem 1.5rem; }
  .hero__deco { margin-bottom: 0.7rem; }
  .site-label { margin-bottom: 0.55rem; font-size: 0.7rem; }
  .hero h1 { margin-bottom: 0.55rem; font-size: clamp(1.45rem, 7vw, 2rem); }
  .hero__description { font-size: 0.8rem; }
  .discovery { margin-bottom: 1.5rem; padding: 0.7rem; }
  .course-tabs { margin-bottom: 0.65rem; }
  .course-tab { min-height: 40px; padding-inline: 0.35rem; font-size: 0.8rem; }
  .search-input { min-height: 46px; font-size: 0.83rem; }
  .filter-open { min-height: 46px; padding-inline: 0.75rem; }
  .filter-open__label { font-size: 0.8rem; }
  .active-row { align-items: flex-start; }
  .result-summary { margin-top: 0.7rem; padding-top: 0.7rem; }
  .era-navigation { margin-bottom: 2rem; }
  .era-section { margin-bottom: 3rem; }
  .game-card { padding: 1.1rem; }
  .filter-dialog {
    width: 100%;
    max-width: none;
    max-height: min(84vh, 720px);
    margin: auto 0 0;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 16px 16px 0 0;
  }
  .filter-dialog__body { max-height: calc(min(84vh, 720px) - 126px); }
}

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