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

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: #1a1a2e;
  color: #e0e0e0;
  min-height: 100vh;
}

a { color: #7eb8da; text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

header {
  padding: 1rem 2rem;
  background: #16213e;
  border-bottom: 1px solid #2a2a4a;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

header h1 {
  font-size: 1.4rem;
  font-weight: 600;
  color: #fff;
}

header nav {
  display: flex;
  gap: 1.5rem;
}

.puzzle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.puzzle-card {
  background: #16213e;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #2a2a4a;
  transition: border-color 0.2s;
}

.puzzle-card:hover {
  border-color: #7eb8da;
}

.puzzle-card img {
  width: 100%;
  aspect-ratio: 3/2;
  object-fit: cover;
}

.puzzle-card .info {
  padding: 0.75rem 1rem;
}

.puzzle-card .info h3 {
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.puzzle-card .info .meta {
  font-size: 0.85rem;
  color: #888;
}

/* Auth forms */
.auth-form {
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
}

.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.9rem;
  color: #aaa;
}

.auth-form input {
  padding: 0.6rem 0.75rem;
  background: #16213e;
  border: 1px solid #2a2a4a;
  border-radius: 4px;
  color: #e0e0e0;
  font-size: 1rem;
}

.auth-form input:focus {
  outline: none;
  border-color: #7eb8da;
}

.auth-form button {
  padding: 0.7rem;
  background: #7eb8da;
  color: #1a1a2e;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 0.5rem;
}

.auth-form button:hover {
  background: #9dccea;
}

.auth-link {
  margin-top: 1rem;
  font-size: 0.9rem;
  color: #888;
}

/* New game — motif picker */
.section-label {
  font-size: 0.85rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.puzzle-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-top: 0.5rem;
  margin-bottom: 1.5rem;
}

.puzzle-card.selectable {
  width: 240px;
  cursor: pointer;
  border: 2px solid #2a2a4a;
  border-radius: 10px;
  overflow: hidden;
  background: #16213e;
  transition: border-color 0.2s;
}

.puzzle-card.selectable:hover {
  border-color: #7eb8da;
}

.puzzle-card.selectable img {
  width: 100%;
  aspect-ratio: 3/2;
  object-fit: cover;
  display: block;
}

.puzzle-card.selectable .info {
  padding: 0.6rem 0.85rem 0.7rem;
}

.puzzle-card.selectable .info h3 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.15rem;
  color: #f0f0f0;
}

.puzzle-card.selectable .info .meta {
  font-size: 0.8rem;
  color: #888;
}

/* Motif detail */
.back-link {
  display: inline-block;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
  cursor: pointer;
  color: #7eb8da;
  transition: opacity 0.15s;
}

.back-link:hover {
  opacity: 0.8;
  text-decoration: none;
}

.motif-detail {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 2rem;
  align-items: flex-start;
}

.motif-preview {
  width: 340px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

.motif-info {
  padding-top: 0.25rem;
}

.motif-info h3 {
  font-size: 1.3rem;
  font-weight: 600;
  color: #f0f0f0;
  margin-bottom: 0.35rem;
}

.motif-info .artist {
  color: #aaa;
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
}

.motif-info .link {
  font-size: 0.85rem;
}

/* Size picker */
.size-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.5rem;
  margin-bottom: 1.5rem;
}

.size-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.75rem 1.5rem;
  background: #16213e;
  border: 2px solid #2a2a4a;
  border-radius: 8px;
  color: #e0e0e0;
  cursor: pointer;
  transition: all 0.15s ease;
}

.size-option:hover {
  border-color: #5a9aba;
  background: #1a2d4a;
}

.size-option.selected {
  background: #1e3a5f;
  border-color: #7eb8da;
  box-shadow: 0 0 0 1px rgba(126, 184, 218, 0.3);
}

.size-option .piece-count {
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.2;
}

.size-option .dimensions {
  font-size: 0.78rem;
  color: #888;
  transition: color 0.15s;
}

.size-option.selected .dimensions {
  color: #aac8dd;
}

/* Game form */
.game-form {
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.game-form.hidden {
  display: none;
}

.game-form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.9rem;
  color: #aaa;
}

.game-form input[type="text"] {
  padding: 0.6rem 0.75rem;
  background: #16213e;
  border: 1px solid #2a2a4a;
  border-radius: 4px;
  color: #e0e0e0;
  font-size: 1rem;
}

.game-form input[type="text"]:focus {
  outline: none;
  border-color: #7eb8da;
}

.game-form button[type="submit"] {
  padding: 0.7rem;
  background: #7eb8da;
  color: #1a1a2e;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 0.5rem;
  transition: background 0.15s;
}

.game-form button[type="submit"]:hover {
  background: #9dccea;
}

.toggle-label {
  flex-direction: row !important;
  align-items: center;
  gap: 0.5rem !important;
  cursor: pointer;
}

.toggle-label .toggle {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: #7eb8da;
}

/* Feedback messages */
.error {
  color: #e87474;
  background: rgba(232, 116, 116, 0.1);
  padding: 0.6rem 0.75rem;
  border-radius: 4px;
  font-size: 0.9rem;
}

.success {
  color: #74e89a;
  background: rgba(116, 232, 154, 0.1);
  padding: 0.6rem 0.75rem;
  border-radius: 4px;
  font-size: 0.9rem;
}
