:root {
  font-family: Inter, "Segoe UI", "Yu Gothic UI", sans-serif;
  color: #18202a;
  background: #f5f6f7;
  font-synthesis: none;
  letter-spacing: 0;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background: #f5f6f7;
}

button, input, select { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }

.site-header {
  min-height: 58px;
  color: #fff;
  background: #18202a;
  border-bottom: 3px solid #d59b18;
}

.header-inner,
.control-inner,
.results-inner {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.header-inner {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  font-size: 1rem;
  font-weight: 750;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 30px;
  color: #18202a;
  background: #f0bd48;
  border-radius: 4px;
  font-size: .72rem;
  font-weight: 900;
}

.mock-label {
  color: #cbd1d8;
  font-size: .78rem;
}

.control-band {
  background: #fff;
  border-bottom: 1px solid #dce0e4;
}

.control-inner { padding: 28px 0 20px; }

.title-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 5px; font-size: 1.8rem; line-height: 1.2; }
#result-summary { margin-bottom: 0; color: #66707c; font-size: .9rem; }

.quiet-button,
.primary-button,
.icon-button {
  min-height: 44px;
  border-radius: 5px;
  font-weight: 700;
}

.quiet-button {
  padding: 0 15px;
  border: 1px solid #cbd1d8;
  color: #34404d;
  background: #fff;
}

.filters {
  display: grid;
  grid-template-columns: minmax(260px, 2fr) minmax(190px, 1fr) minmax(180px, 1fr);
  gap: 12px;
}

