:root {
  --ink: #090907;
  --paper: #fbf8ed;
  --paper-2: #f2edda;
  --yellow: #d6bf00;
  --pink: #ef4d9a;
  --cyan: #34b8e8;
  --green: #10d88d;
  --purple: #9863ee;
  --border: 4px solid var(--ink);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", Arial, sans-serif;
  font-size: 16px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.05) 50%, transparent 50%) 0 0 / 18px 18px,
    linear-gradient(rgba(0, 0, 0, 0.05) 50%, transparent 50%) 0 0 / 18px 18px,
    #e4e0c9;
}

body {
  min-height: 100vh;
  margin: 0;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.04) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 74px;
  padding: 14px clamp(18px, 5vw, 72px);
  background: var(--yellow);
  border-bottom: var(--border);
  box-shadow: inset 0 -3px 0 rgba(255, 255, 255, 0.35);
}

.brand,
.topbar nav,
.panel-title,
.preview-head,
.prompt-actions,
.loading-panel {
  display: flex;
  align-items: center;
}

.brand {
  gap: 14px;
  min-width: 0;
}

.brand strong {
  white-space: nowrap;
}

.brand small {
  display: inline-flex;
  align-items: center;
  height: 25px;
  padding: 0 16px;
  color: #fff;
  background: var(--pink);
  border: 3px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  font-family: Consolas, monospace;
  font-weight: 900;
}

.mark {
  display: grid;
  grid-template-columns: repeat(2, 10px);
  gap: 4px;
  width: 46px;
  height: 46px;
  padding: 9px;
  background: var(--pink);
  border: 4px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
}

.mark span {
  background: var(--ink);
}

.mark span:nth-child(2),
.mark span:nth-child(3) {
  background: #fff;
}

.topbar nav {
  gap: 12px;
}

.topbar a,
.mini-button,
.primary-action,
.choice-grid span {
  border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  text-decoration: none;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.topbar a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 16px;
  color: #fff;
  background: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.topbar a:hover,
.mini-button:hover,
.primary-action:hover,
.choice-grid label:hover span {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--ink);
}

.topbar a.is-active {
  color: var(--yellow);
}

.app-shell {
  width: min(1260px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 48px 0 72px;
}

.intro {
  margin-bottom: 26px;
}

.gallery-hero {
  margin-bottom: 28px;
}

.crumb {
  display: inline-flex;
  margin-bottom: 10px;
  font-size: 13px;
}

.crumb::before {
  content: ">";
  margin-right: 10px;
  font-family: Consolas, monospace;
  font-weight: 900;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  max-width: 680px;
  font-size: clamp(44px, 7vw, 84px);
  line-height: 0.96;
  letter-spacing: 0;
  font-weight: 500;
}

.gallery-hero h1 {
  font-size: clamp(36px, 5vw, 58px);
  line-height: 1;
}

.gallery-hero p {
  margin-top: 10px;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.6;
}

h1 mark {
  display: inline-block;
  margin-left: 10px;
  padding: 0 10px 4px;
  color: #fff;
  background: var(--pink);
  font-family: Impact, "Arial Black", sans-serif;
  text-transform: uppercase;
  box-shadow: 7px 7px 0 var(--ink);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 0.85fr) minmax(420px, 1.15fr);
  gap: 28px;
  align-items: start;
}

.workspace.is-idle {
  grid-template-columns: minmax(320px, 560px);
  justify-content: center;
}

.workspace.is-loading {
  grid-template-columns: minmax(320px, 520px) minmax(320px, 520px);
}

.workspace.is-ready {
  grid-template-columns: minmax(320px, 440px) minmax(560px, 1fr);
}

.panel {
  position: relative;
  background: rgba(255, 255, 255, 0.72);
  border: var(--border);
  box-shadow: 8px 8px 0 var(--ink);
}

.input-panel,
.output-panel,
.prompt-panel,
.loading-panel {
  padding: 28px;
}

.tape {
  position: absolute;
  top: -26px;
  left: 28px;
  min-width: 104px;
  padding: 8px 18px;
  border: 4px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  color: #fff;
  font-family: Consolas, monospace;
  font-weight: 900;
  text-align: center;
  transform: rotate(-6deg);
}

.tape-pink {
  background: var(--pink);
}

.tape-cyan {
  left: auto;
  right: 28px;
  background: var(--cyan);
  transform: rotate(7deg);
}

