:root {
  --blue: #0f6cae;
  --blue-dk: #084d7d;
  --ink: #08233a;
  --ink-2: #405b73;
  --ink-3: #7c91a6;
  --bg: #f4faff;
  --line: rgba(8, 35, 58, 0.09);
  --line-s: rgba(8, 35, 58, 0.18);
  --serif: 'Playfair Display', Georgia, serif;
  --sans: 'Plus Jakarta Sans', system-ui, sans-serif;
  --checker: repeating-conic-gradient(rgba(8, 35, 58, 0.05) 0% 25%, transparent 0% 50%) 0 0 / 22px 22px, #eef6fd;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background:
    radial-gradient(ellipse 70% 40% at 10% 5%, rgba(255, 255, 255, 0.9) 0%, transparent 55%),
    radial-gradient(ellipse 50% 30% at 95% 100%, rgba(218, 239, 255, 0.7) 0%, transparent 60%),
    var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

.kit-shell { display: flex; min-height: 100vh; }

.kit-topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 220;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  background: rgba(244, 250, 255, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}

.kit-topbar-title { font-family: var(--serif); font-weight: 700; font-size: 0.98rem; line-height: 1.1; }

.kit-menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line-s);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 10px 16px;
  cursor: pointer;
}

.kit-menu-btn span.burger { display: inline-flex; flex-direction: column; gap: 3px; }
.kit-menu-btn span.burger i { width: 15px; height: 1.6px; background: var(--ink); border-radius: 2px; }

.kit-scrim {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 230;
  background: rgba(8, 35, 58, 0.4);
}

.kit-side {
  width: 272px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 34px 26px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.66);
  backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.kit-brandrow { display: flex; align-items: center; gap: 13px; }

.kit-brandname { font-family: var(--serif); font-weight: 700; font-size: 1.02rem; line-height: 1.15; }

.kit-brandsub {
  display: block;
  font-family: var(--sans);
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--blue);
  margin-top: 3px;
}

.kit-nav { display: flex; flex-direction: column; gap: 2px; }

.kit-nav a {
  text-decoration: none;
  color: var(--ink-2);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  padding: 10px 12px;
  border-radius: 8px;
  transition: background 0.2s, color 0.2s;
}

.kit-nav a:hover { background: rgba(15, 108, 174, 0.08); color: var(--ink); }

.kit-panel { border-top: 1px solid var(--line); padding-top: 20px; display: flex; flex-direction: column; gap: 12px; }

.kit-label { font-size: 0.62rem; font-weight: 800; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-3); }

.kit-select {
  appearance: none;
  border: 1px solid var(--line-s);
  border-radius: 999px;
  background: #fff url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23405b73' fill='none' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 16px center;
  padding: 11px 38px 11px 16px;
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
}

.kit-check { display: flex; align-items: center; gap: 10px; font-size: 0.82rem; font-weight: 600; color: var(--ink-2); cursor: pointer; user-select: none; }
.kit-check input { accent-color: var(--blue); width: 17px; height: 17px; cursor: pointer; }

.kit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  cursor: pointer;
  border-radius: 999px;
  font-family: var(--sans);
  font-weight: 800;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  padding: 14px 20px;
  background: var(--blue);
  color: #fff;
  box-shadow: 0 4px 18px rgba(15, 108, 174, 0.32);
  transition: background 0.25s, transform 0.18s, opacity 0.2s;
}
.kit-btn:hover { background: var(--blue-dk); transform: translateY(-1px); }
.kit-btn[disabled] { opacity: 0.45; cursor: wait; transform: none; }

.kit-btn.ghost {
  background: transparent;
  color: var(--blue-dk);
  border: 1.5px solid rgba(15, 108, 174, 0.4);
  box-shadow: none;
}
.kit-btn.ghost:hover { background: rgba(15, 108, 174, 0.08); }

.kit-note { font-size: 0.74rem; line-height: 1.65; color: var(--ink-3); border-top: 1px solid var(--line); padding-top: 18px; margin-top: auto; }

.kit-main { flex: 1; min-width: 0; padding: 46px clamp(20px, 4vw, 60px) 90px; }

.kit-hero { max-width: 880px; margin-bottom: 54px; }
.kit-hero h1 { font-family: var(--serif); font-weight: 700; font-size: clamp(2rem, 4vw, 3.1rem); letter-spacing: -0.025em; line-height: 1.06; }
.kit-hero h1 em { font-style: italic; font-weight: 400; color: var(--blue); }
.kit-hero p { margin-top: 16px; color: var(--ink-2); font-size: 0.98rem; line-height: 1.8; max-width: 640px; }

