:root {
  --paper: #fff8dc;
  --paper-2: #f7e7b3;
  --ink: #202020;
  --muted: #615d50;
  --accent: #ff7f50;
  --accent-2: #6fd0c5;
  --white: #fffdf2;
  --shadow: 6px 6px 0 #202020;
}
* { box-sizing: border-box; }
html { image-rendering: pixelated; }
body {
  margin: 0;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    linear-gradient(rgba(32,32,32,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(32,32,32,.05) 1px, transparent 1px);
  background-size: 16px 16px;
  font-family: "Courier New", ui-monospace, monospace;
  line-height: 1.55;
}
button, input, select { font: inherit; }
.site-header { text-align: center; padding: 34px 16px 20px; }
.brand {
  color: var(--ink); text-decoration: none; text-transform: lowercase;
  font-size: clamp(42px, 8vw, 68px); font-weight: 900; line-height: 1;
  letter-spacing: -5px; text-shadow: 4px 4px 0 var(--accent-2);
}
.blink { animation: blink 1s steps(1,end) infinite; color: var(--accent); }
@keyframes blink { 50% { opacity: 0; } }
.tagline { margin: 13px 0 0; font-size: 13px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }
.container { width: min(1060px, calc(100% - 28px)); margin: 0 auto; }
.pixel-panel {
  position: relative; margin: 22px 0 28px; padding: clamp(22px, 4vw, 34px);
  background: var(--white); border: 3px solid var(--ink); box-shadow: var(--shadow);
}
.window-label {
  position: absolute; top: -14px; left: 16px; padding: 3px 9px;
  background: var(--accent-2); border: 3px solid var(--ink); font-size: 12px; font-weight: 900;
}
.intro { text-align: center; }
h1, h2 { line-height: 1.25; margin-top: 0; }
h1 { margin-bottom: 12px; font-size: clamp(25px, 4vw, 40px); }
h2 { font-size: 20px; }
p { margin-bottom: 0; }
.ad-slot {
  min-height: 90px; display: grid; place-items: center; margin: 22px 0;
  border: 3px dashed var(--ink); background: rgba(255,255,255,.55); color: var(--muted);
  font-weight: 900; letter-spacing: 2px;
}
.upload-box {
  padding: 30px 18px; text-align: center; border: 3px dashed var(--ink); background: var(--paper);
}
.upload-box.dragover { background: #d9fff7; }
.upload-icon { font-size: 34px; line-height: 1; margin-bottom: 14px; }
.upload-box p { margin: 12px 0 2px; color: var(--muted); }
.upload-box span { font-weight: 900; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 22px; margin-top: 26px; }
.setting-card {
  margin: 0; min-width: 0; padding: 18px; background: #fff; border: 3px solid var(--ink); box-shadow: 4px 4px 0 var(--paper-2);
}
.setting-card legend { padding: 3px 8px; background: var(--accent); border: 2px solid var(--ink); font-weight: 900; }
.setting-card label { display: grid; gap: 7px; margin: 13px 0; font-size: 14px; font-weight: 700; }
input[type="number"], input[type="text"], select {
  width: 100%; min-height: 43px; padding: 9px 10px; color: var(--ink); background: #fff;
  border: 3px solid var(--ink); border-radius: 0; outline: none;
}
input[type="number"]:focus, input[type="text"]:focus, select:focus { box-shadow: 3px 3px 0 var(--accent-2); }
input[type="color"] { width: 100%; min-height: 43px; padding: 3px; border: 3px solid var(--ink); background: #fff; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); }
.check-row { display: flex !important; align-items: center; gap: 9px !important; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.value-badge { justify-self: end; margin-top: -28px; padding: 1px 6px; background: var(--paper-2); border: 2px solid var(--ink); }
.color-row { display: grid; grid-template-columns: 70px 1fr; gap: 8px; align-items: center; }
.color-row code { padding: 8px; border: 3px solid var(--ink); background: var(--paper); }
.hidden { display: none !important; }
.actions { display: flex; justify-content: center; gap: 14px; margin-top: 26px; }
.pixel-btn {
  min-width: 145px; padding: 11px 18px; cursor: pointer; background: var(--white); color: var(--ink);
  border: 3px solid var(--ink); border-radius: 0; box-shadow: 4px 4px 0 var(--ink); font-weight: 900;
}
.pixel-btn:hover { transform: translate(2px,2px); box-shadow: 2px 2px 0 var(--ink); }
.pixel-btn:active { transform: translate(4px,4px); box-shadow: none; }
.pixel-btn.primary { background: var(--accent); }
.status { min-height: 25px; margin-top: 18px; text-align: center; font-weight: 900; }
.section-title-row { display: flex; justify-content: space-between; gap: 15px; align-items: center; }
.tiny { font-size: 11px; padding: 3px 7px; background: var(--paper-2); border: 2px solid var(--ink); }
.preview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: 20px; }
.preview-item { overflow: hidden; background: #fff; border: 3px solid var(--ink); box-shadow: 4px 4px 0 var(--paper-2); }
.preview-item img { display: block; width: 100%; background: #eee; }
.preview-info { padding: 12px; }
.preview-info strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.download-btn { display: inline-block; margin-top: 10px; padding: 7px 10px; color: var(--ink); background: var(--accent-2); border: 2px solid var(--ink); text-decoration: none; font-weight: 900; }
.empty-message { color: var(--muted); }
.guide p { color: var(--muted); }
footer { width: min(1060px, calc(100% - 28px)); margin: 30px auto 42px; display: flex; justify-content: space-between; gap: 16px; font-size: 13px; font-weight: 700; }
footer nav { display: flex; gap: 14px; flex-wrap: wrap; }
footer a { color: inherit; }
@media (max-width: 760px) {
  .settings-grid { grid-template-columns: 1fr; }
  .actions { flex-direction: column; }
  .pixel-btn { width: 100%; }
  .two-col { grid-template-columns: 1fr; }
  .section-title-row, footer { flex-direction: column; align-items: flex-start; }
  .brand { letter-spacing: -3px; }
}

.upload-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.file-list { display: grid; gap: 6px; width: min(620px, 100%); margin: 14px auto 0; text-align: left; }
.file-list span { display: block; padding: 7px 9px; border: 2px solid var(--ink); background: var(--paper); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.single-action { justify-content: center; }
.big-action { min-width: min(100%, 340px); padding: 16px 24px; font-size: 16px; }
.pixel-btn:disabled { opacity: .45; cursor: wait; }
.retro-note {
  margin: 10px 0 0;
  padding: 9px 10px;
  color: #5e2f0b;
  background: #fff0c7;
  border: 2px dashed var(--ink);
  font-size: 12px;
  font-weight: 700;
}
.result-panel {
  margin-top: 26px;
  padding: 18px;
  border: 3px solid var(--ink);
  background: #fff;
  box-shadow: 4px 4px 0 var(--paper-2);
}
.result-panel h2 { margin-bottom: 8px; }
.result-help { margin: 0 0 14px; color: var(--muted); font-size: 13px; }
.result-list { display: grid; gap: 8px; margin-top: 15px; }
.result-file {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px;
  border: 2px solid var(--ink);
  background: var(--paper);
}
.result-file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 900; }
.result-file .pixel-btn { min-width: 105px; padding: 7px 10px; box-shadow: 3px 3px 0 var(--ink); font-size: 12px; }
@media (max-width: 560px) {
  .result-file { grid-template-columns: 1fr; }
  .result-file .pixel-btn { width: 100%; }
}
.result-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.result-actions .pixel-btn {
  min-width: 112px;
}
@media (max-width: 560px) {
  .result-actions { width: 100%; }
  .result-actions .pixel-btn { width: 100%; }
}