.panel-title {
  gap: 12px;
  margin-bottom: 22px;
}

.panel-title.compact {
  margin-bottom: 14px;
}

.panel-title h2 {
  font-size: 18px;
  font-weight: 500;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 88px;
  min-height: 30px;
  padding: 0 12px;
  border: 3px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  font-family: Consolas, monospace;
  font-size: 13px;
  font-weight: 900;
}

.badge-blue {
  background: var(--cyan);
}

.badge-purple {
  color: #fff;
  background: var(--purple);
}

.badge-yellow {
  background: var(--yellow);
}

.badge-green {
  background: var(--green);
}

.field {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
  font-size: 14px;
  font-weight: 800;
}

input,
textarea {
  width: 100%;
  border: 3px solid var(--ink);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  box-shadow: inset 3px 3px 0 rgba(0, 0, 0, 0.08);
  font: inherit;
  font-size: 17px;
  line-height: 1.6;
  outline: none;
}

input::placeholder,
textarea::placeholder {
  color: rgba(9, 9, 7, 0.36);
  font-weight: 700;
}

input {
  min-height: 50px;
  padding: 8px 12px;
}

textarea {
  min-height: 122px;
  padding: 12px;
  resize: vertical;
}

input:focus,
textarea:focus {
  background: #fffced;
  box-shadow: 0 0 0 4px rgba(52, 184, 232, 0.35), inset 3px 3px 0 rgba(0, 0, 0, 0.08);
}

.divider {
  height: 0;
  margin: 24px 0;
  border-top: 3px dashed var(--ink);
}

.primary-action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
  min-height: 62px;
  color: #fff;
  background: linear-gradient(180deg, #ef72b3, var(--pink));
  font: inherit;
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
}

.primary-action:disabled,
.mini-button:disabled {
  cursor: wait;
  filter: grayscale(0.65);
  opacity: 0.72;
}

.run-status {
  min-height: 24px;
  margin-top: 18px;
  color: #111;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.5;
}

.run-status.error {
  color: #b00030;
}

.output-panel,
.loading-panel {
  display: none;
}

.workspace.is-loading .loading-panel,
.workspace.is-ready .output-panel {
  display: block;
}

.loading-panel {
  min-height: 430px;
}

.loader-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 230px;
  margin: 26px 0 22px;
  overflow: hidden;
  background:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.06) 0 1px, transparent 1px 4px),
    var(--paper);
  border: 3px solid var(--ink);
  box-shadow: inset 5px 5px 0 rgba(0, 0, 0, 0.08);
}

.loader-stage {
  background: radial-gradient(circle at 50% 55%, rgba(255, 255, 255, 0.96), rgba(246, 239, 217, 0.72) 42%, rgba(214, 191, 0, 0.12) 72%);
}

.scent-orbit {
  position: absolute;
  width: 190px;
  height: 190px;
  border: 2px solid rgba(9, 9, 7, 0.4);
  border-radius: 50%;
  animation: orbitTurn 4.8s linear infinite;
}

.scent-orbit::before,
.scent-orbit::after {
  content: "";
  position: absolute;
  inset: 18px;
  border: 2px dashed rgba(9, 9, 7, 0.3);
  border-radius: 50%;
}

.scent-orbit::after {
  inset: 44px;
  border-style: solid;
  opacity: 0.6;
}

.scent-orbit i {
  position: absolute;
  width: 16px;
  height: 16px;
  background: var(--pink);
  border: 3px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
}

.scent-orbit i:nth-child(1) {
  left: 86px;
  top: -10px;
}

.scent-orbit i:nth-child(2) {
  right: 8px;
  bottom: 32px;
  background: var(--cyan);
}

.scent-orbit i:nth-child(3) {
  left: 12px;
  bottom: 40px;
  background: var(--yellow);
}

.mist-card {
  position: absolute;
  width: 138px;
  height: 178px;
  border: 3px solid var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(244, 239, 226, 0.92)),
    repeating-linear-gradient(0deg, transparent 0 22px, rgba(9, 9, 7, 0.16) 23px 25px);
  box-shadow: 7px 7px 0 rgba(0, 0, 0, 0.18);
  opacity: 0.82;
  animation: cardReveal 2.8s ease-in-out infinite;
}

.card-a {
  transform: translateX(-72px) rotate(-8deg);
}

