@import url("./assets/fonts/noto-sans-sc.css");

:root {
  color-scheme: light;
  --ink: #17130f;
  --muted: #706961;
  --paper: #fffaf0;
  --paper-deep: #f4ead8;
  --card: rgba(255, 255, 255, 0.86);
  --line: rgba(23, 19, 15, 0.14);
  --yellow: #ffeb3d;
  --yellow-deep: #f6cd22;
  --shadow: 0 24px 70px rgba(72, 47, 12, 0.13);
  font-family: "Noto Sans SC Variable", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 7% 4%, rgba(255, 235, 61, 0.48), transparent 25rem),
    radial-gradient(circle at 95% 60%, rgba(247, 185, 64, 0.2), transparent 30rem),
    linear-gradient(155deg, #fffdf7 0%, var(--paper) 52%, #f8f1e6 100%);
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.95' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.18'/%3E%3C/svg%3E");
}

button,
input {
  font: inherit;
}

.shell {
  position: relative;
  width: min(1380px, calc(100% - 40px));
  margin: 0 auto;
  padding: 54px 0 34px;
}

.masthead {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-bottom: 34px;
}

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 76px;
  height: 76px;
  border: 4px solid var(--ink);
  border-radius: 22px 22px 22px 5px;
  background: var(--yellow);
  box-shadow: 7px 7px 0 var(--ink);
  font-size: 33px;
  font-weight: 900;
}

.eyebrow {
  margin: 0 0 5px;
  color: #9b7410;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 3px;
  font-size: clamp(31px, 4vw, 48px);
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.lede {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 15px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(300px, 390px) minmax(0, 1fr);
  gap: 24px;
  align-items: stretch;
}

.controls,
.preview-panel {
  border: 1px solid rgba(23, 19, 15, 0.1);
  border-radius: 28px;
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.controls {
  padding: 28px;
}

.section-heading {
  display: flex;
  gap: 13px;
  align-items: flex-start;
  margin-bottom: 29px;
}

.section-heading > span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: var(--ink);
  background: var(--yellow);
  border: 1px solid var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.section-heading h2 {
  margin: 1px 0 1px;
  font-size: 21px;
  line-height: 1.2;
}

.section-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

label {
  display: block;
  margin: 0 0 9px;
  font-size: 14px;
  font-weight: 800;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 7px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.input-wrap:focus-within {
  border-color: var(--ink);
  box-shadow: 0 0 0 4px rgba(255, 235, 61, 0.42);
  transform: translateY(-1px);
}

.input-wrap input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  padding: 15px 16px;
  color: var(--ink);
  background: transparent;
  font-size: 16px;
  font-weight: 650;
}

.serial-wrap input {
  padding-left: 42px;
  font-size: 23px;
  letter-spacing: 0.06em;
}

.prefix {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: #a29482;
  font-size: 20px;
  font-weight: 800;
}

.field-help,
.field-meta {
  color: var(--muted);
  font-size: 11px;
}

.field-help {
  margin-bottom: 22px;
}

.field-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

.field-meta .field-help {
  margin-bottom: 0;
}

#char-count {
  white-space: nowrap;
}

.message {
  min-height: 42px;
  margin: 16px 0 14px;
  padding: 10px 12px;
  border-radius: 11px;
  color: #665b4d;
  background: #f6f0e7;
  font-size: 12px;
  line-height: 1.55;
}

.message.error {
  color: #8b211b;
  background: #ffebe8;
}

.message.success {
  color: #2c6543;
  background: #e9f7ed;
}

.primary-action {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  padding: 15px 18px;
  color: var(--ink);
  background: var(--yellow);
  box-shadow: 5px 5px 0 var(--ink);
  font-weight: 900;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.primary-action:hover {
  background: #fff066;
  transform: translate(-1px, -1px);
  box-shadow: 7px 7px 0 var(--ink);
}

.primary-action:active {
  transform: translate(4px, 4px);
  box-shadow: 1px 1px 0 var(--ink);
}

.primary-action:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  transform: none;
}

.primary-action svg {
  width: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.specs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 25px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.specs div {
  min-width: 0;
}

.specs strong,
.specs span {
  display: block;
}

.specs strong {
  font-size: 12px;
}

.specs span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.preview-panel {
  min-width: 0;
  padding: 28px;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.section-heading.compact {
  margin-bottom: 21px;
}

.status-pill {
  align-self: flex-start;
  border: 1px solid rgba(23, 19, 15, 0.12);
  border-radius: 999px;
  padding: 7px 11px;
  color: #4e6f58;
  background: #eef8f0;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill.error {
  color: #8b211b;
  background: #ffebe8;
}

.preview-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 360px;
  overflow: hidden;
  border: 1px dashed rgba(23, 19, 15, 0.23);
  border-radius: 22px;
  padding: clamp(20px, 4vw, 46px);
  background:
    linear-gradient(45deg, rgba(23, 19, 15, 0.026) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(23, 19, 15, 0.026) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(23, 19, 15, 0.026) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(23, 19, 15, 0.026) 75%),
    #f8f4ec;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
}

.preview-stage::before {
  content: "高清输出预览";
  position: absolute;
  top: 13px;
  left: 16px;
  color: #aa9e8e;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 5px;
  background: white;
  box-shadow: 0 18px 44px rgba(32, 22, 8, 0.19);
}

.tip {
  margin: 14px 2px 0;
  color: var(--muted);
  font-size: 11px;
}

.tip span {
  margin-right: 7px;
  color: #ad7e00;
  font-weight: 900;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 21px 5px 0;
  color: #8a8176;
  font-size: 10px;
}

footer p {
  margin-bottom: 0;
}

@media (max-width: 900px) {
  .shell {
    width: min(700px, calc(100% - 28px));
    padding-top: 32px;
  }

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

  .preview-panel {
    grid-row: 1;
  }

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

@media (max-width: 560px) {
  .masthead {
    align-items: flex-start;
    gap: 15px;
  }

  .brand-mark {
    width: 58px;
    height: 58px;
    border-radius: 17px 17px 17px 4px;
    box-shadow: 5px 5px 0 var(--ink);
    font-size: 25px;
  }

  .eyebrow {
    font-size: 9px;
  }

  .lede {
    font-size: 12px;
  }

  .controls,
  .preview-panel {
    border-radius: 22px;
    padding: 21px;
  }

  .preview-stage {
    min-height: 195px;
    padding: 29px 10px 20px;
  }

  .status-pill {
    display: none;
  }

  .specs {
    gap: 5px;
  }

  footer {
    display: block;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

.language-link { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink); }
.controls, .masthead > div, .section-heading > div { min-width: 0; }
.shell { overflow-wrap: anywhere; }
html[lang="en"] .preview-stage::before { content: "PNG preview"; }
:focus-visible { outline: 3px solid #175ba8; outline-offset: 3px; }
@media (max-width: 560px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .preview-panel { grid-row: auto; }
  .field-meta, .preview-header { flex-wrap: wrap; }
  .primary-action { min-height: 44px; }
}
