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

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: #1a1a2e;
  color: #e0e0e0;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 2rem 1rem;
}

main {
  width: 100%;
  max-width: 800px;
  display: flex;
  flex-direction: column;
}

h1 {
  font-size: 2rem;
  color: #e2b714;
  text-align: center;
}

h1 a.home-link {
  color: inherit;
  text-decoration: none;
}

h1 a.home-link:hover {
  text-decoration: underline;
}

.subtitle {
  text-align: center;
  color: #888;
  margin-bottom: 0.25rem;
}

.date {
  text-align: center;
  color: #666;
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

/* -- Home page -- */

.home-intro {
  text-align: center;
  color: #999;
  margin-bottom: 1.5rem;
}

#topics-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.topic-card {
  display: flex;
  flex-direction: column;
  background: #16213e;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 0.8rem 1rem;
  gap: 0.5rem;
}

.topic-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.topic-friends-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-left: 0.15rem;
}

.topic-friends-label {
  font-size: 0.75rem;
  color: #999;
  min-width: 4rem;
}

.topic-friends-avatars {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
}

.topic-name {
  font-size: 1rem;
  color: #e0e0e0;
  font-weight: 500;
}

.difficulty-buttons {
  display: flex;
  gap: 0.4rem;
}

.difficulty-btn {
  padding: 0.35rem 0.7rem;
  border: 1px solid #444;
  border-radius: 4px;
  font-size: 0.8rem;
  text-decoration: none;
  color: #ccc;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.difficulty-btn:hover {
  border-color: #888;
}

.difficulty-btn.normal:hover {
  background: #3a3a1b;
  border-color: #ff9800;
  color: #ff9800;
}

.difficulty-btn.expert:hover {
  background: #3a1b1b;
  border-color: #f44336;
  color: #f44336;
}

.difficulty-btn.game-in-progress {
  border-color: #e2b714;
  color: #e2b714;
  background: rgba(226, 183, 20, 0.1);
}

.difficulty-btn.game-played {
  border-color: #4caf50;
  color: #4caf50;
}

/* -- Recent results -- */

#recent-results-section {
  margin-bottom: 2rem;
}

.recent-results-heading {
  font-size: 1.1rem;
  color: #ccc;
  margin-bottom: 0.75rem;
}

.recent-results-card {
  background: #16213e;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 0.8rem 1rem;
  margin-bottom: 0.75rem;
}

.recent-results-card-title {
  font-size: 1rem;
  color: #e0e0e0;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.recent-results-card-date {
  font-size: 0.8rem;
  color: #888;
  margin-bottom: 0.5rem;
}

.recent-results-ranking {
  list-style: none;
  padding: 0;
  counter-reset: recent-results-rank;
}

.recent-results-rank-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.3rem 0;
  border-bottom: 1px solid #262640;
  font-size: 0.9rem;
  color: #ccc;
  counter-increment: recent-results-rank;
}

.recent-results-rank-entry:last-child {
  border-bottom: none;
}

.recent-results-rank-entry::before {
  content: counter(recent-results-rank) ".";
  color: #888;
  margin-right: 0.5rem;
  min-width: 1.5em;
}

.recent-results-rank-self {
  color: #e2b714;
  font-weight: bold;
}

.recent-results-rank-name {
  flex: 1;
}

.recent-results-rank-result {
  color: #999;
  font-size: 0.85rem;
}

.recent-results-rank-self .recent-results-rank-result {
  color: #c9a512;
}

.recent-results-leaderboard-link {
  display: block;
  text-align: center;
  color: #e2b714;
  font-size: 0.85rem;
  text-decoration: none;
  margin-top: 0.5rem;
}

.recent-results-leaderboard-link:hover {
  text-decoration: underline;
  color: #fff;
}

.avatar-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #2a2a4a;
  color: #ccc;
  font-size: 0.75rem;
  font-weight: 600;
}

.play-section-heading {
  font-size: 1.1rem;
  color: #ccc;
  margin-bottom: 0.75rem;
}

.friend-suggestions-heading {
  font-size: 1.1rem;
  color: #ccc;
  margin-bottom: 0.75rem;
}

.friend-suggestion-card {
  display: flex;
  align-items: center;
  background: #16213e;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 0.7rem 1rem;
  margin-bottom: 0.5rem;
  gap: 0.7rem;
}

