:root {
  --bg: #1a1a2e;
  --bg-surface: #16213e;
  --bg-card: #1e293b;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --accent: #7c3aed;
  --accent-hover: #6d28d9;
  --border: #334155;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  padding: 2rem;
  max-width: 900px;
  margin: 0 auto;
}

.header-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

h1 {
  font-size: 1.75rem;
  font-weight: 600;
}

ul {
  list-style: none;
}

li {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

li strong {
  color: var(--text);
  font-size: 1.05rem;
}

li span {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.btn {
  border: none;
  display: inline-block;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s;
}

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

fieldset {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

fieldset > .form-row {
  margin-bottom: 0.5rem;
}

fieldset > .form-row input[type="text"],
fieldset > .form-row input[type="number"] {
  width: 100%;
  padding: 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text);
  font-size: 0.9rem;
}

.game-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.75rem;
}

.game-row h3 {
  width: 100%;
  font-size: 1rem;
  margin-bottom: 0;
}

.game-row .form-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.game-row .form-row label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.game-row .form-row select,
.game-row .form-row input {
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text);
  font-size: 0.85rem;
}

#import-paste {
  width: 100%;
  padding: 0.5rem;
  margin-bottom: 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text);
  font-size: 0.9rem;
  resize: vertical;
}

#import-btn {
  margin-bottom: 0.75rem;
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.player-search-wrap {
  flex: 1;
  position: relative;
}

.player-search-wrap svg {
  position: absolute;
  left: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.player-search-wrap input {
  width: 100%;
  padding: 0.55rem 0.65rem 0.55rem 2.1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text);
  font-size: 0.9rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.player-search-wrap input::placeholder {
  color: var(--text-muted);
}

.player-search-wrap input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.25);
}

.show-all-toggle {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  white-space: nowrap;
  cursor: pointer;
}

#player-checklist,
.player-checklist {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  max-height: 200px;
  overflow-y: auto;
}

.player-check {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.player-check:has(input:checked) {
  border-color: var(--accent);
  background: var(--bg-surface);
}

.pl-meta {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.pl-results {
  display: flex;
  gap: 2rem;
  margin-bottom: 1.5rem;
}

.pl-results[hidden] {
  display: none;
}

.pl-team h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.pl-winners h3 {
  color: #4ade80;
}

.pl-losers h3 {
  color: #f87171;
}

.pl-team li {
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.25rem;
}

.player-korean {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.prize {
  color: #fbbf24;
  font-size: 0.85rem;
}

.pl-notes {
  margin-bottom: 1.5rem;
}

.pl-notes summary {
  cursor: pointer;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.pl-notes pre {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  font-size: 0.85rem;
  white-space: pre-wrap;
  overflow-x: auto;
}

.games-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
}

.games-table th,
.games-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.games-table thead th {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
}

.win-indicator {
  color: #4ade80;
  font-weight: 600;
}

.loss-indicator {
  color: #f87171;
  font-weight: 600;
}

h2 {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
}

a {
  color: var(--accent);
}

a:hover {
  color: var(--accent-hover);
}

nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.nav-spacer {
  flex: 1;
}

.nav-user {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.nav-logout {
  display: inline;
}

.nav-logout button {
  border: none;
}

.btn-sm {
  padding: 0.25rem 0.6rem;
  font-size: 0.8rem;
}

.btn-danger {
  background: #dc3545;
}

.btn-danger:hover {
  background: #b02a37;
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
  font: inherit;
}

.btn-link:hover {
  color: var(--accent-hover);
}

.maps-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.map-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 4px;
}

.map-images-edit {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.map-image-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.auth-form-container {
  max-width: 400px;
  margin: 2rem auto;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.form-group label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.form-group input {
  padding: 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text);
  font-size: 0.9rem;
}

.auth-errors {
  color: #f87171;
  font-size: 0.9rem;
  min-height: 1.2em;
  margin-bottom: 0.5rem;
}

.auth-alt {
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.player-info-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}

.player-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 2rem;
}

.player-info-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.player-info-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.player-info-value {
  font-size: 1rem;
  font-weight: 500;
}

.site-link {
  display: inline-block;
  vertical-align: middle;
  margin-left: 0.5rem;
  line-height: 0;
}

.site-link svg,
.site-link .site-icon {
  width: 14px;
  height: 14px;
  vertical-align: middle;
}

.pl-links li {
  padding: 0.4rem 0.75rem;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.spoiler-hidden {
  color: var(--text-muted);
  font-style: italic;
}

.meta-stats {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.meta-stat-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
}

.meta-stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.meta-stat-value {
  font-size: 1.5rem;
  font-weight: 600;
}

.meta-stat-muted {
  color: var(--text-muted);
}

.meta-edit-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.meta-edit-card h2 {
  margin-bottom: 1rem;
}

.vod-links-section {
  margin-bottom: 1.5rem;
}

.vod-links-section .header-row {
  margin-bottom: 0.75rem;
}

.vod-timestamp {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.inline-form {
  display: inline;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

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

.modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  padding: 1.5rem;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

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

.modal-body .form-group {
  margin-bottom: 1rem;
}

.modal-body select,
.modal-body textarea,
.modal-body input[type="text"] {
  width: 100%;
  padding: 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.9rem;
}

.modal-body textarea {
  resize: vertical;
  font-family: inherit;
}
