:root {
  --bg: #f7f4ef;
  --text: #18130d;
  --muted: #4f4a40;
  --accent: #d27a3f;
  --accent-strong: #b35c1f;
  --panel: #ffffff;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
  --radius: 16px;
  --font-display: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

:root[data-theme="dark"] {
  --bg: #0f0c08;
  --text: #f1e9de;
  --muted: #c8bea9;
  --panel: #19130d;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  --accent: #f39b5d;
  --accent-strong: #d27a3f;
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  background: radial-gradient(circle at 20% 20%, rgba(210, 122, 63, 0.08), transparent 25%),
              radial-gradient(circle at 80% 0%, rgba(179, 92, 31, 0.1), transparent 20%),
              var(--bg);
  color: var(--text);
  line-height: 1.6;
  letter-spacing: -0.01em;
}

h1, h2, h3 {
  font-family: var(--font-display);
  margin: 0 0 0.35em;
  letter-spacing: -0.01em;
}

p {
  margin: 0 0 0.75em;
  color: var(--muted);
}

a {
  color: inherit;
  text-decoration: none;
}

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

.topbar__actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.topbar .btn {
  padding: 10px 14px;
}

header.hero {
  padding: 72px 6vw 56px;
}

.hero__content {
  max-width: 720px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}

.lede {
  font-size: 18px;
}

.actions {
  display: flex;
  gap: 12px;
  margin-top: 18px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 700;
  transition: transform 300ms ease, box-shadow 400ms ease, background 400ms ease, color 400ms ease;
}

.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  box-shadow: var(--shadow);
}

.btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.12);
}

.btn.ghost {
  background: transparent;
  border-color: #d7d0c5;
  color: var(--text);
}

.btn.ghost:hover {
  background: rgba(31, 27, 20, 0.04);
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid #d7d0c5;
  background: transparent;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 300ms ease, box-shadow 400ms ease, background 400ms ease;
}

.icon-btn:hover {
  background: rgba(31, 27, 20, 0.04);
  transform: translateY(-1px);
}

main {
  padding: 0 6vw 64px;
}

.section {
  margin-bottom: 48px;
}

.section__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  position: relative;
}

