@font-face { font-family: "Mali"; font-weight: 400; src: url("fonts/mali-vietnamese-400.woff2") format("woff2"); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; font-display: swap; }
@font-face { font-family: "Mali"; font-weight: 400; src: url("fonts/mali-latin-ext-400.woff2") format("woff2"); unicode-range: U+0100-02BA, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0; font-display: swap; }
@font-face { font-family: "Mali"; font-weight: 400; src: url("fonts/mali-latin-400.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122, U+2212; font-display: swap; }
@font-face { font-family: "Mali"; font-weight: 500; src: url("fonts/mali-vietnamese-500.woff2") format("woff2"); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; font-display: swap; }
@font-face { font-family: "Mali"; font-weight: 500; src: url("fonts/mali-latin-ext-500.woff2") format("woff2"); unicode-range: U+0100-02BA, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0; font-display: swap; }
@font-face { font-family: "Mali"; font-weight: 500; src: url("fonts/mali-latin-500.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122, U+2212; font-display: swap; }

:root { --ink: #5d5258; --soft: #9a8f94; --line: #f1dfe4; --pink: #f29bb0; --pink-d: #e47e98; --hand: "Mali", system-ui, sans-serif; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; color: var(--ink); font: 400 14px/1.45 var(--hand); background: #fff4f6; background-image: radial-gradient(#f6dfe5 1.2px, transparent 1.3px); background-size: 18px 18px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

.top { text-align: center; padding: max(18px, env(safe-area-inset-top)) 16px 6px; }
.top h1 { margin: 0; font: 500 34px/1.1 var(--hand); color: #5a4650; }
.top h1::after { content: " 🐾"; font-size: 0.6em; }
.top p { margin: 4px 0 0; color: var(--soft); }

.wrap { max-width: 1040px; margin: 0 auto; padding: 12px 16px 24px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 420px); gap: 24px; align-items: start; }
@media (max-width: 820px) { .wrap { grid-template-columns: 1fr; } }

.preview { position: sticky; top: 12px; display: grid; justify-items: center; gap: 10px; }
@media (max-width: 820px) { .preview { position: static; } }
.stage { width: 100%; display: grid; place-items: center; padding: 10px; border-radius: 24px; background: rgba(255, 255, 255, 0.55); border: 1px dashed var(--line); }
#out { width: min(100%, 420px); height: auto; display: block; }
.warn { margin: 0; padding: 6px 12px; border-radius: 12px; background: #fff3d6; color: #9a6a10; font-size: 13px; text-align: center; }
.acts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.note { margin: 0; font-size: 12px; color: var(--soft); text-align: center; }

.btn { min-height: 40px; padding: 0 18px; border-radius: 99px; border: 0; background: var(--pink); color: #fff; font-weight: 500; box-shadow: 0 4px 12px rgba(228, 126, 152, 0.3); }
.btn:active { transform: scale(0.96); }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); box-shadow: none; }

.panel { display: grid; gap: 12px; }
.group { padding: 14px 14px 14px; border-radius: 18px; background: #fff; border: 1px solid var(--line); display: grid; gap: 10px; }
.group h2 { margin: 0; font: 500 16px var(--hand); color: #5a4650; }
.group h3 { margin: 2px 0 0; font: 500 13px var(--hand); color: var(--soft); }
label { display: grid; gap: 3px; font-size: 12px; color: var(--soft); }
input:not([type="checkbox"]):not([type="color"]), select, textarea { width: 100%; min-width: 0; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); background: #fffafb; color: var(--ink); font-size: 14px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--pink); box-shadow: 0 0 0 3px #fde3ea; }
textarea { resize: vertical; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: end; }
label.check { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink); padding-bottom: 8px; }
.fields { display: grid; gap: 8px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button, .seg button { padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line); background: #fffafb; font-size: 13px; }
.chips button.on, .seg button.on { background: #fde3ea; border-color: var(--pink); color: var(--pink-d); font-weight: 500; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg.icons button { width: 44px; height: 40px; padding: 0; font-size: 18px; border-radius: 12px; }

.pets { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.pets button { aspect-ratio: 1; border-radius: 14px; border: 1px solid var(--line); background: #fffafb; padding: 4px; display: grid; place-items: center; font-size: 11px; color: var(--soft); }
.pets button img { width: 100%; height: auto; }
.pets button.on { border-color: var(--pink); background: #fde3ea; box-shadow: 0 0 0 2px #fde3ea; }

.themes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.themes button { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 12px; border: 1px solid var(--line); background: #fffafb; font-size: 12px; text-align: left; }
.themes button i { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.themes button.on { border-color: var(--pink); background: #fde3ea; }
.colors { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.colors label { justify-items: center; text-align: center; }
.colors input { width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; }
.colors input::-webkit-color-swatch-wrapper { padding: 0; }
.colors input::-webkit-color-swatch { border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px var(--line); }

.foot { text-align: center; color: var(--soft); font-size: 11px; padding: 0 16px 24px; }
.toast { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translate(-50%, 140%); padding: 8px 18px; border-radius: 99px; background: #fff; box-shadow: 0 8px 20px rgba(110, 80, 90, 0.18); transition: transform 0.3s, opacity 0.3s; opacity: 0; pointer-events: none; z-index: 10; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* scan check, logo, A4 sheet */
.scan { margin: 0; padding: 5px 12px; border-radius: 99px; font-size: 13px; text-align: center; }
.scan.wait { color: var(--soft); background: #f6f0f2; }
.scan.ok { color: #2f7d55; background: #e3f6ea; }
.scan.bad { color: #a0561a; background: #fff0dc; border-radius: 14px; }
.btn.small { min-height: 32px; padding: 0 12px; font-size: 13px; }
.logo-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.logo-row img { width: 40px; height: 40px; object-fit: contain; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
.hint { margin: 0; font-size: 12px; color: var(--soft); }
.pets { grid-template-columns: repeat(5, 1fr); }
.sheet { border: 0; padding: 0; border-radius: 22px; width: min(640px, calc(100vw - 24px)); background: #fffafb; color: var(--ink); box-shadow: 0 24px 60px rgba(90, 60, 70, 0.3); }
.sheet::backdrop { background: rgba(60, 40, 50, 0.35); }
.sh-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 6px; }
.sh-head h2 { margin: 0; font: 500 20px var(--hand); }
.sh-body { display: grid; grid-template-columns: auto 1fr; gap: 16px; padding: 6px 16px 18px; align-items: start; }
@media (max-width: 560px) { .sh-body { grid-template-columns: 1fr; justify-items: center; } }
#sheet-prev { width: 220px; height: auto; border-radius: 6px; box-shadow: 0 4px 16px rgba(90, 60, 70, 0.18); background: #fff; }
.sh-side { display: grid; gap: 10px; align-content: start; }
.sh-side .lbl { margin: 0; font-size: 13px; color: var(--soft); }
.print-only { display: none; }
@media print {
  @page { size: A4; margin: 0; }
  body > *:not(#print-img) { display: none !important; }
  body { background: #fff !important; }
  #print-img { display: block !important; width: 210mm; height: 297mm; }
}
