:root {
  color-scheme: dark;
  --bg: #101512;
  --sky: #16323a;
  --forest: #1c3f2e;
  --stone: #252820;
  --stone-2: #303427;
  --stone-3: #171a15;
  --wood: #5a3728;
  --line: #6d6547;
  --line-soft: #474634;
  --text: #fff7df;
  --muted: #c9c0a8;
  --green: #4fd08d;
  --green-dark: #26724e;
  --gold: #efc86d;
  --danger: #ff806c;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(22, 50, 58, 0.95) 0, rgba(16, 21, 18, 0.96) 520px),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.025) 0 2px, transparent 2px 18px),
    var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, transparent 0, rgba(0, 0, 0, 0.28) 100%),
    repeating-linear-gradient(90deg, rgba(239, 200, 109, 0.045) 0 1px, transparent 1px 96px);
}

a {
  color: var(--gold);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.app-shell {
  position: relative;
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 38px;
}

.site-hero,
.workspace {
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.site-hero {
  position: relative;
  overflow: hidden;
  margin-bottom: 16px;
  background:
    linear-gradient(135deg, rgba(28, 63, 46, 0.9), rgba(37, 40, 32, 0.94) 54%, rgba(90, 55, 40, 0.85)),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 14px);
}

.site-hero::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 5px;
  background: linear-gradient(90deg, var(--green), var(--gold), #b87645);
}

.nav-bar {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(239, 200, 109, 0.25);
  background: rgba(12, 15, 12, 0.38);
}

.nav-brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
  color: var(--text);
  font-size: 1.02rem;
  font-weight: 800;
}