.friend-suggestion-card.friend-suggestion-fade-out {
  animation: suggestion-fade-out 0.3s ease forwards;
}

@keyframes suggestion-fade-out {
  to {
    opacity: 0;
    transform: translateX(20px);
    height: 0;
    padding: 0;
    margin: 0;
    overflow: hidden;
  }
}

.friend-suggestion-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.friend-suggestion-name {
  font-size: 0.95rem;
  font-weight: 500;
  color: #e0e0e0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.friend-suggestion-reason {
  font-size: 0.8rem;
  color: #888;
}

.friend-suggestion-follow-btn {
  background: transparent;
  border: 1px solid #e2b714;
  color: #e2b714;
  border-radius: 4px;
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.friend-suggestion-follow-btn:hover {
  background: #e2b714;
  color: #1a1a2e;
}

.friend-suggestion-follow-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.friend-suggestion-card .avatar-sm {
  flex-shrink: 0;
}

.friend-suggestions-more-link {
  display: block;
  text-align: center;
  font-size: 0.8rem;
  color: #888;
  margin-top: 0.5rem;
  text-decoration: none;
}

.friend-suggestions-more-link:hover {
  color: #e2b714;
}

#request-topic-section {
  margin-top: 0.75rem;
}

#request-topic-form {
  display: flex;
  gap: 0.5rem;
}

#topic-name-input {
  flex: 1;
  padding: 0.6rem 0.8rem;
  border: 1px solid #333;
  border-radius: 4px;
  background: #16213e;
  color: #e0e0e0;
  font-size: 1rem;
  outline: none;
}

#topic-name-input:focus {
  border-color: #e2b714;
}

#request-topic-btn {
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 4px;
  background: #e2b714;
  color: #1a1a2e;
  font-weight: bold;
  font-size: 1rem;
  cursor: pointer;
}

#request-topic-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#request-topic-status {
  margin-top: 0.5rem;
  font-size: 0.9rem;
}

.status-success {
  color: #4caf50;
}

.status-error {
  color: #f44336;
}

/* -- Game page -- */

#game-area {
  display: flex;
  gap: 1rem;
  flex: 1;
  margin-bottom: 1rem;
  min-height: 0;
}

#question-log {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
}

/* -- Hint panel -- */

#hint-panel {
  width: 200px;
  flex-shrink: 0;
  background: #16213e;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 0.75rem;
  overflow-y: auto;
  align-self: flex-start;
}

#hint-panel h3 {
  font-size: 0.9rem;
  color: #e2b714;
  margin-bottom: 0.5rem;
}

#hint-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.hint-item {
  font-size: 0.85rem;
}

.hint-reveal-btn {
  background: none;
  border: 1px solid #444;
  border-radius: 3px;
  color: #e2b714;
  font-size: 0.8rem;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  width: 100%;
  text-align: left;
}

.hint-reveal-btn:hover:not(:disabled) {
  border-color: #e2b714;
  background: rgba(226, 183, 20, 0.1);
}

.hint-reveal-btn:disabled {
  color: #555;
  border-color: #333;
  cursor: not-allowed;
}

.hint-text {
  color: #ccc;
  line-height: 1.4;
  display: block;
}

@media (max-width: 640px) {
  #game-area {
    flex-direction: column;
  }

  #hint-panel {
    width: 100%;
    order: -1;
  }
}

.log-entry {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.log-question {
  color: #ccc;
  font-size: 0.95rem;
}

.log-question .number {
  color: #e2b714;
  font-weight: bold;
  margin-right: 0.5rem;
}

.log-answer-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-left: 1.5rem;
}

.log-answer {
  font-weight: bold;
  font-size: 0.95rem;
}

.explanation-toggle {
  background: none;
  border: 1px solid #444;
  border-radius: 3px;
  color: #888;
  font-size: 0.75rem;
  padding: 0.1rem 0.4rem;
  cursor: pointer;
}

.explanation-toggle:hover {
  color: #ccc;
  border-color: #666;
}

.explanation-toggle-all {
  background: none;
  border: 1px solid #444;
  border-radius: 3px;
  color: #888;
  font-size: 0.8rem;
  padding: 0.25rem 0.6rem;
  cursor: pointer;
  margin-top: 0.5rem;
  align-self: flex-start;
}

