:root {
  --bg: #0f1923;
  --surface: #1f2731;
  --text: #ece8e1;
  --muted: #7a8189;
  --accent: #ff4655;
  --success: #4cd18a;
  --border: #2b3543;
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 1rem 1rem 5rem;
}

.topnav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topnav a {
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  font-size: 0.9rem;
}

.topnav a:hover {
  color: var(--accent);
}

.logout-form {
  margin-left: auto;
}

.logout-form button {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.9rem;
  cursor: pointer;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.login-card {
  margin-top: 3rem;
}

.login-card h1 {
  margin-top: 0;
  color: var(--accent);
  font-size: 1.5rem;
}

form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

label {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.5rem;
}

input {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 0.6rem 0.7rem;
  font-size: 1rem;
}

button {
  margin-top: 1rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 0.7rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.error {
  color: var(--accent);
  font-size: 0.9rem;
}

.button-link {
  display: inline-block;
  margin-top: 1rem;
  background: var(--accent);
  color: white;
  border-radius: 6px;
  padding: 0.7rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
}

.filters {
  margin-top: 1rem;
}

.filters select {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 0.6rem 0.7rem;
  font-size: 1rem;
}

.segmented {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  margin-top: 0.5rem;
}

.segmented a {
  flex: none;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
}

.segmented a.active {
  border-color: var(--accent);
  color: var(--accent);
}

.hint {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 1rem 0 0.5rem;
}

.skin-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.skin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.skin-card img {
  width: 100%;
  max-height: 120px;
  object-fit: contain;
  background: var(--bg);
  border-radius: 6px;
}

.skin-name {
  margin: 0;
  font-weight: 600;
}

.skin-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  margin-right: 0.3rem;
  border: 1px solid var(--border);
  color: var(--muted);
}

.badge.ineligible {
  color: var(--accent);
  border-color: var(--accent);
}

.badge.owned {
  color: var(--success);
  border-color: var(--success);
}

.toggle-form {
  margin: 0;
}

.link-button {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.8rem;
  text-decoration: underline;
  padding: 0;
  margin: 0;
  cursor: pointer;
}

.pagination {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.pagination a,
.pagination span {
  padding: 0.4rem 0.7rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  font-size: 0.85rem;
}

.pagination a.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.pagination .page-arrow {
  font-weight: 600;
}

.pagination span.disabled {
  color: var(--muted);
  opacity: 0.4;
}

.pagination .page-ellipsis {
  border-color: transparent;
  padding-left: 0.3rem;
  padding-right: 0.3rem;
  color: var(--muted);
}

.history-entry {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 0.75rem;
  overflow: hidden;
}

.history-entry summary {
  list-style: none;
  cursor: pointer;
  padding: 0.9rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.history-entry summary::-webkit-details-marker {
  display: none;
}

.history-entry summary::after {
  content: "\25BE";
  color: var(--muted);
  flex: none;
  transition: transform 0.15s ease;
}

.history-entry[open] summary::after {
  transform: rotate(180deg);
}

.history-entry summary:hover .history-date {
  color: var(--accent);
}

.history-summary-main {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.history-date {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
}

.history-date-today {
  color: var(--accent);
}

.history-count {
  color: var(--muted);
  font-size: 0.8rem;
}

.history-preview {
  display: flex;
  gap: 0.25rem;
  flex: none;
}

.history-preview img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  background: var(--bg);
  border-radius: 5px;
  border: 1px solid var(--border);
}

.history-entry .skin-grid {
  margin-top: 0;
  padding: 0 1rem 1rem;
}

.history-entry .skin-card {
  background: var(--bg);
}
