/* «Свои ии»: мини-приложение и сайт. Стиль «мемфис, серый»: серый фон с сеткой точек, жёлтый, розовый,
   толстые чёрные рамки и жёсткие тени, всё скруглено. Одна тема (так в утверждённом макете). */
:root {
  --bg: #CDCDC9;
  --dot: #ABABA6;
  --yellow: #FFE14D;
  --halftone: #FFC400;
  --pink: #FF6FB5;
  --ink: #111;
  --paper: #fff;
  --muted: #444;
  --bad: #E5484D;
  --font: "Shantell Sans", "Baloo Bhaijaan 2", "Baloo 2", "Baloo Thambi 2", "Noto Sans Armenian",
          "Noto Sans Georgian", "M PLUS Rounded 1c", "Jua", "ZCOOL KuaiLe", system-ui, sans-serif;
  --nav-h: 62px;
  color-scheme: light;
}
html[lang="zh"] { --font: "Shantell Sans", "ZCOOL KuaiLe", system-ui, sans-serif; }
html[lang="ko"] { --font: "Shantell Sans", "Jua", system-ui, sans-serif; }
html[lang="bal"] { --font: "Noto Sans Arabic", "Shantell Sans", system-ui, sans-serif; }
html[lang="ja"] { --font: "Shantell Sans", "M PLUS Rounded 1c", system-ui, sans-serif; }

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background-color: var(--bg);
  background-image: radial-gradient(var(--dot) 1.3px, transparent 1.6px);
  background-size: 14px 14px;
  color: var(--ink);
  font-family: var(--font);
  font-weight: 500;
  font-size: 15px;
  line-height: 1.35;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--pink); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- каркас ---------- */
.app { max-width: 480px; margin: 0 auto; min-height: 100vh; position: relative;
       padding: 22px 20px calc(var(--nav-h) + 40px + env(safe-area-inset-bottom)); }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.h1 { font-weight: 800; font-size: 20px; letter-spacing: -0.02em; margin: 0; flex: 1; min-width: 0;
      overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h2 { font-weight: 800; font-size: 15px; letter-spacing: -0.01em; margin: 22px 4px 10px; }
.tag { background: var(--ink); color: var(--paper); font-size: 12px; font-weight: 700; padding: 4px 10px; white-space: nowrap; }
.pill { display: inline-flex; align-items: center; gap: 8px; min-height: 34px; padding: 0 14px; border-radius: 999px;
        background: var(--paper); border: 2.5px solid var(--ink); box-shadow: 3px 3px 0 var(--ink);
        font-size: 12px; font-weight: 700; white-space: nowrap; }
.pill .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--pink); border: 2px solid var(--ink); }
.pink-pill { background: var(--pink); border: 2px solid var(--ink); border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 10px; }

/* ---------- карточки и кнопки ---------- */
.card { background: var(--paper); border: 3px solid var(--ink); border-radius: 26px; box-shadow: 5px 5px 0 var(--ink); padding: 14px 16px; }
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
       border: 2.5px solid var(--ink); border-radius: 22px; background: var(--paper); box-shadow: 3px 3px 0 var(--ink);
       font-size: 14px; font-weight: 700; text-decoration: none; transition: transform .08s, box-shadow .08s; }
.btn:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn.yellow { background: var(--yellow); }
.btn.pink { background: var(--pink); }
.btn.big { width: 100%; min-height: 54px; border-width: 3px; border-radius: 27px; box-shadow: 5px 5px 0 var(--ink);
           font-weight: 800; font-size: 15px; letter-spacing: -0.02em; }
