/* Giao diện "bút sáp": giấy kem, nét vẽ tay, màu sáp tươi */
:root {
    --paper: #FFFBEF;
    --paper2: #FFF3D1;
    --ink: #2D2A26;
    --ink2: #5A5248;
    --red: #E8473C;
    --red-d: #C2322A;
    --yellow: #FFD23F;
    --yellow-d: #F2B705;
    --blue: #3FA7D6;
    --blue-d: #2A86B2;
    --green: #5BBF5B;
    --green-d: #3E9A3E;
    --purple: #9B5DE5;
    --wob: 255px 14px 225px 14px / 14px 225px 14px 255px;
    --wob2: 14px 225px 14px 255px / 255px 14px 225px 14px;
    --font-h: 'Itim', 'Mali', 'Comic Sans MS', system-ui, sans-serif;
    --font-b: 'Mali', 'Itim', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { animation: none !important; transition: none !important; } }
body {
    margin: 0;
    font-family: var(--font-b);
    font-size: 16px;
    line-height: 1.55;
    color: var(--ink);
    background-color: var(--paper);
    background-image:
        url("doodles.svg"),
        repeating-linear-gradient(0deg, transparent 0 31px, rgba(63, 167, 214, .09) 31px 32px);
    background-size: 400px 400px, auto;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--blue-d); }
img { max-width: 100%; }
h1, h2, h3 { font-family: var(--font-h); font-weight: 400; line-height: 1.2; margin: 0 0 .4em; letter-spacing: .01em; }
.wrap { width: min(1080px, 100% - 32px); margin: 0 auto; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 12px; z-index: 99; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px dashed var(--blue-d); outline-offset: 3px; }

