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

:root {
  --bg: #f6f8ff;
  --surface: #FFFFFF;
  --surface2: #F0F3FF;
  --border: rgba(60, 80, 180, 0.12);
  --border2: rgba(60, 80, 180, 0.22);
  --text: #0F1428;
  --text-muted: #3D4A70;
  --text-faint: #7880B0;
  --radius-md: 8px;
  --radius-lg: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0D0F1C;
    --surface: #161828;
    --surface2: #1E2138;
    --border: rgba(100, 120, 255, 0.12);
    --border2: rgba(100, 120, 255, 0.22);
    --text: #E8ECFF;
    --text-muted: #9AA0CC;
    --text-faint: #5A608A;
  }
  .badge-strategy  { background: #2A2580; color: #A5B0FF; }
  .badge-party     { background: #6B2200; color: #FFBB88; }
  .badge-coop      { background: #053D28; color: #5DDBA8; }
  .badge-abstract  { background: #082E55; color: #6BBFEE; }
  .badge-family    { background: #5A3000; color: #FFCC66; }
  .badge-card      { background: #560A30; color: #F0A0C8; }
  .badge-deduction { background: #30156A; color: #C8AAFF; }
  .badge-luck      { background: #1E3A08; color: #9ADA60; }
  .complexity-pip { background: #252840; }
}

body {
  font-family: 'Georgia', serif;
  background: linear-gradient(155deg, rgb(249, 251, 255) 0%, rgb(237, 242, 255) 55%, rgb(223, 232, 255) 100%);
  min-height: 100vh;
  color: var(--text);
  padding: 2.5rem 1.5rem 4rem;
}

header {
  max-width: 900px;
  margin: 0 auto 1.5rem;
  border-bottom: 1.5px solid var(--border2);
  padding-bottom: 1.25rem;
}

header h1 {
  font-family: 'Georgia', serif;
  font-size: 26px;
  font-weight: bold;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}

header h1 em {
  font-style: normal;
  color: rgb(63, 109, 246);
}

header p {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

.controls {
  max-width: 900px;
  margin: 0 auto 1.5rem;
}

.search-wrap {
  flex: 1;
  min-width: 160px;
}

#search-input {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1.5px solid var(--border2);
  background: var(--surface);
  color: var(--text);
  width: 100%;
  outline: none;
}

#search-input::placeholder { color: var(--text-faint); }
#search-input:focus { border-color: #3F6DF6; }

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

.select-wrap {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
  min-width: 120px;
}

.filter-label {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

select {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 13px;
  padding: 6px 32px 6px 12px;
  border-radius: 8px;
  border: 1.5px solid var(--border2);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%237880B0' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  width: 100%;
}

select:focus { outline: none; border-color: #4F46E5; }

.grid {
  max-width: 900px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 14px;
}

.card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-top-width: 3px;
  border-radius: var(--radius-lg);
  padding: 1rem 1.125rem;
  transition: box-shadow 0.15s, transform 0.1s;
}

.card {
  cursor: pointer;
}

.card:hover {
  box-shadow: 0 6px 24px rgba(60, 80, 180, 0.13);
  transform: translateY(-2px);
}

.card.selected {
  box-shadow: 0 0 0 2px #3F6DF6, 0 6px 24px rgba(63, 109, 246, 0.18);
  transform: translateY(-2px);
}

.card.dimmed {
  opacity: 0.35;
  transform: none;
  box-shadow: none;
}

.card-strategy  { border-top-color: #4F46E5; }
.card-party     { border-top-color: #EA580C; }
.card-coop      { border-top-color: #059669; }
.card-abstract  { border-top-color: #0284C7; }
.card-family    { border-top-color: #D97706; }
.card-card      { border-top-color: #BE185D; }
.card-deduction { border-top-color: #7C3AED; }
.card-luck      { border-top-color: #4D7C0F; }

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 4px;
}

.game-name {
  font-family: 'Georgia', serif;
  font-size: 15px;
  font-weight: bold;
  color: var(--text);
  line-height: 1.3;
}

.badge {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 10px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: 8px;
}

.badge-strategy  { background: #E0E2FF; color: #3730A3; }
.badge-party     { background: #FFE8D8; color: #9A3412; }
.badge-coop      { background: #D4F5E8; color: #065F46; }
.badge-abstract  { background: #D4EEFF; color: #0369A1; }
.badge-family    { background: #FFE8B0; color: #78350F; }
.badge-card      { background: #FFD8EC; color: #9D174D; }
.badge-deduction { background: #E8DAFF; color: #5B21B6; }
.badge-luck      { background: #D8F0B8; color: #365314; }

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.players {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 12px;
  color: var(--text-faint);
}

.complexity-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
}

.complexity-pips { display: flex; gap: 3px; }

.complexity-pip {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #C8CCE8;
  transition: background 0.15s;
}

.card-strategy  .complexity-pip.filled { background: #4F46E5; }
.card-party     .complexity-pip.filled { background: #EA580C; }
.card-coop      .complexity-pip.filled { background: #059669; }
.card-abstract  .complexity-pip.filled { background: #0284C7; }
.card-family    .complexity-pip.filled { background: #D97706; }
.card-card      .complexity-pip.filled { background: #BE185D; }
.card-deduction .complexity-pip.filled { background: #7C3AED; }
.card-luck      .complexity-pip.filled { background: #4D7C0F; }

.complexity-text {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 11px;
  color: var(--text-faint);
}

.similar-label {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.similar-list { display: flex; flex-direction: column; gap: 4px; }

.similar-item {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  padding: 8px 10px;
  background: var(--surface2);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sim-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.similar-item.highlighted {
  background: #E8EEFF;
  outline: 1.5px solid #3F6DF6;
}

.similar-item .why {
  font-size: 12px;
  color: var(--text-faint);
  line-height: 1.4;
}

.no-similar {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 12px;
  color: var(--text-faint);
  font-style: italic;
  padding: 4px 0;
}

/* Results row */
.results-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

.count-badge {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 12px;
  color: var(--text-faint);
}

.clear-btn {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: #3F6DF6;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.clear-btn:hover { text-decoration: underline; }

/* Empty state */
.empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 4rem 1rem;
  text-align: center;
}

.empty-icon { font-size: 40px; }

.empty-title {
  font-family: 'Georgia', serif;
  font-size: 18px;
  color: var(--text-muted);
}

.empty-sub {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 13px;
  color: var(--text-faint);
}

footer {
  max-width: 900px;
  margin: 2.5rem auto 0;
  border-top: 1.5px solid var(--border);
  padding-top: 1rem;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 12px;
  color: var(--text-faint);
}