.card-b {
  transform: translateX(78px) rotate(7deg);
  animation-delay: 700ms;
}

.mist-bottle {
  position: relative;
  z-index: 2;
  width: 86px;
  height: 148px;
  border: 4px solid var(--ink);
  background: linear-gradient(110deg, #0b0b0b 0 28%, #2d241a 52%, #0b0b0b 100%);
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.24);
}

.mist-bottle::before {
  content: "";
  position: absolute;
  left: 23px;
  top: -42px;
  width: 40px;
  height: 42px;
  border: 4px solid var(--ink);
  border-bottom: 0;
  background: #0b0b0b;
}

.mist-bottle::after {
  content: "OPC";
  position: absolute;
  left: 14px;
  right: 14px;
  top: 58px;
  padding: 10px 0;
  border: 2px solid #7b7568;
  color: #f5efe0;
  text-align: center;
  font: 700 17px Georgia, serif;
}

.scent-ribbon {
  position: absolute;
  width: 240px;
  height: 50px;
  border-radius: 50%;
  filter: blur(8px);
  opacity: 0.58;
  animation: ribbonDrift 3.6s ease-in-out infinite;
}

.ribbon-a {
  background: rgba(239, 77, 154, 0.36);
  transform: rotate(-18deg);
}

.ribbon-b {
  background: rgba(52, 184, 232, 0.34);
  transform: rotate(24deg);
  animation-delay: 900ms;
}

.pixel-bottle {
  position: relative;
  width: 96px;
  height: 150px;
  background: #111;
  border: 4px solid var(--ink);
  box-shadow: 10px 10px 0 rgba(0, 0, 0, 0.18);
  animation: bottlePulse 900ms steps(2, end) infinite;
}

.pixel-bottle::before {
  content: "";
  position: absolute;
  left: 26px;
  top: -48px;
  width: 44px;
  height: 48px;
  background: #111;
  border: 4px solid var(--ink);
  border-bottom: 0;
}

.pixel-bottle span {
  position: absolute;
  left: 18px;
  right: 18px;
  height: 10px;
  background: var(--pink);
  box-shadow: 0 24px 0 var(--cyan), 0 48px 0 var(--yellow), 0 72px 0 var(--green);
}

.scanline {
  position: absolute;
  left: 0;
  right: 0;
  height: 16px;
  background: rgba(239, 77, 154, 0.34);
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  animation: scanMove 1300ms linear infinite;
}

.pixel-bottle,
.scanline {
  display: none;
}

.progress-shell {
  height: 28px;
  padding: 4px;
  background: #fff;
  border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
}

.progress-bar {
  width: 8%;
  height: 100%;
  background: linear-gradient(90deg, var(--pink), var(--cyan), var(--yellow));
  transition: width 360ms steps(4, end);
}

.loading-copy {
  margin-top: 18px;
  font-size: 15px;
  font-weight: 900;
}

@keyframes bottlePulse {
  50% {
    transform: translateY(-4px);
  }
}

@keyframes scanMove {
  from {
    top: -20px;
  }
  to {
    top: 100%;
  }
}

@keyframes orbitTurn {
  to {
    transform: rotate(360deg);
  }
}

@keyframes cardReveal {
  0%,
  100% {
    opacity: 0.3;
    filter: blur(1.5px);
  }
  50% {
    opacity: 0.9;
    filter: blur(0);
  }
}

@keyframes ribbonDrift {
  0%,
  100% {
    transform: translateY(20px) rotate(-18deg) scale(0.86);
  }
  50% {
    transform: translateY(-24px) rotate(14deg) scale(1.08);
  }
}

.mini-button {
  min-height: 34px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.art-viewer {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 52px;
  gap: 18px;
  align-items: center;
}

.art-stage {
  display: grid;
  place-items: center;
  min-height: min(72vh, 760px);
  padding: 18px;
  background:
    radial-gradient(circle at 50% 18%, rgba(239, 77, 154, 0.12), transparent 34%),
    radial-gradient(circle at 78% 70%, rgba(52, 184, 232, 0.14), transparent 38%),
    rgba(255, 255, 255, 0.42);
  border: 3px solid var(--ink);
  box-shadow: inset 5px 5px 0 rgba(0, 0, 0, 0.08);
}

.nav-arrow {
  display: grid;
  place-items: center;
  width: 52px;
  aspect-ratio: 1;
  border: 3px solid var(--ink);
  background: var(--ink);
  color: #fff;
  box-shadow: 4px 4px 0 var(--ink);
  font: 900 42px/1 Georgia, serif;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.nav-arrow:hover {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--ink);
}

.art-canvas {
  display: none;
  width: auto;
  max-width: 100%;
  max-height: min(68vh, 720px);
  height: auto;
  background: var(--paper);
  border: 3px solid var(--ink);
  box-shadow: 8px 8px 0 var(--ink);
}

.art-canvas.is-active {
  display: block;
}

.poster-canvas {
  background: #111;
}

.viewer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 18px;
}

