@font-face {
  font-family: "Poster Sarasa";
  src: url("./assets/fonts/SarasaGothicSC-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Poster Sarasa Bold";
  src: url("./assets/fonts/SarasaGothicSC-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "Poster Sarasa Semi";
  src: url("./assets/fonts/SarasaGothicSC-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: "Poster Hazy";
  src: url("./assets/fonts/Lxgw975HazyGoSC-600W.ttf") format("truetype");
  font-weight: 600;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #08090a;
  --panel: #171719;
  --panel-strong: #202024;
  --line: rgba(255, 255, 255, 0.12);
  --text: #f8f8f4;
  --muted: rgba(248, 248, 244, 0.62);
  --red: #ff2948;
  --blue: #36a6e8;
  --gold: #bb7b14;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Poster Sarasa Semi", system-ui, sans-serif;
}

button,
input,
textarea,
select {
  font: inherit;
}

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

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

#posterCanvas {
  width: min(100%, 430px);
  height: auto;
  aspect-ratio: 3 / 4;
  border-radius: 8px;
  background: #0d0e0f;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.55), 0 0 0 1px var(--line);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

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

.preview p {
  width: min(100%, 430px);
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.panel {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(23, 23, 25, 0.94);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--red);
  color: white;
  font-weight: 900;
}

.brand strong {
  font-size: 20px;
}

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

.poster-switch a {
  min-height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 900;
}

.poster-switch a.is-active {
  border-color: rgba(54, 166, 232, 0.72);
  background: rgba(54, 166, 232, 0.18);
  color: var(--text);
}

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

.upload:hover,
.upload.is-dragging {
  border-color: var(--blue);
  background: rgba(54, 166, 232, 0.08);
}

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

.upload small,
.reference figcaption {
  color: var(--muted);
  font-size: 12px;
}

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

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

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

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #09090a;
  color: var(--text);
  padding: 12px 13px;
  outline: none;
}

textarea {
  resize: vertical;
}

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

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

.advanced summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 800;
}

.advanced .grid {
  margin-top: 14px;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1.45fr;
  gap: 12px;
}

button {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--text);
  font-weight: 900;
  cursor: pointer;
}

button.primary {
  background: linear-gradient(90deg, #ff2442, #ff7b22);
}

.reference {
  margin: 0;
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 12px;
  align-items: center;
  color: var(--muted);
}

.reference img {
  width: 96px;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 6px;
}

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

  .grid,
  .actions {
    grid-template-columns: 1fr;
  }
}
