:root {
  --bg: #f4f3ef;
  --panel: #ffffff;
  --ink: #1c1b19;
  --muted: #6b6860;
  --line: #e2dfd7;
  --accent: #b4532a;
  --accent-ink: #ffffff;
  --stage: #e9e6de;
  --warn: #9a3412;
  --warn-bg: #fff4ec;
  --ok: #166534;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161513;
    --panel: #201f1c;
    --ink: #ecebe6;
    --muted: #a19d93;
    --line: #34322d;
    --accent: #e07a4a;
    --stage: #121110;
    --warn: #fdba74;
    --warn-bg: #2a1d14;
    --ok: #86efac;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 14px; overflow-x: hidden; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand .logo { width: 34px; height: 34px; border-radius: 8px; display: block; }
.brand h1 .by { color: var(--accent); font-weight: 600; white-space: nowrap; }
.brand h1 { margin: 0; font-size: 17px; }
.brand p { margin: 0; color: var(--muted); font-size: 12px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }

button, select, input, textarea { font: inherit; color: inherit; }
button {
  border: 1px solid var(--line); background: var(--panel); padding: 7px 12px; border-radius: 8px; cursor: pointer;
}
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.layout { display: grid; grid-template-columns: 360px 1fr; min-height: calc(100vh - 62px); }
.panel {
  background: var(--panel); border-right: 1px solid var(--line); padding: 8px 14px 40px;
  overflow-y: auto; max-height: calc(100vh - 62px); position: sticky; top: 62px;
}
details { border-bottom: 1px solid var(--line); padding: 8px 0 12px; }
summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); margin-top: 8px; }
label.row { flex-direction: column; }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); font-size: 13px; }
label.check.pad { margin-top: 26px; }
input[type=text], input[type=number], select, textarea {
  width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); color: var(--ink);
}
textarea { resize: vertical; }
input[type=color] { width: 100%; height: 34px; padding: 2px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.hint { color: var(--muted); font-size: 12px; margin: 6px 0 0; line-height: 1.45; }
.field { display: flex; gap: 8px; align-items: flex-start; margin-top: 8px; }
.field input[type=checkbox] { margin-top: 10px; }
.field .lbl { padding-top: 7px; flex: 1; }
.field input[type=text], .field textarea { flex: 1; min-width: 0; }
.field .pct { display: flex; align-items: center; gap: 2px; flex: none; font-size: 12px; color: var(--muted); }
.field .pct input { width: 56px; padding: 7px 4px; text-align: right; }
.chiprow { display: flex; align-items: baseline; gap: 8px; }
.chiprow > span { flex: none; width: 74px; font-size: 12px; color: var(--muted); }
.chiprow .chips { flex: 1; }
.blankcta { width: 100%; margin-top: 6px; font-size: 13px; text-align: left; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.chips button { padding: 3px 8px; font-size: 12px; border-radius: 999px; }
.chips button.active { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.care { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 8px; }
.care label {
  margin: 0; flex-direction: column; align-items: center; gap: 2px; padding: 5px 2px; border: 1px solid var(--line);
  border-radius: 8px; cursor: pointer; color: var(--ink); font-size: 10px; text-align: center;
}
.care label:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.care input { display: none; }
.care svg { width: 26px; height: 26px; }

.workspace { display: flex; flex-direction: column; min-width: 0; }
.toolbar {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--panel);
}
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs button.active { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.tabs button[disabled] { opacity: .4; cursor: not-allowed; }
.tools { display: flex; gap: 10px; align-items: center; }
.tools label { margin: 0; }
.tools select { width: auto; }
.stage {
  flex: 1; min-height: 360px; overflow: auto; display: grid; place-items: center; padding: 24px;
  background-color: var(--stage);
  background-image: radial-gradient(color-mix(in srgb, var(--muted) 30%, transparent) 1px, transparent 1px);
  background-size: 18px 18px;
}
.stage svg { display: block; filter: drop-shadow(0 6px 14px rgba(0,0,0,.18)); }
.info { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 14px 16px; background: var(--panel); border-top: 1px solid var(--line); }
.spec table { border-collapse: collapse; width: 100%; font-size: 13px; }
.spec td { padding: 4px 6px; border-bottom: 1px solid var(--line); }
.spec td:first-child { color: var(--muted); width: 48%; }
.warnings { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.warnings li { padding: 7px 10px; border-radius: 8px; background: var(--warn-bg); color: var(--warn); margin-bottom: 6px; }
.warnings li.ok { background: transparent; color: var(--ok); border: 1px solid var(--line); }

button.danger { color: #b91c1c; }
@media (prefers-color-scheme: dark) { button.danger { color: #fca5a5; } }
button:disabled { opacity: .5; cursor: not-allowed; }

/* Ảnh / logo */
.upl { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
label.btn {
  flex-direction: row; justify-content: center; margin: 0; padding: 10px; border-radius: 8px; cursor: pointer;
  border: 1px dashed var(--accent); color: var(--accent); font-size: 13px; font-weight: 600; text-align: center;
}
label.btn:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.imglist { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.thumb {
  width: 56px; height: 56px; padding: 3px; border-radius: 8px; display: grid; place-items: center;
  background: repeating-conic-gradient(#d9d6ce 0 25%, #fff 0 50%) 0 0 / 10px 10px;
}
.thumb.active { outline: 2px solid var(--accent); outline-offset: 1px; }
.thumb img { max-width: 100%; max-height: 100%; display: block; }
.btnrow { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.btnrow button { padding: 6px 10px; font-size: 13px; }
input[type=range] { width: 100%; accent-color: var(--accent); }

.viewer { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.stage svg { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.stage svg [data-img] { cursor: move; }
.stage svg [data-handle=resize] { cursor: nwse-resize; }
.stage svg [data-handle=rotate] { cursor: grab; }
.stage.drop { outline: 3px dashed var(--accent); outline-offset: -10px; }
.imgbar {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 8px 12px;
  background: var(--panel); border-top: 1px solid var(--line);
}
.imgbar[hidden] { display: none; }
.imgbar .name { font-size: 12px; color: var(--muted); max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.imgbar label { flex-direction: row; align-items: center; gap: 4px; margin: 0; font-size: 12px; }
.imgbar input { width: 64px; padding: 5px 6px; }
.imgbar button { padding: 5px 9px; font-size: 13px; }

/* Hộp thoại */
dialog {
  border: 1px solid var(--line); border-radius: 14px; padding: 0; background: var(--panel); color: var(--ink);
  width: min(460px, calc(100vw - 24px)); max-height: calc(100dvh - 24px);
}
dialog::backdrop { background: rgba(0,0,0,.45); }
dialog form { padding: 16px 18px; display: flex; flex-direction: column; }
dialog h2 { margin: 0 0 4px; font-size: 17px; }
dialog .note { min-height: 1.2em; font-size: 13px; color: var(--accent); margin: 8px 0 0; }
dialog textarea { margin-top: 8px; }
.dlgbtns { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.dlgbtns button[hidden] { display: none; }

/* Mẫu tự động */
button.magic { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.tplcta {
  width: 100%; margin-top: 6px; padding: 10px; text-align: left; font-size: 13px; font-weight: 600; color: var(--accent);
  border: 1px dashed var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent);
}
dialog.wide { width: min(1040px, calc(100vw - 24px)); }
.tplwrap { display: grid; grid-template-columns: 300px 1fr; gap: 18px; margin-top: 6px; }
.tplstep { margin: 12px 0 0; font-weight: 600; font-size: 13px; }
.tplind { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
.tplind button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; font-size: 12px; text-align: center; }
.tplind button span { font-size: 22px; line-height: 1; }
.tplind button.active, #tplSizes button.active {
  border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); font-weight: 600;
}
.tplhead { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.tplhead .btnrow { margin-top: 8px; }
.tplgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin-top: 10px; }
.tpl { display: flex; flex-direction: column; gap: 4px; padding: 8px; text-align: left; border-radius: 12px; }
.tpl:hover { box-shadow: 0 4px 14px rgba(0,0,0,.12); }
.tplsvg {
  display: grid; place-items: center; height: 150px; padding: 10px; border-radius: 8px;
  background: var(--stage);
}
.tplsvg svg { max-width: 100%; height: auto; filter: drop-shadow(0 3px 8px rgba(0,0,0,.2)); }
.tplname { font-weight: 600; font-size: 13px; }
.tplmeta { font-size: 11px; color: var(--muted); }
.tplmeta b { color: var(--ok); font-weight: 500; }
.tplmeta em { color: var(--warn); font-style: normal; }

#toast {
  position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 30px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--panel); padding: 10px 14px; border-radius: 10px; font-size: 13px;
  max-width: min(520px, calc(100vw - 32px)); transition: .25s; z-index: 50; box-shadow: 0 6px 20px rgba(0,0,0,.25);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

#printArea { display: none; }
#printArea .pcap { font: 9pt system-ui, Arial, sans-serif; color: #444; margin: 3mm 0 0; }
#printArea .pcal { height: 0; border-top: 0.3mm solid #000; margin-top: 4mm; position: relative; }
#printArea .pcal::before, #printArea .pcal::after { content: ""; position: absolute; top: -1.5mm; height: 3mm; border-left: 0.3mm solid #000; }
#printArea .pcal::before { left: 0; } #printArea .pcal::after { right: 0; }
@media print {
  body { background: #fff !important; }
  body > *:not(#printArea) { display: none !important; }
  #printArea { display: block !important; }
  #printArea img { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .panel, .viewer, .info { min-width: 0; }
  .panel select, .panel input, .panel textarea { max-width: 100%; }
  .topbar { position: static; padding: 8px 12px; }
  .brand p { display: none; }
  .actions button { padding: 7px 10px; }
  /* Điện thoại: khung xem dính trên cùng, bảng điều khiển cuộn bên dưới. */
  .workspace { display: contents; }
  .viewer { order: -1; position: sticky; top: 0; z-index: 4; box-shadow: 0 4px 12px rgba(0,0,0,.12); }
  .toolbar { padding: 8px 10px; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; }
  .tabs button { white-space: nowrap; padding: 6px 10px; }
  .stage { height: 42vh; height: 42dvh; min-height: 220px; padding: 12px; flex: none; }
  .panel { position: static; max-height: none; border-right: 0; border-bottom: 1px solid var(--line); order: 0; }
  .info { grid-template-columns: 1fr; order: 1; }
  input, select, textarea { font-size: 16px; } /* tránh iOS tự phóng to khi chạm ô nhập */
  .ptabs { position: static; }
  .toolbar .tools { flex-wrap: wrap; }
  dialog.wide { width: 100vw; max-width: 100vw; max-height: 100dvh; height: 100dvh; border-radius: 0; }
  .tplwrap { grid-template-columns: 1fr; }
  .tplind { grid-template-columns: repeat(3, 1fr); }
  .tplgrid { grid-template-columns: 1fr 1fr; }
}

/* ===== Bảng điều khiển dạng tab ===== */
.ptabs {
  display: flex; flex-wrap: wrap; gap: 4px; position: sticky; top: -8px; z-index: 3;
  background: var(--panel); padding: 10px 0 8px; margin: 0 0 4px; border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}
.ptabs::-webkit-scrollbar { display: none; }
.ptabs button { white-space: nowrap; padding: 6px 10px; font-size: 13px; border-radius: 999px; }
.ptabs button.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.pane { padding: 4px 0 16px; }
.pane h3 { font-size: 13px; margin: 16px 0 6px; color: var(--ink); }
.pane > select { width: 100%; }
.bigbtn {
  width: 100%; margin-top: 10px; padding: 11px; font-weight: 700; font-size: 14px;
  border: 1.5px dashed var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent);
}
.card { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-top: 10px; background: var(--bg); }
label.check.big { font-size: 14px; margin-top: 0; }

/* Bảng màu nhanh */
.colorrow { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.colorrow input[type=color] { width: 44px; height: 34px; flex: none; }
.swatches { display: flex; flex-wrap: wrap; gap: 5px; }
.sw {
  width: 24px; height: 24px; padding: 0; border-radius: 50%; border: 1px solid rgba(0,0,0,.18);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.25);
}
.sw.active { outline: 2px solid var(--accent); outline-offset: 2px; }
.sw.none { background: var(--panel); color: #b91c1c; font-size: 13px; line-height: 1; }

/* Lưới phông chữ */
.fontgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
.fontgrid button { padding: 8px 4px 6px; font-size: 17px; line-height: 1.15; display: flex; flex-direction: column; align-items: center; gap: 2px; overflow: hidden; }
.fontgrid button small { font: 10px system-ui, sans-serif; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.fontgrid button.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }

/* Thẻ gợi ý tải ảnh */
.pickcards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.pickcard { text-align: left; padding: 10px; display: flex; flex-direction: column; gap: 4px; border-radius: 12px; }
.pickcard b { font-size: 13.5px; }
.pickcard span { font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.pickcard:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }

/* Công cụ vẽ */
.toolgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
.toolgrid button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; font-size: 12px; }
.toolgrid button b { font-size: 18px; line-height: 1; }
.toolgrid button.active { background: #7c3aed; color: #fff; border-color: #7c3aed; }
.layers { display: flex; flex-direction: column; gap: 4px; }
.layer { text-align: left; display: flex; gap: 8px; align-items: center; padding: 6px 10px; font-size: 13px; overflow: hidden; white-space: nowrap; }
.layer b { width: 18px; text-align: center; color: #7c3aed; }
.layer.active { border-color: #7c3aed; background: color-mix(in srgb, #7c3aed 10%, transparent); }
.stage.drawing svg { cursor: crosshair; }
.stage svg [data-obj] { cursor: move; }

/* Bảng "Đang chọn" */
.objprops {
  border: 1.5px solid #7c3aed; border-radius: 12px; padding: 8px 12px 12px; margin: 10px 0 4px;
  background: color-mix(in srgb, #7c3aed 5%, var(--panel));
}
.objprops[hidden], .objprops [hidden] { display: none !important; }
.objhead { display: flex; justify-content: space-between; align-items: center; }
.objhead button { padding: 2px 9px; }
.checks { display: flex; gap: 16px; }

/* Mục nâng cao thu gọn — giữ giao diện tối giản cho người mới */
details.adv { border: 1px solid var(--line); border-radius: 10px; padding: 0 10px; margin-top: 14px; }
details.adv > summary { font-size: 13px; color: var(--muted); padding: 9px 0; font-weight: 500; }
details.adv[open] { padding-bottom: 10px; }

/* Lấy chữ từ ảnh: gợi ý phông */
.ocrhead { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; gap: 8px; }
.matchlist { display: grid; gap: 6px; margin: 8px 0; }
.matchlist button { font-size: 22px; padding: 8px 10px; display: flex; flex-direction: column; align-items: flex-start; text-align: left; overflow: hidden; white-space: nowrap; }
.matchlist button small { font: 11px system-ui, sans-serif; color: var(--muted); }
.matchlist button:first-child { border-color: var(--accent); }
.sw.orig { width: auto; border-radius: 999px; padding: 0 8px; font-size: 11px; background: var(--panel); }

.glyphnote { border: 1px dashed #7c3aed; border-radius: 10px; padding: 4px 10px 8px; margin-top: 6px; }
.glyphnote button { padding: 4px 10px; font-size: 12px; }
#ocrCopy:disabled { opacity: .45; }
.bigbtn.alt { border-style: solid; border-color: var(--line); color: var(--ink); background: var(--panel); font-weight: 600; margin-top: 6px; }
.relayout { width: 100%; margin-top: 8px; font-weight: 600; color: var(--accent); border-color: var(--accent); }
.manualnote { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 8px; padding: 8px 10px; border: 1px dashed var(--accent); border-radius: 10px; font-size: 13px; }
.manualnote .relayout { width: auto; margin: 0; }
#stage [data-line] { cursor: pointer; }
#stage [data-line]:hover rect { fill: rgba(124, 58, 237, 0.07); }
.manualnote[hidden] { display: none; }
#printArea .techprint { margin-top: 6mm; border-collapse: collapse; width: 150mm; font: 9.5pt Arial, sans-serif; color: #111; }
#printArea .techprint caption { text-align: left; font-weight: 700; padding: 1.5mm 2mm; background: #efe9dc; border: 0.3mm solid #222; border-bottom: 0; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
#printArea .techprint th, #printArea .techprint td { border: 0.2mm solid #8a857b; padding: 1.2mm 2mm; text-align: left; vertical-align: top; }
#printArea .techprint th { width: 45mm; }
.techmaster { padding: 8px 10px; border: 1px solid var(--accent); border-radius: 10px; }
.techrow { display: flex; gap: 8px; align-items: flex-start; margin-top: 8px; }
.techrow > input[type=checkbox] { margin-top: 24px; flex: none; }
.techrow > label { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.techrow .qty { display: flex; align-items: center; gap: 6px; color: var(--ink, inherit); }
.techrow .qty input { flex: 1; min-width: 0; }
/* Hộp thoại in: cài đặt + xem trước */
.prgrid { display: grid; grid-template-columns: minmax(240px, 320px) 1fr; gap: 14px; align-items: start; }
.prprev { display: flex; flex-wrap: wrap; gap: 12px; padding: 12px; min-height: 180px; background: var(--panel2, #ece8df); border-radius: 10px; max-height: 60vh; overflow: auto; align-content: flex-start; }
.prprev figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.prprev .pg { background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.prprev .pg svg { display: block; }
.prprev figcaption { font-size: 11px; color: var(--muted); text-align: center; max-width: 190px; }
@media (max-width: 720px) { .prgrid { grid-template-columns: 1fr; } }
#printArea img { display: block; break-after: page; page-break-after: always; }
#printArea img:last-child { break-after: auto; page-break-after: auto; }
.expreview { margin-top: 10px; max-height: 220px; width: 100%; background: repeating-conic-gradient(#eee 0 25%, #fff 0 50%) 0 0 / 12px 12px; border-radius: 8px; display: flex; justify-content: center; }
.expreview svg { max-height: 220px; width: 100%; }
dialog .note a { margin-left: 4px; font-weight: 600; }
/* Lịch sử */
.histlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; margin-top: 10px; max-height: 55vh; overflow: auto; }
.histitem { display: flex; gap: 6px; align-items: stretch; border: 1px solid var(--line, #ddd); border-radius: 10px; padding: 6px; }
.histitem.cur { border-color: var(--accent); }
.histopen { flex: 1; display: flex; gap: 8px; align-items: center; text-align: left; background: none; border: 0; padding: 2px; min-width: 0; }
.histopen img, .histopen .noimg { width: 72px; height: 48px; object-fit: contain; background: #f4f1ea; border-radius: 6px; flex: none; display: grid; place-items: center; font-size: 11px; color: var(--muted); }
.histopen span { display: flex; flex-direction: column; min-width: 0; }
.histopen b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.histopen small { color: var(--muted); font-size: 11px; }

/* Logo vẽ sẵn */
.logogrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; margin-bottom: 10px; }
.logopick { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; font-size: 11px; line-height: 1.2; text-align: center; }
.logopick svg { width: 40px; height: 40px; color: var(--ink, #1c1b19); }
.pane button.wide { width: 100%; margin: 6px 0; justify-content: center; }

/* Nút đóng ✕ ở góc mọi hộp thoại */
dialog > .dlgx { position: sticky; top: 0; float: right; z-index: 5; width: 36px; height: 36px; padding: 0; margin: -4px -4px 0 8px;
  border-radius: 50%; font-size: 18px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }

/* Lối vào trò chơi */
a.btnlink { display: inline-flex; align-items: center; padding: 7px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--ink); text-decoration: none; font-size: 14px; white-space: nowrap; }
a.btnlink:hover { border-color: var(--accent); }
a.btnlink.homeBtn { background: #0d1f3c; color: #fff; border-color: #0d1f3c; font-weight: 700; }
a.btnlink.homeBtn:hover { background: #16305a; }
a.gamecard { display: flex; flex-direction: column; gap: 4px; padding: 12px; margin-bottom: 12px; border: 1px dashed var(--accent); border-radius: 12px; color: var(--ink); text-decoration: none; background: var(--warn-bg); }
a.gamecard span { color: var(--muted); font-size: 13px; }
/* Nút gửi thiết kế sang form báo giá */
.topbar button.quoteBtn { background: #0f8b8d; color: #fff; border-color: #0f8b8d; font-weight: 700; }
.topbar button.quoteBtn:hover { background: #0b6f71; border-color: #0b6f71; }
/* Hộp mẫu tự động: nút "tự thiết kế từ đầu" nổi bật ở đầu hộp */
.tpltop { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.tpltop h2 { margin-bottom: 4px; }
.blankbig { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px 18px; border: 2px solid var(--accent); background: var(--accent); color: var(--accent-ink, #fff); border-radius: 12px; font-size: 16px; font-weight: 700; cursor: pointer; text-align: left; box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent); }
.blankbig small { font-size: 12.5px; font-weight: 400; opacity: .9; }
.blankbig:hover { filter: brightness(1.06); }
@media (max-width: 700px) { .blankbig { width: 100%; } }
