:root {
  color-scheme: dark light;
  --bg: #0f172a;
  --bg-alt: #1e293b;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #facc15;
  --accent-soft: rgba(250, 204, 21, 0.15);
  --card: rgba(15, 23, 42, 0.65);
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(120% 120% at 50% 0%, rgba(30, 64, 175, 0.45), rgba(15, 23, 42, 0.95) 52%),
    radial-gradient(80% 100% at 100% 0%, rgba(8, 145, 178, 0.25), transparent 60%),
    #0f172a;
  color: var(--text);
}

.modal-open {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  color: var(--accent);
}

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 24px 96px;
}

.controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin-bottom: 32px;
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 16px;
  padding: 20px 24px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.field input,
.field select {
  appearance: none;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.65);
  color: var(--text);
  padding: 12px 14px;
  font-size: 0.95rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.1);
}

.cards {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.card {
  background: var(--card);
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 20px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.35);
}
.card-header {
  text-align: left;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card-header h2 {
  margin: 0;
  font-size: 1.45rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.subtitle {
  color: var(--muted);
  font-size: 0.95rem;
}

.tag {
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  color: var(--muted);
  font-size: 0.9rem;
  gap: 12px;
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.prompt-preview {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.95rem;
  line-height: 1.55;
  color: rgba(226, 232, 240, 0.88);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 6.2rem;
}

.card-actions {
  display: flex;
  justify-content: flex-start;
}

.card-actions button {
  appearance: none;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(250, 204, 21, 0.85), rgba(251, 191, 36, 0.85));
  color: #0f172a;
  font-weight: 600;
  padding: 10px 18px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card-actions button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(250, 204, 21, 0.25);
}

.card-actions button:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.4);
}

.preview {
  margin: -16px -16px 0;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.45);
}

.preview img {
  display: block;
  width: 100%;
  height: auto;
}

.section-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 4px;
}

.prompt-text {
  background: rgba(15, 23, 42, 0.55);
  border-radius: 14px;
  padding: 16px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.95rem;
  line-height: 1.6;
  border: 1px solid rgba(148, 163, 184, 0.12);
  white-space: pre-wrap;
}

.requirement {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.note {
  background: rgba(250, 204, 21, 0.12);
  border-left: 3px solid var(--accent);
  padding: 12px 16px;
  border-radius: 12px;
  color: #fef3c7;
  font-size: 0.9rem;
}

.source-list {
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 14px;
  padding: 14px 18px;
  font-size: 0.9rem;
  color: var(--muted);
}

.source-list ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

.source-list li {
  margin-bottom: 6px;
}

.source-list li:last-child {
  margin-bottom: 0;
}

.status {
  text-align: center;
  color: var(--muted);
}

.status.error {
  color: #fca5a5;
}

.site-header {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand a {
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero {
  max-width: 880px;
  margin: 0 auto 40px;
  text-align: center;
  padding: 32px 24px 0;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.5rem, 6vw, 3.5rem);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hero p {
  margin-top: 16px;
  color: var(--muted);
  line-height: 1.6;
}

.site-footer {
  max-width: 1200px;
  margin: 32px auto 0;
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.site-footer a {
  text-decoration: underline;
}

@media (max-width: 640px) {
  .page {
    padding: 32px 16px 64px;
  }

  .controls {
    padding: 16px;
  }
}

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(6px);
}

.modal-dialog {
  position: relative;
  max-width: 720px;
  margin: 4vh auto;
  background: rgba(10, 17, 31, 0.96);
  border-radius: 24px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  padding: 32px;
  color: var(--text);
  box-shadow: 0 24px 60px rgba(10, 17, 31, 0.55);
  max-height: calc(100vh - 8vh);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-dialog:focus {
  outline: 3px solid rgba(250, 204, 21, 0.55);
  outline-offset: 4px;
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 20px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1.8rem;
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover {
  color: var(--accent);
}

.modal-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  padding-right: 4px;
  -webkit-overflow-scrolling: touch;
}

.modal-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-preview {
  margin: -12px -12px 8px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.modal-preview img {
  width: 100%;
  display: block;
}

.modal-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--muted);
  font-size: 0.95rem;
}

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

.modal-section li {
  margin-bottom: 6px;
}

.modal-section li:last-child {
  margin-bottom: 0;
}

@media (max-width: 768px) {
  .modal-dialog {
    margin: 6vh 16px;
    padding: 24px;
  }
}