.btn.big.split { justify-content: space-between; padding: 0 22px; }
.btn svg { flex: none; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 4px 6px 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { height: 36px; padding: 0 14px; border-radius: 999px; font-size: 13px; font-weight: 700; white-space: nowrap;
        border: 2.5px solid var(--ink); background: var(--paper); flex: none; }
.chip.on { background: var(--yellow); box-shadow: 3px 3px 0 var(--ink); }
.arrow { width: 28px; height: 28px; border-radius: 50%; background: var(--paper); border: 2.5px solid var(--ink);
         display: inline-flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; flex: none; }
.arrow.pink { background: var(--pink); }
[dir="rtl"] .arrow, [dir="rtl"] .flip { transform: scaleX(-1); }
.round { width: 40px; height: 40px; border-radius: 50%; border: 2.5px solid var(--ink); background: var(--paper);
         box-shadow: 3px 3px 0 var(--ink); display: inline-flex; align-items: center; justify-content: center; padding: 0; flex: none; }

/* ---------- главная ---------- */
.label-row { margin-top: 10px; display: flex; justify-content: space-between; align-items: center; padding: 0 4px;
             font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.label-row .tag { letter-spacing: .05em; }
.sticker { display: block; overflow: visible; margin: 4px 0 0 -2px; max-width: 100%; height: auto; }
.meter { margin-top: 14px; display: flex; align-items: center; gap: 12px; padding: 0 4px; font-size: 12px; font-weight: 700; }
.bar { flex: 1; height: 16px; border-radius: 999px; background: var(--paper); border: 2.5px solid var(--ink); overflow: hidden; }
.bar > i { display: block; height: 100%; background-color: var(--pink); border-inline-end: 2.5px solid var(--ink);
           background-image: repeating-linear-gradient(135deg, rgba(17,17,17,.25) 0 2px, transparent 2px 7px);
           transition: width .4s; }
.bar.thin { height: 14px; }
.recent { margin-top: 18px; display: flex; gap: 10px; }
.recent .card { flex: 1; min-width: 0; height: 68px; border-radius: 20px; border-width: 2.5px; box-shadow: 4px 4px 0 var(--ink);
                padding: 8px 12px; display: flex; flex-direction: column; justify-content: space-between; text-align: start; }
.recent .card b { font-size: 12px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent .card span { font-size: 11px; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tile { position: relative; overflow: hidden; height: 100px; border: 3px solid var(--ink); border-radius: 26px;
        box-shadow: 4px 4px 0 var(--ink); background: var(--yellow); padding: 0; text-align: start; }
.tile svg { position: absolute; inset-inline-start: 6px; top: 4px; }
.tile span { position: absolute; inset-inline-start: 12px; bottom: 9px; font-size: 14px; font-weight: 800; letter-spacing: -0.02em; }
@keyframes boil { 0% { filter: url(#boil1); } 34% { filter: url(#boil2); } 67% { filter: url(#boil3); } 100% { filter: url(#boil1); } }
.boil { animation: boil .54s steps(1, end) infinite; }
@media (prefers-reduced-motion: reduce) { .boil { animation: none; } * { transition: none !important; } }

/* ---------- нижняя панель ---------- */
.nav { position: fixed; left: 50%; transform: translateX(-50%); width: min(448px, calc(100% - 32px));
       bottom: calc(14px + env(safe-area-inset-bottom)); height: var(--nav-h); border-radius: 31px; background: var(--ink);
       box-shadow: 4px 4px 0 var(--pink); padding: 6px; display: flex; gap: 4px; z-index: 20; }
.nav button { flex: 1; border-radius: 25px; display: flex; align-items: center; justify-content: center; padding: 0;
              color: var(--pink); background: transparent; border: 2.5px solid transparent; }
.nav button.on { background: rgba(255,111,181,.2); border-color: var(--pink); }
.dock { position: fixed; left: 50%; transform: translateX(-50%); width: min(440px, calc(100% - 40px));
        bottom: calc(var(--nav-h) + 28px + env(safe-area-inset-bottom)); z-index: 15; display: flex; flex-direction: column; gap: 10px; }
.has-dock { padding-bottom: calc(var(--nav-h) + 120px + env(safe-area-inset-bottom)); }
.has-dock2 { padding-bottom: calc(var(--nav-h) + 180px + env(safe-area-inset-bottom)); }

/* ---------- создать ---------- */
.prompt { margin-top: 10px; position: relative; background: var(--paper); border: 3px solid var(--ink); border-radius: 26px;
          box-shadow: 5px 5px 0 var(--ink); padding: 14px 16px 40px; }
.prompt textarea { width: 100%; border: 0; outline: 0; resize: none; background: transparent; min-height: 64px;
                   font-size: 15px; line-height: 1.35; font-weight: 500; padding: 0; }
.prompt .count { position: absolute; inset-inline-start: 16px; bottom: 10px; font-size: 12px; font-weight: 600; color: var(--muted); }
.prompt .mic { position: absolute; inset-inline-end: 8px; bottom: 6px; width: 34px; height: 34px; border-radius: 50%;
               border: 2.5px solid var(--ink); background: var(--pink); display: flex; align-items: center; justify-content: center; padding: 0; }
.prompt .mic.rec { background: var(--yellow); animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.12); } }
.field-label { margin: 14px 4px 6px; font-size: 13px; font-weight: 700; }
.model-btn { margin-top: 14px; width: 100%; display: flex; align-items: center; justify-content: space-between; min-height: 58px;
             padding: 6px 18px; border-radius: 24px; border: 3px solid var(--ink); background: var(--yellow);
             box-shadow: 4px 4px 0 var(--ink); text-align: start; gap: 10px; }
.model-btn b { display: block; font-size: 15px; font-weight: 800; letter-spacing: -0.02em; }
.model-btn small { display: block; font-size: 12px; font-weight: 500; }
.opt { margin-top: 12px; }
.opt .t { font-size: 12px; font-weight: 700; margin: 0 4px 6px; }
.stepper { margin-top: 14px; display: flex; align-items: center; justify-content: space-between; min-height: 62px;
           padding: 0 12px 0 18px; border-radius: 24px; border: 2.5px solid var(--ink); background: var(--paper); box-shadow: 3px 3px 0 var(--ink); gap: 10px; }
.stepper b { display: block; font-size: 15px; }
.stepper small { display: block; font-size: 11px; color: var(--muted); }
.stepper .ctl { display: flex; align-items: center; gap: 6px; }
.stepper .ctl button { width: 38px; height: 38px; border-radius: 50%; border: 2.5px solid var(--ink); background: var(--paper);
                       font-size: 20px; font-weight: 700; padding: 0; }
.stepper .ctl button.plus { background: var(--pink); }
.stepper .ctl output { width: 26px; text-align: center; font-size: 20px; font-weight: 800; }
.photos { display: flex; gap: 10px; flex-wrap: wrap; }
.photo { position: relative; width: 72px; height: 72px; border-radius: 18px; border: 2.5px solid var(--ink); overflow: hidden; background: var(--paper); }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo button { position: absolute; top: 2px; inset-inline-end: 2px; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--ink);
                background: var(--paper); font-size: 12px; line-height: 1; padding: 0; }
.photo.add { display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 700; background: var(--yellow); cursor: pointer; }
.progress { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.progress .head { display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 700; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; padding: 10px 14px;
          border: 2.5px solid var(--ink); border-radius: 20px; background: var(--paper); font-size: 13px; font-weight: 600; }
.switch input { width: 44px; height: 26px; appearance: none; border: 2.5px solid var(--ink); border-radius: 999px; background: var(--paper);
                position: relative; flex: none; cursor: pointer; }
.switch input::after { content: ""; position: absolute; top: 2px; inset-inline-start: 2px; width: 17px; height: 17px; border-radius: 50%;
                       background: var(--ink); transition: inset-inline-start .15s; }
.switch input:checked { background: var(--pink); }
.switch input:checked::after { inset-inline-start: 19px; }
select.sel { width: 100%; min-height: 44px; border: 2.5px solid var(--ink); border-radius: 18px; background: var(--paper); padding: 0 12px; }

/* ---------- результат ---------- */
.preview { margin-top: 12px; position: relative; min-height: 240px; border-radius: 30px; border: 3px solid var(--ink);
           box-shadow: 7px 7px 0 var(--ink); background: linear-gradient(160deg, var(--yellow) 0%, var(--pink) 120%);
           display: flex; align-items: center; justify-content: center; overflow: hidden; }
.preview img, .preview video { display: block; width: 100%; max-height: 62vh; object-fit: contain; background: var(--ink); }
.preview audio { width: calc(100% - 32px); }
.preview .badge { position: absolute; inset-inline-start: 12px; top: 12px; background: var(--paper); border: 2.5px solid var(--ink);
                  border-radius: 999px; padding: 2px 10px; font-size: 11px; font-weight: 700; }
.thumbs { margin-top: 16px; display: flex; gap: 10px; }
.thumb { flex: 1; height: 64px; border-radius: 20px; border: 3px solid var(--ink); background: var(--yellow); overflow: hidden;
         display: flex; align-items: center; justify-content: center; padding: 0; max-width: 33%; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.on { border-color: var(--pink); box-shadow: 0 0 0 3px var(--ink); }
.thumb.wait { opacity: .55; }
.acts { display: flex; gap: 10px; }
.acts .btn { flex: 1; padding: 0 8px; font-size: 13px; }

/* ---------- история ---------- */
.grid2 { margin-top: 18px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 14px; }
.item { display: flex; flex-direction: column; gap: 8px; text-align: start; background: none; border: 0; padding: 0; }
.item .box { position: relative; height: 112px; border-radius: 24px; border: 3px solid var(--ink); box-shadow: 4px 4px 0 var(--ink);
             background: var(--yellow); display: flex; align-items: center; justify-content: center; overflow: hidden; width: 100%; }
.item .box img { width: 100%; height: 100%; object-fit: cover; }
.item .box.failed { background: #eee; }
.item .dl { position: absolute; inset-inline-end: 8px; bottom: 8px; width: 34px; height: 34px; border-radius: 50%; background: var(--paper);
            border: 2.5px solid var(--ink); display: flex; align-items: center; justify-content: center; padding: 0; }
.item .run { position: absolute; inset-inline-start: 8px; top: 8px; background: var(--pink); border: 2.5px solid var(--ink);
             border-radius: 999px; padding: 2px 9px; font-size: 11px; font-weight: 700; }
.item .runbar { position: absolute; left: 0; bottom: 0; width: 100%; height: 12px; background: var(--paper); border-top: 2.5px solid var(--ink); }
.item .runbar i { display: block; height: 100%; background: var(--pink); border-inline-end: 2.5px solid var(--ink); }
.item .meta { padding: 0 4px; display: flex; flex-direction: column; gap: 1px; }
.item .meta b { font-size: 12px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .meta span { font-size: 12px; color: #333; }
.empty { margin-top: 30px; text-align: center; font-weight: 600; }

/* ---------- тарифы ---------- */
.seg { margin-top: 10px; display: flex; padding: 4px; border-radius: 999px; background: var(--paper); border: 2.5px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); }
.seg button { flex: 1; min-height: 36px; border-radius: 999px; border: 0; background: transparent; font-weight: 600; font-size: 14px; }
.seg button.on { background: var(--yellow); font-weight: 800; }
.plan { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 8px 18px; border-radius: 24px; border: 3px solid var(--ink);
        box-shadow: 3px 3px 0 var(--ink); background: var(--paper); width: 100%; text-align: start; }
.plan.on { background: var(--yellow); box-shadow: 5px 5px 0 var(--ink); }
.plan b { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 800; letter-spacing: -0.02em; }
.plan small { font-size: 12px; font-weight: 500; }
.plan .price { font-size: 18px; font-weight: 800; letter-spacing: -0.03em; white-space: nowrap; }
.hot { background: var(--pink); border: 2px solid var(--ink); font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 999px; letter-spacing: .05em; text-transform: uppercase; }
.perk { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 500; line-height: 1.25; padding: 0 4px; }
.perk i { width: 20px; height: 20px; border-radius: 50%; background: var(--pink); border: 2px solid var(--ink); display: flex; align-items: center; justify-content: center; flex: none; }

/* ---------- профиль ---------- */
.profile { margin-top: 12px; border-radius: 30px; padding: 16px; background: var(--paper); border: 3px solid var(--ink); box-shadow: 7px 7px 0 var(--ink);
           display: flex; align-items: center; gap: 14px; }
.avatar { width: 62px; height: 62px; border-radius: 50%; background: var(--pink); border: 3px solid var(--ink); font-size: 24px; font-weight: 800;
          display: flex; align-items: center; justify-content: center; flex: none; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stat { border-radius: 22px; border: 3px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); padding: 12px; display: flex; flex-direction: column; gap: 6px; background: var(--yellow); }
.stat b { font-size: 22px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.stat span { font-size: 11px; line-height: 1.25; }
.setrow { width: 100%; display: flex; align-items: center; min-height: 54px; padding: 6px 16px; border: 2.5px solid var(--ink); border-radius: 22px;
          background: var(--paper); box-shadow: 3px 3px 0 var(--ink); text-align: start; gap: 10px; text-decoration: none; }
.setrow b { display: block; font-size: 15px; font-weight: 700; letter-spacing: -0.02em; }
.setrow small { display: block; font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }

/* ---------- чат ---------- */
.msgs { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.msg { max-width: 88%; padding: 10px 14px; border: 2.5px solid var(--ink); border-radius: 20px; background: var(--paper);
       box-shadow: 3px 3px 0 var(--ink); overflow-wrap: anywhere; white-space: pre-wrap; }
.msg.me { align-self: flex-end; background: var(--yellow); }
.msg pre { white-space: pre-wrap; background: #f3f3f0; border-radius: 10px; padding: 8px; font-size: 13px; overflow-x: auto; }
.msg.think { opacity: .7; }
.chatbar { display: flex; gap: 8px; align-items: flex-end; background: var(--paper); border: 3px solid var(--ink); border-radius: 26px;
           box-shadow: 5px 5px 0 var(--ink); padding: 8px 8px 8px 14px; }
.chatbar textarea { flex: 1; border: 0; outline: 0; resize: none; background: transparent; max-height: 140px; min-height: 24px; padding: 6px 0; }

/* ---------- лист выбора, окна, тосты ---------- */
.sheet-bg { position: fixed; inset: 0; background: rgba(17,17,17,.45); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: min(480px, 100%); max-height: 82vh; overflow-y: auto; background: var(--bg); border: 3px solid var(--ink); border-bottom: 0;
         border-radius: 30px 30px 0 0; padding: 18px 20px calc(24px + env(safe-area-inset-bottom)); }
.sheet .h1 { margin-bottom: 12px; white-space: normal; }
.opt-item { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 52px; padding: 8px 16px;
            border: 2.5px solid var(--ink); border-radius: 20px; background: var(--paper); box-shadow: 3px 3px 0 var(--ink); text-align: start; }
.opt-item.on { background: var(--yellow); }
.input { width: 100%; min-height: 48px; border: 2.5px solid var(--ink); border-radius: 18px; background: var(--paper); padding: 0 14px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); top: calc(14px + env(safe-area-inset-top)); z-index: 60;
         max-width: calc(100% - 32px); background: var(--ink); color: var(--paper); border-radius: 18px; padding: 10px 16px;
         font-weight: 600; box-shadow: 4px 4px 0 var(--pink); }
.spinner { width: 28px; height: 28px; border: 4px solid var(--ink); border-top-color: var(--pink); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.center { min-height: 60vh; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 14px; text-align: center; }

/* ---------- сайт: лендинг ---------- */
.land { max-width: 1040px; margin: 0 auto; padding: 22px 20px 60px; }
.land header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.logo { font-weight: 800; font-size: 22px; letter-spacing: -0.02em; }
.hero { display: grid; grid-template-columns: 1.2fr 1fr; gap: 28px; align-items: center; margin-top: 34px; }
.hero h1 { font-size: clamp(32px, 6vw, 56px); line-height: 1.05; letter-spacing: -0.03em; margin: 0 0 14px; font-weight: 800; }
.hero p { font-size: 18px; margin: 0 0 22px; }
.hero .cta { display: flex; gap: 12px; flex-wrap: wrap; }
.hero .cta .btn { min-height: 54px; padding: 0 24px; border-width: 3px; box-shadow: 5px 5px 0 var(--ink); font-size: 16px; }
.phone { justify-self: center; width: 280px; border: 3px solid var(--ink); border-radius: 36px; box-shadow: 8px 8px 0 var(--ink);
         background: var(--bg); background-image: radial-gradient(var(--dot) 1.3px, transparent 1.6px); background-size: 14px 14px; padding: 18px; }
.feat { margin-top: 48px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.feat .card h3 { margin: 0 0 6px; font-size: 17px; }
.feat .card p { margin: 0; font-size: 14px; }
.land .plans { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.land footer { margin-top: 48px; display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; font-weight: 600; }
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; }
  .feat { grid-template-columns: 1fr; }
  .land .plans { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 380px) { .tiles { gap: 8px; } .tile span { font-size: 12px; } .h1 { font-size: 18px; } }
