* {
  box-sizing: border-box;
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  max-width: 900px;
  margin: 0 auto;
  padding: 1rem 1.5rem 2.5rem;
  background: #f5f5f5;
  color: #1a1a1a;
}

header {
  margin-bottom: 2rem;
}

header h1 {
  margin: 0 0 0.25rem 0;
  font-size: 1.5rem;
}

header p {
  margin: 0;
  color: #555;
  font-size: 0.95rem;
}

main section {
  background: #fff;
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

main h2 {
  margin: 0 0 0.75rem 0;
  font-size: 1.15rem;
}

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

.image-grid .cell {
  text-align: center;
  padding: 0.5rem;
  border: 2px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  background: #fafafa;
}

.image-grid .cell:hover {
  border-color: #ccc;
}

.image-grid .cell.selected {
  border-color: #1967d2;
  background: #e8f0fe;
}

.image-grid .cell img {
  display: block;
  width: 56px;
  height: 56px;
  margin: 0 auto 0.25rem;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
}

.image-grid .cell .label {
  font-size: 0.7rem;
  color: #555;
  word-break: break-word;
}

.single-preview {
  margin-top: 0.75rem;
}

.single-preview img {
  width: 84px;
  height: 84px;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
}

.compare {
  display: flex;
  gap: 1.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.compare .pair {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.compare .pair img {
  width: 84px;
  height: 84px;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
}

.compare .pair span {
  font-size: 0.8rem;
  color: #555;
}

.params {
  margin: 0.5rem 0;
}

.params label {
  margin-right: 1rem;
  font-size: 0.9rem;
}

.params input {
  width: 4rem;
  margin-right: 0.5rem;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.hint {
  font-size: 0.85rem;
  color: #666;
  margin-top: 0.5rem;
}

#predict-result {
  margin-left: 0.5rem;
  font-size: 0.9rem;
}

#predict-result .label {
  font-weight: 600;
}

#predict-result .confidence {
  color: #555;
}

.error {
  color: #c5221f;
}

#predict-transformed-result {
  margin-left: 0.5rem;
  font-size: 0.9rem;
}

#predict-transformed-result .label {
  font-weight: 600;
}

#predict-transformed-result .confidence {
  color: #555;
}

.watermark {
  position: fixed;
  bottom: 0.5rem;
  right: 1rem;
  font-size: 2rem;
  color: #999;
  opacity: 0.6;
  pointer-events: none;
}
