:root {
  --background: #ffffff;
  --foreground: #0a0a0a;
  --muted: #f4f4f5;
  --muted-foreground: #71717a;
  --border: #e4e4e7;
  --input: #e4e4e7;
  --primary: #0a0a0a;
  --primary-foreground: #fafafa;
  --secondary: #f4f4f5;
  --secondary-foreground: #0a0a0a;
  --destructive: #ef4444;
  --radius: 0.5rem;
}

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

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--background);
  color: var(--foreground);
  line-height: 1.5;
  min-height: 100vh;
}

/* layout */
.center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}

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

/* typography */
h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
}

.header {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}

.header h1 {
  font-size: 1rem;
  font-weight: 500;
  margin: 0;
}

/* form elements */
label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

input[type="text"],
input[type="password"],
textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  border: 1px solid var(--input);
  border-radius: var(--radius);
  background: var(--background);
  color: var(--foreground);
  outline: none;
  transition: border-color 0.15s;
}

input[type="text"]:focus,
input[type="password"]:focus,
textarea:focus {
  border-color: var(--foreground);
}

textarea {
  min-height: 100px;
  resize: vertical;
}

/* buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn:hover {
  opacity: 0.9;
}

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

.btn-primary {
  background: var(--primary);
  color: var(--primary-foreground);
}

.btn-secondary {
  background: var(--secondary);
  color: var(--secondary-foreground);
  border: 1px solid var(--border);
}

.btn-group {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

/* card */
.card {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  width: 100%;
  max-width: 400px;
}

/* image grid */
.image-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 2rem;
}

.image-card {
  aspect-ratio: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.image-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.image-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* loading indicator */
.loading {
  text-align: center;
  padding: 2rem;
  color: var(--muted-foreground);
}

.htmx-indicator {
  display: none;
}

.htmx-request .htmx-indicator {
  display: block;
}

.htmx-request.htmx-indicator {
  display: block;
}

/* error message */
.error {
  color: var(--destructive);
  font-size: 0.875rem;
  margin-top: 0.5rem;
}

/* revised prompt */
.revised-prompt {
  color: var(--muted-foreground);
  font-size: 0.875rem;
  font-style: italic;
  margin-top: 1rem;
  padding: 0.75rem;
  background: var(--muted);
  border-radius: var(--radius);
}

/* detail page */
.detail-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}

.detail-container img {
  max-width: 100%;
  max-height: 100vh;
  object-fit: contain;
}

/* prompt form */
.prompt-form {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  padding: 2rem 1rem;
}