.explanation-toggle-all:hover {
  color: #ccc;
  border-color: #666;
}

.log-explanation {
  padding-left: 1.5rem;
  margin-top: 0.25rem;
  color: #999;
  font-size: 0.85rem;
  font-style: italic;
}

.log-answer.yes { color: #4caf50; }
.log-answer.no { color: #f44336; }
.log-answer.partially { color: #ff9800; }
.log-answer.depends { color: #2196f3; }
.log-answer.win { color: #e2b714; }

.hint-log-entry {
  padding-left: 1.5rem;
}

.hint-log-label {
  color: #e2b714;
  font-size: 0.85rem;
  font-style: italic;
}

#status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: #888;
  margin-bottom: 0.5rem;
}

#status-text {
  font-style: italic;
}

#status-text.error {
  color: #ff6b6b;
  font-style: normal;
  font-weight: bold;
}

#ask-form {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

#question-input {
  flex: 1;
  padding: 0.6rem 0.8rem;
  border: 1px solid #333;
  border-radius: 4px;
  background: #16213e;
  color: #e0e0e0;
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  resize: none;
  overflow: hidden;
  line-height: 1.4;
}

#question-input:focus {
  border-color: #e2b714;
}

#question-input:disabled {
  opacity: 0.5;
}

#submit-btn {
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 4px;
  background: #e2b714;
  color: #1a1a2e;
  font-weight: bold;
  font-size: 1rem;
  cursor: pointer;
}

#submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#concede-btn {
  padding: 0.6rem 0.8rem;
  border: 1px solid #555;
  border-radius: 4px;
  background: transparent;
  color: #888;
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

#concede-btn:hover:not(:disabled) {
  border-color: #ff6b6b;
  color: #ff6b6b;
}

#concede-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.share-btn {
  padding: 0.5rem 1.5rem;
  border: 1px solid #e2b714;
  border-radius: 4px;
  text-decoration: none;
  background: transparent;
  color: #e2b714;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.share-btn:hover {
  background: #e2b714;
  color: #1a1a2e;
}

.solution-reveal {
  text-align: center;
  font-size: 1.1rem;
  margin-top: 0.5rem;
  color: #e2b714;
  font-weight: bold;
}

/* -- Nav bar -- */

.nav-bar {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  display: flex;
  gap: 0.6rem;
  z-index: 10;
  background: rgba(26, 26, 46, 0.85);
  backdrop-filter: blur(6px);
  padding: 0.5rem 0.65rem;
  border-radius: 999px;
}

.nav-bar a {
  color: #ccc;
  text-decoration: none;
  line-height: 1;
  display: flex;
  transition: color 0.15s;
}

.nav-bar a:hover {
  color: #e2b714;
}

/* -- Settings page -- */

#settings-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
}

.settings-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.settings-field label {
  font-size: 0.85rem;
  color: #999;
}

.settings-field input {
  padding: 0.6rem 0.8rem;
  border: 1px solid #333;
  border-radius: 4px;
  background: #16213e;
  color: #e0e0e0;
  font-size: 1rem;
  outline: none;
}

.settings-field input:focus {
  border-color: #e2b714;
}

.settings-actions {
  display: flex;
  gap: 0.5rem;
}

#save-btn {
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 4px;
  background: #e2b714;
  color: #1a1a2e;
  font-weight: bold;
  font-size: 1rem;
  cursor: pointer;
}

.secondary-btn {
  padding: 0.6rem 1.2rem;
  border: 1px solid #444;
  border-radius: 4px;
  background: transparent;
  color: #ccc;
  font-size: 1rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.secondary-btn:hover {
  border-color: #888;
  color: #e0e0e0;
}

#save-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#save-status {
  font-size: 0.9rem;
}

/* -- Auth / Account pages -- */

.auth-section {
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: #16213e;
  border: 1px solid #333;
  border-radius: 6px;
}

.auth-section h2 {
  font-size: 1.1rem;
  color: #e2b714;
  margin-bottom: 0.75rem;
}

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

.auth-section button[type="submit"] {
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 4px;
  background: #e2b714;
  color: #1a1a2e;
  font-weight: bold;
  font-size: 1rem;
  cursor: pointer;
}