.brand-mark,
.hero-icon-frame {
  display: grid;
  place-items: center;
  border: 1px solid rgba(239, 200, 109, 0.55);
  background:
    linear-gradient(45deg, #303427 25%, transparent 25%),
    linear-gradient(-45deg, #303427 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #303427 75%),
    linear-gradient(-45deg, transparent 75%, #303427 75%),
    #1a1d17;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}

.brand-mark {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
}

.brand-mark img {
  width: 34px;
  height: 34px;
  image-rendering: pixelated;
}

.language-switch {
  display: flex;
  border: 1px solid var(--line);
  background: rgba(14, 17, 14, 0.75);
}

.language-switch button {
  min-width: 46px;
  min-height: 38px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
}

.language-switch button:last-child {
  border-right: 0;
}

.language-switch button.active {
  background: var(--green-dark);
  color: #fffbe8;
}

.hero-layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
  gap: 26px;
  align-items: end;
  padding: 28px 22px 30px;
}

.hero-copy {
  max-width: 760px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 10px;
  border: 1px solid rgba(239, 200, 109, 0.45);
  background: rgba(14, 17, 14, 0.48);
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  margin-top: 12px;
  font-size: 2.55rem;
  line-height: 1.05;
  font-weight: 900;
  letter-spacing: 0;
}

h2 {
  font-size: 1.22rem;
  letter-spacing: 0;
}

.hero-copy > p {
  max-width: 640px;
  margin-top: 12px;
  color: #f4ecd3;
  font-size: 1.05rem;
  line-height: 1.55;
}

.sponsor-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  color: var(--muted);
}

.sponsor-logo-card {
  display: block;
  width: min(420px, 100%);
  margin-top: 16px;
  border: 1px solid rgba(239, 200, 109, 0.42);
  background:
    linear-gradient(180deg, rgba(255, 247, 223, 0.05), rgba(0, 0, 0, 0.2)),
    rgba(8, 11, 10, 0.54);
  color: var(--text);
  overflow: hidden;
  pointer-events: none;
}

.sponsor-logo-card img {
  width: 100%;
  height: 132px;
  object-fit: cover;
  object-position: center;
  display: block;
}

.hero-side {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 12px;
  align-items: stretch;
}

.hero-icon-frame {
  width: 112px;
  height: 112px;
}

.hero-icon-frame img {
  width: 82px;
  height: 82px;
  image-rendering: pixelated;
}

.hero-icon-frame.sponsor-emblem img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: auto;
}

.counter {
  display: grid;
  align-content: center;
  min-height: 112px;
  padding: 12px;
  border: 1px solid rgba(239, 200, 109, 0.42);
  background: rgba(13, 16, 13, 0.58);
}

.counter-value {
  color: var(--gold);
  font-size: 2rem;
  line-height: 1;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.counter span:last-child {
  margin-top: 6px;
  color: var(--muted);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(330px, 0.85fr);
  background: rgba(17, 20, 16, 0.92);
}

.tool-panel,
.preview-panel {
  background:
    linear-gradient(180deg, rgba(48, 52, 39, 0.96), rgba(37, 40, 32, 0.98)),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 12px);
}

.preview-panel {
  border-left: 1px solid var(--line);
}

.panel-heading,
.preview-header {
  padding: 20px 22px 0;
}

.panel-heading p,
.preview-header p,
.privacy-note {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.45;
}

.generator-form {
  padding: 20px 22px 22px;
}

.upload-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.dropzone {
  position: relative;
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 148px;
  padding: 16px;
  border: 1px dashed rgba(239, 200, 109, 0.52);
  background: rgba(23, 26, 21, 0.9);
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.dropzone.dragging,
.dropzone:hover {
  border-color: var(--green);
  background: rgba(31, 57, 39, 0.96);
  transform: translateY(-1px);
}

.dropzone.has-file {
  border-style: solid;
  border-color: rgba(79, 208, 141, 0.9);
  background:
    linear-gradient(180deg, rgba(79, 208, 141, 0.12), rgba(23, 26, 21, 0.92)),
    rgba(23, 26, 21, 0.9);
}

.dropzone.has-file::after {
  content: "✓";
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(134, 239, 184, 0.9);
  background: var(--green-dark);
  color: #fffbe8;
  font-weight: 900;
}

.dropzone input {
  display: none;
}

.file-type {
  width: fit-content;
  padding: 4px 8px;
  border: 1px solid var(--line-soft);
  background: rgba(90, 55, 40, 0.32);
  color: var(--gold);
  font-size: 0.8rem;
  font-weight: 900;
}

.dropzone.has-file .file-type {
  border-color: rgba(134, 239, 184, 0.9);
  background: rgba(38, 114, 78, 0.62);
  color: #fffbe8;
}

.dropzone strong {
  font-size: 1.08rem;
  color: var(--text);
}

.dropzone small {
  color: var(--muted);
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.dropzone.has-file small {
  color: #dff8e8;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.94rem;
}

select,
input[type="range"] {
  width: 100%;
}

select {
  min-height: 42px;
  border: 1px solid var(--line-soft);
  background: #141711;
  color: var(--text);
  padding: 0 10px;
}

input[type="range"] {
  accent-color: var(--green);
}

.range-field output {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.toggle-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  grid-column: 1 / -1;
}

.toggle-row label {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--line-soft);
  background: #141711;
}

.toggle-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

button,
.download-button {
  min-height: 44px;
  border: 1px solid transparent;
  padding: 0 16px;
  font-weight: 900;
  cursor: pointer;
}

.primary-button,
.download-button {
  border-color: #86efb8;
  background: linear-gradient(180deg, #69e5a4, var(--green));
  color: #09120d;
}

.secondary-button {
  background: rgba(20, 23, 17, 0.8);
  border-color: var(--line);
  color: var(--text);
}

button:disabled,
.download-button.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

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

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

.preview-panel {
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  min-height: 620px;
}

.preview-stage {
  display: grid;
  place-items: center;
  margin: 20px 22px;
  min-height: 360px;
  border: 1px solid rgba(239, 200, 109, 0.42);
  background:
    linear-gradient(45deg, #303427 25%, transparent 25%),
    linear-gradient(-45deg, #303427 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #303427 75%),
    linear-gradient(-45deg, transparent 75%, #303427 75%),
    #1a1d17;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
}

.preview-stage img {
  width: min(72%, 300px);
  max-height: 300px;
  object-fit: contain;
  image-rendering: auto;
}

.preview-stage img.placeholder-preview {
  width: 110px;
  max-height: 110px;
  image-rendering: pixelated;
}

.download-button {
  display: grid;
  place-items: center;
  margin: 0 22px 14px;
  text-align: center;
}

.privacy-note {
  padding: 0 22px 22px;
  font-size: 0.92rem;
}

@media (max-width: 920px) {
  .hero-layout,
  .workspace {
    display: block;
  }

  .hero-side {
    margin-top: 20px;
    max-width: 420px;
  }

  .preview-panel {
    border-left: 0;
    border-top: 1px solid var(--line);
    min-height: auto;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 18px, 1200px);
    padding-top: 10px;
  }

  .nav-bar,
  .sponsor-line {
    align-items: flex-start;
  }

  .nav-bar {
    flex-direction: column;
  }

  .language-switch {
    align-self: stretch;
  }

  .language-switch button {
    flex: 1;
  }

  .hero-layout {
    padding: 20px 16px 26px;
  }

  h1 {
    font-size: 2rem;
  }

  .hero-copy > p {
    font-size: 1rem;
  }

  .upload-grid,
  .settings-grid,
  .toggle-row {
    grid-template-columns: 1fr;
  }

  .hero-side {
    grid-template-columns: 96px minmax(0, 1fr);
    max-width: 100%;
  }

  .hero-icon-frame {
    width: 96px;
    height: 96px;
  }

  .counter {
    min-height: 96px;
  }

  .preview-stage {
    min-height: 280px;
  }
}
