:root {
  color-scheme: dark;
  --bg: #101318;
  --panel: #1c222a;
  --panel-edge: #303946;
  --text: #edf2f7;
  --muted: #a7b2bf;
  --accent: #38bdf8;
  --accent-strong: #f59e0b;
  --danger: #fb7185;
}

* {
  box-sizing: border-box;
}

/* The `hidden` attribute sets display:none in the UA sheet, but ANY author
   display rule beats it -- `.download { display: inline-grid }` was winning, so
   the download link showed with no href before anything had been generated, and
   clearDownload() could not retract a stale one. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  background: radial-gradient(circle at top left, #1f2933 0, var(--bg) 34rem);
  color: var(--text);
}

.shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.panel {
  width: min(680px, 100%);
  border: 1px solid var(--panel-edge);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 94%, black);
  padding: 28px;
  box-shadow: 0 24px 70px rgb(0 0 0 / 32%);
}

.mast {
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.1;
}

.form {
  display: grid;
  gap: 18px;
}

.field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

input[type="text"],
input[type="file"] {
  width: 100%;
  border: 1px solid var(--panel-edge);
  border-radius: 6px;
  background: #111820;
  color: var(--text);
  padding: 12px 14px;
  font: inherit;
}

input[type="file"] {
  padding: 10px;
}

button,
.download {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  background: var(--accent-strong);
  color: #18120a;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  display: inline-grid;
  place-items: center;
  padding: 0 18px;
}

.seed-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.seed-row input[type="text"] {
  flex: 1 1 auto;
  min-width: 0;
}

.seed-row button {
  flex: 0 0 auto;
}

/* Secondary action: must not compete with the primary Generate button. */
button.ghost {
  background: transparent;
  border: 1px solid var(--panel-edge);
  color: var(--accent);
  font-weight: 700;
}

button.ghost:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

button.ghost:active {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
}

button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.saved-row {
  display: flex;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--panel-edge);
  border-radius: 6px;
  background: #111820;
  padding: 10px 10px 10px 14px;
}

.saved-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-weight: 400;
}

.share-row {
  margin-top: 16px;
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.share-row input[type="text"] {
  font-size: 13px;
  color: var(--muted);
}

.status {
  min-height: 24px;
  margin-top: 18px;
  color: var(--muted);
}

.status.error {
  color: var(--danger);
}

.download {
  margin-top: 16px;
  width: 100%;
}

@media (max-width: 520px) {
  .shell {
    padding: 14px;
  }

  .panel {
    padding: 20px;
  }

  h1 {
    font-size: 28px;
  }
}

.back-link {
  display: inline-block;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.back-link:hover {
  color: var(--accent);
}
