:root {
  --bg: #0b1020;
  --panel: #101830;
  --line: #2a3a67;
  --text: #eff3ff;
  --muted: #a8b4d9;
  --accent: #45d5ff;
  --accent-2: #ff8d3a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Manrope", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 10%, #1e2c59 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, #4f2130 0%, transparent 35%),
    var(--bg);
  min-height: 100vh;
}

h1, h2 {
  margin: 0 0 12px;
  font-family: "Noto Serif SC", serif;
  font-weight: 700;
}

.layout {
  width: min(1100px, 92vw);
  margin: 24px auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.panel {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  backdrop-filter: blur(6px);
}

.sub {
  margin: 0 0 16px;
  color: var(--muted);
}

.field {
  display: block;
  margin-bottom: 14px;
}

.field span {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

input[type="file"], select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0f1731;
  color: var(--text);
  padding: 10px 12px;
  font-size: 16px;
  line-height: 1.4;
}

textarea {
  resize: vertical;
}

small {
  color: var(--muted);
}

.ratio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ratio-btn {
  border: 1px solid var(--line);
  background: #0f1731;
  color: var(--text);
  border-radius: 10px;
  padding: 8px 12px;
  min-height: 40px;
  cursor: pointer;
}

.ratio-btn.active {
  background: linear-gradient(130deg, var(--accent), #4ef0c0);
  color: #052233;
  border-color: transparent;
}

.preview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.preview img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.btn-generate, .download-btn {
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
}

.btn-generate {
  width: 100%;
  min-height: 44px;
  background: linear-gradient(130deg, var(--accent), #4ef0c0);
  color: #052233;
}

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

.status, .quota {
  min-height: 22px;
  color: var(--muted);
}

.quota {
  display: none;
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.result-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #0f1731;
}

.result-card img {
  width: 100%;
  display: block;
}

.download-btn {
  width: 100%;
  min-height: 38px;
  background: var(--accent-2);
  color: #1d0e00;
}

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

@media (max-width: 640px) {
  .preview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .result-grid {
    grid-template-columns: 1fr;
  }
}
