/* ==============================================
   PostAI — Interactive demo: Insight Video
   Page shell uses the main site theme; the app
   window mimics app.postai.sg (neutral dark).
   ============================================== */
:root {
  --bg: #0a0a12; --bg-alt: #0d0d1a; --bg-card: #13131f;
  --border: rgba(139, 92, 246, 0.15); --border-hover: rgba(139, 92, 246, 0.45);
  --accent: #8b5cf6; --accent-2: #a78bfa; --accent-3: #c4b5fd; --accent-dim: rgba(139, 92, 246, 0.12);
  --text: #f1f5f9; --text-2: #94a3b8; --text-3: #64748b;
  --green: #10b981; --amber: #f59e0b; --red: #ef4444;
  /* app window */
  --app-bg: #121214; --app-panel: #1b1b1f; --app-panel-2: #232328; --app-line: #2e2e35;
  --app-text: #ececf1; --app-text-2: #a1a1aa; --app-text-3: #71717a;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', -apple-system, sans-serif; background: var(--bg); color: var(--text-2); line-height: 1.55; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
img, video { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3 { color: var(--text); line-height: 1.15; letter-spacing: -0.02em; }

/* ---------- Page hero ---------- */
.d-hero { padding: 56px 0 28px; text-align: center; }
.eyebrow { display: inline-flex; gap: 8px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-2); background: var(--accent-dim); border: 1px solid var(--border); padding: 6px 14px; border-radius: 999px; margin-bottom: 14px; }
.d-hero h1 { font-size: clamp(28px, 4.6vw, 44px); font-weight: 800; }
.d-hero p { max-width: 640px; margin: 12px auto 0; font-size: 17px; }

/* ---------- Playground layout ---------- */
.play { display: grid; grid-template-columns: 300px 1fr; gap: 24px; align-items: start; padding-bottom: 72px; }
.coach { position: sticky; top: 84px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 18px; padding: 22px; }
.coach__progress { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .06); overflow: hidden; margin-bottom: 16px; }
.coach__progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #8b5cf6, #a78bfa); transition: width .35s ease; }
.coach__count { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-2); }
.coach h2 { font-size: 22px; margin: 6px 0 10px; }
.coach p { font-size: 15px; }
.coach__tip { margin-top: 12px; font-size: 13.5px; color: var(--text-3); border-left: 2px solid var(--accent); padding-left: 10px; }
.coach__nav { display: flex; gap: 8px; margin-top: 18px; }
.coach__nav .btn { flex: 1; justify-content: center; padding: 11px 14px; font-size: 14px; }
.btn-outline { background: transparent; color: var(--text); border: 1px solid rgba(255, 255, 255, .18); }
.btn-outline:hover { border-color: var(--accent-2); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.coach__steps { list-style: none; margin-top: 18px; display: grid; gap: 2px; border-top: 1px solid var(--border); padding-top: 14px; }
.coach__steps button { width: 100%; text-align: left; background: none; border: 0; cursor: pointer; display: flex; gap: 10px; align-items: center; padding: 6px 8px; border-radius: 8px; font-size: 13.5px; color: var(--text-3); }
.coach__steps button:hover { background: rgba(255, 255, 255, .03); color: var(--text-2); }
.coach__steps b { width: 20px; height: 20px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; font-size: 11px; background: rgba(255, 255, 255, .06); }
.coach__steps .done b { background: rgba(16, 185, 129, .2); color: var(--green); }
.coach__steps .cur { color: var(--text); background: var(--accent-dim); }
.coach__steps .cur b { background: var(--accent); color: #fff; }
.coach__end { display: none; margin-top: 16px; gap: 8px; flex-direction: column; }
.coach__end.on { display: flex; }
.coach__end .btn { justify-content: center; }

/* ---------- App window ---------- */
.win { border-radius: 16px; overflow: hidden; border: 1px solid #2a2a33; box-shadow: 0 30px 90px rgba(0, 0, 0, .55), 0 0 0 1px rgba(139, 92, 246, .12); background: var(--app-bg); color: var(--app-text); }
.win__bar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: #19191d; border-bottom: 1px solid var(--app-line); }
.win__dots { display: flex; gap: 6px; }
.win__dots i { width: 11px; height: 11px; border-radius: 50%; background: #3a3a42; }
.win__url { flex: 1; text-align: center; font-size: 12.5px; color: var(--app-text-3); background: #111114; border-radius: 8px; padding: 5px 10px; max-width: 360px; margin: 0 auto; }
.win__demo { font-size: 11px; font-weight: 700; color: var(--amber); background: rgba(245, 158, 11, .1); border: 1px solid rgba(245, 158, 11, .3); padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.app { position: relative; min-height: 640px; }
.app__top { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--app-line); }
.app__logo { display: flex; align-items: center; gap: 8px; font-weight: 800; }
.app__logo img { width: 24px; height: 24px; border-radius: 6px; }
.app__credits { margin-left: auto; font-size: 13px; color: var(--app-text-2); background: var(--app-panel); border: 1px solid var(--app-line); padding: 4px 10px; border-radius: 999px; }
.app__me { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.app__body { padding: 18px; max-width: 760px; margin: 0 auto; }

.tabs { display: flex; gap: 4px; overflow-x: auto; padding: 4px; background: var(--app-panel); border: 1px solid var(--app-line); border-radius: 12px; margin-bottom: 16px; scrollbar-width: none; }
.tabs button { flex: 1; white-space: nowrap; padding: 8px 12px; border-radius: 9px; border: 0; background: none; cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--app-text-2); }
.tabs button:hover { color: var(--app-text); }
.tabs button.on { background: #fff; color: #111; }
.seg { display: flex; background: var(--app-panel-2); border-radius: 10px; padding: 3px; margin-bottom: 14px; }
.seg button { flex: 1; padding: 8px; border: 0; background: none; border-radius: 8px; cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--app-text-2); }
.seg button.on { background: #3a3a44; color: var(--app-text); }
.card { background: var(--app-panel); border: 1px solid var(--app-line); border-radius: 14px; padding: 16px; }
.card + .card { margin-top: 12px; }
.lbl { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 700; color: var(--app-text); margin-bottom: 8px; }
.lbl small { font-weight: 500; color: var(--app-text-3); }
.field { display: flex; gap: 8px; align-items: center; background: #111114; border: 1px solid var(--app-line); border-radius: 10px; padding: 6px 6px 6px 12px; }
.field input { flex: 1; min-width: 0; background: none; border: 0; outline: none; font-size: 13.5px; }
.field input::placeholder, textarea::placeholder { color: var(--app-text-3); }
.mini { font-size: 12.5px; font-weight: 600; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--app-line); background: var(--app-panel-2); cursor: pointer; color: var(--app-text); white-space: nowrap; }
.mini:hover { border-color: #4a4a55; }
.trend { list-style: none; display: grid; gap: 2px; margin-top: 6px; }
.trend label { display: flex; gap: 10px; align-items: flex-start; padding: 9px 8px; border-radius: 9px; cursor: pointer; font-size: 13.5px; color: var(--app-text-2); }
.trend label:hover { background: var(--app-panel-2); }
.trend input { margin-top: 3px; accent-color: #8b5cf6; }
.trend .src { display: block; font-size: 11.5px; color: var(--app-text-3); }
.trend label.on { background: rgba(139, 92, 246, .12); color: var(--app-text); }
.row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; font-size: 13.5px; }
.toggle { position: relative; width: 38px; height: 22px; border-radius: 999px; background: #3a3a44; border: 0; cursor: pointer; flex-shrink: 0; transition: background .2s; }
.toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; }
.toggle.on { background: #8b5cf6; }
.toggle.on::after { transform: translateX(16px); }
textarea.ta { width: 100%; min-height: 76px; resize: vertical; background: #111114; border: 1px solid var(--app-line); border-radius: 10px; padding: 10px 12px; font-size: 13.5px; outline: none; line-height: 1.5; }
textarea.ta:focus, .field:focus-within { border-color: #8b5cf6; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chips button { font-size: 12px; padding: 5px 10px; border-radius: 999px; border: 1px dashed #4a4a55; background: none; cursor: pointer; color: var(--app-text-2); }
.chips button:hover { border-color: #8b5cf6; color: var(--app-text); }
.primary { width: 100%; margin-top: 14px; padding: 12px; border-radius: 11px; border: 0; cursor: pointer; font-weight: 700; font-size: 14.5px; background: #fff; color: #111; }
.primary:hover { background: #e9e9ee; }
.primary.violet { background: #8b5cf6; color: #fff; }
.primary.violet:hover { background: #7c3aed; }
.muted { font-size: 12.5px; color: var(--app-text-3); }
.drop { border: 1.5px dashed #4a4a55; border-radius: 12px; padding: 26px; text-align: center; font-size: 13.5px; color: var(--app-text-2); cursor: pointer; }
.drop:hover { border-color: #8b5cf6; }
.ep { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.ep button { min-width: 38px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--app-line); background: var(--app-panel-2); cursor: pointer; font-size: 13px; color: var(--app-text-2); }
.ep button.on { background: #8b5cf6; border-color: #8b5cf6; color: #fff; }

/* ---------- Storyboard ---------- */
.sb__head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.sb__title { font-size: 18px; font-weight: 800; outline: none; border-radius: 6px; padding: 2px 4px; }
.sb__title:focus { background: var(--app-panel-2); }
.sb__steps { display: flex; gap: 14px; font-size: 12.5px; color: var(--app-text-3); margin: 6px 0 14px; }
.sb__steps .on { color: var(--app-text); font-weight: 700; }
.sb__lang { margin-left: auto; background: var(--app-panel-2); border: 1px solid var(--app-line); border-radius: 8px; padding: 5px 8px; font-size: 12.5px; }
.scenes { display: grid; gap: 8px; }
.scene { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: start; padding: 10px; border-radius: 12px; background: var(--app-panel); border: 1px solid var(--app-line); transition: border-color .2s; }
.scene:hover { border-color: #3d3d47; }
.scene__thumb { position: relative; width: 64px; height: 92px; border-radius: 8px; overflow: hidden; cursor: pointer; border: 0; padding: 0; background: #000; }
.scene__thumb img { width: 100%; height: 100%; object-fit: cover; }
.scene__thumb span { position: absolute; inset: auto 0 0 0; font-size: 10px; font-weight: 700; text-align: center; padding: 3px; background: rgba(0, 0, 0, .65); color: #fff; opacity: 0; transition: opacity .2s; }
.scene__thumb:hover span { opacity: 1; }
.scene__n { font-size: 11px; font-weight: 700; color: var(--app-text-3); margin-bottom: 4px; display: flex; gap: 8px; align-items: center; }
.scene__n .tag { font-size: 10.5px; padding: 1px 7px; border-radius: 999px; background: rgba(139, 92, 246, .16); color: var(--accent-3); }
.scene__text { width: 100%; min-height: 40px; background: none; border: 1px solid transparent; border-radius: 8px; padding: 6px 8px; margin-left: -8px; font-size: 13.5px; line-height: 1.45; resize: none; outline: none; color: var(--app-text); overflow: hidden; }
.scene__text:hover { border-color: var(--app-line); }
.scene__text:focus { border-color: #8b5cf6; background: #111114; }
.scene__tools { display: flex; flex-direction: column; gap: 6px; }
.ic { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--app-line); background: var(--app-panel-2); cursor: pointer; display: grid; place-items: center; font-size: 14px; color: var(--app-text-2); }
.ic:hover { color: var(--app-text); border-color: #4a4a55; }
.ic.on { background: rgba(139, 92, 246, .2); border-color: #8b5cf6; color: #fff; }
.ic.playing { animation: pulse 1s ease infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 4px rgba(139, 92, 246, .3); } }
.add-scene { width: 100%; margin-top: 8px; padding: 10px; border-radius: 10px; border: 1px dashed #4a4a55; background: none; color: var(--app-text-2); cursor: pointer; font-size: 13px; }

/* ---------- Avatar / settings ---------- */
.layouts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.layout { border: 2px solid var(--app-line); border-radius: 12px; padding: 8px; background: none; cursor: pointer; text-align: center; font-size: 13px; font-weight: 700; color: var(--app-text-2); }
.layout img { width: 100%; aspect-ratio: 9 / 13; object-fit: cover; object-position: top; border-radius: 8px; margin-bottom: 6px; }
.layout small { display: block; font-weight: 500; font-size: 11.5px; color: var(--app-text-3); }
.layout.on { border-color: #8b5cf6; color: var(--app-text); }
.me { display: flex; gap: 12px; align-items: center; }
.me img { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; }
.me b { display: block; }
.me .ok { font-size: 12px; color: var(--green); }
.me.busy img { animation: spin 1s linear infinite; opacity: .6; }
@keyframes spin { to { transform: rotate(360deg); } }
.sel { width: 100%; background: #111114; border: 1px solid var(--app-line); border-radius: 10px; padding: 9px 10px; font-size: 13.5px; }
.styles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.styles button { position: relative; aspect-ratio: 3 / 4; border-radius: 9px; overflow: hidden; border: 2px solid transparent; cursor: pointer; padding: 0; background: #000; }
.styles button img { width: 100%; height: 100%; object-fit: cover; opacity: .7; }
.styles button span { position: absolute; left: 0; right: 0; bottom: 6px; font-size: 10.5px; font-weight: 800; color: #fff; text-shadow: 0 1px 3px #000; }
.styles button.on { border-color: #8b5cf6; }
.styles button.on img { opacity: 1; }
.dots { display: flex; gap: 8px; }
.dots button { width: 24px; height: 24px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.dots button.on { border-color: #fff; box-shadow: 0 0 0 2px #8b5cf6; }
.pills { display: flex; gap: 6px; }
.pills button { padding: 6px 12px; border-radius: 8px; border: 1px solid var(--app-line); background: var(--app-panel-2); cursor: pointer; font-size: 12.5px; color: var(--app-text-2); }
.pills button.on { background: #8b5cf6; border-color: #8b5cf6; color: #fff; }
.settings-grid { display: grid; grid-template-columns: 1fr 180px; gap: 16px; align-items: start; }
.cap-preview { position: relative; aspect-ratio: 9 / 16; border-radius: 12px; overflow: hidden; background: #000; }
.cap-preview img { width: 100%; height: 100%; object-fit: cover; }
.cap-preview .cap { position: absolute; left: 8%; right: 8%; text-align: center; font-weight: 800; font-size: 15px; line-height: 1.25; text-shadow: 0 2px 6px rgba(0, 0, 0, .8); transition: all .2s; }
.cap .hl { padding: 0 4px; border-radius: 4px; }
.contact { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: #fff; color: #111; margin-top: 8px; }
.contact img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.contact b { font-size: 13.5px; display: block; }
.contact span { font-size: 12px; color: #16a34a; font-weight: 700; }
input[type=range] { width: 100%; accent-color: #8b5cf6; }

/* ---------- Overlays inside app ---------- */
.ov { position: absolute; inset: 0; z-index: 20; background: rgba(8, 8, 12, .78); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 18px; }
.ov[hidden] { display: none; }
.modal { width: min(560px, 100%); max-height: 100%; overflow: auto; background: var(--app-panel); border: 1px solid var(--app-line); border-radius: 16px; padding: 16px; }
.modal__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-weight: 800; }
.modal__x { width: 30px; height: 30px; border-radius: 8px; border: 0; background: var(--app-panel-2); cursor: pointer; font-size: 18px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.grid4 button { aspect-ratio: 1; border-radius: 9px; overflow: hidden; border: 2px solid transparent; padding: 0; cursor: pointer; }
.grid4 button:hover { border-color: #8b5cf6; }
.grid4 img { width: 100%; height: 100%; object-fit: cover; }
.ai-list { display: grid; gap: 8px; margin-top: 10px; }
.ai-list button { display: flex; justify-content: space-between; align-items: center; padding: 12px; border-radius: 10px; border: 1px solid var(--app-line); background: var(--app-panel-2); cursor: pointer; text-align: left; font-size: 13.5px; }
.ai-list small { color: var(--app-text-3); display: block; }
.ai-list em { font-style: normal; font-size: 12px; color: var(--amber); }
.working { text-align: center; }
.working h3 { color: var(--app-text); margin-bottom: 14px; font-size: 17px; }
.working ul { list-style: none; display: grid; gap: 8px; text-align: left; font-size: 14px; color: var(--app-text-2); max-width: 300px; margin: 0 auto; }
.working li::before { content: '○'; display: inline-block; width: 22px; color: var(--app-text-3); }
.working li.ok { color: var(--app-text); }
.working li.ok::before { content: '✓'; color: var(--green); font-weight: 800; }
.working li.run::before { content: '◌'; color: #a78bfa; animation: spin 1s linear infinite; }
.bar { height: 6px; border-radius: 6px; background: var(--app-panel-2); overflow: hidden; margin: 16px auto 0; max-width: 300px; }
.bar i { display: block; height: 100%; width: 0; background: #8b5cf6; transition: width .3s; }
.preview { display: grid; grid-template-columns: 220px 1fr; gap: 16px; align-items: start; }
.preview video { width: 100%; aspect-ratio: 9 / 16; border-radius: 12px; background: #000; }
.cover-pick { display: flex; gap: 10px; align-items: center; margin-top: 4px; }
.cover-pick .cv { position: relative; width: 70px; aspect-ratio: 9 / 16; border-radius: 8px; overflow: hidden; }
.cover-pick .cv img { width: 100%; height: 100%; object-fit: cover; }
.cover-pick .cv b { position: absolute; left: 4px; right: 4px; top: 8px; font-size: 9px; line-height: 1.1; color: #fff; text-align: center; text-shadow: 0 1px 3px #000; text-transform: uppercase; }
.done { text-align: center; padding: 10px 0; }
.done__thumb { width: 140px; margin: 0 auto 14px; border-radius: 12px; overflow: hidden; }
.done h3 { color: var(--app-text); font-size: 20px; }
.platforms { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 14px 0; }
.platforms button { padding: 10px 6px; border-radius: 10px; border: 1px solid var(--app-line); background: var(--app-panel-2); cursor: pointer; font-size: 12.5px; font-weight: 700; color: var(--app-text-2); }
.platforms button.on { border-color: #8b5cf6; background: rgba(139, 92, 246, .16); color: #fff; }
.slots { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; font-size: 12px; margin-top: 8px; }
.slots button { padding: 8px 0; border-radius: 8px; border: 1px solid var(--app-line); background: var(--app-panel-2); cursor: pointer; color: var(--app-text-2); }
.slots button small { display: block; font-size: 10px; color: var(--app-text-3); }
.slots button.on { background: #8b5cf6; border-color: #8b5cf6; color: #fff; }
.slots button.on small { color: rgba(255, 255, 255, .8); }
.toast { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%) translateY(20px); z-index: 30; opacity: 0; pointer-events: none; transition: all .3s; background: #fff; color: #111; font-weight: 700; font-size: 13.5px; padding: 10px 16px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); white-space: nowrap; }
.toast.on { opacity: 1; transform: translateX(-50%); }

/* ---------- Hotspot + tip ---------- */
.hot { position: absolute; z-index: 15; pointer-events: none; border-radius: 12px; box-shadow: 0 0 0 2px #a78bfa, 0 0 0 6px rgba(167, 139, 250, .25); transition: all .3s ease; animation: hot 1.6s ease infinite; }
.hot[hidden] { display: none; }
@keyframes hot { 50% { box-shadow: 0 0 0 2px #a78bfa, 0 0 0 10px rgba(167, 139, 250, .08); } }
.tip { position: absolute; z-index: 16; max-width: 250px; background: #7c3aed; color: #fff; font-size: 13px; font-weight: 600; line-height: 1.4; padding: 9px 12px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); transition: all .3s ease; pointer-events: none; }
.tip[hidden] { display: none; }
.tip::before { content: ''; position: absolute; left: 18px; top: -6px; width: 12px; height: 12px; background: #7c3aed; transform: rotate(45deg); }
.tip.up::before { top: auto; bottom: -6px; }
.tip small { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; opacity: .78; margin-bottom: 2px; }

.screen[hidden] { display: none; }
.after { padding: 0 0 80px; text-align: center; }
.after h2 { font-size: clamp(24px, 3.6vw, 34px); margin-bottom: 10px; }
.after p { margin-bottom: 22px; }
.after .row-cta { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .play { grid-template-columns: 1fr; }
  .coach { position: relative; top: 0; }
  .coach__steps { display: none; }
}
@media (max-width: 640px) {
  .d-hero { padding: 36px 0 18px; }
  .app { min-height: 560px; }
  .app__body { padding: 12px; }
  .win__url { display: none; }
  .settings-grid, .preview { grid-template-columns: 1fr; }
  .cap-preview { max-width: 180px; margin: 0 auto; }
  .preview video { max-width: 220px; margin: 0 auto; }
  .styles { grid-template-columns: repeat(5, 1fr); }
  .grid4 { grid-template-columns: repeat(3, 1fr); }
  .scene { grid-template-columns: 54px 1fr auto; gap: 10px; }
  .scene__thumb { width: 54px; height: 80px; }
  .tabs button { flex: 0 0 auto; }
  .tip { max-width: 210px; }
}
.coach [hidden], .win [hidden] { display: none !important; }
