:root {
  color-scheme: light dark;
  font-family: system-ui, sans-serif;
}

body {
  margin: 0;
  background: #f5f5f7;
  color: #1c1c1e;
}

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

h1 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
}

.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid #d0d0d5;
}

.tab {
  padding: 0.6rem 0.9rem;
  text-decoration: none;
  color: #555;
  font-size: 0.9rem;
  border-bottom: 2px solid transparent;
}

.tab.active {
  color: #3b82f6;
  border-bottom-color: #3b82f6;
  font-weight: 600;
}

.disclaimer {
  background: #fff8e1;
  border: 1px solid #f0d98a;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  color: #6b5200;
  margin-bottom: 1.25rem;
}

#username-form {
  display: flex;
  gap: 0.75rem;
}

#username-input {
  flex: 1;
  padding: 0.6rem 0.9rem;
  border-radius: 8px;
  border: 1px solid #d0d0d5;
  font-size: 0.95rem;
}

.username-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.username-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: #fff;
  border-radius: 8px;
  padding: 0.6rem 0.9rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  font-size: 0.9rem;
}

.username-platform {
  min-width: 110px;
  color: #1c1c1e;
  text-decoration: none;
  font-weight: 600;
}

.username-detail {
  color: #777;
  font-size: 0.8rem;
}

.badge {
  flex-shrink: 0;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  min-width: 110px;
  text-align: center;
}

.badge-found { background: #dcfce7; color: #166534; }
.badge-notfound { background: #f1f1f3; color: #555; }
.badge-unknown { background: #fef3c7; color: #92400e; }
.badge-error { background: #fee2e2; color: #991b1b; }

#search-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.dropzone {
  flex: 1 1 100%;
  min-height: 160px;
  border: 2px dashed #a0a0a5;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: #fff;
  overflow: hidden;
  transition: border-color 0.15s ease;
}

.dropzone.dragover {
  border-color: #3b82f6;
}

.dropzone img {
  max-width: 100%;
  max-height: 300px;
  object-fit: contain;
}

select,
button {
  padding: 0.6rem 1rem;
  border-radius: 8px;
  border: 1px solid #d0d0d5;
  font-size: 0.95rem;
  background: #fff;
}

button {
  background: #3b82f6;
  color: #fff;
  border: none;
  cursor: pointer;
}

button:disabled {
  background: #a5c4f5;
  cursor: not-allowed;
}

#status {
  min-height: 1.4rem;
  color: #555;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.grid-item {
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
}

.grid-item img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: #eee;
}

.grid-item .meta {
  padding: 0.5rem 0.6rem;
  font-size: 0.8rem;
}

.grid-item a {
  color: #3b82f6;
  text-decoration: none;
  word-break: break-all;
}

#ocr-text-section {
  margin-top: 1.5rem;
}

#ocr-text-section h2 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

#ocr-text {
  background: #fff;
  border: 1px solid #d0d0d5;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 240px;
  overflow-y: auto;
}

.candidate-heading {
  font-size: 1rem;
  margin: 1.5rem 0 0.5rem;
}

@media (prefers-color-scheme: dark) {
  body { background: #121214; color: #f0f0f2; }
  .dropzone, select, button, .grid-item, .username-row, #username-input, #ocr-text { background: #1e1e21; color: #f0f0f2; border-color: #333; }
  .username-platform { color: #f0f0f2; }
  .tabs { border-bottom-color: #333; }
  .tab { color: #999; }
  .disclaimer { background: #2a2410; border-color: #5c4d13; color: #f0d98a; }
}
