:root {
  color-scheme: light;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: #142c23;
  background: #edf3ef;
  --ink: #142c23;
  --muted: #52675d;
  --green: #125944;
  --green-dark: #0d4534;
  --line: #dce6de;
  --card: #fff;
  --radius: 20px;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .5; }
:focus-visible { outline: 3px solid #23856b; outline-offset: 3px; }
[hidden] { display: none !important; }

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.topbar-inner, .shell {
  max-width: 1192px;
  margin: auto;
  padding-inline: clamp(16px, 3vw, 36px);
}
.topbar-inner {
  min-height: 76px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.identity { display: inline-flex; align-items: center; gap: 11px; }
.logo {
  position: relative;
  isolation: isolate;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 13px;
  background: var(--green-dark);
  color: #fff;
  font-size: 1.25rem;
  font-weight: 850;
  letter-spacing: -.09em;
}
.logo span {
  position: absolute;
  inset: 9px 7px auto auto;
  width: 7px;
  aspect-ratio: 1;
  transform: rotate(45deg);
  background: #eeb94e;
}
.identity-text { display: grid; gap: 1px; }
.identity-text strong { font-weight: 850; letter-spacing: -.018em; }
.identity-text small { font-size: .8125rem; color: var(--muted); }
.topbar-label { color: var(--muted); font-size: .875rem; font-weight: 600; }

.shell { padding-block: 32px 48px; }
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.14fr) minmax(330px, .86fr);
  align-items: start;
  gap: clamp(20px, 3vw, 36px);
}
.editor { min-width: 0; display: grid; gap: 15px; }
.intro { margin-bottom: 4px; }
h1 { font-size: clamp(1.8rem, 4vw, 2.625rem); font-weight: 820; letter-spacing: -.043em; line-height: 1.12; }
h2 { font-size: 1.125rem; line-height: 1.25; font-weight: 780; letter-spacing: -.015em; }
.intro p { color: var(--muted); margin-top: 9px; line-height: 1.5; }
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  padding: clamp(12px, 2vw, 20px);
}
.templates {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(5, minmax(58px, 1fr));
  gap: clamp(5px, 1vw, 10px);
}
.template { position: relative; min-width: 0; cursor: pointer; }
.template input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.template-card {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 5px 4px 7px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #f8faf8;
  color: var(--ink);
  font-size: .875rem;
  font-weight: 680;
  line-height: 1.23;
  text-align: center;
  min-height: 100%;
}
.template-card img { width: 100%; height: auto; aspect-ratio: 2/3; object-fit: cover; border-radius: 6px; background: var(--swatch); display: block; }
.template input:checked + .template-card {
  border-color: var(--green);
  box-shadow: inset 0 0 0 1px var(--green);
  background: #e5f1e9;
  color: var(--green-dark);
}
.template input:focus-visible + .template-card { outline: 3px solid #23856b; outline-offset: 2px; }
.template:hover .template-card { border-color: #6a9c81; }
.price-heading { display: flex; align-items: start; justify-content: space-between; gap: 8px; }
.price-heading p, .stage-head p { color: var(--muted); margin-top: 5px; font-size: .875rem; line-height: 1.43; }
.saved { color: var(--green-dark); font-size: .8125rem; font-weight: 630; background: #eaf3ed; padding: 5px 8px; border-radius: 7px; white-space: nowrap; }
.saved[data-error] { color: #8a2738; background: #f9e9ec; }
.price-groups { display: grid; grid-template-columns: 1fr 1fr; align-items: start; gap: 12px; margin-top: 14px; }
.price-group { min-width: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.price-group h3 { padding: 9px 11px; background: #edf4ee; font-size: .875rem; letter-spacing: .035em; text-transform: uppercase; }
.price-row {
  padding: 5px 8px 5px 11px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 66px;
  align-items: center;
  gap: 8px;
}
.price-row + .price-row { border-top: 1px solid #eaf0eb; }
.price-row label { font-size: .875rem; font-weight: 630; line-height: 1.22; }
.price-input {
  min-width: 0;
  width: 100%;
  height: 44px;
  border: 1px solid #c4d6cb;
  border-radius: 8px;
  background: #fcfdfc;
  color: var(--green-dark);
  font-size: 1rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  text-align: right;
  padding: 0 8px;
}
.price-input[aria-invalid="true"] { border-color: #a63346; }
.price-input:focus { outline: 2px solid #23856b; outline-offset: 1px; background: #fff; }

.stage {
  position: sticky;
  top: 16px;
  background: #dfeae3;
  border-radius: var(--radius);
  border: 1px solid #d3e1d8;
  padding: 16px;
  display: grid;
  gap: 12px;
}
.stage-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.preview-area { display: grid; place-items: center; position: relative; min-width: 0; }
#poster {
  display: block;
  aspect-ratio: 2/3;
  width: min(100%, max(200px, calc((100dvh - 265px) * 2 / 3)));
  height: auto;
  background: #edf3ef;
  border-radius: 8px;
  box-shadow: 0 10px 30px #183c2926;
}
.preview-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 10px;
  padding: 16px;
  text-align: center;
  color: var(--muted);
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 730;
  text-align: center;
  line-height: 1.25;
}
.primary { background: var(--green); color: white; }
.primary:hover:not(:disabled) { background: var(--green-dark); }
.light { color: var(--green-dark); border-color: #c5d8cb; background: #fff; }
.light:hover:not(:disabled) { background: #f3f8f4; }
.desktop-action { display: grid; }
.desktop-action .primary { min-height: 48px; }
.mobile-action { display: none; }
.preview-dialog {
  width: min(94vw, 540px);
  max-height: 94dvh;
  overflow: auto;
  scrollbar-gutter: stable;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #e7efe9;
  padding: 12px;
}
.preview-dialog::backdrop { background: #091f18b8; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
#large-poster { display: block; width: min(100%, max(220px, calc((100dvh - 154px) * 2 / 3))); aspect-ratio: 2/3; height: auto; margin: 10px auto; border-radius: 6px; }
.dialog-actions { display: flex; gap: 8px; }
.dialog-actions button { flex: 1; }
.notice {
  position: fixed;
  z-index: 5;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 28px);
  background: #15392d;
  color: white;
  border-radius: 10px;
  padding: 10px 14px;
  box-shadow: 0 6px 23px #123b2844;
  font-size: .875rem;
}
.noscript { padding: 16px; }

@media (max-width: 960px) and (min-width: 741px) {
  .price-groups { grid-template-columns: 1fr; }
}
@media (max-width: 740px) {
  .topbar-inner { min-height: 64px; }
  .logo { width: 38px; height: 38px; border-radius: 10px; }
  .topbar-label { display: none; }
  .shell { padding-block: 22px calc(90px + env(safe-area-inset-bottom)); }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .stage { position: static; }
  #poster { width: min(100%, 470px); }
  .desktop-action { display: none; }
  .mobile-action {
    position: fixed;
    z-index: 3;
    inset: auto 0 0;
    display: grid;
    grid-template-columns: .9fr 1.1fr;
    gap: 9px;
    background: #f8fbf9;
    border-top: 1px solid var(--line);
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  }
  .mobile-action button { min-height: 48px; }
  .notice { bottom: calc(82px + env(safe-area-inset-bottom)); }
}
@media (max-width: 455px) {
  .price-groups { grid-template-columns: 1fr; }
  .price-row { grid-template-columns: minmax(0, 1fr) 92px; }
  .templates { grid-template-columns: repeat(5, minmax(48px, 1fr)); }
  .template-card { font-size: .8125rem; padding-inline: 3px; }
  .price-heading { flex-wrap: wrap; }
}

