/* BERDA Media Mini App — visual language of the bot prototype (tokens, cards, tab bar, night hero). */
:root {
  --bg: #EEF1F7; --card: #FFFFFF; --tile: #E6ECF8; --tile-2: #F4F6FB;
  --fg: #10131C; --muted: #687087; --faint: #9AA1B3; --line: rgba(16, 19, 28, .08);
  --accent: #2F6BFF; --accent-ink: #FFFFFF; --accent-soft: #E3EBFF;
  --good: #17935A; --good-soft: #E1F4EA; --warn: #C27A10; --warn-soft: #FBF0DC; --bad: #D9423A; --bad-soft: #FBE5E3;
  --gold: #B07A1E; --gold-soft: #F7EBD3; --violet: #7B5CFF;
  --night: #121A33; --night-2: #1D2A52;
  --shadow: 0 1px 2px rgba(16, 19, 28, .04), 0 6px 24px rgba(30, 45, 90, .06);
  --f-ui: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-display: "Unbounded", "Manrope", system-ui, sans-serif;
  --r-lg: 22px; --r-md: 16px; --r-sm: 12px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0D1017; --card: #171B24; --tile: #1F2534; --tile-2: #1A1F2B;
  --fg: #EEF1F8; --muted: #9AA3B8; --faint: #6C7489; --line: rgba(255, 255, 255, .08);
  --accent: #5B8CFF; --accent-ink: #0B1020; --accent-soft: #1E2A4A;
  --good: #3CC584; --good-soft: #163326; --warn: #E3A645; --warn-soft: #3A2D14; --bad: #F06A60; --bad-soft: #3B1C1A;
  --gold: #E2B055; --gold-soft: #3A2E17; --night: #0A0F20; --night-2: #16224A;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25); color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #0D1017; --card: #171B24; --tile: #1F2534; --tile-2: #1A1F2B;
  --fg: #EEF1F8; --muted: #9AA3B8; --faint: #6C7489; --line: rgba(255, 255, 255, .08);
  --accent: #5B8CFF; --accent-ink: #0B1020; --accent-soft: #1E2A4A;
  --good: #3CC584; --good-soft: #163326; --warn: #E3A645; --warn-soft: #3A2D14; --bad: #F06A60; --bad-soft: #3B1C1A;
  --gold: #E2B055; --gold-soft: #3A2E17; --night: #0A0F20; --night-2: #16224A;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--fg); font: 500 15px/1.45 var(--f-ui); -webkit-font-smoothing: antialiased;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
svg.i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg.i.sm { width: 16px; height: 16px; }

.app { max-width: 440px; margin: 0 auto; padding-block: 12px calc(100px + env(safe-area-inset-bottom, 0px)); }
.view { display: flex; flex-direction: column; gap: 14px; animation: rise .28s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.top h1 { margin: 0; font: 600 20px/1.2 var(--f-display); letter-spacing: -.02em; }
.sub { color: var(--muted); font-size: 13px; }
.h-sec { font-size: 12.5px; font-weight: 800; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; margin: 6px 0 -4px; }
.card { background: var(--card); border-radius: var(--r-lg); padding: 16px; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; background: var(--tile-2); }
.row { display: flex; align-items: center; gap: 12px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.big { font: 600 26px/1.1 var(--f-display); letter-spacing: -.02em; }
.mid { font: 600 19px/1.15 var(--f-display); letter-spacing: -.01em; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 46px; padding: 0 18px; border-radius: 14px; font-weight: 700; font-size: 15px; background: var(--accent); color: var(--accent-ink); transition: transform .1s, filter .15s; }
.btn:active { transform: scale(.98); }
.btn.block { width: 100%; }
.btn.ghost { background: var(--tile); color: var(--fg); }
.btn.sm { height: 36px; padding: 0 13px; font-size: 13.5px; border-radius: 11px; }
.btn[disabled] { opacity: .55; pointer-events: none; }

.hero { position: relative; overflow: hidden; border-radius: 26px; background: var(--night); color: #fff; padding: 20px 18px 18px; }
.hero::before, .hero::after { content: ""; position: absolute; border-radius: 50%; filter: blur(40px); opacity: .55; animation: drift 14s ease-in-out infinite alternate; }
.hero::before { width: 220px; height: 220px; right: -70px; top: -90px; background: #2F6BFF; }
.hero::after { width: 180px; height: 180px; left: -60px; bottom: -90px; background: #7B5CFF; animation-delay: -6s; }
.hero.partner::before { background: #7B5CFF; } .hero.partner::after { background: #E8458B; }
.hero.ambassador::before { background: #E2B055; } .hero.ambassador::after { background: #FF9C3A; }
.hero > * { position: relative; }
@keyframes drift { to { transform: translate(-24px, 18px) scale(1.12); } }
.hero .kick { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: rgba(255, 255, 255, .7); }
.hero h2 { margin: 6px 0 2px; font: 600 26px/1.1 var(--f-display); letter-spacing: -.02em; }
.hero .rate { font: 600 40px/1 var(--f-display); letter-spacing: -.03em; }
.hero .rate small { font: 700 13px var(--f-ui); color: rgba(255, 255, 255, .7); margin-left: 6px; letter-spacing: 0; }
.hero .money { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.hero .money div { padding: 12px; border-radius: 16px; background: rgba(255, 255, 255, .08); }
.hero .money b { display: block; font: 600 19px/1.15 var(--f-display); }
.hero .money span { font-size: 12px; color: rgba(255, 255, 255, .7); }

.bar { height: 8px; border-radius: 99px; background: var(--tile); overflow: hidden; }
.bar > b { display: block; height: 100%; width: 0; border-radius: 99px; background: var(--accent); transition: width .9s cubic-bezier(.2, .8, .2, 1); }
.bar.good > b { background: var(--good); }
.prog { display: flex; flex-direction: column; gap: 6px; }
.prog .between { font-size: 13px; }
.prog .between b { font-weight: 800; }

.list { display: flex; flex-direction: column; }
.li { display: flex; align-items: center; gap: 12px; padding: 11px 0; text-align: left; width: 100%; }
.li + .li { border-top: 1px solid var(--line); }
.ic { width: 38px; height: 38px; border-radius: 12px; background: var(--tile); display: grid; place-items: center; color: var(--accent); flex: none; }
.ic.good { background: var(--good-soft); color: var(--good); } .ic.gold { background: var(--gold-soft); color: var(--gold); }
.ic.violet { background: color-mix(in srgb, var(--violet) 16%, transparent); color: var(--violet); }
.li .tx { flex: 1; min-width: 0; }
.li .tx b { display: block; font-size: 14.5px; font-weight: 700; line-height: 1.3; }
.li .tx small { display: block; color: var(--muted); font-size: 12.5px; }
.li .amt { font-weight: 800; white-space: nowrap; }
.li .amt.good { color: var(--good); }

.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; padding: 4px 9px; border-radius: 999px; background: var(--tile); white-space: nowrap; }
.chip.good { background: var(--good-soft); color: var(--good); } .chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); } .chip.acc { background: var(--accent-soft); color: var(--accent); }

.seg { display: flex; padding: 4px; gap: 4px; background: var(--tile); border-radius: 14px; }
.seg button { flex: 1; height: 34px; border-radius: 10px; font-weight: 700; font-size: 13.5px; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--fg); box-shadow: var(--shadow); }

.kpi { display: flex; flex-direction: column; gap: 4px; }
.kpi b { font: 600 22px/1.1 var(--f-display); }
.kpi .d { font-size: 12px; font-weight: 800; }
.kpi .d.up { color: var(--good); } .kpi .d.down { color: var(--bad); }

.code { font: 600 34px/1 var(--f-display); letter-spacing: .04em; text-align: center; padding: 18px 0 8px;
  background: linear-gradient(90deg, var(--fg) 0%, var(--accent) 35%, var(--violet) 55%, var(--fg) 80%); background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: gradmove 7s linear infinite; }
@keyframes gradmove { to { background-position: -200% 0; } }
.linkbox { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--tile-2); font-size: 13.5px; }
.linkbox span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* chat */
.chat { display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 84%; padding: 9px 12px; border-radius: 16px; background: var(--card); box-shadow: var(--shadow); font-size: 14.5px; white-space: pre-wrap; word-break: break-word; }
.msg.me { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 6px; }
.msg.them { align-self: flex-start; border-bottom-left-radius: 6px; }
.msg time { display: block; margin-top: 3px; font-size: 11px; opacity: .6; text-align: right; }
.msg .who { display: inline-block; margin: 0 6px 2px 0; font-size: 11px; font-weight: 800; padding: 1px 6px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); }
.msg .who.human { background: var(--good-soft); color: var(--good); }
.composer { position: sticky; bottom: calc(72px + env(safe-area-inset-bottom, 0px)); z-index: 10; margin-top: 4px; padding: 8px 0; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(12px); }
.composer form { display: flex; gap: 8px; }
.composer input { flex: 1; height: 44px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); }
.queue { align-self: center; font-size: 13px; padding: 8px 12px; border-radius: 12px; background: var(--good-soft); color: var(--good); text-align: center; }

/* forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 700; color: var(--muted); }
.field input, .field select { height: 46px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); }
.hint { font-size: 12.5px; color: var(--muted); }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(14px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); }
.tabbar nav { max-width: 440px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); height: 64px; }
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11.5px; font-weight: 700; color: var(--faint); position: relative; }
.tab[aria-current="page"] { color: var(--accent); }
.tab.center i { width: 54px; height: 46px; border-radius: 16px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-top: -14px; box-shadow: 0 0 0 4px var(--bg); }
.tab.center[aria-current="page"] i { background: var(--accent); color: var(--accent-ink); }
.tab .dot { position: absolute; top: 8px; right: calc(50% - 16px); width: 8px; height: 8px; border-radius: 50%; background: var(--bad); }

.toast { position: fixed; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 50; max-width: 90vw; padding: 10px 14px; border-radius: 14px; background: var(--night); color: #fff; font-size: 14px; font-weight: 600; box-shadow: var(--shadow); animation: rise .2s ease both; }

.sheet-scrim { position: fixed; inset: 0; z-index: 40; background: rgba(8, 12, 24, .45); display: flex; align-items: flex-end; justify-content: center; animation: fade .2s ease both; }
.sheet { width: 100%; max-width: 440px; max-height: 86vh; overflow: auto; background: var(--card); border-radius: 24px 24px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0px)); animation: up .25s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes fade { from { opacity: 0; } } @keyframes up { from { transform: translateY(40px); opacity: 0; } }
.empty { text-align: center; padding: 28px 12px; color: var(--muted); }
.skeleton { height: 180px; border-radius: 26px; background: linear-gradient(90deg, var(--tile) 25%, var(--tile-2) 50%, var(--tile) 75%); background-size: 200% 100%; animation: gradmove 1.4s linear infinite; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* stage 6: ladder, bank */
.ladder { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 12px; align-items: end; }
.step { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 14px; background: var(--tile-2); text-align: center; animation: rise .4s ease both; animation-delay: calc(var(--i) * 70ms); }
.step:nth-child(1) { margin-top: 32px; } .step:nth-child(2) { margin-top: 24px; } .step:nth-child(3) { margin-top: 16px; } .step:nth-child(4) { margin-top: 8px; }
.step span { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--tile); font-size: 12px; font-weight: 800; color: var(--muted); }
.step b { font: 600 13px/1 var(--f-display); color: var(--gold); }
.step small { font-size: 10.5px; line-height: 1.2; color: var(--muted); }
.step.done { background: var(--good-soft); }
.step.done span { background: var(--good); color: #fff; }
.bank { background: linear-gradient(135deg, var(--gold-soft), var(--card) 60%); }
.jar { position: relative; display: grid; place-items: center; width: 56px; height: 56px; border-radius: 18px; background: var(--gold-soft); color: var(--gold); overflow: hidden; }
.jar svg { width: 28px; height: 28px; }
.jar i { position: absolute; top: -8px; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); animation: coindrop 2.4s ease-in infinite; }
.jar i:nth-of-type(1) { left: 18px; } .jar i:nth-of-type(2) { left: 32px; animation-delay: 1.2s; }
@keyframes coindrop { 0% { transform: translateY(0); opacity: 0; } 15% { opacity: 1; } 70% { transform: translateY(40px); opacity: 1; } 100% { transform: translateY(40px); opacity: 0; } }
.grid2 > .field { justify-content: flex-end; }

/* stage 7: stream */
.cells { display: flex; gap: 8px; justify-content: center; margin: 12px 0; }
.cells i { display: grid; place-items: center; width: 42px; height: 50px; border-radius: 12px; font: 600 22px/1 var(--f-display); font-style: normal; background: var(--tile); color: var(--faint); }
.cells i.on { background: var(--accent); color: var(--accent-ink); animation: flip .45s ease both; }
@keyframes flip { from { transform: rotateX(90deg); } to { transform: none; } }
.row input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); }

