/* Teret Studio, design "Gallery first" (A/B variant /gallery/).
   Light and bright: the videos supply the colour. Phone layout with a bottom
   tab bar below 900px; a left rail above. */
:root {
  --paper: #ffffff;
  --ink: #17140f;
  --berbere: #ff4f2e;        /* decoration only (wordmark dot, accents) */
  --action: #d63a1b;         /* buttons with white text (passes 4.5:1) */
  --action-hover: #b8301499;
  --action-dark: #a82a10;
  --stone: #f2f1ee;
  --stone-2: #e9e7e2;
  --line: #eeece8;
  --chip-line: #e3e0da;
  --muted: #5f5a52;
  --on-ink-muted: #c9c4bb;
  --ok-bg: #dff3e6; --ok: #1d6b3b;
  --busy-bg: #ffe3dc; --busy: #a82a10;
  --err: #b42318; --err-bg: #fde8e6;
  --display: "Bricolage Grotesque", "Noto Sans Ethiopic", system-ui, sans-serif;
  --body: Inter, "Noto Sans Ethiopic", system-ui, sans-serif;
  --radius: 14px;
  --rail: 232px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 15px/1.5 var(--body); overflow-x: hidden; }
h1, h2, h3 { font-family: var(--display); margin: 0; letter-spacing: -0.02em; text-wrap: balance; }
h1 { font-weight: 800; font-size: 28px; line-height: 1.1; }
h2 { font-weight: 800; font-size: 20px; }
h3 { font-weight: 700; font-size: 16px; }
p { margin: 0; }
a { color: var(--action); }
a:hover { color: var(--action-dark); }
img, video, canvas { max-width: 100%; display: block; }
[hidden] { display: none !important; }
.et, [lang="am"], [lang="ti"] { font-family: "Noto Sans Ethiopic", var(--body); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--berbere); outline-offset: 2px; border-radius: 6px; }

/* ---------- shell ---------- */
.shell { min-height: 100dvh; display: flex; }
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 18px max(18px, env(safe-area-inset-right)) 110px max(18px, env(safe-area-inset-left)); outline: none; }
.main.full { max-width: none; padding: 0; }
.loading { color: var(--muted); padding: 40px 0; text-align: center; }

.wordmark { font-family: var(--display); font-weight: 800; font-size: 24px; letter-spacing: -0.03em; color: var(--ink); text-decoration: none; line-height: 1; }
.wordmark span { color: var(--berbere); }

