:root {
  --color-bg: #0f1117;
  --color-surface: #171a23;
  --color-surface-alt: #1f2330;
  --color-border: #2b2f3d;
  --color-text: #e9eaf0;
  --color-text-muted: #9599ab;
  --color-primary: #7c5cff;
  --color-primary-hover: #6a49ff;
  --color-accent: #ff6a88;
  --color-error: #ff6b6b;
  --radius: 14px;
  --max-width: 1100px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.site-header {
  background: linear-gradient(135deg, #1a1c2e, #2d1b4e);
  padding: 40px 0;
  border-bottom: 1px solid var(--color-border);
}

.header-inner h1 {
  margin: 0 0 8px;
  font-size: 2rem;
}

.header-inner p {
  margin: 0;
  color: var(--color-text-muted);
}

/* Toolbar */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: end;
  margin: 32px 0 24px;
}

.search-input {
  flex: 1 1 220px;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.95rem;
}

.filter-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

select,
input,
textarea {
  font-family: inherit;
}

.filter-label select {
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  min-width: 160px;
}

/* Game grid */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 56px;
}

.game-card {
  display: flex;
  flex-direction: column;
  text-align: left;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  color: inherit;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.game-card:hover,
.game-card:focus-visible {
  transform: translateY(-4px);
  border-color: var(--color-primary);
  outline: none;
}

.cover {
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.85);
  letter-spacing: 1px;
}

.game-card-info {
  padding: 14px 16px 18px;
}

.game-card-info h3 {
  margin: 0 0 4px;
  font-size: 1.05rem;
}

.game-card-meta {
  margin: 0;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.empty-state {
  color: var(--color-text-muted);
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 0;
}

/* Buttons */
.btn {
  border: none;
  border-radius: var(--radius);
  padding: 11px 20px;
  font-size: 0.95rem;
  cursor: pointer;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--color-primary-hover);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Contact form */
.contact-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 32px;
  margin-bottom: 56px;
}

.contact-section h2 {
  margin-top: 0;
}

.contact-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
  margin-top: 20px;
}

.contact-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.contact-form input,
.contact-form select {
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-surface-alt);
  color: var(--color-text);
}

.contact-form button {
  align-self: end;
}

.form-feedback {
  grid-column: 1 / -1;
  margin: 0;
  min-height: 1.2em;
  color: var(--color-text-muted);
}

.form-feedback.error {
  color: var(--color-error);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 6, 10, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal-overlay[hidden] {
  display: none;
}

body.modal-open {
  overflow: hidden;
}

.modal-dialog {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  max-width: 640px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  font-size: 1.2rem;
  cursor: pointer;
}

.modal-header {
  display: flex;
  gap: 18px;
  align-items: center;
  margin-bottom: 20px;
}

.modal-header .cover {
  width: 100px;
  height: 100px;
  border-radius: var(--radius);
  flex-shrink: 0;
  font-size: 1.6rem;
}

.modal-header h2 {
  margin: 0 0 6px;
}

.modal-meta {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.modal-synopsis {
  color: var(--color-text);
}

.platform-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
}

.platform-list li {
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.8rem;
}

.average-rating {
  font-weight: 600;
  color: var(--color-accent);
}

.star-picker {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
}

.star {
  background: none;
  border: none;
  font-size: 1.6rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.star-filled {
  color: #ffb800;
}

.star-empty {
  color: var(--color-border);
}

.review-stars .star {
  font-size: 0.95rem;
  cursor: default;
  display: inline-block;
}

.review-form textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-surface-alt);
  color: var(--color-text);
  resize: vertical;
  margin-bottom: 10px;
}

.review-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.review-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: var(--color-surface-alt);
}

.review-item-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}

.review-item p {
  margin: 0;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 24px 0;
  color: var(--color-text-muted);
  font-size: 0.85rem;
  text-align: center;
}

@media (max-width: 480px) {
  .modal-header {
    flex-direction: column;
    align-items: flex-start;
  }
}
