:root {
  --bg: #fafaf7;
  --fg: #222;
  --muted: #6b7280;
  --accent: #d97757;
  --accent-hover: #b85f44;
  --card: #fff;
  --border: #e5e7eb;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.5;
}

header {
  padding: 24px 20px 8px;
  max-width: 960px;
  margin: 0 auto;
}

header h1 { margin: 0 0 4px; font-size: 22px; }
.tag { margin: 0; color: var(--muted); font-size: 13px; }

main, #gate {
  max-width: 960px;
  margin: 16px auto;
  padding: 0 20px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: #374151;
}

input, textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
}

textarea { resize: vertical; }

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(217, 119, 87, 0.15);
}

button {
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 12px;
}

button:hover { background: var(--accent-hover); }
button:disabled { background: #d1d5db; cursor: not-allowed; }

.row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-top: 12px;
}

@media (max-width: 960px) {
  .row { grid-template-columns: repeat(3, 1fr); }
}

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

.realism-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 10px 12px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #7c2d12;
  cursor: pointer;
}

.realism-toggle input {
  width: auto;
  margin: 0;
  cursor: pointer;
}

.hint {
  font-size: 12px;
  color: var(--muted);
  margin: 8px 0 0;
  min-height: 1em;
}

.hint.error { color: #b91c1c; }

#results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.result {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.result img { width: 100%; display: block; background: #f3f4f6; }

.result .meta {
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.result a.download {
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 12px;
}

.result a.download:hover { background: var(--accent-hover); }
