:root {
  --acc: #e5006e; --acc-soft: #fde6f0; --bg: #faf7f8; --card: #fff; --line: #e9e4e6;
  --fg: #1b1b1f; --fg2: #6f6a70; --r: 14px;
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--fg); font-size: 14.5px; line-height: 1.45; }
.top { display: flex; align-items: baseline; gap: 16px; padding: 14px 24px; flex-wrap: wrap; }
.brand { font-weight: 800; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.logo { width: 12px; height: 12px; border-radius: 50%; background: var(--acc); box-shadow: 0 0 0 4px var(--acc-soft); }
.top p { margin: 0; color: var(--fg2); font-size: 13px; }
.proBtn { margin-left: auto; background: #1b1b1f; color: #ffd66b; border-color: #1b1b1f; }

.app { display: grid; grid-template-columns: minmax(0, 1fr) 440px; gap: 24px; padding: 0 24px 40px; max-width: 1280px; margin: 0 auto; align-items: start; }
.stage { position: sticky; top: 12px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.frame { position: relative; border-radius: 20px; overflow: hidden; background: #ece8ea; box-shadow: 0 10px 40px rgba(40, 10, 25, .14); line-height: 0; }
.frame canvas { display: block; max-width: 100%; max-height: calc(100vh - 190px); width: auto; height: auto; }
.empty { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(250, 247, 248, .93); line-height: 1.45; text-align: center; padding: 20px; }
.empty .big { font-size: 44px; }
.empty h2 { margin: 6px 0; font-size: 19px; }
.empty p { color: var(--fg2); margin: 6px auto 14px; max-width: 320px; font-size: 13px; }
.empty .hint { font-size: 12px; margin-top: 16px; }

.transport { display: flex; align-items: center; gap: 10px; width: min(100%, 520px); }
.play { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--fg); color: #fff; font-size: 14px; cursor: pointer; flex: none; }
.transport input { flex: 1; accent-color: var(--acc); }
.time { font-variant-numeric: tabular-nums; color: var(--fg2); font-size: 12.5px; min-width: 84px; text-align: right; }
.actions { display: flex; gap: 10px; justify-content: center; }

.btn { border: 1.5px solid var(--line); background: #fff; color: var(--fg); border-radius: 999px; padding: 10px 22px; font: inherit; font-weight: 650; cursor: pointer; text-decoration: none; display: inline-block; }
.btn:hover { border-color: #cfc8cb; }
.btn.primary { background: var(--acc); border-color: var(--acc); color: #fff; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.small { padding: 6px 14px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.link { border: 0; background: none; color: var(--acc); font: inherit; font-weight: 650; cursor: pointer; padding: 6px 0; text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }

.panel { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.filebar { display: flex; align-items: center; gap: 12px; background: var(--acc-soft); border-radius: var(--r); padding: 12px 16px; }
.filebar .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--acc); flex: none; }
.filebar div { flex: 1; min-width: 0; }
.filebar b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filebar small { color: var(--acc); }
.filebar .link { text-decoration: none; }

details { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 0 16px; }
details[open] { padding-bottom: 12px; }
summary { font-weight: 700; padding: 13px 0; cursor: pointer; list-style: none; display: flex; justify-content: space-between; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "▾"; color: var(--fg2); transition: transform .15s; }
details[open] summary::after { transform: rotate(180deg); }

.row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 7px 0; min-height: 44px; }
.row > span { flex: 1; min-width: 0; }
.row small { display: block; color: var(--fg2); font-size: 12px; }
.row.two { gap: 10px; }
.row.two label { flex: 1; color: var(--fg2); font-size: 12.5px; display: flex; flex-direction: column; gap: 4px; }
.row input[type=range] { width: 170px; accent-color: var(--acc); }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; padding: 4px 0 8px; }
input[type=text], input[type=date], select { font: inherit; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; color: var(--fg); min-width: 0; }
select { max-width: 220px; }
.note { color: var(--fg2); font-size: 12.5px; margin: 4px 0; }

.seg { display: inline-flex; background: #f1eeef; border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg.wide { display: flex; margin: 2px 0 6px; }
.seg.wide button { flex: 1; }
.seg button { border: 0; background: none; font: inherit; font-size: 13.5px; padding: 7px 11px; border-radius: 8px; cursor: pointer; color: var(--fg2); font-weight: 600; white-space: nowrap; }
.seg button.on { background: #fff; color: var(--fg); box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }

.sw { appearance: none; -webkit-appearance: none; width: 46px; height: 28px; border-radius: 99px; background: #ddd7da; position: relative; cursor: pointer; flex: none; transition: background .15s; margin: 0; }
.sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .15s; }
.sw:checked { background: var(--acc); }
.sw:checked::after { transform: translateX(18px); }

.styles { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin-bottom: 6px; }
.styles button { border: 2px solid transparent; background: none; padding: 3px; border-radius: 12px; cursor: pointer; font: inherit; font-size: 12px; color: var(--fg2); display: flex; flex-direction: column; gap: 3px; align-items: stretch; }
.styles button.on { border-color: var(--acc); color: var(--fg); font-weight: 700; }
.styles .th { aspect-ratio: 4/3; border-radius: 8px; overflow: hidden; background: #eee; border: 1px solid var(--line); }
.styles img { width: 100%; height: 100%; object-fit: cover; display: block; }

.swatches { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.swatches button { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1.5px var(--line); cursor: pointer; padding: 0; }
.swatches button.on { box-shadow: 0 0 0 2.5px var(--fg); }
.swatches input { width: 32px; height: 30px; border: 0; padding: 0; background: none; cursor: pointer; }
.emojis { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px 0; }
.emojis button { font-size: 22px; width: 40px; height: 40px; border-radius: 10px; border: 2px solid transparent; background: #f5f2f3; cursor: pointer; }
.emojis button.on { border-color: var(--acc); background: var(--acc-soft); }
.emojis input { width: 70px; text-align: center; font-size: 18px; padding: 6px; }

.vehicles { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 6px; padding: 4px 0; }
.vehicles button { border: 2px solid transparent; background: #f5f2f3; border-radius: 12px; padding: 4px 2px 6px; cursor: pointer; font: inherit; font-size: 12px; color: var(--fg2); display: flex; flex-direction: column; align-items: center; }
.vehicles button.on { border-color: var(--acc); background: var(--acc-soft); color: var(--fg); font-weight: 700; }
.vehicles canvas { width: 48px; height: 48px; }
.modal { position: fixed; inset: 0; background: rgba(20, 10, 15, .55); display: grid; place-items: center; z-index: 20; padding: 16px; }
.sheet { background: #fff; border-radius: 22px; padding: 22px; width: min(440px, 100%); max-height: 100%; overflow: auto; text-align: center; }
.sheet h2 { margin: 0 0 14px; font-size: 19px; }
.xprev, .sheet video { max-width: 100%; max-height: 52vh; border-radius: 14px; background: #eee; display: block; margin: 0 auto 14px; width: auto; height: auto; }
.bar { height: 8px; background: #f1eeef; border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--acc); border-radius: 99px; transition: width .2s; }
.sheet .actions { margin-top: 12px; }
.drop { position: fixed; inset: 12px; border: 3px dashed var(--acc); border-radius: 24px; background: rgba(253, 230, 240, .9); display: grid; place-items: center; font-size: 22px; font-weight: 800; color: var(--acc); z-index: 30; pointer-events: none; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; padding: 0 14px 30px; }
  .stage { position: static; }
  .frame canvas { max-height: 70vh; }
  .top { padding: 12px 14px; }
}

/* ---- Free / Pro ---- */
.ptag, .seg button.lock::after { font-size: 9px; font-weight: 800; letter-spacing: .04em; color: #8a5a00; background: #ffe7a8; border-radius: 5px; padding: 1px 5px; vertical-align: 1px; }
body.is-pro .ptag { display: none; }
.seg button.lock::after { content: "PRO"; margin-left: 5px; }
body.is-pro .seg button.lock::after { content: none; }
.styles button.lock, .vehicles button.lock, .swatches button.lock { position: relative; }
.styles button.lock::after, .vehicles button.lock::after { content: "PRO"; position: absolute; top: 6px; right: 6px; font-size: 9px; font-weight: 800; color: #8a5a00; background: #ffe7a8; border-radius: 5px; padding: 1px 5px; }
.swatches button.lock::after { content: "🔒"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 11px; background: rgba(255, 255, 255, .55); border-radius: 50%; }
body.is-pro .lock::after { content: none !important; }
.proNote { text-align: center; margin: 0; max-width: 420px; }
body.is-pro .proNote { display: none; }
.sheet.pro { text-align: left; }
.sheet.pro h2 { margin-bottom: 6px; }
.plist { margin: 8px 0 14px; padding-left: 20px; }
.plist li { margin: 3px 0; }
#pmBuyBox { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.keyrow { display: flex; gap: 8px; }
.keyrow input { flex: 1; }
.pmMsg { min-height: 18px; }
.sheet.pro .actions { justify-content: flex-end; flex-wrap: wrap; }

/* ---- Language picker ---- */
.langSel { max-width: 150px; padding: 6px 10px; font-size: 13px; border-radius: 999px; margin-left: auto; }
.langSel + .proBtn { margin-left: 0; }
.top .proBtn { margin-left: 0; }

/* ---- Vehicle picker: categories + scrolling grid ---- */
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; border: 1.5px solid var(--line); background: #fff; color: var(--fg2); border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 12.5px; font-weight: 650; cursor: pointer; white-space: nowrap; }
.chips button.on { background: var(--fg); border-color: var(--fg); color: #fff; }
.vehicles { max-height: 330px; overflow-y: auto; overscroll-behavior: contain; }
.row.sub { padding-left: 14px; min-height: 36px; }

/* ---- Route editor ---- */
.ed { position: fixed; inset: 0; z-index: 60; display: grid; grid-template-columns: minmax(0, 1fr) 380px; background: var(--bg); }
.ed-map { position: relative; min-height: 0; }
.ed-map canvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; background: #e8e8e4; }
.ed-map canvas:active { cursor: grabbing; }
.ed-top { position: absolute; top: 12px; left: 12px; right: 12px; max-width: 420px; }
.ed-top input { width: 100%; padding: 11px 16px; border-radius: 999px; border: 1.5px solid var(--line); font: inherit; box-shadow: 0 4px 16px rgba(0, 0, 0, .15); background: #fff; }
.ed-res { margin-top: 6px; background: #fff; border-radius: 14px; box-shadow: 0 8px 28px rgba(0, 0, 0, .2); overflow: hidden; }
.ed-res button { display: block; width: 100%; text-align: left; border: 0; background: #fff; padding: 9px 14px; cursor: pointer; font: inherit; border-bottom: 1px solid var(--line); }
.ed-res button:hover { background: var(--acc-soft); }
.ed-res b { display: block; font-size: 14px; }
.ed-res small { color: var(--fg2); font-size: 12px; }
.ed-res p { margin: 0; padding: 10px 14px; color: var(--fg2); font-size: 13px; }
.ed-tools { position: absolute; right: 12px; top: 12px; display: flex; flex-direction: column; gap: 6px; }
.ed-tools .btn { box-shadow: 0 3px 10px rgba(0, 0, 0, .15); }
.ed-tools .btn.on { background: var(--acc); border-color: var(--acc); color: #fff; }
.ed-hint { position: absolute; left: 12px; bottom: 14px; background: rgba(27, 27, 31, .82); color: #fff; padding: 7px 13px; border-radius: 999px; font-size: 12.5px; max-width: calc(100% - 24px); }
.ed-side { display: flex; flex-direction: column; min-height: 0; border-left: 1px solid var(--line); background: var(--card); }
.ed-side header { display: flex; align-items: baseline; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.ed-side header b { font-size: 16px; }
.ed-side header small { color: var(--fg2); flex: 1; }
.ed-start { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); color: var(--fg2); font-size: 13px; }
.ed-list { flex: 1; overflow-y: auto; padding: 8px 12px; overscroll-behavior: contain; }
.ed-place { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 12px; border: 1.5px solid transparent; cursor: pointer; }
.ed-place.on { border-color: var(--acc); background: var(--acc-soft); }
.ed-place .bd { width: 26px; height: 26px; border-radius: 50%; background: var(--acc); color: #fff; font-weight: 800; font-size: 12px; display: grid; place-items: center; flex: none; }
.ed-place.on .bd { background: var(--fg); }
.ed-place .nm { flex: 1; min-width: 0; border: 1px solid transparent; background: transparent; font: inherit; font-weight: 650; padding: 5px 6px; border-radius: 8px; }
.ed-place .nm:focus { border-color: var(--line); background: #fff; }
.ed-place .acts { display: flex; gap: 2px; }
.ed-place .acts button { border: 0; background: none; cursor: pointer; width: 26px; height: 26px; border-radius: 8px; color: var(--fg2); font-size: 13px; }
.ed-place .acts button:hover:not(:disabled) { background: #fff; color: var(--fg); }
.ed-place .acts button:disabled { opacity: .25; cursor: default; }
.ed-place .acts .rm:hover { color: #d00 !important; }
.ed-leg { display: flex; align-items: center; gap: 8px; padding: 3px 8px 3px 20px; border-left: 2px dashed #d9d2d6; margin-left: 20px; flex-wrap: wrap; }
.ed-leg .seg button { padding: 3px 7px; font-size: 14px; }
.ed-leg .info { font-size: 12px; color: var(--fg2); }
.ed-leg .road { border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 2px 10px; font: inherit; font-size: 12px; font-weight: 650; cursor: pointer; color: var(--acc); }
.ed-side footer { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
.ed-side footer .note { flex: 1; margin: 0; font-size: 12px; min-height: 16px; }
@media (max-width: 800px) {
  .ed { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) minmax(0, 46vh); }
  .ed-side { border-left: 0; border-top: 1px solid var(--line); }
  .ed-tools { flex-direction: row; top: auto; bottom: 52px; right: 12px; }
  .ed-hint { bottom: 12px; font-size: 11.5px; }
}

.legal { text-align: center; padding: 8px 0 28px; font-size: 13px; color: var(--fg2); }
.legal a { color: var(--fg2); }