/* ---------- thanh trên ---------- */
.top { position: sticky; top: 0; z-index: 20; background: rgba(255, 251, 239, .94); backdrop-filter: blur(6px); border-bottom: 3px solid var(--ink); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--font-h); font-size: 23px; }
.brand img { width: 46px; height: 46px; }
.nav { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.nav a { text-decoration: none; color: var(--ink); font-weight: 700; padding: 6px 12px; border: 2.5px solid transparent; border-radius: var(--wob); }
.nav a:hover, .nav a.on { border-color: var(--ink); background: var(--yellow); }

/* ---------- nút ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 20px; font: inherit; font-family: var(--font-h); font-size: 18px; line-height: 1.2;
    color: var(--ink); background: #fff; border: 3px solid var(--ink); border-radius: var(--wob);
    box-shadow: 4px 4px 0 var(--ink); cursor: pointer; text-decoration: none;
    transition: transform .08s, box-shadow .08s;
}
.btn:hover { transform: translate(-1px, -2px) rotate(-.6deg); box-shadow: 5px 6px 0 var(--ink); }
.btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.btn[disabled] { opacity: .6; cursor: not-allowed; transform: none; }
.btn-red { background: var(--red); color: #fff; }
.btn-yellow { background: var(--yellow); }
.btn-blue { background: var(--blue); color: #fff; }
.btn-green { background: var(--green); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 15px; box-shadow: 3px 3px 0 var(--ink); }
.btn-block { width: 100%; }

/* ---------- khối giấy ---------- */
.card { background: #fff; border: 3px solid var(--ink); border-radius: var(--wob2); padding: 22px; box-shadow: 6px 6px 0 rgba(45, 42, 38, .9); margin-bottom: 22px; }
.card.tape { position: relative; }
.card.tape::before { content: ""; position: absolute; top: -14px; left: 50%; width: 110px; height: 26px; transform: translateX(-50%) rotate(-3deg); background: rgba(255, 210, 63, .75); border: 2px dashed rgba(45, 42, 38, .35); }
.muted { color: var(--ink2); }
.small { font-size: 14px; }
.scribble { background: linear-gradient(transparent 62%, rgba(255, 210, 63, .85) 62% 90%, transparent 90%); padding: 0 4px; }

/* ---------- thông báo ---------- */
.alert { padding: 12px 16px; border: 3px solid var(--ink); border-radius: var(--wob); margin: 16px 0; font-weight: 700; }
.alert-ok { background: #DDF4D8; }
.alert-err { background: #FFE0DA; }
.alert-warn { background: #FFF1BF; }

/* ---------- hero ---------- */
.hero { padding: 40px 0 26px; }
.hero .wrap { display: grid; grid-template-columns: 1.15fr .85fr; gap: 26px; align-items: center; }
.hero h1 { font-size: clamp(34px, 6vw, 58px); }
.hero h1 .c1 { color: var(--red); }
.hero h1 .c2 { color: var(--blue-d); }
.hero p.lead { font-size: 18px; color: var(--ink2); max-width: 520px; }
.hero-art { position: relative; }
.hero-art img { width: 100%; max-width: 380px; display: block; margin: 0 auto; animation: bob 3.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-8px) rotate(-2deg); } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 22px; padding: 0; list-style: none; }
.chips li { padding: 4px 12px; background: #fff; border: 2.5px solid var(--ink); border-radius: var(--wob); font-weight: 700; font-size: 14px; }
.chips li:nth-child(3n+1) { transform: rotate(-1.5deg); background: #E3F4FB; }
.chips li:nth-child(3n+2) { transform: rotate(1deg); background: #FFF1BF; }
.chips li:nth-child(3n) { transform: rotate(-.5deg); background: #E2F5DF; }

/* ---------- bảng giá ---------- */
.sec { padding: 26px 0; }
.sec-title { text-align: center; font-size: clamp(28px, 4.5vw, 40px); margin-bottom: 8px; }
.sec-sub { text-align: center; color: var(--ink2); margin: 0 auto 26px; max-width: 560px; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 22px; }
.plan { position: relative; display: flex; flex-direction: column; gap: 10px; background: #fff; border: 3px solid var(--ink); border-radius: var(--wob2); padding: 24px 22px; box-shadow: 6px 6px 0 var(--ink); }
.plan:nth-child(1) { transform: rotate(-.8deg); }
.plan:nth-child(2) { transform: rotate(.6deg); background: #FFF8DC; }
.plan:nth-child(3) { transform: rotate(-.4deg); }
.plan .tag { align-self: flex-start; font-family: var(--font-h); font-size: 15px; padding: 2px 12px; border: 2.5px solid var(--ink); border-radius: var(--wob); background: var(--blue); color: #fff; }
.plan:nth-child(2) .tag { background: var(--red); }
.plan .ribbon { position: absolute; top: -16px; right: 14px; transform: rotate(4deg); background: var(--yellow); border: 2.5px solid var(--ink); padding: 2px 12px; font-family: var(--font-h); border-radius: var(--wob); }
.plan h3 { font-size: 26px; margin: 4px 0 0; }
.plan .price { font-family: var(--font-h); font-size: 44px; line-height: 1; color: var(--red); }
.plan .price small { font-size: 17px; color: var(--ink2); }
.plan ul { margin: 6px 0 10px; padding: 0; list-style: none; display: grid; gap: 6px; }
.plan li { padding-left: 26px; position: relative; }
.plan li::before { content: "✔"; position: absolute; left: 0; color: var(--green-d); font-weight: 700; }
.plan .btn { margin-top: auto; }
.plan.off { opacity: .6; }

/* ---------- form ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 700; margin-bottom: 5px; }
.inp, .field input[type=text], .field input[type=password], .field input[type=number], .field input[type=url], .field input[type=search], .field select, .field textarea {
    width: 100%; padding: 11px 14px; font: inherit; font-size: 16px; color: var(--ink); background: #fff;
    border: 3px solid var(--ink); border-radius: var(--wob); outline: none;
}
.inp:focus, .field input:focus, .field select:focus, .field textarea:focus { box-shadow: 4px 4px 0 var(--yellow-d); }
.row { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; }
.row > .inp, .row > input { flex: 1 1 200px; min-width: 0; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 700; cursor: pointer; margin: 8px 0; }
.check input { width: 20px; height: 20px; accent-color: var(--red); }
.hint { font-size: 13.5px; color: var(--ink2); margin-top: 4px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.who { display: flex; align-items: center; gap: 10px; margin-top: 8px; padding: 8px 12px; border: 2.5px dashed var(--green-d); border-radius: var(--wob); background: #E9F8E6; font-weight: 700; }
.who[hidden] { display: none; }
.who.bad { border-color: var(--red-d); background: #FFE7E2; color: var(--red-d); }
.who img { width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--ink); object-fit: cover; }

/* ---------- hộp thoại mua ---------- */
dialog.buy { border: 3px solid var(--ink); border-radius: var(--wob2); padding: 0; width: min(440px, 100% - 24px); box-shadow: 8px 8px 0 var(--ink); background: var(--paper); color: var(--ink); }
dialog.buy::backdrop { background: rgba(45, 42, 38, .45); }
.buy-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 3px dashed var(--ink); background: var(--paper2); }
.buy-head h3 { margin: 0; font-size: 24px; }
.buy-body { padding: 20px; }
.x { background: #fff; border: 2.5px solid var(--ink); border-radius: 50%; width: 38px; height: 38px; font-size: 20px; cursor: pointer; }

/* ---------- các bước ---------- */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 18px; counter-reset: s; padding: 0; list-style: none; }
.steps li { counter-increment: s; background: #fff; border: 3px solid var(--ink); border-radius: var(--wob); padding: 18px 16px 16px 60px; position: relative; }
.steps li::before { content: counter(s); position: absolute; left: 14px; top: 14px; width: 34px; height: 34px; display: grid; place-items: center; font-family: var(--font-h); font-size: 20px; background: var(--yellow); border: 2.5px solid var(--ink); border-radius: 50%; }
.steps li:nth-child(2)::before { background: #BEE6F6; }
.steps li:nth-child(3)::before { background: #CDEFC8; }
.steps li:nth-child(4)::before { background: #FFD0CB; }
.steps b { font-family: var(--font-h); font-weight: 400; font-size: 19px; display: block; }

/* ---------- đơn hàng ---------- */
.order-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }
.qr { width: 100%; max-width: 320px; aspect-ratio: 1; display: block; margin: 0 auto; background: #fff; border: 3px solid var(--ink); border-radius: 18px; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 14px; margin: 0; }
dl.kv dt { color: var(--ink2); font-weight: 700; }
dl.kv dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.code { overflow-wrap: anywhere; word-break: break-all; font-family: ui-monospace, Menlo, monospace; background: var(--paper2); padding: 2px 8px; border: 2px dashed var(--yellow-d); border-radius: 6px; }
.copy { margin-left: 6px; }
.wait { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink2); margin-top: 14px; }
.pencil { width: 26px; height: 26px; animation: draw 1.2s ease-in-out infinite; }
@keyframes draw { 50% { transform: translateX(8px) rotate(14deg); } }
.done-box { background: #E9F8E6; border: 3px solid var(--green-d); border-radius: var(--wob); padding: 18px; }
.linkbox { display: flex; gap: 8px; margin: 8px 0; flex-wrap: wrap; }
.linkbox input { flex: 1 1 220px; min-width: 0; padding: 10px 12px; border: 3px solid var(--ink); border-radius: var(--wob); font: inherit; font-weight: 700; background: #fff; }

/* ---------- badge ---------- */
.b { display: inline-block; padding: 2px 10px; border: 2px solid var(--ink); border-radius: var(--wob); font-weight: 700; font-size: 13.5px; white-space: nowrap; }
.b-green { background: #CDEFC8; } .b-amber { background: #FFF1BF; } .b-blue { background: #CFEAF7; } .b-red { background: #FFD0CB; } .b-gray { background: #EEE; }

/* ---------- bảng ---------- */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { padding: 10px 8px; border-bottom: 2px dashed rgba(45, 42, 38, .25); text-align: left; vertical-align: top; }
.tbl th { font-family: var(--font-h); font-weight: 400; font-size: 16px; }
.tbl-wrap { overflow-x: auto; }

/* ---------- khung widget ---------- */
.frames { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; }
.frame { position: relative; cursor: pointer; }
.frame[hidden] { display: none; }
.frame input { position: absolute; opacity: 0; }
.frame span { display: grid; gap: 4px; padding: 6px; background: #fff; border: 2.5px solid var(--ink); border-radius: 14px; text-align: center; font-size: 12px; font-weight: 700; }
.frame img { width: 100%; aspect-ratio: 1; object-fit: contain; background: repeating-conic-gradient(#F3EBD6 0% 25%, #fff 0% 50%) 50% / 14px 14px; border-radius: 8px; }
.frame input:checked + span { background: var(--yellow); box-shadow: 3px 3px 0 var(--ink); }
.frame input:focus-visible + span { outline: 3px dashed var(--blue-d); outline-offset: 2px; }
.cats { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.cat { padding: 5px 12px; background: #fff; border: 2.5px solid var(--ink); border-radius: var(--wob); font: inherit; font-weight: 700; cursor: pointer; }
.cat.on { background: var(--ink); color: #fff; }
.bar { position: sticky; bottom: 10px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 14px; padding: 12px; background: var(--paper2); border: 3px solid var(--ink); border-radius: var(--wob); }
.bar label { display: inline-flex; gap: 6px; align-items: center; font-weight: 700; }
.bar select, .bar input { padding: 6px 8px; border: 2.5px solid var(--ink); border-radius: 8px; font: inherit; }

/* ---------- chân trang & nút liên hệ ---------- */
.foot { margin-top: 40px; padding: 26px 0 90px; border-top: 3px dashed var(--ink); text-align: center; color: var(--ink2); }
.foot a { margin: 0 8px; }
.fab { position: fixed; right: 16px; bottom: 16px; z-index: 30; display: flex; flex-direction: column; gap: 10px; }
.fab a { width: 54px; height: 54px; display: grid; place-items: center; border: 3px solid var(--ink); border-radius: 50%; box-shadow: 3px 3px 0 var(--ink); font-family: var(--font-h); text-decoration: none; color: #fff; font-size: 15px; }
.fab .z { background: var(--blue); }
.fab .f { background: #4C6EF5; }

/* ---------- admin ---------- */
.adm .top { background: var(--paper2); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { background: #fff; border: 3px solid var(--ink); border-radius: var(--wob); padding: 14px 16px; }
.stat small { display: block; color: var(--ink2); font-weight: 700; }
.stat b { font-family: var(--font-h); font-weight: 400; font-size: 28px; }
.inline { display: inline-flex; gap: 6px; margin: 2px 4px 2px 0; }

@media (max-width: 760px) {
    .top .wrap { flex-wrap: wrap; gap: 6px; padding: 8px 0; }
    .brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 70vw; }
    .nav { width: 100%; flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; padding-bottom: 2px; }
    .nav a { white-space: nowrap; }
    .hero .wrap { grid-template-columns: 1fr; }
    .hero-art { order: -1; }
    .order-grid, .grid2 { grid-template-columns: 1fr; }
    .hero { padding-top: 20px; }
    .hero-art img { max-width: 210px; }
    .brand { font-size: 19px; }
    .brand img { width: 38px; height: 38px; }
    .nav a { padding: 4px 8px; font-size: 14px; }
    .plan { transform: none !important; }
    dl.kv { grid-template-columns: 1fr; gap: 2px; }
    dl.kv dd { margin-bottom: 8px; }
    .frames { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
