:root {
  --bg: #0f172a;
  --card: #1e293b;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --accent: #8b5cf6;
  --good: #22c55e;
  --bad: #ef4444;
}

* { box-sizing: border-box; }

/* display rules below (flex, grid) would otherwise override the hidden attribute */
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, sans-serif;
  padding: 16px;
}

.card {
  width: 100%;
  max-width: 440px;
  background: var(--card);
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

h1 { margin: 0 0 8px; font-size: 1.6rem; }

.home-btn {
  display: block;
  margin: -8px 0 8px -8px;
  padding: 6px 10px;
  border: none;
  font-size: 0.9rem;
  color: var(--muted);
}
.home-btn:hover { color: var(--text); }

.stats {
  display: flex;
  justify-content: space-around;
  color: var(--muted);
  margin-bottom: 16px;
}
.stats strong { color: var(--text); }

.photo-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  background: #0b1222;
  border-radius: 12px;
  overflow: hidden;
  display: grid;
  place-items: center;
}
#photo { width: 100%; height: 100%; object-fit: cover; object-position: top; }
#loading { color: var(--muted); }

.muted { color: var(--muted); margin: 4px 0 12px; }

.rules {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  font-size: 0.95rem;
  line-height: 1.6;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 4px 0 8px;
  border: 1px solid #334155;
  border-radius: 8px;
  overflow: hidden;
}
.segmented button { border: none; border-radius: 0; padding: 8px 12px; }
.segmented button[aria-pressed="true"] { background: var(--accent); }

.daily {
  width: 100%;
  margin-top: 8px;
  padding: 14px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.daily .emoji { font-size: 1.8rem; }
.daily .count { font-size: 0.8rem; opacity: 0.85; }

.link-btn { margin-top: 14px; border: none; color: var(--muted); }
.link-btn:hover { color: var(--text); }

.submit-form { margin-top: 8px; }

select {
  width: 100%;
  margin: 4px 0;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #0b1222;
  color: var(--text);
  font-size: 1rem;
}

.board { list-style: none; padding: 0; margin: 8px 0; text-align: left; }
.board li { display: flex; gap: 10px; padding: 6px 8px; border-bottom: 1px solid #334155; }
.board .rank { width: 2.5em; color: var(--muted); }
.board .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board .points { font-weight: 600; }
.board li.you { background: rgba(139, 92, 246, 0.2); border-radius: 6px; }
.board li.gap, .board li.empty { justify-content: center; color: var(--muted); border-bottom: none; }

.category-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.category-list button {
  padding: 16px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.category-list button.everyone { grid-column: 1 / -1; }
.category-list .emoji { font-size: 1.8rem; }
.category-list .count { font-size: 0.8rem; color: var(--muted); }

form { display: flex; gap: 8px; margin-top: 16px; }
input {
  flex: 1;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #0b1222;
  color: var(--text);
  font-size: 1rem;
}
input:focus { outline: 2px solid var(--accent); border-color: transparent; }

button {
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid #334155;
  background: transparent;
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
}
button:hover { background: #334155; }
button:disabled { opacity: 0.4; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); }
button.primary:hover { filter: brightness(1.1); }

.actions { display: flex; justify-content: center; gap: 8px; margin-top: 12px; }

.feedback { min-height: 1.4em; font-weight: 600; }
.feedback.good { color: var(--good); }
.feedback.bad { color: var(--bad); }

#summary { list-style: none; padding: 0; text-align: left; }
#summary li { padding: 4px 0; border-bottom: 1px solid #334155; }

footer { margin-top: 20px; font-size: 0.75rem; color: var(--muted); }

.shake { animation: shake 0.3s; }
@keyframes shake {
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}