.kit-section { margin-bottom: 76px; scroll-margin-top: 24px; }

.kit-sechead { margin-bottom: 28px; max-width: 760px; }
.kit-sechead .kit-kicker { display: block; font-size: 0.64rem; font-weight: 800; letter-spacing: 0.24em; text-transform: uppercase; color: var(--blue); margin-bottom: 10px; }
.kit-sechead h2 { font-family: var(--serif); font-weight: 700; font-size: clamp(1.5rem, 2.6vw, 2.1rem); letter-spacing: -0.02em; }
.kit-sechead p { margin-top: 10px; color: var(--ink-2); font-size: 0.92rem; line-height: 1.75; }

.art-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); gap: 30px; }
.art-grid.wide { grid-template-columns: 1fr; }

.art-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(8, 35, 58, 0.05);
  transition: box-shadow 0.3s, transform 0.3s;
}
.art-card:hover { box-shadow: 0 14px 40px rgba(8, 35, 58, 0.12); transform: translateY(-3px); }

.art-stage {
  position: relative;
  flex: 1;
  overflow: hidden;
  background: var(--checker);
  border-bottom: 1px solid var(--line);
  cursor: zoom-in;
}
.art-stage::after {
  content: 'Tap to preview & edit';
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 80;
  background: rgba(8, 35, 58, 0.82);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 7px 12px;
  border-radius: 999px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
}
.art-stage:hover::after { opacity: 1; transform: translateY(0); }

.art-frame { position: relative; width: 100%; }

.art-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; flex-wrap: wrap; }
.art-name { font-size: 0.84rem; font-weight: 800; }
.art-dims { font-size: 0.68rem; font-weight: 600; letter-spacing: 0.06em; color: var(--ink-3); margin-top: 2px; }
.art-actions { display: flex; gap: 8px; }

.art-dl {
  border: none;
  cursor: pointer;
  border-radius: 999px;
  font-family: var(--sans);
  font-weight: 800;
  font-size: 0.62rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  padding: 10px 16px;
  background: var(--ink);
  color: #fff;
  transition: background 0.2s, transform 0.15s;
}
.art-dl:hover { background: var(--blue); transform: translateY(-1px); }

.swatch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(190px, 100%), 1fr)); gap: 18px; }

.swatch { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; cursor: pointer; transition: transform 0.25s, box-shadow 0.25s; }
.swatch:hover { transform: translateY(-3px); box-shadow: 0 10px 28px rgba(8, 35, 58, 0.12); }
.swatch-chip { height: 96px; }
.swatch-body { padding: 13px 15px; }
.swatch-name { font-size: 0.8rem; font-weight: 800; }
.swatch-hex { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.08em; color: var(--ink-3); margin-top: 3px; }

.type-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 24px; }

.type-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 30px 32px 26px; box-shadow: 0 2px 10px rgba(8, 35, 58, 0.05); }
.type-sample-a { font-family: var(--serif); font-weight: 700; font-size: 3rem; line-height: 1; letter-spacing: -0.02em; }
.type-sample-b { font-family: var(--sans); font-weight: 800; font-size: 2.4rem; line-height: 1; }
.type-meta { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 0.78rem; color: var(--ink-2); line-height: 1.7; }
.type-meta strong { color: var(--ink); }

.guide-layer { position: absolute; inset: 0; z-index: 60; pointer-events: none; display: none; }
body.guides-on .guide-layer { display: block; }

.guide-line-v, .guide-line-h { position: absolute; background: rgba(255, 45, 85, 0.55); }
.guide-line-v { top: 0; bottom: 0; width: 1px; }
.guide-line-h { left: 0; right: 0; height: 1px; }
.guide-box { position: absolute; border: 1.5px dashed rgba(255, 45, 85, 0.65); }
.guide-tag { position: absolute; background: rgba(255, 45, 85, 0.85); color: #fff; font-size: 9px; font-weight: 800; letter-spacing: 0.08em; padding: 2px 6px; border-radius: 4px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%) translateY(90px);
  background: var(--ink);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 13px 24px;
  border-radius: 999px;
  box-shadow: 0 12px 34px rgba(8, 35, 58, 0.35);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s;
  z-index: 600;
  max-width: 88vw;
  text-align: center;
}

.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

.modal-root { position: fixed; inset: 0; z-index: 400; display: none; }
.modal-root.open { display: block; }

.modal-scrim { position: absolute; inset: 0; background: rgba(5, 18, 32, 0.66); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }

