* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #f4f6f8;
  color: #1f2933;
  transition: background-color 180ms ease, color 180ms ease;
}

.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}

h1,
h2 {
  margin: 0 0 8px;
}

.subtitle {
  margin: 0 0 20px;
  color: #52606d;
}

.subtitle-small {
  font-size: 0.8rem;
  opacity: 0.9;
}

.subtitle-warning {
  display: block;
  font-size: 0.75rem;
  margin-top: 6px;
  width: fit-content;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid #f59e0b;
  background: #fffbeb;
  color: #92400e;
  font-weight: 600;
}

.top-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.card,
.panel {
  background: #ffffff;
  border: 1px solid #d9e2ec;
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
}

.card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 120px;
}

.card p {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  margin-top: auto;
}

@keyframes statSlideIn {
  0% {
    transform: translateY(-12px);
    opacity: 0.2;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

.stat-slide {
  animation: statSlideIn 360ms ease;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.hidden {
  display: none;
}

button {
  border: none;
  border-radius: 6px;
  padding: 10px 14px;
  cursor: pointer;
  color: #ffffff;
  background: #0d6efd;
  font-size: 0.95rem;
  transition: transform 120ms ease, filter 120ms ease, box-shadow 120ms ease;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.18);
  position: relative;
}

button:hover {
  filter: brightness(1.03);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(2px) scale(0.98);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
  filter: brightness(0.94);
}

button:focus-visible {
  outline: 2px solid #94c5ff;
  outline-offset: 2px;
}

button.danger {
  background: #d94841;
}

.row-actions {
  display: flex;
  gap: 8px;
}

.small-btn {
  font-size: 0.8rem;
  padding: 6px 9px;
}

.small-btn.delete {
  background: #d94841;
}

ul {
  margin: 0;
  padding-left: 18px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid #e4e7eb;
  padding: 8px;
  text-align: left;
}

tbody tr:last-child td {
  border-bottom: none;
}

@keyframes newRowPop {
  0% {
    transform: translateY(-12px);
    opacity: 0.2;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

.new-encounter-row td {
  animation: newRowPop 360ms ease;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

#logPageInfo {
  font-size: 0.9rem;
}

.warning-banner {
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid #f59e0b;
  background: #fffbeb;
  color: #92400e;
  font-weight: 600;
}

.drop-history-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.drop-history-header h2 {
  margin-bottom: 0;
}

.encounter-log-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.encounter-log-header h2 {
  margin-bottom: 0;
}

.encounter-log-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.reminder-config-panel {
  margin-top: -2px;
  margin-bottom: 10px;
  margin-left: auto;
  width: min(360px, 100%);
  border: 1px solid #93c5fd;
  border-radius: 8px;
  padding: 12px;
  background: #eff6ff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.config-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

#reminderSecondsInput {
  width: 140px;
  border: 1px solid #d9e2ec;
  border-radius: 6px;
  padding: 8px;
  background: #ffffff;
  color: #1f2933;
}

.config-actions {
  margin-top: 10px;
}

body.night {
  background: #121826;
  color: #e5e7eb;
}

body.night .subtitle {
  color: #9ca3af;
}

body.night .subtitle-warning {
  border-color: #b45309;
  background: #2f2500;
  color: #fbbf24;
}

body.night .card,
body.night .panel {
  background: #1f2937;
  border-color: #374151;
}

body.night .stat-slide {
  animation: statSlideIn 360ms ease;
}

body.night th,
body.night td {
  border-bottom-color: #374151;
}

body.night .new-encounter-row td {
  animation: newRowPop 360ms ease;
}

body.night .warning-banner {
  border-color: #b45309;
  background: #2f2500;
  color: #fbbf24;
}

body.night #reminderSecondsInput {
  border-color: #4b5563;
  background: #111827;
  color: #e5e7eb;
}

body.night .reminder-config-panel {
  border-color: #1d4ed8;
  background: #172554;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

@media (max-width: 640px) {
  .top-header {
    flex-direction: column;
    align-items: stretch;
  }
}
