/* Tcharam: media-first, near-zero text. Black canvas, white type, white buttons; lime only as the logo's accent. */
/* Nunito (SIL Open Font License 1.1), self-hosted variable font from Google Fonts, latin + latin-ext */
@font-face { font-family: 'Nunito'; font-style: normal; font-weight: 400 900; font-display: swap; src: url('/fonts/nunito-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Nunito'; font-style: normal; font-weight: 400 900; font-display: swap; src: url('/fonts/nunito-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
:root {
  --bg: #000; --bg1: #0c0c0d; --bg2: #151517; --line: #232326; --fg: #f4f4f5; --mute: #8d8d93; --dim: #5d5d63;
  --lime: #CBF52D; --ok: #36d399; --bad: #ff6b6b; --r: 10px; --pad: 14px; --maxw: 1320px;
  --font: "Nunito", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.45 var(--font); min-height: 100vh; overflow-x: hidden; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
img, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--pad); }
.mute { color: var(--mute); }
.tiny { font-size: 12px; color: var(--dim); }
svg.i { width: 22px; height: 22px; fill: currentColor; flex: 0 0 auto; }
svg.i.f, .bnav a.on > svg.i:not(.f), .thumbs button.on > svg.i:not(.f) { display: none; }
.bnav a.on > svg.i.f, .thumbs button.on > svg.i.f { display: block; }

/* top bar */
.top { position: sticky; top: 0; z-index: 30; background: rgba(0,0,0,0.82); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.top .wrap { display: flex; align-items: center; gap: 18px; height: 54px; }
.mark { display: inline-flex; align-items: center; flex: 0 0 auto; }
.mark img { height: 41px; width: auto; }
.top nav { display: none; gap: 18px; }
.top nav a { color: var(--mute); font-size: 14px; font-weight: 700; }
.top nav a.on, .top nav a:hover { color: var(--fg); }
.sp { flex: 1; }
.bal { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; font-variant-numeric: tabular-nums; color: var(--fg); padding: 6px 2px; }
.bal { font-weight: 800; }
.bal i { width: 9px; height: 9px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 10px rgba(203,245,45,0.45); }
.bnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: grid; grid-template-columns: repeat(4, 1fr); background: rgba(0,0,0,0.9); backdrop-filter: blur(16px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.bnav a { display: grid; place-items: center; height: 54px; color: var(--dim); }
.bnav a.on { color: var(--fg); }
main.app { padding-bottom: 80px; min-height: 80vh; }
@media (min-width: 860px) { .top nav { display: flex; } .bnav { display: none; } main.app { padding-bottom: 40px; } }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 48px; padding: 0 20px; border-radius: 999px; border: 1px solid var(--line); background: transparent; font-weight: 800; font-size: 15px; transition: opacity .15s, transform .08s; -webkit-tap-highlight-color: transparent; white-space: nowrap; }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; }
.btn.solid { background: var(--fg); color: #000; border-color: var(--fg); }
.btn.wide { width: 100%; }
.btn .c { display: inline-flex; align-items: center; gap: 5px; font-variant-numeric: tabular-nums; opacity: 0.75; }
.btn .c::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.ibtn { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line); background: transparent; color: var(--fg); }
.link { background: none; border: 0; color: var(--mute); padding: 8px; font-size: 13px; }

/* home */
.ask { display: flex; align-items: center; gap: 8px; margin: 10px 0 14px; background: var(--bg1); border: 1px solid var(--line); border-radius: 999px; padding: 5px 5px 5px 18px; }
.ask input { flex: 1; min-width: 0; background: none; border: 0; outline: none; font-size: 15px; height: 40px; }
.ask input::placeholder { color: var(--dim); }
.ask button { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--fg); color: #000; display: grid; place-items: center; }
.tabs { display: flex; gap: 20px; overflow-x: auto; scrollbar-width: none; padding: 2px 0 12px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { color: var(--dim); font-size: 14px; font-weight: 700; white-space: nowrap; }
.tabs a.on { color: var(--fg); }
.feed { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
@media (min-width: 640px) { .feed { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 980px) { .feed { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; } }
.tile { position: relative; display: block; aspect-ratio: 9 / 16; overflow: hidden; background: var(--bg2); border-radius: 6px; }
.tile video, .tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile .cap { position: absolute; left: 10px; right: 10px; bottom: 9px; font-size: 13px; font-weight: 800; line-height: 1.2; text-shadow: 0 1px 8px rgba(0,0,0,0.8); z-index: 1; }
.tile::after { content: ""; position: absolute; inset: 55% 0 0; background: linear-gradient(transparent, rgba(0,0,0,0.55)); }
.tile .st { position: absolute; left: 8px; top: 8px; z-index: 1; font-size: 11px; padding: 3px 7px; border-radius: 99px; background: rgba(0,0,0,0.6); }
.tile .bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255,255,255,0.15); z-index: 2; }
.tile .bar i { display: block; height: 100%; background: var(--lime); }
.foot { padding: 34px var(--pad) 100px; text-align: center; font-size: 12px; color: var(--dim); }
.foot a { color: var(--dim); margin: 0 6px; }
@media (min-width: 860px) { .foot { padding-bottom: 34px; } }

/* template */
.tp { display: grid; gap: 16px; padding-top: 6px; }
.tp-media { position: relative; width: 100%; max-width: 520px; margin: 0 auto; aspect-ratio: 9 / 16; max-height: 64vh; border-radius: var(--r); overflow: hidden; background: var(--bg2); }
.tp-media video, .tp-media img { width: 100%; height: 100%; object-fit: cover; }
.tp-panel { width: 100%; max-width: 520px; margin: 0 auto; display: grid; gap: 14px; }
.tp-title { font-size: 22px; font-weight: 850; letter-spacing: -0.01em; margin: 0; line-height: 1.2; }
.tp-sub { margin: -8px 0 0; color: var(--mute); font-size: 14px; }
@media (min-width: 900px) { .tp { grid-template-columns: minmax(0, 460px) minmax(0, 420px); justify-content: center; gap: 40px; padding-top: 24px; } .tp-media { max-height: 82vh; } .tp-panel { align-content: start; padding-top: 8px; } }
.slots { display: flex; gap: 10px; flex-wrap: wrap; }
.slot { position: relative; width: 92px; height: 116px; border-radius: var(--r); border: 1px dashed #3a3a3f; background: var(--bg1) center/cover no-repeat; display: grid; place-items: center; color: var(--mute); overflow: hidden; }
.slot.has { border: 1px solid var(--fg); }
.slot.has svg { display: none; }
.slot span { position: absolute; left: 0; right: 0; bottom: 6px; text-align: center; font-size: 11px; color: var(--mute); }
.slot.has span { display: none; }
.slot input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.slot .wait { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,0.6); font-size: 12px; }
.in { width: 100%; background: var(--bg1); border: 1px solid var(--line); border-radius: var(--r); padding: 13px 14px; outline: none; font-size: 15px; }
.in:focus { border-color: #5a5a60; }
textarea.in { min-height: 96px; resize: vertical; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { font-weight: 700; height: 34px; padding: 0 13px; border-radius: 99px; border: 1px solid var(--line); background: transparent; color: var(--mute); font-size: 13px; }
.seg button.on { border-color: var(--fg); color: var(--fg); }
.chk { display: flex; gap: 9px; align-items: flex-start; font-size: 12px; color: var(--mute); line-height: 1.4; }
.chk input { margin: 1px 0 0; width: 16px; height: 16px; accent-color: #fff; flex: 0 0 auto; }
.chk a { text-decoration: underline; }
.row2 { display: grid; grid-template-columns: auto 1fr; gap: 8px; }
.err { color: var(--bad); font-size: 13px; margin: 0; }

/* progress + result */
.stage { position: relative; width: 100%; max-width: 520px; margin: 6px auto 0; aspect-ratio: 9 / 16; max-height: 70vh; border-radius: var(--r); overflow: hidden; background: var(--bg2); }
.stage > video, .stage > img { width: 100%; height: 100%; object-fit: cover; }
.stage .blur { position: absolute; inset: -20px; background: center/cover no-repeat; filter: blur(28px) brightness(0.45); }
.stage .pg { position: absolute; left: 22px; right: 22px; bottom: 26px; display: grid; gap: 10px; }
.stage .pg b { font-size: 34px; font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: -0.03em; }
.line { height: 2px; background: rgba(255,255,255,0.15); border-radius: 2px; overflow: hidden; }
.line i { display: block; height: 100%; width: 0; background: var(--lime); transition: width 0.8s ease; }
.under { width: 100%; max-width: 520px; margin: 12px auto 0; display: grid; gap: 12px; }
.icons { display: flex; justify-content: center; gap: 14px; }
.icons .ibtn { width: 52px; height: 52px; }
.thumbs { display: flex; justify-content: center; gap: 8px; }
.thumbs button { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: none; color: var(--dim); display: grid; place-items: center; }
.thumbs button.on { color: var(--fg); border-color: var(--fg); }

/* studio */
.canvas { max-width: 760px; margin: 10px auto 0; display: grid; gap: 10px; }
.box { background: var(--bg1); border: 1px solid var(--line); border-radius: 18px; padding: 14px; display: grid; gap: 12px; }
.box textarea { width: 100%; min-height: 130px; background: none; border: 0; outline: none; resize: none; font-size: 17px; line-height: 1.45; }
.box textarea::placeholder { color: var(--dim); }
.tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pick { height: 34px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--bg2); color: var(--fg); font-size: 13px; appearance: none; -webkit-appearance: none; outline: none; }
.att { display: flex; gap: 8px; align-items: center; }
.att .slot { width: 46px; height: 58px; border-radius: 8px; }
.att .slot span { display: none; }
.go { margin-left: auto; }
.mode { display: flex; gap: 18px; justify-content: center; font-size: 14px; }
.mode button { background: none; border: 0; color: var(--dim); padding: 6px 0; font-weight: 700; }
.mode button.on { color: var(--fg); }

/* credits */
.big { font-size: 56px; font-weight: 900; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin: 14px 0 0; line-height: 1; }
.packs { display: grid; gap: 8px; margin-top: 18px; }
.pack { display: flex; justify-content: space-between; align-items: center; width: 100%; height: 64px; padding: 0 18px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg1); color: var(--fg); }
.pack.pop { border-color: var(--fg); }
.pack .n { font-size: 20px; font-weight: 850; font-variant-numeric: tabular-nums; }
.pack .v { font-size: 15px; color: var(--mute); }
.narrow { max-width: 460px; margin: 0 auto; }

/* sheet */
.sheet-bg { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,0.7); display: grid; align-items: end; justify-items: center; }
@media (min-width: 700px) { .sheet-bg { align-items: center; } }
.sheet { width: 100%; max-width: 440px; max-height: 92vh; overflow: auto; background: var(--bg1); border: 1px solid var(--line); border-radius: 20px 20px 0 0; padding: 18px var(--pad) calc(18px + env(safe-area-inset-bottom)); }
@media (min-width: 700px) { .sheet { border-radius: 20px; } }
.sheet .x { float: right; background: none; border: 0; color: var(--mute); padding: 4px; }
.qr { width: 210px; height: 210px; margin: 10px auto; background: #fff; border-radius: 12px; padding: 8px; }
.qr img { width: 100%; height: 100%; image-rendering: pixelated; }
.code { word-break: break-all; font-size: 11px; color: var(--dim); max-height: 46px; overflow: hidden; margin-top: 8px; }
.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: var(--fg); color: #000; padding: 10px 16px; border-radius: 99px; font-size: 14px; font-weight: 800; z-index: 90; max-width: 90vw; text-align: center; }
.empty { text-align: center; color: var(--mute); padding: 18vh 10px; display: grid; gap: 16px; justify-items: center; }

/* pages from the Worker (share, docs) */
body.doc main, body.share main { max-width: 560px; margin: 0 auto; padding: 0 var(--pad); }
body.doc .mark, body.share .mark { display: inline-flex; margin: 16px 0 8px; }
.prose { color: #d6d6da; font-size: 14px; }
.prose h1 { font-weight: 900; font-size: 24px; margin: 14px 0 4px; color: var(--fg); }
.prose h2 { font-size: 16px; margin: 22px 0 4px; color: var(--fg); }
.prose li { margin: 4px 0; }
.prose a { text-decoration: underline; }
.sv { width: 100%; height: 100%; object-fit: contain; background: #000; }
.ai { position: absolute; top: 10px; right: 10px; font-size: 11px; padding: 3px 8px; border-radius: 99px; background: rgba(0,0,0,0.55); color: #ddd; }

/* studio: prompt box + photo + settings sheet */
.box .bar2 { display: flex; align-items: center; gap: 10px; }
.box .bar2 .go { margin-left: auto; }
.gear { position: relative; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: transparent; color: var(--mute); display: grid; place-items: center; }
.gear.mod::after { content: ""; position: absolute; top: 7px; right: 7px; width: 6px; height: 6px; border-radius: 50%; background: var(--lime); }
.set { display: grid; gap: 16px; padding-top: 6px; }
.set h4 { margin: 0 0 8px; font-size: 12px; font-weight: 700; color: var(--dim); letter-spacing: 0.02em; }
@media (max-width: 480px) { .box .bar2 { flex-wrap: wrap; row-gap: 10px; } .box .bar2 .btn { flex: 1 0 auto; } }
.canvas { grid-template-columns: minmax(0, 1fr); }
.prose .mark { text-decoration: none; }
