:root {
  --bg: #000000;
  --panel: #0a0a0a;
  --border: #143d14;
  --fg: #33cc33;
  --fg-dim: #1a8c1a;
  --muted: #4d9e4d;
  --white: #ffffff;
  --red: #f43f4f;
  --blue-light: #75aadb;
  --blue: #3a75c4;
  --teal: #008789;
  --teal-dark: #006663;
  --cyan: #007272;
  --error: #f43f4f;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: ui-monospace, "Cascadia Code", "Consolas", "Liberation Mono", "SFMono-Regular", Menlo, monospace;
  padding: clamp(16px, 5vw, 40px) clamp(12px, 4vw, 24px) 60px;
  overflow-x: hidden;
}

.page {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
}

.topbar {
  color: var(--teal);
  font-weight: 900;
  text-align: center;
  font-size: clamp(0.65rem, 2.6vw, 0.85rem);
  letter-spacing: 0.03em;
  padding: 8px 4px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: clamp(20px, 5vw, 32px);
  word-break: break-word;
}

header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  margin-bottom: 20px;
}

.logo {
  height: 40px;
  width: auto;
  filter: grayscale(1) brightness(1.3) sepia(1) hue-rotate(60deg) saturate(4);
}

h1 {
  margin: 0;
  font-size: clamp(1.3rem, 5vw, 1.9rem);
  font-weight: 400;
  color: var(--red);
  line-height: 1.3;
}

h1 strong {
  font-weight: 900;
  color: var(--white);
}

h1 strong em {
  font-style: italic;
  color: var(--white);
}

.manifesto {
  color: var(--fg-dim);
  font-size: clamp(0.82rem, 2.6vw, 0.92rem);
  line-height: 1.6;
  text-align: justify;
  margin-bottom: clamp(20px, 5vw, 32px);
  padding: 0 4px;
}

.manifesto .nuancier {
  color: var(--cyan);
  font-weight: 900;
}

.manifesto .version {
  font-style: italic;
  color: var(--muted);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: clamp(16px, 4vw, 24px);
  margin-bottom: 18px;
}

.field {
  margin-bottom: 18px;
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 480px) {
  .grid { grid-template-columns: 1fr 1fr; }
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--fg);
}

.hint {
  font-weight: 400;
  font-style: italic;
  color: var(--muted);
  font-size: 0.78rem;
}

input[type="text"],
input[type="number"],
select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  background: #000000;
  border: 1px solid var(--border);
  color: var(--fg);
  font-family: inherit;
  font-size: 1rem;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
  outline: none;
  border-color: var(--teal);
}

input[type="range"] {
  width: 100%;
  min-height: 44px;
  accent-color: var(--teal);
}

button {
  width: 100%;
  min-height: 48px;
  padding: 13px;
  border: 1px solid #ff0000;
  background: #ff0000;
  color: var(--white);
  font-family: inherit;
  font-weight: 900;
  font-size: 1rem;
  text-transform: lowercase;
  letter-spacing: 0.06em;
  cursor: crosshair;
  transition: background-color 0.15s, border-color 0.15s;
}

button:hover:not(:disabled) { background: #0000ff; border-color: #0000ff; }
button:disabled { opacity: 0.5; cursor: wait; }

.loading {
  display: none;
  text-align: center;
  margin: 14px 0 0;
}

.loading img {
  max-width: 100%;
  height: auto;
  image-rendering: pixelated;
}

.fallback-note {
  text-align: center;
  color: var(--teal);
  font-style: italic;
  font-size: 0.82rem;
  margin: 0 0 10px;
}

.error {
  border-color: var(--error);
  color: var(--error);
  text-align: center;
}

.result {
  text-align: center;
  padding: 12px;
}

.result img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
  border: 1px solid var(--border);
}

footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.7;
}

footer .about { font-style: italic; }

footer a {
  color: var(--blue-light);
}

footer a:hover { color: var(--red); }

@media (max-width: 380px) {
  .logo { height: 32px; }
}