/* stage 8: Media Clan, invitations, complaints */
:root { --violet: #7B5CFF; --violet-soft: #EEEAFF; --teal: #0E9E9A; --teal-soft: #DDF4F3; --orange: #EE7A16; --orange-soft: #FDEDDF; --warn-soft: #FBF0DC; }
[data-theme="dark"] { --violet: #9D88FF; --violet-soft: #29224D; --teal: #3DCFCB; --teal-soft: #123634; --orange: #FF9C50; --orange-soft: #3B2614; --warn-soft: #3A2D14; }
.ic.violet { color: var(--violet); background: var(--violet-soft); }
.chip.violet { background: var(--violet-soft); color: var(--violet); }
.clan-btn { position: relative; overflow: hidden; border-radius: 24px; padding: 16px; color: #fff; text-align: left; display: flex; align-items: center; gap: 14px; width: 100%; border: 0; font: inherit; cursor: pointer;
  background: linear-gradient(120deg, #FF4D8D, #7B5CFF, #2F6BFF, #16C2C2, #FF9C3A, #FF4D8D); background-size: 320% 320%; animation: gshift 9s ease infinite; box-shadow: 0 18px 36px -18px #7B5CFF; }
.clan-btn b { display: block; font-size: 18px; } .clan-btn small { display: block; font-size: 13px; opacity: .92; line-height: 1.35; margin-top: 2px; }
.clan-btn .go { margin-left: auto; width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,.22); display: grid; place-items: center; flex: none; }
@keyframes gshift { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
.cstack { display: flex; flex: none; } .cstack .aav { margin-left: -12px; border: 2.5px solid rgba(255,255,255,.85); } .cstack .aav:first-child { margin-left: 0; }
.aav { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff; flex: none; }
.aav svg { width: 17px; height: 17px; }
.clan-hero, .pg-hero { position: relative; overflow: hidden; border-radius: 24px; padding: 20px 18px; color: #fff; background: linear-gradient(135deg, #1A1240, #2B1B6B 40%, #0F2A66); }
.pg-hero { background: linear-gradient(135deg, #0F2A3E, #0E5A6A 45%, #1D3FA8); }
.clan-hero h2, .pg-hero h2 { margin: 12px 0 8px; font-size: 24px; line-height: 1.15; } .clan-hero p, .pg-hero p { margin: 0; color: rgba(255,255,255,.82); font-size: 14px; }
.clan-hero .chip, .pg-hero .chip { background: rgba(255,255,255,.14); color: #fff; }
.pg-stat { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; } .pg-stat div { border-radius: 14px; background: rgba(255,255,255,.08); padding: 10px; }
.pg-stat b { display: block; font-size: 20px; } .pg-stat small { color: rgba(255,255,255,.7); font-size: 12px; }
.cl-card { text-align: left; display: flex; flex-direction: column; gap: 8px; border: 0; font: inherit; color: inherit; cursor: pointer; } .cl-card.off { opacity: .6; cursor: default; }
.tiers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; } .tier { border-radius: 14px; padding: 10px 4px; text-align: center; background: var(--tile-2, rgba(127,127,127,.08)); border: 1.5px solid transparent; }
.tier b { display: block; font-size: 18px; } .tier small { display: block; font-size: 11px; color: var(--muted); } .tier.on { border-color: var(--violet); } .tier.on b { color: var(--violet); } .tier.done b { color: var(--good); }
.slots { display: flex; flex-wrap: wrap; gap: 5px; } .slots i { width: 14px; height: 14px; border-radius: 5px; background: var(--tile, rgba(127,127,127,.15)); } .slots i.f { background: linear-gradient(140deg, var(--violet), #E8458B); } .slots i.s { background: var(--muted); opacity: .4; }
.ccode { font-family: ui-monospace, monospace; font-weight: 700; font-size: 24px; letter-spacing: .06em; }
.mestat { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 14px; background: var(--tile-2, rgba(127,127,127,.08)); font-size: 13.5px; } .mestat.ok svg { color: var(--good); }
.ppl { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 12px 6px; margin-top: 10px; } .pp { display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 0; }
.pp small { font-size: 11.5px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.rlist { margin-top: 10px; display: flex; flex-direction: column; gap: 2px; } .rrow { display: grid; grid-template-columns: 22px 28px minmax(0, 1fr); align-items: center; gap: 10px; padding: 8px; border-radius: 12px; font-size: 13.5px; }
.rrow .rn { color: var(--muted); font-weight: 800; text-align: center; } .rrow.me { background: var(--violet-soft); } .rav { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; color: #fff; font-size: 10.5px; font-weight: 800; }
.rnm { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .chip.mine { font-size: 10.5px; padding: 1px 7px; background: var(--violet); color: #fff; }
.prize { background: linear-gradient(115deg, rgba(255,194,77,.22), rgba(255,107,61,.12) 55%, rgba(232,69,139,.12)); }
.inv-track { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 10px; } .inv-track .it { text-align: center; padding: 8px 2px; border-radius: 12px; background: var(--tile-2, rgba(127,127,127,.08)); }
.inv-track .p { display: block; font-weight: 800; } .inv-track small { color: var(--muted); font-size: 11px; } .inv-track .it.on .p { color: var(--teal); } .inv-track .it.cur { outline: 1.5px solid var(--teal); }
.opt { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px; border-radius: 16px; background: var(--tile-2, rgba(127,127,127,.08)); text-align: left; color: inherit; border: 0; font: inherit; cursor: pointer; }
.opt .oi { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--violet-soft); color: var(--violet); flex: none; } .opt .ot { flex: 1; min-width: 0; } .opt b { display: block; } .opt small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.opt.dang .oi { background: var(--bad-soft); color: var(--bad); } .opt.dang b { color: var(--bad); }
.skip-card { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 0; font: inherit; color: inherit; cursor: pointer; } .skip-card .tx { flex: 1; } .skip-card small { display: block; color: var(--muted); }
textarea { width: 100%; box-sizing: border-box; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: inherit; padding: 10px 12px; font: inherit; }
.err { color: var(--bad); font-weight: 600; font-size: 13px; }