.gallery-page {
  max-width: 1160px;
  margin: 0 auto;
}

.archive-panel {
  padding: 30px;
}

.archive-intro {
  max-width: 720px;
  margin: -4px 0 24px;
  color: rgba(9, 9, 7, 0.7);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.7;
}

.archive-empty {
  min-height: 260px;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.05) 0 1px, transparent 1px 5px),
    var(--paper);
  border: 3px dashed var(--ink);
  color: rgba(9, 9, 7, 0.52);
  font-size: 18px;
  font-weight: 900;
  line-height: 1.7;
  text-align: center;
}

.archive-list {
  display: grid;
  gap: 26px;
}

.archive-item {
  padding: 20px;
  background: rgba(255, 255, 255, 0.68);
  border: 3px solid var(--ink);
  box-shadow: 6px 6px 0 var(--ink);
}

.archive-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 3px dashed var(--ink);
}

.archive-head div {
  display: grid;
  gap: 8px;
}

.archive-head strong {
  font-size: 22px;
}

.archive-head span,
.archive-head small {
  color: rgba(9, 9, 7, 0.62);
  font-size: 13px;
  font-weight: 900;
}

.archive-head small {
  max-width: 360px;
  text-align: right;
}

.archive-images {
  display: grid;
  grid-template-columns: minmax(260px, 0.82fr) minmax(300px, 1fr);
  gap: 22px;
  align-items: start;
}

.archive-images figure {
  margin: 0;
}

.archive-images img {
  display: block;
  width: 100%;
  max-height: 620px;
  object-fit: contain;
  background: var(--paper);
  border: 3px solid var(--ink);
  box-shadow: 6px 6px 0 var(--ink);
}

.archive-images figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
  font-weight: 900;
}

.slide-dots {
  display: flex;
  gap: 10px;
}

.slide-dots span {
  width: 14px;
  height: 14px;
  border: 3px solid var(--ink);
  background: #fff;
  box-shadow: 2px 2px 0 var(--ink);
}

.slide-dots span.is-active {
  background: var(--pink);
}

.prompt-panel {
  margin-top: 28px;
}

.prompt-panel textarea {
  min-height: 220px;
  font-family: Consolas, "Microsoft YaHei", monospace;
  font-size: 14px;
}

.prompt-actions {
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
}

#copy-status {
  min-height: 20px;
  font-size: 13px;
  font-weight: 800;
}

@media (max-width: 980px) {
  .topbar {
    position: static;
    flex-wrap: wrap;
  }

  .workspace,
  .workspace.is-idle,
  .workspace.is-loading,
  .workspace.is-ready {
    grid-template-columns: 1fr;
  }

  .archive-images {
    grid-template-columns: 1fr;
  }

  .art-viewer {
    grid-template-columns: 42px minmax(0, 1fr) 42px;
    gap: 10px;
  }

  .nav-arrow {
    width: 42px;
    font-size: 34px;
  }

  .art-stage {
    min-height: auto;
    padding: 12px;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100vw - 20px, 520px);
    padding-top: 32px;
  }

  .topbar {
    padding-inline: 12px;
  }

  .brand {
    width: 100%;
  }

  .brand strong {
    white-space: normal;
  }

  .topbar nav {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 6px;
  }

  h1 {
    font-size: 42px;
  }

  h1 mark {
    margin: 8px 0 0;
  }

  .input-panel,
  .output-panel,
  .prompt-panel,
  .archive-panel {
    padding: 22px 16px;
  }

  .archive-head,
  .archive-images figcaption {
    align-items: stretch;
    flex-direction: column;
  }

  .archive-head small {
    max-width: none;
    text-align: left;
  }

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