/* deck.asia app chrome (landing, dashboard, create, editor, admin). Phone first. */
:root {
  --ink: #15161a; --ink2: #43454d; --mute: #8a8c94; --line: #e6e3dc; --paper: #f4f3ef; --card: #ffffff;
  --brand: #ff5b2e; --brand-ink: #ffffff; --ok: #1f9d55; --warn: #c27c0e; --bad: #d33a2c;
  --r: 16px; --head: "Bricolage Grotesque", system-ui, sans-serif; --sans: "Inter", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.5 var(--sans); }
a { color: inherit; }
h1, h2, h3 { font-family: var(--head); letter-spacing: -0.02em; line-height: 1.1; margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* top bar */
.top { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; gap: 12px; height: 60px; }
.top .logo, a.logo { font-family: var(--head); font-weight: 800; font-size: 22px; text-decoration: none; letter-spacing: -0.03em; }
.top .logo b, a.logo b { color: var(--brand); font-weight: 800; }
.top nav { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.credit-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-weight: 600; font-size: 14px; text-decoration: none; cursor: pointer; }
.credit-pill .n { color: var(--brand); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 999px; padding: 12px 20px; font-weight: 700; cursor: pointer; text-decoration: none; background: var(--ink); color: #fff; min-height: 46px; transition: transform .08s; }
.btn:active { transform: scale(.98); }
.btn.brand { background: var(--brand); color: var(--brand-ink); }
.btn.ghost { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.btn.small { padding: 8px 14px; min-height: 36px; font-size: 14px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.link { background: none; border: 0; padding: 0; color: var(--ink2); text-decoration: underline; cursor: pointer; font-size: 14px; }

/* forms */
label { display: block; font-weight: 600; font-size: 14px; margin: 0 0 6px; }
.field { margin-bottom: 14px; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], textarea, select {
  width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 12px 14px; font-size: 16px; outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(21,22,26,.08); }
textarea { min-height: 140px; resize: vertical; line-height: 1.5; }
.hint { font-size: 13px; color: var(--mute); margin-top: 6px; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 48px; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; width: 40px; height: 40px; cursor: pointer; color: var(--mute); display: grid; place-items: center; }

.card:not(.deck *) { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; }
.muted { color: var(--mute); }
.err { color: var(--bad); font-size: 14px; min-height: 20px; margin: 4px 0 8px; }
.tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line); }
.tag.ok { background: #e6f6ec; border-color: #bfe6cd; color: #146c3a; }
.tag.warn { background: #fff4e0; border-color: #f2d6a0; color: #8a5a07; }
.tag.bad { background: #fde9e7; border-color: #f3c3be; color: #9b2419; }

/* toast */
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(120%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 15px; z-index: 100; transition: transform .25s; max-width: calc(100vw - 32px); }
#toast.show { transform: translateX(-50%) translateY(0); }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(15,16,20,.5); z-index: 60; display: none; align-items: flex-end; justify-content: center; }
.modal.open { display: flex; }
.modal .sheet { background: var(--card); width: 100%; max-width: 520px; border-radius: 22px 22px 0 0; padding: 22px 18px calc(22px + env(safe-area-inset-bottom)); max-height: 92dvh; overflow: auto; }
@media (min-width: 700px) { .modal { align-items: center; } .modal .sheet { border-radius: 22px; padding: 26px; } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.x { background: var(--paper); border: 0; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; font-size: 18px; }

/* credit packs */
.packs { display: grid; gap: 10px; }
.pack { display: flex; align-items: center; gap: 14px; border: 2px solid var(--line); border-radius: 14px; padding: 14px; cursor: pointer; background: var(--card); text-align: left; width: 100%; }
.pack.sel { border-color: var(--ink); }
.pack .p-n { font-family: var(--head); font-size: 22px; font-weight: 800; min-width: 74px; }
.pack .p-price { margin-left: auto; font-weight: 800; font-size: 18px; white-space: nowrap; }
.pack small { display: block; color: var(--mute); }

/* template gallery */
.tpl-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 760px) { .tpl-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; } }
@media (min-width: 1060px) { .tpl-grid { grid-template-columns: repeat(4, 1fr); } }
.tpl { text-decoration: none; color: inherit; background: var(--card); border: 2px solid var(--line); border-radius: 16px; overflow: hidden; cursor: pointer; text-align: left; padding: 0; display: flex; flex-direction: column; }
.tpl.sel { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }
.tpl .thumb { pointer-events: none; }
.tpl .meta { padding: 10px 12px 12px; }
.tpl .meta b { display: block; font-size: 14px; line-height: 1.25; }
.tpl .meta span { display: block; font-size: 12px; color: var(--mute); line-height: 1.35; margin-top: 3px; }
.thumb .slide { border-radius: 0; }

/* deck cards (dashboard) */
.decks { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 640px) { .decks { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 980px) { .decks { grid-template-columns: repeat(3, 1fr); } }
.deck-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; text-decoration: none; }
.deck-card .info { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; }
.deck-card .info b { font-size: 15px; line-height: 1.3; }
.deck-card .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--mute); }
.empty-state { text-align: center; padding: 48px 20px; }

/* mic */
.mic { width: 88px; height: 88px; border-radius: 50%; border: 0; background: var(--brand); color: #fff; cursor: pointer; display: grid; place-items: center; box-shadow: 0 10px 30px color-mix(in srgb, var(--brand) 40%, transparent); flex: none; }
.mic svg { width: 36px; height: 36px; }
.mic.on { animation: pulse 1.2s infinite; background: var(--bad); }
.mic.small { width: 46px; height: 46px; box-shadow: none; }
.mic.small svg { width: 22px; height: 22px; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(211,58,44,.5); } 70% { box-shadow: 0 0 0 22px rgba(211,58,44,0); } 100% { box-shadow: 0 0 0 0 rgba(211,58,44,0); } }

/* photos */
.photos { display: flex; gap: 10px; flex-wrap: wrap; }
.photo { position: relative; width: 84px; height: 84px; border-radius: 12px; overflow: hidden; background: var(--paper); border: 1px solid var(--line); }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo button { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; font-size: 13px; line-height: 1; }
.photo-add { width: 84px; height: 84px; border-radius: 12px; border: 2px dashed var(--line); background: transparent; cursor: pointer; color: var(--mute); font-size: 13px; display: grid; place-items: center; text-align: center; line-height: 1.2; }

/* stepper */
.steps-nav { display: flex; gap: 6px; margin: 18px 0; }
.steps-nav span { flex: 1; height: 4px; border-radius: 4px; background: var(--line); }
.steps-nav span.on { background: var(--ink); }

/* tables (admin) */
.tbl:not(.deck *) { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl:not(.deck *) th { text-align: left; color: var(--mute); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 10px 8px; border-bottom: 1px solid var(--line); }
.tbl:not(.deck *) td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 760px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.kpi b { display: block; font-family: var(--head); font-size: 26px; letter-spacing: -.02em; }
.kpi span { font-size: 13px; color: var(--mute); }
.tabs:not(.deck *) { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.tabs:not(.deck *) button { flex: none; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 8px 14px; font-weight: 600; font-size: 14px; cursor: pointer; }
.tabs:not(.deck *) button.on { background: var(--ink); color: #fff; border-color: var(--ink); }

.spinner { width: 42px; height: 42px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--brand); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.hide { display: none !important; }
.btn { white-space: nowrap; }
@media (max-width: 520px) { .top nav .new-btn { display: none; } .top nav { gap: 6px; } }

/* template gallery filters + actions */
.tpl-filter { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.tpl-filter::-webkit-scrollbar { display: none; }
.tpl-filter button { flex: none; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px; padding: 8px 14px; font: 600 14px/1 inherit; font-family: inherit; cursor: pointer; }
.tpl-filter button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.tpl-filter.small button { padding: 6px 12px; font-size: 13px; }
.tpl-filter.small { margin-bottom: 8px; }
.tpl-act { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.btn.sm { padding: 7px 12px; min-height: 34px; font-size: 13px; }
.tpl-mini { max-height: 420px; overflow-y: auto; }

/* narrow phones: top bar fits in one line */
@media (max-width: 420px) {
  .top .wrap { gap: 8px; }
  .top .logo { font-size: 19px; }
  .top nav { gap: 5px; }
  .top nav .btn.small { padding: 6px 10px; min-height: 32px; font-size: 13px; }
  .top .credit-pill { padding: 5px 9px; font-size: 13px; }
}
@media (max-width: 420px) { .top nav .nav-ex { display: none; } }

/* live voice strip (shown while the mic is on) */
.vstrip { display: flex; align-items: center; gap: 14px; margin: 0 10px 10px; padding: 12px 14px; border-radius: 12px; background: #15161a; color: #fff; }
.vstrip[hidden] { display: none; }
.vs-wave { flex: none; display: flex; align-items: center; gap: 3px; height: 44px; }
.vs-wave i { width: 3px; height: 100%; border-radius: 3px; background: var(--brand); transform: scaleY(.1); transform-origin: center; transition: transform .08s linear; }
.vs-fake .vs-wave i { animation: vsfake 1s ease-in-out infinite; }
.vs-fake .vs-wave i:nth-child(3n) { animation-delay: -.3s; } .vs-fake .vs-wave i:nth-child(3n+1) { animation-delay: -.6s; } .vs-fake .vs-wave i:nth-child(4n) { animation-duration: .8s; }
@keyframes vsfake { 0%, 100% { transform: scaleY(.15); } 50% { transform: scaleY(.85); } }
.vs-main { min-width: 0; flex: 1; }
.vs-top { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.vs-dot { width: 8px; height: 8px; border-radius: 50%; background: #ff3b30; animation: vsblink 1s infinite; }
@keyframes vsblink { 50% { opacity: .2; } }
.vs-time { font-variant-numeric: tabular-nums; color: #b9bac2; }
.vs-hint { margin-left: auto; color: #8a8c94; font-size: 12px; }
.vs-cap { margin: 4px 0 0; font-size: 15px; line-height: 1.45; color: #fff; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.vs-old { color: #b9bac2; }
.vs-new { color: #fff; font-weight: 600; background: linear-gradient(90deg, color-mix(in srgb, var(--brand) 35%, transparent), transparent); border-radius: 4px; padding: 0 2px; }
@media (max-width: 520px) { .vs-wave { gap: 2px; height: 36px; } .vs-wave i { width: 2px; } .vs-hint { display: none; } }
/* word meter under a text box */
.wmeter { display: flex; align-items: center; gap: 8px; }
.wmeter .bar { width: 70px; height: 5px; border-radius: 5px; background: var(--line); overflow: hidden; }
.wmeter .bar i { display: block; height: 100%; width: 0; background: var(--ok); border-radius: inherit; transition: width .2s; }
.wmeter.warn .bar i { background: var(--warn); } .wmeter.over .bar i { background: var(--bad); } .wmeter.over { color: var(--bad); font-weight: 700; }

/* payment summary in the buy-credits sheet */
.paysum { margin-top: 14px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; font-size: 14px; background: var(--paper); }
.paysum div { display: flex; justify-content: space-between; padding: 4px 0; color: var(--ink2); }
.paysum .tot { border-top: 1px dashed var(--line); margin-top: 4px; padding-top: 8px; color: var(--ink); font-weight: 800; font-size: 16px; }

/* "Log masuk sebagai" bar */
#viewAsBar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; padding: 8px 14px; background: #7c3aed; color: #fff; font-size: 14px; }
#viewAsBar button { border: 0; background: #fff; color: #4c1d95; font: 700 13px/1 inherit; font-family: inherit; padding: 7px 12px; border-radius: 999px; cursor: pointer; }
#viewAsBar + .top, body:has(#viewAsBar) .top { top: 38px; }

/* 4-language showcase (home + /contoh) */
.lang-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 640px) { .lang-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .lang-grid { grid-template-columns: repeat(4, 1fr); } }
.lang-card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; display: flex; flex-direction: column; }
.lang-card .thumb { display: block; border-bottom: 1px solid var(--line); }
.lang-card .thumb > * { pointer-events: none; }
.lang-card .meta { padding: 12px 14px 14px; }
.lang-card .meta b { display: block; font-size: 15px; }
.lang-card .meta span { display: block; font-size: 13px; color: var(--mute, #777); margin-top: 3px; }
.lang-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.lang-chips button { font: inherit; font-size: 13px; font-weight: 600; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: inherit; cursor: pointer; }
.lang-chips button.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* Website language picker */
.site-lang { position: relative; display: inline-flex; align-items: center; gap: 4px; height: 34px; padding: 0 8px 0 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font-size: 14px; font-weight: 600; cursor: pointer; }
.site-lang select { appearance: none; -webkit-appearance: none; border: 0; background: transparent; font: inherit; color: inherit; cursor: pointer; padding: 0 2px; outline: none; }
.site-lang:focus-within { border-color: var(--ink); }
@media (max-width: 640px) { .site-lang { height: 32px; padding: 0 6px 0 8px; font-size: 13px; gap: 2px; } }
html[data-site-lang="zh"] { --sans: "Inter", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; --head: "Bricolage Grotesque", "Noto Sans SC", "PingFang SC", system-ui, sans-serif; }
html[data-site-lang="ta"] { --sans: "Inter", "Noto Sans Tamil", "Tamil Sangam MN", "Latha", system-ui, sans-serif; --head: "Bricolage Grotesque", "Noto Sans Tamil", "Tamil Sangam MN", system-ui, sans-serif; }
html[data-site-lang="ta"] h1, html[data-site-lang="ta"] h2, html[data-site-lang="ta"] h3 { letter-spacing: 0; line-height: 1.3; }
/* Long languages (Tamil) on phones: the top bar wraps instead of overflowing */
.top .wrap { flex-wrap: wrap; height: auto; min-height: 60px; row-gap: 6px; }
.top nav { flex-wrap: wrap; justify-content: flex-end; row-gap: 6px; }
@media (max-width: 640px) { .top .wrap { padding-top: 8px; padding-bottom: 8px; } .site-lang > span { display: none; } }

/* Phone polish for long languages (found in phone audit 2026-11-26) */
@media (max-width: 640px) {
  .btn:not(.small) { white-space: normal; text-align: center; line-height: 1.25; }
  html[data-site-lang="ta"] main h1 { font-size: clamp(24px, 7.4vw, 34px) !important; overflow-wrap: break-word; }
  html[data-site-lang="ta"] main h2 { overflow-wrap: break-word; }
}
main, .auth-wrap > *, .grid3 > *, .tpl-grid > *, .lang-grid > * { min-width: 0; }
section[id], [id="bahasa"] { scroll-margin-top: 84px; }
.top nav > * { align-self: center; }
.site-lang { height: auto; min-height: 32px; box-sizing: border-box; }
