@font-face {
  font-family: "Poster HY";
  src: url("assets/fonts/HYRuiYiSongJ.ttf") format("truetype");
  font-display: swap;
}

@font-face {
  font-family: "Poster Bespoke";
  src: url("assets/fonts/Bespoke.otf") format("opentype");
  font-display: swap;
}

@font-face {
  font-family: "Poster ZhangTie";
  src: url("assets/fonts/ZaoZiZhangTie.ttf") format("truetype");
  font-display: swap;
}

@font-face {
  font-family: "Poster OPPO";
  src: url("assets/fonts/OPPOSans.ttf") format("truetype");
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #090909;
  --panel: #171717;
  --line: rgba(255, 255, 255, 0.13);
  --text: #f7f4ee;
  --muted: rgba(247, 244, 238, 0.58);
  --red: #ff2442;
  --cyan: #33dcc8;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 18% 0%, rgba(255, 36, 66, 0.15), transparent 28rem), var(--bg);
  color: var(--text);
  font-family: "Poster Bespoke", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

.app {
  width: min(1220px, calc(100vw - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(320px, 455px) minmax(330px, 520px);
  gap: 42px;
  align-items: center;
  justify-content: center;
  padding: 32px 0;
}

.preview {
  display: grid;
  justify-items: center;
}

#poster {
  width: min(100%, 430px);
  aspect-ratio: 1242 / 1660;
  height: auto;
  border-radius: 4px;
  background: #f5f5f5;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.58), 0 0 0 1px var(--line);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

#poster.is-dragging {
  cursor: grabbing;
}

.preview p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(23, 23, 23, 0.9);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.brand span {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--red);
  color: white;
  font-weight: 800;
}

.brand strong {
  font-family: "Poster HY";
  font-size: 18px;
  color: var(--text);
}

.upload {
  min-height: 122px;
  display: grid;
  place-items: center;
  gap: 4px;
  padding: 20px;
  border: 1px dashed rgba(255, 255, 255, 0.28);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.035);
  text-align: center;
  cursor: pointer;
}

.upload input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload b {
  font-size: 18px;
}

.upload small,
.field span {
  color: var(--muted);
  font-size: 13px;
}

.field {
  display: grid;
  gap: 8px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.5);
  color: var(--text);
  padding: 12px 13px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: rgba(51, 220, 200, 0.7);
}

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

.chips {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.chips button {
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  cursor: pointer;
}

.chips button:hover {
  border-color: rgba(255, 255, 255, 0.3);
}

.advanced {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.025);
}

.advanced summary {
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 0 13px;
  cursor: pointer;
  font-weight: 800;
}

.advanced .field {
  padding: 0 13px 14px;
}

.range-field span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.range-field output {
  min-width: 44px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.download {
  min-height: 50px;
  border: 0;
  border-radius: 6px;
  background: linear-gradient(90deg, #ff2442, #ff7a1a);
  color: white;
  font-weight: 900;
  cursor: pointer;
}

.download-result {
  display: grid;
  gap: 10px;
}

.download-result a {
  min-height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
}

.download-result img {
  width: 96px;
  aspect-ratio: 1242 / 1660;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 4px;
}

@media (max-width: 860px) {
  .app {
    grid-template-columns: 1fr;
    gap: 24px;
    align-items: start;
  }
}

@media (max-width: 520px) {
  .app {
    width: min(100vw - 24px, 430px);
  }

  .panel {
    padding: 18px;
  }

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