.auth-section button[type="submit"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.account-value {
  color: #e0e0e0;
  font-size: 1rem;
}

/* -- Profile & Friends -- */

.profile-inline-edit {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.profile-inline-edit input {
  flex: 1;
  padding: 0.6rem 0.8rem;
  border: 1px solid #333;
  border-radius: 4px;
  background: #16213e;
  color: #e0e0e0;
  font-size: 1rem;
  outline: none;
}

.profile-inline-edit input:focus {
  border-color: #e2b714;
}

/* -- Avatar -- */

.avatar-large {
  width: 128px;
  height: 128px;
  border-radius: 50%;
  object-fit: cover;
}

.avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.avatar-xs {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
}

.avatar-nav {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  vertical-align: middle;
}

.avatar-placeholder {
  background: #333;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  font-size: 2rem;
}

.avatar-placeholder[hidden] {
  display: none;
}

#avatar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid #333;
}

#avatar-actions {
  display: flex;
  gap: 0.5rem;
}

#avatar-actions .secondary-btn {
  font-size: 0.85rem;
  padding: 0.35rem 0.8rem;
}

#avatar-generator {
  width: 100%;
  margin-top: 0.5rem;
}

#avatar-gen-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

#avatar-gen-actions button:first-child {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 4px;
  background: #e2b714;
  color: #1a1a2e;
  font-weight: bold;
  font-size: 0.9rem;
  cursor: pointer;
}

#avatar-gen-actions button:first-child:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#avatar-preview-images {
  display: flex;
  align-items: flex-end;
  gap: 1.5rem;
  justify-content: center;
  margin-bottom: 0.75rem;
}

#avatar-preview-images > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}

#avatar-confirm-actions {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
}

#avatar-confirm-actions button:first-child {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 4px;
  background: #e2b714;
  color: #1a1a2e;
  font-weight: bold;
  font-size: 0.9rem;
  cursor: pointer;
}

#avatar-reference-input {
  font-size: 0.85rem;
  color: #ccc;
}

#avatar-reference-input::file-selector-button {
  padding: 0.35rem 0.7rem;
  border: 1px solid #444;
  border-radius: 4px;
  background: transparent;
  color: #ccc;
  font-size: 0.85rem;
  cursor: pointer;
  margin-right: 0.5rem;
}

#avatar-reference-input::file-selector-button:hover {
  border-color: #888;
  color: #e0e0e0;
}

.leaderboard-table td .avatar-sm,
.search-result-row .avatar-sm,
.friend-row .avatar-sm,
.recent-results-rank-entry .avatar-sm {
  vertical-align: middle;
  margin-right: 0.4rem;
  flex-shrink: 0;
}

.player-code-text {
  font-family: monospace;
  font-size: 1.1rem;
  letter-spacing: 0.1em;
  color: #e2b714;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.95rem;
  color: #e0e0e0;
}

.toggle-label input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: #e2b714;
}

.field-hint {
  font-size: 0.8rem;
  color: #888;
  margin-top: 0.2rem;
}

.field-status {
  font-size: 0.85rem;
  margin-top: 0.2rem;
  min-height: 1.2em;
}

.search-result-row,
.friend-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0;
  border-bottom: 1px solid #262640;
}

.search-result-info,
.friend-info {
  font-size: 0.9rem;
  color: #ccc;
}

.friend-anonymous {
  color: #666;
  font-style: italic;
}

.search-follow-btn {
  padding: 0.2rem 0.6rem;
  font-size: 0.8rem;
}

#friends-list-container {
  margin-top: 0.75rem;
}

#friends-list-container > label {
  font-size: 0.85rem;
  color: #999;
}

#logout-btn {
  padding: 0.6rem 1.2rem;
  border: 1px solid #f44336;
  border-radius: 4px;
  background: transparent;
  color: #f44336;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

#logout-btn:hover {
  background: #f44336;
  color: #1a1a2e;
}

/* -- Scrollable table wrapper -- */

.table-scroll-wrapper {
  overflow-x: auto;
  max-width: 100%;
}

/* -- Game history table -- */

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin-top: 0.75rem;
}

.history-table th {
  text-align: left;
  color: #999;
  font-weight: normal;
  font-size: 0.8rem;
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid #333;
}

.history-table td {
  padding: 0.5rem;
  border-bottom: 1px solid #262640;
  color: #ccc;
}