.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: calc(12px + env(safe-area-inset-top)) 18px 10px; background: rgba(255,255,255,.96); backdrop-filter: blur(8px); }
.topbar .right { display: flex; align-items: center; gap: 8px; }
.pill-balance { display: inline-flex; align-items: center; min-height: 36px; padding: 0 13px; border-radius: 99px; background: var(--ink); color: #fff; font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.pill-balance:hover { color: #fff; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--stone); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; text-decoration: none; text-transform: uppercase; flex: none; }
.avatar.lg { width: 64px; height: 64px; font-size: 26px; }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: center; padding: 6px 8px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--paper); font-size: 11px; text-align: center; }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--muted); text-decoration: none; padding: 6px 0; min-height: 48px; justify-content: center; }
.tabbar a.on { color: var(--ink); font-weight: 700; }
.tabbar a.plus { justify-self: center; width: 54px; height: 54px; min-height: 0; border-radius: 17px; background: var(--action); color: #fff; padding: 0; }

.rail { flex: none; width: var(--rail); position: sticky; top: 0; height: 100dvh; padding: 24px 16px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.rail .wordmark { font-size: 26px; padding: 0 10px 16px; }
.rail .new { margin-bottom: 12px; }
.rail .nav { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 500; }
.rail .nav:hover { background: var(--stone); color: var(--ink); }
.rail .nav.on { background: var(--stone); color: var(--ink); font-weight: 600; }
.rail .bal { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding: 14px; border-radius: 14px; background: var(--ink); color: #fff; text-decoration: none; }
.rail .bal:hover { color: #fff; }
.rail .bal small { font-size: 12px; color: var(--on-ink-muted); }
.rail .bal b { font-family: var(--display); font-weight: 800; font-size: 22px; }

@media (min-width: 900px) {
  .shell.signed .rail { display: flex; }
  .shell.signed .topbar, .shell.signed .tabbar { display: none !important; }
  .main { padding: 28px 40px 60px; }
  h1 { font-size: 34px; }
}
@media (max-width: 899.98px) {
  .rail { display: none !important; }
  .shell.focus .tabbar { display: none !important; }
  .shell.focus .main { padding-bottom: 40px; }
}

/* ---------- controls ---------- */
button, .btn, input, select, textarea { font: inherit; color: inherit; }
.btn, button.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: 14px; border: 1.5px solid var(--chip-line); background: var(--paper); color: var(--ink); font-weight: 600; text-decoration: none; cursor: pointer; text-align: center; line-height: 1.2; }
.btn:hover { border-color: #cfcac1; color: var(--ink); }
.btn.primary { background: var(--action); border-color: var(--action); color: #fff; }
.btn.primary:hover { background: var(--action-dark); border-color: var(--action-dark); color: #fff; }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.dark:hover { color: #fff; background: #000; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--ink); background: var(--stone); }
.btn.soft { background: var(--stone); border-color: var(--stone); }
.btn.wide { width: 100%; }
.btn.lg { min-height: 54px; font-size: 16px; border-radius: 16px; }
.btn.sm { min-height: 40px; padding: 0 14px; font-size: 14px; border-radius: 11px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: default; }
.btn .spin { width: 16px; height: 16px; border: 2.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.linkbtn { background: none; border: 0; padding: 6px 2px; color: var(--action); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; min-height: 44px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span, .label { font-size: 13px; font-weight: 600; color: var(--muted); }
.input, .select, .textarea { width: 100%; min-height: 50px; padding: 12px 14px; border-radius: 14px; border: 1.5px solid transparent; background: var(--stone); font-size: 16px; }
.textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--ink); background: var(--paper); }
.hint { font-size: 13px; color: var(--muted); }
.msg { font-size: 14px; padding: 10px 12px; border-radius: 12px; }
.msg.err { background: var(--err-bg); color: var(--err); }
.msg.ok { background: var(--ok-bg); color: var(--ok); }
.msg:empty { display: none; }

.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 0; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 40px; padding: 0 15px; border-radius: 99px; border: 1.5px solid var(--chip-line); background: var(--paper); font-size: 14px; font-weight: 500; cursor: pointer; }
.chip:hover { border-color: #cfcac1; }
.chip.on, .chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 600; }

.toggle { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 64px; padding: 12px 14px; border-radius: 14px; background: var(--stone); cursor: pointer; }
.toggle b { display: block; font-weight: 600; }
.toggle small { color: var(--muted); font-size: 13px; }
.toggle input { appearance: none; flex: none; width: 46px; height: 28px; border-radius: 99px; background: #cfcac1; position: relative; cursor: pointer; transition: background .15s; margin: 0; }
.toggle input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.toggle input:checked { background: var(--action); }
.toggle input:checked::after { transform: translateX(18px); }

.status { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.status.ready { background: var(--ok-bg); color: var(--ok); }
.status.busy { background: var(--busy-bg); color: var(--busy); }
.status.draft { background: var(--stone); color: var(--muted); }
.status.failed { background: var(--err-bg); color: var(--err); }

.card { border-radius: 18px; background: var(--stone); padding: 18px; }
.panel { border: 1.5px solid var(--line); border-radius: 18px; padding: 18px; background: var(--paper); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.back { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px; }
.back:hover { color: var(--ink); }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 14px; }
.empty .ico { width: 64px; height: 64px; border-radius: 20px; background: var(--stone); display: grid; place-items: center; color: var(--ink); }

/* ---------- thumbs and cards ---------- */
.thumb { position: relative; aspect-ratio: 9 / 16; border-radius: 16px; overflow: hidden; background: var(--stone); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .ph { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; gap: 8px; padding: 14px; color: #fff; }
.thumb .ph .ph-title { font-family: "Noto Sans Ethiopic", var(--display); font-weight: 700; font-size: 17px; line-height: 1.25; text-wrap: balance; }
.thumb .ph .ph-ico { position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%); opacity: .9; }
.ph-3d { background: linear-gradient(160deg, #6cc3f5 0%, #3c8fd8 55%, #2a5ea6 100%); }
.ph-chat { background: linear-gradient(160deg, #1f2937 0%, #111827 100%); }
.ph-quiz { background: linear-gradient(160deg, #6d4bd8 0%, #3b1f9a 100%); }
.ph-countdown { background: linear-gradient(160deg, #0f766e 0%, #0b3f3b 100%); }
.ph-bars { background: linear-gradient(160deg, #1e293b 0%, #0f172a 100%); }
.ph-balls { background: linear-gradient(160deg, #ff7a45 0%, #c2410c 100%); }
.tag { position: absolute; left: 9px; top: 9px; padding: 4px 9px; border-radius: 8px; background: rgba(23,20,15,.74); color: #fff; font-size: 11.5px; font-weight: 600; }
.use { position: absolute; right: 9px; bottom: 9px; padding: 6px 12px; border-radius: 10px; background: #fff; color: var(--ink); font-size: 12px; font-weight: 700; }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 10px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 20px 18px; } }
.ex-card { display: flex; flex-direction: column; gap: 6px; color: var(--ink); text-decoration: none; min-width: 0; }
.ex-card:hover { color: var(--ink); }
.ex-card:hover .thumb img { transform: scale(1.03); }
.ex-card .thumb img { transition: transform .3s; }
.ex-card .t { font-size: 14px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.ex-card .m { font-size: 12.5px; color: var(--muted); }

.search { display: flex; align-items: center; gap: 10px; min-height: 50px; padding: 0 14px; border-radius: 14px; background: var(--stone); color: var(--muted); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 16px; color: var(--ink); outline: none; min-height: 46px; }
.search:focus-within { box-shadow: 0 0 0 2px var(--ink); }

/* ---------- welcome ---------- */
.welcome { min-height: 100dvh; display: flex; flex-direction: column; }
.welcome-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(14px + env(safe-area-inset-top)) 20px 10px; }
.welcome-top nav { display: flex; align-items: center; gap: 6px; }
.welcome-top .navlink { display: none; color: var(--muted); text-decoration: none; font-weight: 500; padding: 10px 12px; }
.welcome-top .navlink:hover { color: var(--ink); }
.wall { position: relative; height: 330px; overflow: hidden; margin: 6px 0 0; }
.wall-track { display: flex; gap: 10px; padding: 0 20px; width: max-content; animation: drift 60s linear infinite; }
.wall-col { display: flex; flex-direction: column; gap: 10px; width: 128px; }
.wall-col:nth-child(even) { margin-top: 44px; }
.wall .thumb { border-radius: 14px; }
.wall::after { content: ""; position: absolute; inset: auto 0 0 0; height: 90px; background: linear-gradient(rgba(255,255,255,0), #fff); }
@keyframes drift { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .wall-track { animation: none; } }
.welcome-body { padding: 10px 20px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; max-width: 560px; }
.welcome-body h1 { font-size: 34px; line-height: 1.05; }
.welcome-body .lead { font-size: 16px; color: var(--muted); }
.banner { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; padding: 6px 12px; border-radius: 99px; background: var(--busy-bg); color: var(--busy); font-weight: 600; font-size: 13px; }
.format-strip { display: flex; flex-wrap: wrap; gap: 8px; }
.format-strip span { padding: 6px 12px; border-radius: 99px; background: var(--stone); font-size: 13px; font-weight: 500; }
@media (min-width: 900px) {
  .welcome-top { padding: 22px 48px; }
  .welcome-top .navlink { display: inline-block; }
  .welcome-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 40px; align-items: center; padding: 10px 48px 48px; flex: 1; }
  .welcome-body { padding: 0; max-width: 560px; }
  .welcome-body h1 { font-size: 56px; }
  .welcome-body .lead { font-size: 18px; }
  .wall { height: 620px; border-radius: 28px; margin: 0; }
  .wall-col { width: 170px; }
  .wall::after { display: none; }
}

/* ---------- auth ---------- */
.auth { min-height: 100dvh; display: flex; flex-direction: column; }
.auth-inner { flex: 1; width: 100%; max-width: 440px; margin: 0 auto; padding: 12px 20px 32px; display: flex; flex-direction: column; gap: 18px; }
.auth-head { display: flex; align-items: center; justify-content: space-between; padding: calc(14px + env(safe-area-inset-top)) 20px 6px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: var(--stone); }
.seg button { min-height: 44px; border: 0; border-radius: 11px; background: transparent; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(23,20,15,.12); }
.auth-split { display: none; }
@media (min-width: 900px) {
  .auth { flex-direction: row; }
  .auth-split { display: flex; flex: 1; flex-direction: column; justify-content: flex-end; gap: 18px; padding: 48px; background: var(--ink); color: #fff; position: relative; overflow: hidden; }
  .auth-split .mini-wall { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 24px; opacity: .55; }
  .auth-split .mini-wall .thumb { border-radius: 14px; }
  .auth-split .quote { position: relative; font-family: var(--display); font-size: 30px; font-weight: 800; line-height: 1.1; max-width: 460px; }
  .auth-split::after { content: ""; position: absolute; inset: 0; background: linear-gradient(rgba(23,20,15,.15), rgba(23,20,15,.92)); }
  .auth-split > * { position: relative; z-index: 1; }
  .auth-main { flex: 0 0 520px; display: flex; flex-direction: column; }
  .auth-inner { justify-content: center; }
}
.big-number { font-family: var(--display); font-weight: 800; font-size: 56px; line-height: 1; color: var(--berbere); }

/* ---------- detail ---------- */
.detail { display: grid; gap: 20px; }
@media (min-width: 900px) { .detail { grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 40px; align-items: start; } }
.facts { display: flex; flex-wrap: wrap; gap: 8px; }
.facts span { padding: 6px 12px; border-radius: 99px; background: var(--stone); font-size: 13px; font-weight: 500; }
.cost-line { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--stone); font-size: 14px; }

/* ---------- player ---------- */
.player { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: calc(var(--ph, 74dvh) * 0.5625); margin-inline: auto; }
@media (max-width: 899.98px) { .player { --ph: 60dvh; } }
.player .screen { position: relative; aspect-ratio: 9 / 16; border-radius: 18px; overflow: hidden; background: #0b0b0b; }
.player .screen canvas { width: 100%; height: 100%; }
.player .overlay { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; text-align: center; color: #fff; font-size: 14px; background: rgba(0,0,0,.55); }
.player .controls { display: flex; align-items: center; gap: 10px; }
.player .controls button { min-height: 44px; min-width: 84px; padding: 0 16px; border-radius: 12px; border: 0; background: var(--ink); color: #fff; font-weight: 600; cursor: pointer; }
.player .controls button:disabled { opacity: .5; cursor: default; }
.player .controls input[type=range] { flex: 1; min-width: 0; accent-color: var(--action); height: 32px; }
.player .controls .time { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- create ---------- */
.create { max-width: 620px; display: flex; flex-direction: column; gap: 18px; }
.preset { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 16px; background: var(--stone); }
.preset .thumb { width: 54px; flex: none; border-radius: 10px; }
.preset .thumb .ph .ph-title { display: none; }
.preset .grow { flex: 1; min-width: 0; }
.preset b { display: block; }
.format-pick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.format-pick button { min-height: 54px; border-radius: 14px; border: 1.5px solid var(--chip-line); background: #fff; font-weight: 600; font-size: 14px; cursor: pointer; padding: 6px; }
.format-pick button.on { border-color: var(--ink); background: var(--ink); color: #fff; }
.counter { text-align: right; font-size: 12px; color: var(--muted); }

/* ---------- writing ---------- */
.writing { max-width: 520px; margin: 30px auto; display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; }
.pen { width: 76px; height: 76px; border-radius: 24px; background: var(--busy-bg); color: var(--action); display: grid; place-items: center; }
.pen svg { animation: write 1.4s ease-in-out infinite; }
@keyframes write { 50% { transform: translate(4px, -3px) rotate(-8deg); } }
@media (prefers-reduced-motion: reduce) { .pen svg { animation: none; } }
.skeleton { width: 100%; display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.skeleton div { height: 56px; border-radius: 14px; background: linear-gradient(90deg, var(--stone) 0%, #fbfaf8 50%, var(--stone) 100%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- editor ---------- */
.editor { display: grid; gap: 18px; }
@media (min-width: 900px) { .editor { grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 36px; align-items: start; } .editor .left { position: sticky; top: 24px; } }
.ed-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; justify-content: space-between; margin-bottom: 14px; }
.ed-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ed-title textarea { resize: none; overflow: hidden; line-height: 1.2; font-family: "Noto Sans Ethiopic", var(--display); font-weight: 800; font-size: 22px; border: 0; padding: 4px 6px; margin-left: -6px; border-radius: 8px; background: transparent; min-width: 0; width: 100%; letter-spacing: -0.01em; }
.ed-title textarea:hover { background: var(--stone); }
.ed-title textarea:focus { outline: none; background: var(--stone); }
.saved { font-size: 12.5px; color: var(--muted); }
.settings { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.settings .select { min-height: 44px; width: auto; padding: 8px 12px; font-size: 14px; }
.scenes { display: flex; flex-direction: column; gap: 10px; }
.scene { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; padding: 12px; border-radius: 16px; background: var(--stone); }
.scene .n { width: 30px; height: 30px; border-radius: 10px; background: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.scene .what { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.scene textarea { width: 100%; border: 1.5px solid transparent; background: #fff; border-radius: 10px; padding: 8px 10px; font-size: 15px; line-height: 1.45; resize: vertical; min-height: 44px; }
.scene textarea:focus { outline: none; border-color: var(--ink); }
.scene .ro { font-size: 15px; overflow-wrap: anywhere; }
.ask { display: flex; gap: 8px; align-items: flex-end; padding: 10px; border-radius: 16px; border: 1.5px solid var(--line); }
.ask textarea { flex: 1; min-width: 0; border: 0; resize: none; min-height: 44px; padding: 10px; font-size: 15px; background: transparent; }
.ask textarea:focus { outline: none; }
.ed-actions { display: flex; gap: 10px; }
.ed-actions .btn { flex: 1; }
.sticky-actions { position: sticky; bottom: 0; padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(rgba(255,255,255,0), #fff 28%); z-index: 5; }
@media (min-width: 900px) { .sticky-actions { position: static; background: none; padding: 0; } }

/* ---------- sheets ---------- */
dialog.sheet { border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 100%; max-height: 92dvh; border-radius: 24px 24px 0 0; background: #fff; color: var(--ink); box-shadow: 0 -10px 40px rgba(0,0,0,.18); }
dialog.sheet::backdrop { background: rgba(23,20,15,.5); }
.sheet-body { padding: 10px 20px calc(22px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; overflow-y: auto; max-height: 92dvh; }
.sheet-grip { width: 44px; height: 5px; border-radius: 3px; background: #dcd8d1; margin: 0 auto 6px; }
@media (min-width: 900px) {
  dialog.sheet { margin: auto; max-width: 480px; border-radius: 24px; }
  .sheet-grip { display: none; }
  .sheet-body { padding: 26px 28px 28px; }
}
.lines { display: flex; flex-direction: column; border-radius: 16px; background: var(--stone); padding: 4px 14px; }
.lines .l { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid #e3e0da; font-size: 14.5px; }
.lines .l:last-child { border-bottom: 0; }
.lines .l b { font-variant-numeric: tabular-nums; }
.lines .l.total { font-weight: 700; font-size: 16px; }
.after { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-radius: 14px; border: 1.5px solid var(--line); font-size: 14px; }
.after b { font-variant-numeric: tabular-nums; }

/* ---------- exporting / ready ---------- */
.progress-wrap { max-width: 520px; margin: 20px auto; display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; }
.ring { width: 168px; height: 168px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--action) calc(var(--p, 0) * 1%), var(--stone) 0); }
.ring div { width: 136px; height: 136px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 36px; font-variant-numeric: tabular-nums; }
.bar { width: 100%; height: 10px; border-radius: 99px; background: var(--stone); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--action); border-radius: 99px; transition: width .4s; }
.ready-wrap { display: grid; gap: 20px; }
@media (min-width: 900px) { .ready-wrap { grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); gap: 40px; align-items: start; } }
.ready-wrap video { width: 100%; max-width: calc(74dvh * 0.5625); margin-inline: auto; aspect-ratio: 9 / 16; border-radius: 18px; background: #000; object-fit: contain; }
.caption { padding: 14px; border-radius: 14px; background: var(--stone); font-size: 15px; white-space: pre-wrap; overflow-wrap: anywhere; }
.share { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.share a { display: flex; flex-direction: column; align-items: center; gap: 6px; min-height: 72px; justify-content: center; border-radius: 14px; background: var(--stone); color: var(--ink); text-decoration: none; font-size: 13px; font-weight: 600; }
.share a:hover { background: var(--stone-2); color: var(--ink); }

/* ---------- my videos ---------- */
.vlist { display: flex; flex-direction: column; gap: 10px; }
.vrow { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 16px; border: 1.5px solid var(--line); background: #fff; }
.vrow .thumb { width: 52px; flex: none; border-radius: 10px; }
.vrow .thumb .ph .ph-title, .vrow .thumb .tag { display: none; }
.vrow .thumb .ph .ph-ico { transform: translate(-50%, -50%) scale(.6); }
.vrow .main-link { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; color: var(--ink); text-decoration: none; min-height: 44px; justify-content: center; }
.vrow .main-link b { font-weight: 600; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.vrow .main-link small { color: var(--muted); font-size: 12.5px; }
.icon-btn { width: 44px; height: 44px; flex: none; border-radius: 12px; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.icon-btn:hover { background: var(--stone); color: var(--ink); }

/* ---------- wallet ---------- */
.balance-card { border-radius: 22px; background: var(--ink); color: #fff; padding: 20px; display: flex; flex-direction: column; gap: 4px; }
.balance-card small { color: var(--on-ink-muted); font-size: 13px; }
.balance-card b { font-family: var(--display); font-weight: 800; font-size: 38px; line-height: 1.05; }
.balance-card .sub { color: var(--on-ink-muted); font-size: 14px; }
.packs { display: grid; gap: 10px; }
@media (min-width: 900px) { .packs { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; } }
.pack { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 16px; border-radius: 18px; border: 1.5px solid var(--line); background: #fff; text-align: left; cursor: pointer; min-height: 44px; }
.pack:hover { border-color: #cfcac1; }
.pack.pop { border-color: var(--ink); }
.pack .badge { position: absolute; top: -11px; right: 14px; padding: 3px 10px; border-radius: 99px; background: var(--ink); color: #fff; font-size: 11.5px; font-weight: 700; }
.pack .name { font-weight: 600; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .05em; }
.pack .tokens { font-family: var(--display); font-weight: 800; font-size: 24px; }
.pack .price { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.pack .price b { font-size: 18px; }
.pack .price s { color: var(--muted); font-size: 14px; }
.pack .off { align-self: flex-start; padding: 3px 9px; border-radius: 99px; background: var(--busy-bg); color: var(--busy); font-size: 12px; font-weight: 700; }
.pack .about { font-size: 13px; color: var(--muted); }
@media (max-width: 899.98px) {
  .pack { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 12px; }
  .pack .name, .pack .tokens, .pack .about { grid-column: 1; }
  .pack .price, .pack .off { grid-column: 2; grid-row: span 1; justify-self: end; text-align: right; }
  .pack .price { flex-direction: column; align-items: flex-end; gap: 0; grid-row: 1 / span 2; }
  .pack .off { grid-row: 3; }
}
.costs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 900px) { .costs { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.costs div { padding: 12px; border-radius: 14px; background: var(--stone); font-size: 13.5px; display: flex; justify-content: space-between; gap: 8px; }
.costs b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.paywith { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); }
.ref-big { font-family: ui-monospace, Menlo, monospace; font-size: 24px; font-weight: 700; letter-spacing: .06em; padding: 14px; border-radius: 14px; background: var(--stone); text-align: center; }

.rows { display: flex; flex-direction: column; }
.rows .r { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: center; }
.rows .r:last-child { border-bottom: 0; }
.rows .r small { display: block; color: var(--muted); font-size: 12.5px; }
.rows .plus { color: var(--ok); font-weight: 700; font-variant-numeric: tabular-nums; }
.rows .minus { font-weight: 700; font-variant-numeric: tabular-nums; }

.two-col { display: grid; gap: 22px; }
@media (min-width: 900px) { .two-col { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; align-items: start; } }

/* ---------- done / success ---------- */
.success { max-width: 480px; margin: 30px auto; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.check { width: 84px; height: 84px; border-radius: 28px; background: var(--ok-bg); color: var(--ok); display: grid; place-items: center; }
.kv { width: 100%; display: flex; flex-direction: column; border-radius: 16px; background: var(--stone); padding: 4px 14px; text-align: left; }
.kv div { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid #e3e0da; font-size: 14px; }
.kv div:last-child { border-bottom: 0; }

.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 100; background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; font-size: 14px; font-weight: 500; max-width: calc(100% - 32px); box-shadow: 0 8px 30px rgba(0,0,0,.2); }
@media (min-width: 900px) { .toast { bottom: 28px; } }

/* Google sign-in */
.btn.google { background: #fff; color: #17140f; border: 1.5px solid #d9d5cd; gap: 10px; }
.btn.google:hover:not(:disabled) { border-color: #17140f; }
.or { display: flex; align-items: center; gap: 12px; color: #5f5a52; font-size: 14px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: #e3e0da; }

/* Voice preview bar under the player */
.voicebar { display: flex; flex-direction: column; gap: 6px; }
.vb-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.voicebar .spin { vertical-align: -3px; margin-right: 6px; }

/* Welcome footer links */
.foot-links { display: flex; flex-wrap: wrap; gap: 16px; font-size: 14px; margin: 0; }
.foot-links a { color: var(--muted); }
.foot-links a:hover { color: var(--ink); }

/* Support tickets */
.ticket { display: flex; flex-direction: column; gap: 4px; padding: 14px 0; border-bottom: 1px solid var(--chip-line); }
.ticket:last-child { border-bottom: 0; }
.ticket .t-msg { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.ticket .t-reply { margin-top: 8px; padding: 10px 12px; border-radius: 12px; background: var(--ok-bg); }
.ticket .t-reply p { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }

/* Coupon codes (wallet) */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.code-entry summary { cursor: pointer; font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; text-decoration: underline; text-underline-offset: 3px; }
.code-form { display: flex; gap: 8px; margin-top: 6px; max-width: 460px; }
.code-form .input { flex: 1; min-width: 0; text-transform: uppercase; letter-spacing: .06em; }
.code-applied { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 12px 14px; border-radius: 14px; background: var(--busy-bg); color: var(--ink); }
.code-applied > span { flex: 1 1 220px; min-width: 0; }
.code-applied > span svg { vertical-align: -3px; margin-right: 6px; }
.row-btns { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.pack.coupon { border-color: var(--busy); }

/* Touch targets: at least 44 px for everything tappable (WCAG 2.5.5 / Apple HIG). */
.chip, .btn.sm, .welcome-top .navlink { min-height: 44px; }
.pill-balance { min-height: 44px; }
.avatar { width: 44px; height: 44px; }
.wordmark { display: inline-flex; align-items: center; min-height: 44px; }
.player .controls input[type=range] { height: 44px; }
/* The ask box's textarea has no outline of its own: show focus on the whole box. */
.ask:focus-within { border-color: var(--ink); box-shadow: 0 0 0 2px var(--ink); }
.ed-title textarea { min-height: 44px; }
.ed-title textarea:focus-visible { box-shadow: 0 0 0 2px var(--ink); }

/* Shown by the HTML before any script runs, so the first paint is the brand, not a blank page. */
.boot-splash { min-height: 70vh; display: grid; place-content: center; justify-items: center; gap: 10px; text-align: center; color: var(--muted); }
.boot-splash .wordmark { font-size: 34px; }
.boot-splash p { margin: 0; }
.teret-loader { --tl-skin: #c68e5a; --tl-hair: var(--ink); --tl-eye: var(--ink); --tl-shirt: var(--berbere); --tl-pants: var(--ink); --tl-edge: 0; --tl-drop: 0 0 0 transparent; --tl-drop-f: none; --tl-shadow: rgba(23, 20, 15, 0.14); }
/* Teret loader: a blocky Teret character builds itself (legs, body, head), hops twice,
   blinks, and comes apart again. Pure CSS so it plays before any script loads.
   Colours come from --tl-* (set per design above). Still image with reduced motion. */
.teret-loader { position: relative; width: 64px; height: 96px; flex: none; }
.teret-loader.sm { scale: 0.62; margin: -18px -12px; }
.tl-fig { position: absolute; inset: 0; animation: tl-hop 2.6s ease-in-out infinite; }
.tl-fig > span { position: absolute; display: block; box-sizing: border-box; border: var(--tl-edge); }
.tl-legs { left: 16px; top: 70px; width: 32px; height: 17px; border: 0 !important; background: linear-gradient(90deg, var(--tl-pants) 0 13px, transparent 13px 19px, var(--tl-pants) 19px); filter: var(--tl-drop-f); animation: tl-legs 2.6s ease-out infinite; }
.tl-body { left: 10px; top: 39px; width: 44px; height: 31px; border-radius: 7px; background: var(--tl-shirt); box-shadow: var(--tl-drop); animation: tl-body 2.6s ease-out infinite; }
.tl-head { left: 14px; top: 6px; width: 36px; height: 32px; border-radius: 8px; background: var(--tl-skin); box-shadow: inset 0 10px 0 var(--tl-hair), var(--tl-drop); animation: tl-head 2.6s ease-out infinite; }
.tl-head::after { content: ""; position: absolute; inset: 0; transform-origin: 50% 62%;
  background: radial-gradient(circle at 32% 62%, var(--tl-eye) 0 3px, transparent 3.5px), radial-gradient(circle at 68% 62%, var(--tl-eye) 0 3px, transparent 3.5px);
  animation: tl-blink 2.6s infinite; }
.tl-shadow { position: absolute; left: 12px; bottom: 0; width: 40px; height: 6px; border-radius: 50%; background: var(--tl-shadow); animation: tl-shadow 2.6s ease-in-out infinite; }
@keyframes tl-legs { 0% { transform: translateY(-72px); opacity: 0; } 8% { opacity: 1; } 12% { transform: translateY(0); } 14% { transform: scaleY(0.82); } 17%, 84% { transform: none; opacity: 1; } 92%, 100% { transform: translateY(-12px); opacity: 0; } }
@keyframes tl-body { 0%, 12% { transform: translateY(-72px); opacity: 0; } 18% { opacity: 1; } 24% { transform: translateY(0); } 26% { transform: scaleY(0.86); } 29%, 84% { transform: none; opacity: 1; } 92%, 100% { transform: translateY(-16px); opacity: 0; } }
@keyframes tl-head { 0%, 24% { transform: translateY(-72px); opacity: 0; } 30% { opacity: 1; } 36% { transform: translateY(0); } 38% { transform: scaleY(0.86); } 41%, 84% { transform: none; opacity: 1; } 92%, 100% { transform: translateY(-20px); opacity: 0; } }
@keyframes tl-hop { 0%, 44% { transform: none; } 50% { transform: translateY(-14px); } 56% { transform: none; } 62% { transform: translateY(-14px); } 68%, 100% { transform: none; } }
@keyframes tl-shadow { 0%, 10% { transform: scaleX(0.4); opacity: 0; } 16%, 44% { transform: none; opacity: 1; } 50% { transform: scaleX(0.6); } 56% { transform: none; } 62% { transform: scaleX(0.6); } 68%, 84% { transform: none; opacity: 1; } 96%, 100% { transform: scaleX(0.4); opacity: 0; } }
@keyframes tl-blink { 0%, 72% { transform: none; } 74% { transform: scaleY(0.1); } 76%, 100% { transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .tl-fig, .tl-fig > span, .tl-head::after, .tl-shadow { animation: none; opacity: 1; transform: none; }
}

.foot-links a { display: inline-flex; align-items: center; min-height: 44px; }
.boot-splash.quiet { min-height: 40vh; }
