:root {
  color-scheme: dark;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

body {
  margin: 0;
  background: #0f1117;
  color: #f2f3f5;
}

a {
  color: #748ffc;
}

.profile-link {
  color: #91a7ff;
  text-decoration: none;
}

.profile-link:hover {
  text-decoration: underline;
}

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

.header h1 {
  margin-bottom: 0.2rem;
}

.header p {
  margin-top: 0;
  color: #a8b0c0;
}

.card {
  background: #161b26;
  border: 1px solid #2a3142;
  border-radius: 12px;
  padding: 1.25rem;
  margin-top: 1.25rem;
}

.library-subsection {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid #2a3142;
}

.library-subsection h3 {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
  font-weight: 600;
}

form label {
  display: block;
  margin-bottom: 0.8rem;
  font-size: 0.95rem;
}

.title-roll-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.title-roll-row input {
  margin-top: 0.35rem;
}

.dice-roll-btn {
  width: auto;
  margin-top: 0.35rem;
  padding: 0.6rem 0.75rem;
  font-size: 1.1rem;
  line-height: 1;
  border-radius: 8px;
  background: #2b3348;
  border: 1px solid #42506f;
}

.dice-roll-btn:hover {
  background: #39415b;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.checkbox-row input[type="checkbox"] {
  width: auto;
  margin-top: 0;
}

input,
textarea,
button,
select {
  width: 100%;
  box-sizing: border-box;
  margin-top: 0.35rem;
  border-radius: 8px;
  border: 1px solid #36405a;
  padding: 0.7rem;
  background: #0d111a;
  color: #f2f3f5;
}

textarea {
  resize: vertical;
}

button {
  cursor: pointer;
  background: #715cff;
  border: none;
  font-weight: 600;
}

button:hover {
  filter: brightness(1.1);
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.message {
  min-height: 1.2rem;
  margin: 0.6rem 0 0;
  color: #8ce99a;
}

.message.error {
  color: #ff8f8f;
}

.beats-list {
  display: grid;
  gap: 0.9rem;
}

.beat-item {
  border: 1px solid #2f374b;
  border-radius: 10px;
  padding: 0.9rem;
  background: #101521;
}

.beat-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.beat-title {
  margin: 0;
}

.meta {
  margin-top: 0.3rem;
  color: #a8b0c0;
  font-size: 0.9rem;
}

.delete-btn {
  width: auto;
  padding: 0.5rem 0.8rem;
  background: #f03e3e;
}

.reaction-row {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.reaction-btn {
  width: auto;
  padding: 0.45rem 0.7rem;
  background: #2b3348;
  border: 1px solid #42506f;
  font-size: 0.9rem;
}

.download-btn {
  display: inline-block;
  width: auto;
  text-decoration: none;
  color: #f2f3f5;
  text-align: center;
}

.reaction-btn span {
  color: #d0d7e8;
}

.reaction-btn.active {
  background: #715cff;
  border-color: #8f7cff;
}

.discover-controls {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.8rem;
  margin: 0.9rem 0 0.7rem;
}

.tab-row {
  display: flex;
  gap: 0.55rem;
}

.tab-btn {
  width: auto;
  margin-top: 0;
  padding: 0.45rem 0.7rem;
  background: #2b3348;
  border: 1px solid #42506f;
  font-size: 0.9rem;
}

.tab-btn.active {
  background: #715cff;
  border-color: #8f7cff;
}

.range-filter {
  width: auto;
  margin-bottom: 0;
  font-size: 0.85rem;
  color: #a8b0c0;
}

.range-filter select {
  width: auto;
  min-width: 170px;
  margin-top: 0.25rem;
  font-size: 0.9rem;
}

audio {
  width: 100%;
  margin-top: 0.7rem;
}

@media (max-width: 700px) {
  .grid {
    grid-template-columns: 1fr;
  }

  .reaction-row {
    flex-direction: column;
  }

  .reaction-btn {
    width: 100%;
  }

  .download-btn {
    width: 100%;
  }

  .discover-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .tab-row {
    flex-wrap: wrap;
  }

  .tab-btn {
    width: 100%;
  }

  .range-filter {
    width: 100%;
  }

  .range-filter select {
    width: 100%;
  }

  .profile-stats {
    grid-template-columns: 1fr;
  }
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  margin: -0.5rem -1rem 1rem;
  border-bottom: 1px solid #2a3142;
  background: #101521;
}

.topbar .meta {
  margin: 0;
  color: #a8b0c0;
  font-size: 0.95rem;
}

.topbar .actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.link-btn {
  width: auto;
  padding: 0.45rem 0.75rem;
  background: transparent;
  border: 1px solid #36405a;
  color: #c5c9d4;
  text-decoration: none;
  font-size: 0.9rem;
  display: inline-block;
}

.link-btn:hover {
  filter: brightness(1.08);
}

.logout-btn {
  width: auto;
  padding: 0.45rem 0.75rem;
  background: #495057;
  font-size: 0.9rem;
}

.profile-header h1 {
  margin: 0;
}

.profile-header .meta {
  margin-top: 0.4rem;
}

.profile-stats {
  margin-top: 1rem;
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat-card {
  margin: 0;
  background: #101521;
  border: 1px solid #2f374b;
  border-radius: 10px;
  padding: 0.75rem;
}

.stat-card .meta {
  margin: 0;
}

.stat-value {
  margin: 0.3rem 0 0;
  font-size: 1.15rem;
  font-weight: 700;
}

@media (max-width: 850px) {
  .profile-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