.result-win { color: #4caf50; }
.result-loss { color: #f44336; }
.result-in-progress { color: #e2b714; }

.history-result-link {
  color: inherit;
  text-decoration: none;
}

.history-result-link:hover {
  text-decoration: underline;
}

/* -- Control panel -- */

.control-section {
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: #16213e;
  border: 1px solid #333;
  border-radius: 6px;
}

.control-section h2 {
  font-size: 1.1rem;
  color: #e2b714;
  margin-bottom: 0.75rem;
}

.control-section form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.control-row {
  display: flex;
  gap: 0.75rem;
}

.control-row .settings-field {
  flex: 1;
}

.control-section select,
.control-section input[type="number"] {
  padding: 0.6rem 0.8rem;
  border: 1px solid #333;
  border-radius: 4px;
  background: #16213e;
  color: #e0e0e0;
  font-size: 1rem;
  outline: none;
}

.control-section select:focus,
.control-section input[type="number"]:focus {
  border-color: #e2b714;
}

.control-section button[type="submit"] {
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 4px;
  background: #e2b714;
  color: #1a1a2e;
  font-weight: bold;
  font-size: 1rem;
  cursor: pointer;
  align-self: flex-start;
}

.control-section button[type="button"] {
  padding: 0.6rem 1.2rem;
  border: 1px solid #444;
  border-radius: 4px;
  background: transparent;
  color: #888;
  font-size: 1rem;
  cursor: pointer;
  align-self: flex-start;
}

.invites-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.invites-table th {
  text-align: left;
  color: #999;
  font-weight: normal;
  font-size: 0.8rem;
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid #333;
}

.invites-table td {
  padding: 0.5rem;
  border-bottom: 1px solid #262640;
  color: #ccc;
}

.invites-table tr.exhausted td {
  color: #666;
}

.invite-code {
  font-family: monospace;
  font-size: 0.95rem;
  letter-spacing: 0.05em;
}

.delete-invite-btn {
  background: none;
  border: 1px solid #444;
  border-radius: 3px;
  color: #f44336;
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  cursor: pointer;
}

.delete-invite-btn:hover {
  border-color: #f44336;
  background: rgba(244, 67, 54, 0.1);
}

.unblock-btn {
  background: none;
  border: 1px solid #444;
  border-radius: 3px;
  color: #4caf50;
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  cursor: pointer;
}

.unblock-btn:hover {
  border-color: #4caf50;
  background: rgba(76, 175, 80, 0.1);
}

.user-actions {
  display: flex;
  gap: 0.3rem;
}

.user-detail-row > td {
  padding: 0;
  border-top: none;
}

.user-detail-panel {
  padding: 0.5rem 0.8rem;
  background: #161b22;
  border-top: 1px solid #1e2630;
}

.user-detail-limit-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.25rem 0;
}

.user-detail-limit-label {
  width: 5rem;
  color: #8b949e;
  font-size: 0.85rem;
}

.user-detail-limit-value {
  width: 4rem;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.query-buttons {
  display: flex;
  gap: 0.5rem;
}

#query-input {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 1px solid #333;
  border-radius: 4px;
  background: #0d1117;
  color: #e0e0e0;
  font-family: monospace;
  font-size: 0.9rem;
  resize: vertical;
  outline: none;
}

#query-input:focus {
  border-color: #e2b714;
}

#query-result {
  margin-top: 0.75rem;
  overflow-x: auto;
}

#query-result .invites-table td {
  font-family: monospace;
  font-size: 0.85rem;
  white-space: nowrap;
}

.query-row-count {
  font-size: 0.8rem;
  color: #888;
  margin-bottom: 0.4rem;
}

.log-output {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: #0d0d1a;
  border: 1px solid #333;
  border-radius: 6px;
  font-size: 0.8rem;
  line-height: 1.4;
  overflow-x: auto;
  max-height: 60vh;
  overflow-y: auto;
  white-space: pre;
  color: #ccc;
}

@media (max-width: 640px) {
  .control-row {
    flex-direction: column;
  }
}

/* -- Leaderboard page -- */

#leaderboard-error {
  text-align: center;
  color: #f44336;
  margin-top: 1.5rem;
  font-size: 1rem;
}

#leaderboard-controls {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.75rem;
}