.modal-panel {
  position: absolute;
  inset: 3vh 3vw;
  background: #fff;
  border-radius: 22px;
  box-shadow: 0 40px 90px rgba(0, 0, 0, 0.4);
  display: flex;
  overflow: hidden;
}

.modal-preview {
  flex: 1;
  min-width: 0;
  position: relative;
  background: var(--checker);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 34px;
}

.modal-fit { position: relative; }

.modal-fit .brand-board { box-shadow: 0 30px 80px rgba(8, 35, 58, 0.28); }

.modal-side {
  width: 380px;
  flex-shrink: 0;
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  background: #fbfdff;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--line);
}

.modal-title { font-family: var(--serif); font-weight: 700; font-size: 1.15rem; line-height: 1.2; }
.modal-subtitle { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); margin-top: 5px; }

.modal-close {
  border: 1px solid var(--line-s);
  background: #fff;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 1.05rem;
  line-height: 1;
  color: var(--ink-2);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s, color 0.2s, transform 0.2s;
}
.modal-close:hover { background: var(--ink); color: #fff; transform: rotate(90deg); }

.modal-body { flex: 1; overflow-y: auto; padding: 20px 22px 26px; display: flex; flex-direction: column; gap: 22px; }

.ed-group { display: flex; flex-direction: column; gap: 13px; }

.ed-grouptitle {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--blue);
  display: flex;
  align-items: center;
  gap: 10px;
}
.ed-grouptitle::after { content: ''; height: 1px; flex: 1; background: var(--line); }

.ed-field { display: flex; flex-direction: column; gap: 6px; }
.ed-field label { font-size: 0.66rem; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-3); }

.ed-input {
  width: 100%;
  border: 1.5px solid var(--line-s);
  border-radius: 10px;
  background: #fff;
  padding: 10px 13px;
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s;
}
.ed-input:focus { border-color: var(--blue); }
textarea.ed-input { resize: vertical; min-height: 84px; line-height: 1.6; }

.ed-hint { font-size: 0.68rem; color: var(--ink-3); line-height: 1.5; }

.ed-slot {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.ed-thumb {
  width: 54px;
  height: 54px;
  border-radius: 9px;
  flex-shrink: 0;
  background: var(--checker);
  background-size: cover;
  background-position: center;
  border: 1px solid var(--line-s);
}

.ed-slotinfo { flex: 1; min-width: 0; }
.ed-slotname { font-size: 0.78rem; font-weight: 800; }
.ed-slotsrc { font-size: 0.64rem; font-weight: 600; color: var(--ink-3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ed-slotbtns { display: flex; gap: 6px; flex-shrink: 0; }

.ed-mini {
  border: 1px solid var(--line-s);
  background: #fff;
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  white-space: nowrap;
}
.ed-mini:hover { border-color: var(--blue); color: var(--blue); background: rgba(15, 108, 174, 0.06); }
.ed-mini.danger:hover { border-color: #c0392b; color: #c0392b; background: rgba(192, 57, 43, 0.06); }

.ed-lib { display: none; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 10px; border: 1px dashed var(--line-s); border-radius: 12px; background: #fff; }
.ed-lib.open { display: grid; }
.ed-libitem { aspect-ratio: 1; border-radius: 8px; background-size: cover; background-position: center; border: 2px solid transparent; cursor: pointer; transition: transform 0.15s, border-color 0.15s; }
.ed-libitem:hover { transform: scale(1.05); border-color: var(--blue); }

.modal-foot { padding: 16px 22px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.modal-foot .kit-btn { flex: 1; min-width: 150px; }

@media (max-width: 1080px) {
  .modal-panel { inset: 0; border-radius: 0; flex-direction: column; }
  .modal-preview { padding: 16px; min-height: 46vh; }
  .modal-side { width: 100%; flex: 1; border-left: none; border-top: 1px solid var(--line); min-height: 0; }
  .modal-body { padding: 16px 18px 20px; }
}

@media (max-width: 980px) {
  .kit-topbar { display: flex; }
  .kit-shell { flex-direction: column; }

  .kit-side {
    position: fixed;
    z-index: 240;
    top: 0;
    left: 0;
    bottom: 0;
    height: 100vh;
    width: min(310px, 86vw);
    transform: translateX(-102%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    background: #f7fbff;
    box-shadow: 24px 0 60px rgba(8, 35, 58, 0.18);
  }
  .kit-side.open { transform: translateX(0); }
  .kit-shell.nav-open .kit-scrim { display: block; }

  .kit-main { padding: 30px 18px 70px; }

  .art-actions { width: 100%; }
  .art-dl { flex: 1; text-align: center; }

  .toast { bottom: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