.card {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.muted {
  color: var(--muted);
}

.tooltip {
  border-bottom: 1px dotted currentColor;
  cursor: help;
  font-size: 0.85em;
  margin-left: 0.35rem;
  text-transform: none;
}

.error {
  color: #b00020;
  font-weight: 700;
}

.subtle {
  background: rgba(31, 27, 20, 0.02);
  border-radius: calc(var(--radius) * 1.2);
  padding: 24px;
}

.text-block {
  max-width: 720px;
  font-size: 16px;
}

.footer {
  padding: 32px 7vw 48px;
  color: var(--muted);
  font-size: 14px;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal.is-open {
  display: flex;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 12, 8, 0.5);
}

.modal__content {
  position: relative;
  z-index: 1;
  width: min(420px, 90vw);
  background: var(--panel);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.modal__content h3 {
  margin-bottom: 8px;
}

.modal__form {
  display: grid;
  gap: 12px;
}

.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.pill-stats {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(31, 27, 20, 0.05);
  color: var(--text);
  font-weight: 700;
}

.filters {
  margin-bottom: 16px;
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(6px);
}

.filters__row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.filters__tags {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 13px;
}

.filter-menu {
  position: relative;
}

.filter-menu summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #dcd5ca;
  background: #fff;
  font-size: 14px;
  color: var(--text);
  transition: border-color 300ms ease, box-shadow 300ms ease;
}

.filter-menu summary::-webkit-details-marker {
  display: none;
}

.filter-menu[open] summary {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(210, 122, 63, 0.15);
}

:root[data-theme="dark"] .filter-menu summary {
  background: #0f0c08;
  border-color: #3a3228;
}

.filter-options {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  min-width: 320px;
  width: max-content;
  max-width: 520px;
  max-height: 240px;
  overflow: auto;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid #dcd5ca;
  background: var(--panel);
  box-shadow: var(--shadow);
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.filter-options .tag.btn-tag {
  font-size: 13px;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  text-decoration: underline;
  text-decoration-color: rgba(210, 122, 63, 0.5);
  text-underline-offset: 3px;
  font-weight: 600;
  text-align: left;
  color: var(--text);
  justify-content: flex-start;
}

.filter-options .tag.btn-tag:hover {
  color: var(--accent);
}

.filter-options .tag.btn-tag.is-active {
  color: var(--accent-strong);
}

.filter-clear {
  margin-top: 8px;
  align-self: start;
  background: transparent;
  border: none;
  padding: 0;
  color: var(--muted);
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.filter-clear:hover {
  color: var(--accent);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid #dcd5ca;
  padding: 10px 12px;
  font-size: 15px;
  background: #fff;
  transition: border-color 300ms ease, box-shadow 300ms ease;
}

:root[data-theme="dark"] .field input,
:root[data-theme="dark"] .field select,
:root[data-theme="dark"] .field textarea {
  background: #0f0c08;
  border-color: #3a3228;
  color: var(--text);
}

.field textarea {
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(210, 122, 63, 0.15);
}

.game-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1px solid #efe7dc;
  transition: transform 900ms ease, opacity 700ms ease;
  will-change: transform;
  transform: translate(var(--tx, 0px), var(--ty, 0px)) scale(var(--scale, 1));
}

.game-card:hover {
  --scale: 1.01;
}

.game-card.is-moving {
  transition: transform 900ms ease;
}

.game-card.is-entering {
  opacity: 0;
  --scale: 0.98;
}

.game-card.is-exiting {
  opacity: 0;
  --scale: 0.98;
  position: absolute;
  pointer-events: none;
}

.game-card header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
}

.tag-section {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.tag-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.tag.btn-tag {
  cursor: pointer;
  border: none;
  background: transparent;
  padding: 0;
  border-radius: 0;
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: rgba(210, 122, 63, 0.5);
  text-underline-offset: 3px;
  text-align: left;
  align-items: flex-start;
  justify-content: flex-start;
}

.tag.btn-tag:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

.tag.btn-tag.is-active {
  color: var(--accent-strong);
  font-weight: 700;
  text-decoration-color: var(--accent-strong);
}

.admin-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.game-description {
  color: var(--muted);
  font-size: 0.95rem;
}

.read-more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: transparent;
  color: var(--accent);
  padding: 0;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.read-more:hover {
  color: var(--accent-strong);
}

.game-description p {
  margin: 0 0 0.75em;
}

.game-description ul,
.game-description ol {
  margin: 0.5em 0 0.85em 1.1em;
  padding: 0;
}

.game-description li {
  margin: 0.2em 0;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 13px;
  background: rgba(210, 122, 63, 0.12);
  color: var(--text);
}

.tag.muted {
  background: rgba(31, 27, 20, 0.05);
}

.meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(31, 27, 20, 0.02);
  font-size: 13px;
}

.stat {
  display: grid;
  gap: 4px;
  padding-right: 6px;
  border-right: 1px solid rgba(31, 27, 20, 0.08);
}

.stat:last-child {
  border-right: none;
}

.stat__value {
  font-weight: 700;
  color: var(--text);
}

.stat__label {
  color: var(--muted);
  font-size: 12px;
}

.card-cover {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(210, 122, 63, 0.25), rgba(31, 27, 20, 0.08));
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-cover img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-cover span {
  color: var(--muted);
}

.admin-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.admin-panel__header {
  margin-bottom: 6px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.full {
  grid-column: 1 / -1;
}

.input-with-button {
  display: flex;
  gap: 8px;
}

.input-with-button input {
  flex: 1;
}

.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.admin-panel[hidden] {
  display: none;
}

.suggestions {
  position: relative;
  margin-top: 6px;
}

.suggestions__list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--panel);
  border: 1px solid #e5dccf;
  border-radius: 12px;
  box-shadow: var(--shadow);
  max-height: 240px;
  overflow-y: auto;
  z-index: 4;
}

.suggestions__item {
  padding: 10px 12px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.suggestions__item:hover {
  background: rgba(210, 122, 63, 0.1);
}

.table {
  border: 1px solid #e5dccf;
  border-radius: 14px;
  overflow: hidden;
}

.table__head,
.table__row {
  display: grid;
  grid-template-columns: 1.5fr 0.8fr 0.8fr 0.8fr 0.8fr;
  gap: 8px;
  padding: 10px 12px;
}

.table__head {
  background: rgba(31, 27, 20, 0.05);
  font-weight: 700;
}

.table__row {
  border-top: 1px solid #e5dccf;
  align-items: center;
}

.table__actions {
  display: flex;
  gap: 8px;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 20px;
  color: var(--muted);
  border: 1px dashed rgba(31, 27, 20, 0.2);
  border-radius: var(--radius);
}

@media (max-width: 900px) {
  .game-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  header.hero {
    padding-top: 60px;
  }

  .actions {
    flex-wrap: wrap;
  }

  .table__head,
  .table__row {
    grid-template-columns: 1.4fr 0.8fr 0.8fr 0.8fr;
  }

  .table__row .table__actions {
    grid-column: span 4;
  }
}