label { display: grid; gap: 7px; color: #4d5864; font-size: .78rem; font-weight: 700; }

input,
select {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid #bfc6cd;
  border-radius: 5px;
  color: #18202a;
  background: #fff;
}

input:focus-visible,
select:focus-visible,
button:focus-visible {
  outline: 3px solid #f0bd48;
  outline-offset: 2px;
}

.game-shortcuts {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  padding-bottom: 3px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.game-shortcut {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid #d0d5da;
  border-left: 4px solid var(--game-color);
  border-radius: 5px;
  color: #34404d;
  background: #fff;
  font-size: .83rem;
  font-weight: 700;
}

.game-shortcut[aria-pressed="true"] {
  color: #fff;
  background: #26313d;
  border-color: #26313d;
  border-left-color: var(--game-color);
}

.results-inner { padding: 22px 0 60px; }

.active-filter {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-left: 4px solid #2864a0;
  background: #eaf2fa;
  font-size: .85rem;
  font-weight: 700;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.result-card {
  min-width: 0;
  border: 1px solid #d8dde2;
  border-top: 3px solid var(--game-color);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 2px 8px rgb(24 32 42 / 6%);
  overflow: hidden;
}

.card-open {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  text-align: left;
}

.card-open:hover .card-title { text-decoration: underline; }

.deck-board {
  --board-a: #485463;
  --board-b: #202932;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
  width: 100%;
  aspect-ratio: 16 / 9;
  padding: 12px;
  background: #242c35;
  overflow: hidden;
}

.deck-board[data-palette="red"] { --board-a: #b42318; --board-b: #6d211b; }
.deck-board[data-palette="blue"] { --board-a: #1671b9; --board-b: #17456b; }
.deck-board[data-palette="yellow"] { --board-a: #d6a51c; --board-b: #725813; }
.deck-board[data-palette="violet"] { --board-a: #7a3e9d; --board-b: #47265a; }
.deck-board[data-palette="green"] { --board-a: #1b7a54; --board-b: #22513f; }
.deck-board[data-palette="rose"] { --board-a: #a62f62; --board-b: #59253d; }
.deck-board[data-palette="teal"] { --board-a: #16766b; --board-b: #214e4a; }
.deck-board[data-palette="gold"] { --board-a: #b18116; --board-b: #624a14; }
.deck-board[data-palette="ink"] { --board-a: #4c5968; --board-b: #161c23; }
.deck-board[data-palette="silver"] { --board-a: #828c97; --board-b: #4b555f; }

.deck-tile {
  min-width: 0;
  border: 1px solid rgb(255 255 255 / 32%);
  border-radius: 2px;
  background: var(--board-a);
  box-shadow: inset 0 0 0 2px rgb(0 0 0 / 14%);
  opacity: calc(.72 + (var(--tile-index) % 3) * .1);
}

.deck-tile:nth-child(3n) { background: var(--board-b); }
.deck-tile:nth-child(4n) { transform: translateY(3px); }

.card-copy { display: grid; gap: 7px; padding: 14px; }
.card-meta { color: #68727d; font-size: .76rem; }
.card-title { font-size: 1rem; line-height: 1.4; }
.card-game { min-height: 2.7em; color: #303b47; font-size: .84rem; line-height: 1.35; }

.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.card-tags { padding: 0 14px 14px; }
.tag {
  min-height: 29px;
  padding: 5px 9px;
  border: 1px solid #d8dde2;
  border-radius: 4px;
  color: #3d4854;
  background: #f5f6f7;
  font-size: .74rem;
  line-height: 1.2;
}
button.tag:hover { border-color: #2864a0; color: #184c80; }

.card-status {
  justify-self: start;
  margin-top: 2px;
  color: #4e5965;
  font-size: .73rem;
  font-weight: 700;
}
.card-status[data-status="needs_tags"] { color: #8a4b08; }
.card-status[data-status="community_reviewed"] { color: #19654a; }

.empty-state { padding: 48px 16px; color: #68727d; text-align: center; }

dialog {
  width: min(720px, calc(100% - 28px));
  max-height: calc(100dvh - 28px);
  padding: 0;
  border: 0;
  border-radius: 7px;
  box-shadow: 0 24px 70px rgb(0 0 0 / 34%);
}
dialog::backdrop { background: rgb(13 18 24 / 66%); }
.dialog-shell { background: #fff; }
.dialog-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px;
  border-bottom: 1px solid #dde1e5;
}
.dialog-header h2 { margin-bottom: 0; font-size: 1.18rem; line-height: 1.4; }
.dialog-date { margin-bottom: 5px; color: #65707b; font-size: .82rem; }
.icon-button {
  flex: 0 0 44px;
  width: 44px;
  padding: 0;
  border: 1px solid #cbd1d8;
  color: #34404d;
  background: #fff;
  font-size: 1.4rem;
}
.deck-board-large { aspect-ratio: 16 / 8; gap: 8px; padding: 20px; }
.detail-section { padding: 18px 20px; border-top: 1px solid #e2e5e8; }
.detail-section h3 { margin-bottom: 12px; font-size: .96rem; }
.detail-section p { color: #5d6874; font-size: .82rem; line-height: 1.6; }
.evidence-list { display: grid; grid-template-columns: 105px 1fr; gap: 8px 14px; margin: 0; font-size: .84rem; }
.evidence-list dt { color: #69747f; font-weight: 700; }
.evidence-list dd { margin: 0; }
.contribution-section form { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 10px; }
.primary-button { padding: 0 18px; border: 1px solid #174f81; color: #fff; background: #1f5f99; }
.suggestion-feedback { min-height: 1.5em; margin: 10px 0 0; color: #19654a !important; font-weight: 700; }

@media (max-width: 850px) {
  .result-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters { grid-template-columns: 1fr 1fr; }
  .search-field { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
  .header-inner, .control-inner, .results-inner { width: min(100% - 24px, 1180px); }
  .control-inner { padding-top: 20px; }
  .title-row { align-items: start; }
  h1 { font-size: 1.45rem; }
  .quiet-button { min-width: 44px; padding: 0 10px; font-size: .76rem; }
  .filters { grid-template-columns: 1fr; }
  .search-field { grid-column: auto; }
  .result-grid { grid-template-columns: 1fr; gap: 12px; }
  .card-open { display: grid; grid-template-columns: 42% 1fr; min-height: 190px; }
  .deck-board { height: 100%; min-height: 190px; aspect-ratio: auto; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 8px; }
  .deck-tile:nth-child(n + 17) { display: none; }
  .card-copy { align-content: start; padding: 12px; }
  .card-tags { padding: 0 12px 12px; }
  .card-game { min-height: 0; }
  .tag { min-width: 44px; min-height: 44px; }
  .deck-board-large { min-height: 230px; height: 230px; grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .deck-board-large .deck-tile:nth-child(n) { display: block; }
  .contribution-section form { grid-template-columns: 1fr; }
  .primary-button { width: 100%; }
  .evidence-list { grid-template-columns: 1fr; gap: 3px; }
  .evidence-list dd { margin-bottom: 8px; }
}

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