#leaderboard-controls .secondary-btn {
  font-size: 0.85rem;
  padding: 0.35rem 0.8rem;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.leaderboard-table th {
  text-align: left;
  color: #999;
  font-weight: normal;
  font-size: 0.8rem;
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid #333;
}

.leaderboard-table td {
  padding: 0.5rem;
  border-bottom: 1px solid #262640;
  color: #ccc;
}

.leaderboard-self td {
  color: #e2b714;
  font-weight: bold;
}

.leaderboard-self-link {
  color: inherit;
  text-decoration: none;
}

.leaderboard-self-link:hover {
  text-decoration: underline;
}

#leaderboard-empty {
  text-align: center;
  color: #888;
  margin-top: 1.5rem;
}

/* -- Help page -- */

.help-section {
  margin-top: 1.5rem;
}

.help-section h2 {
  font-size: 1.1rem;
  color: #e2b714;
  margin-bottom: 0.5rem;
}

.help-section p {
  color: #ccc;
  line-height: 1.6;
  margin-bottom: 0.5rem;
}

.help-section ol,
.help-section ul {
  padding-left: 1.25rem;
  color: #ccc;
  line-height: 1.6;
}

.help-section li {
  margin-bottom: 0.4rem;
}

.help-section a {
  color: #e2b714;
  text-decoration: underline;
}

.help-section a:hover {
  color: #fff;
}

.answer-legend {
  list-style: none;
  padding-left: 0.5rem;
  margin-top: 0.4rem;
}

.answer-legend li {
  margin-bottom: 0.3rem;
}

.answer-tag {
  display: inline-block;
  font-weight: bold;
  font-size: 0.85rem;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  margin-right: 0.3rem;
}

.answer-tag.yes { color: #4caf50; }
.answer-tag.no { color: #f44336; }
.answer-tag.partially { color: #ff9800; }
.answer-tag.depends { color: #2196f3; }
.answer-tag.win { color: #e2b714; }

.emoji-example {
  margin-right: 0.4rem;
}

/* -- Replay section (home page) -- */

#replay-section {
  border-top: 1px solid #333;
  padding-top: 1.5rem;
  margin-bottom: 1.5rem;
}

#replay-section h2 {
  font-size: 1.1rem;
  color: #ccc;
  margin-bottom: 0.75rem;
}

#replay-form {
  display: flex;
  gap: 0.5rem;
}

#replay-code-input {
  flex: 1;
  padding: 0.6rem 0.8rem;
  border: 1px solid #333;
  border-radius: 4px;
  background: #16213e;
  color: #e0e0e0;
  font-size: 1rem;
  font-family: monospace;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  outline: none;
}

#replay-code-input::placeholder {
  text-transform: none;
}

#replay-code-input:focus {
  border-color: #e2b714;
}

#replay-btn {
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 4px;
  background: #e2b714;
  color: #1a1a2e;
  font-weight: bold;
  font-size: 1rem;
  cursor: pointer;
}

/* -- Replay page -- */

#replay-error {
  text-align: center;
  color: #f44336;
  margin-top: 1.5rem;
  font-size: 1rem;
}

#replay-meta {
  text-align: center;
  margin-bottom: 1rem;
}

.replay-player,
.replay-code {
  color: #888;
  font-size: 0.85rem;
}

#replay-gated {
  text-align: center;
  margin-top: 1.5rem;
  padding: 1.5rem;
  background: #16213e;
  border: 1px solid #333;
  border-radius: 6px;
}

#replay-gated p {
  color: #999;
  margin-bottom: 1rem;
}

.replay-result {
  text-align: center;
  font-size: 1.2rem;
  margin-bottom: 1rem;
  padding: 1rem;
  border-radius: 4px;
}

.replay-result.win {
  background: #1b3a1b;
  color: #4caf50;
}

.replay-result.loss {
  background: #3a1b1b;
  color: #f44336;
}

.replay-result.in-progress {
  background: #2e2a10;
  color: #e2b714;
}

#replay-question-log {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

#replay-hints {
  background: #16213e;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 0.75rem;
  margin-bottom: 1rem;
}

#replay-hints h3 {
  font-size: 0.9rem;
  color: #e2b714;
  margin-bottom: 0.5rem;
}

.replay-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

#replay-hint-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
