/* Єдиний профіль Time Town (town-profile.js): Профіль / Гардероб / Склад. Усі класи — з префіксом ttp-, усі правила — всередині .ttp:
 * сторінки стола (body, html, її теги й класи) цей файл не зачіпає. Кольори — змінні --ttp-*: за замовчуванням
 * нічна палітра Time Town (як у вікні Мафії); стіл може перевизначити їх на .ttp або передати theme у модуль.
 * --ttp-bottom — скільки місця знизу зайняте меню стола (кнопка «Зберегти» й підказки стають над ним). */
.ttp {
  --ttp-bg: #0F1220; --ttp-card: #171B2B; --ttp-inset: #121626; --ttp-line: #272C40; --ttp-line2: #1F2436; --ttp-chip: #262B40;
  --ttp-text: #ECE7DA; --ttp-muted: #9A95A3; --ttp-soft: #C9C3B8; --ttp-gold: #E2BE6A; --ttp-gold2: #F2D28E;
  --ttp-ink: #1A1407; --ttp-night: #8FB2F5; --ttp-green: #7FC9A0; --ttp-goldbg: #262019; --ttp-toast: #2B2519;
  --ttp-serif: 'Playfair Display', Georgia, serif;
  --ttp-num: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  color-scheme: dark; color: var(--ttp-text); font-family: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  font-size: 15px; line-height: 1.4; text-align: left; max-width: 640px; margin: 0 auto;
  -webkit-tap-highlight-color: transparent;
}
.ttp, .ttp *, .ttp *::before, .ttp *::after { box-sizing: border-box; }
.ttp button { font: inherit; color: inherit; margin: 0; }
.ttp button:focus-visible { outline: 2px solid var(--ttp-gold2); outline-offset: 2px; }
.ttp p { margin: 0; }

/* підвкладки */
.ttp-tabs, .ttp-seg { display: flex; gap: 4px; margin: 12px 16px 0; padding: 4px; border-radius: 14px; background: var(--ttp-card); border: 1px solid var(--ttp-line2); }
.ttp-tab { flex: 1; min-width: 0; min-height: 40px; padding: 6px 4px; border: 0; border-radius: 10px; background: none; color: var(--ttp-muted); font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ttp-tab.ttp-on { background: var(--ttp-chip); color: var(--ttp-gold2); }
.ttp-in { animation: ttp-in .24s ease-out; }
@keyframes ttp-in { from { opacity: 0; transform: translateY(8px); } }

/* спільне */
.ttp-section { padding: 14px 16px; }
.ttp-label { font-family: var(--ttp-serif); font-size: 17px; font-weight: 700; line-height: 1.25; color: var(--ttp-text); margin: 0 0 10px; }
.ttp-label.ttp-mt { margin-top: 22px; }
.ttp-cap { font-size: 13px; color: var(--ttp-muted); line-height: 1.45; }
.ttp-note { font-size: 13px; color: var(--ttp-muted); line-height: 1.5; margin-top: 10px; }
.ttp-card { background: var(--ttp-card); border: 1px solid var(--ttp-line2); border-radius: 18px; padding: 14px 16px; }
.ttp-card + .ttp-card { margin-top: 10px; }
.ttp-grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ttp-stat { background: var(--ttp-inset); border-radius: 12px; padding: 12px 6px; text-align: center; min-width: 0; }
.ttp-stat b { display: block; font-size: 22px; font-weight: 600; line-height: 1.2; font-family: var(--ttp-num); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.ttp-stat span { display: block; font-size: 13px; line-height: 1.25; color: var(--ttp-muted); }
.ttp-btn { width: 100%; min-height: 46px; padding: 8px 14px; border-radius: 12px; border: 1px solid var(--ttp-line); background: var(--ttp-card); font-weight: 600; font-size: 15px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; text-align: center; }
.ttp-btn.ttp-primary { background: var(--ttp-gold); color: var(--ttp-ink); border-color: var(--ttp-gold); }
.ttp-btn:disabled { background: var(--ttp-line); color: var(--ttp-muted); border-color: var(--ttp-line); cursor: default; }
.ttp-btn:active:not(:disabled) { transform: scale(.98); }
.ttp-pill { display: inline-flex; align-items: center; gap: 5px; min-height: 36px; padding: 6px 14px; border-radius: 999px; background: var(--ttp-card); border: 1px solid var(--ttp-line); font-family: var(--ttp-num); font-variant-numeric: tabular-nums; font-size: 15px; font-weight: 600; white-space: nowrap; }
.ttp-pill.ttp-gold { color: var(--ttp-gold2); }
.ttp-pill.ttp-night { color: var(--ttp-night); }
.ttp-pill.ttp-game { color: var(--ttp-soft); }
.ttp-toast { position: fixed; left: 50%; bottom: calc(24px + var(--ttp-bottom, 0px)); transform: translateX(-50%); background: var(--ttp-toast); border: 1px solid var(--ttp-gold); color: var(--ttp-gold2); padding: 10px 16px; border-radius: 12px; font-size: 13px; line-height: 1.4; max-width: 90vw; z-index: 10010; text-align: center; }
.ttp-gate { min-height: 50vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 32px 24px; text-align: center; }
.ttp-gate .ttp-em { font-size: 44px; line-height: 1; }
.ttp-gate p { max-width: 320px; color: var(--ttp-soft); font-size: 15px; line-height: 1.5; }
.ttp-gate .ttp-btn { width: auto; min-width: 200px; margin-top: 8px; }
.ttp-h1 { margin: 10px 0 0; font-family: var(--ttp-serif); font-size: 22px; font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; }
.ttp-gate .ttp-h1 { margin: 0; }
.ttp-ic { flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--ttp-inset); border: 1px solid var(--ttp-line); display: flex; align-items: center; justify-content: center; font-size: 20px; line-height: 1; }
.ttp-tx { flex: 1; min-width: 0; }
.ttp-tx b { display: block; font-size: 15px; font-weight: 600; }
.ttp-tx span { display: block; font-size: 13px; color: var(--ttp-muted); line-height: 1.4; margin-top: 2px; }
.ttp-cnt { flex: none; min-width: 44px; text-align: right; font-family: var(--ttp-num); font-variant-numeric: tabular-nums; font-size: 18px; font-weight: 700; color: var(--ttp-gold2); white-space: nowrap; }

/* профіль */
.ttp-hero { display: flex; flex-direction: column; align-items: center; padding: 16px 16px 4px; gap: 6px; text-align: center; }
.ttp-sub { font-size: 14px; color: var(--ttp-soft); }
.ttp-patron { display: inline-block; margin-top: 4px; padding: 3px 10px; border-radius: 999px; font-size: 13px; color: var(--ttp-gold); border: 1px solid rgba(226,190,106,.6); background: rgba(226,190,106,.08); }
.ttp-char { border-radius: 22px; padding: 4px; background: #2A2F3A; }
.ttp-char-wrap { position: relative; margin: 6px 0 14px; }
.ttp-lvl { position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%); background: var(--ttp-gold); color: var(--ttp-ink); font-family: var(--ttp-num); font-variant-numeric: tabular-nums; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; border: 2px solid var(--ttp-bg); }
.ttp-ava { flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.ttp-ava-in { width: 100%; height: 100%; border-radius: 50%; border: 3px solid var(--ttp-bg); background: var(--ttp-chip); display: flex; align-items: center; justify-content: center; font-family: var(--ttp-serif); font-weight: 700; overflow: hidden; }
.ttp-tokens { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }
.ttp-token { width: 40px; height: 40px; border-radius: 12px; background: var(--ttp-card); border: 1px solid var(--ttp-line); display: flex; align-items: center; justify-content: center; font-size: 20px; line-height: 1; }
.ttp-wallet { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 14px 16px 0; }
.ttp-wcell { display: flex; flex-direction: column; align-items: center; gap: 1px; min-height: 44px; padding: 10px 6px; border-radius: 12px; background: var(--ttp-card); border: 0; cursor: pointer; }
.ttp-wcell b { font-family: var(--ttp-num); font-variant-numeric: tabular-nums; font-size: 17px; font-weight: 600; }
.ttp-wcell span { font-size: 13px; color: var(--ttp-muted); }
.ttp-char svg { display: block; width: 100%; height: 100%; border-radius: 18px; background: var(--ttp-inset); }
.ttp-xp { width: 100%; max-width: 420px; margin-top: 10px; }
.ttp-bar { height: 8px; border-radius: 999px; background: var(--ttp-line2); overflow: hidden; }
.ttp-bar > div { height: 100%; background: var(--ttp-gold); border-radius: 999px; }
.ttp-xp-row { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--ttp-muted); margin-top: 8px; font-family: var(--ttp-num); font-variant-numeric: tabular-nums; }
.ttp-bal { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; padding: 14px 16px 0; }
.ttp-coin { display: flex; align-items: center; gap: 12px; }
.ttp-coin + .ttp-coin { border-top: 1px solid var(--ttp-line2); margin-top: 10px; padding-top: 10px; }
.ttp-bio { max-width: 340px; font-size: 15px; line-height: 1.45; font-style: italic; overflow-wrap: anywhere; }
.ttp-st-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.ttp-st-head b { font-size: 15px; font-weight: 600; }
.ttp-ach { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.ttp-ach + .ttp-ach { border-top: 1px solid var(--ttp-line2); }
.ttp-ach.ttp-done .ttp-ic { border-color: var(--ttp-gold); }
.ttp-ach b { display: block; font-size: 14px; font-weight: 600; }
.ttp-ach span { display: block; font-size: 13px; color: var(--ttp-muted); line-height: 1.35; }
.ttp-ach.ttp-locked { opacity: .5; }
.ttp-ach .ttp-ok { margin-left: auto; flex: none; color: var(--ttp-gold); font-size: 16px; }

/* гардероб: редактор персонажа v3 */
.ttp-sexrow { display: flex; align-items: center; gap: 8px; padding: 0 16px; margin-top: 14px; }
.ttp-sexrow .ttp-cap { margin-right: 4px; }
.ttp-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.ttp-chip { min-height: 36px; padding: 6px 14px; border-radius: 999px; background: var(--ttp-card); border: 1px solid var(--ttp-line2); color: var(--ttp-muted); font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.ttp-chip.ttp-on { background: var(--ttp-chip); color: var(--ttp-text); border-color: var(--ttp-line); }
.ttp-chips.ttp-slots { padding: 0 16px; margin: 14px 0 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.ttp-chips.ttp-slots::-webkit-scrollbar { display: none; }
.ttp-chips.ttp-slots .ttp-chip { flex: none; }
.ttp-witem { background: var(--ttp-card); border: 2px solid transparent; border-radius: 14px; padding: 8px 6px 10px; display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; text-align: center; min-height: 44px; min-width: 0; }
.ttp-witem.ttp-sel { border-color: var(--ttp-gold); }
.ttp-thumb { width: 88px; max-width: 100%; height: 105px; border-radius: 12px; overflow: hidden; background: var(--ttp-inset); }
.ttp-thumb svg { width: 100%; height: 100%; display: block; }
.ttp-witem.ttp-locked .ttp-thumb { opacity: .45; }
.ttp-witem.ttp-locked.ttp-sel .ttp-thumb { opacity: 1; }
.ttp-n { font-size: 13px; font-weight: 600; line-height: 1.2; }
.ttp-t { font-size: 12px; line-height: 1.25; }
.ttp-sws { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 2px 0 14px; }
.ttp-csw { flex: none; width: 44px; height: 44px; padding: 0; border-radius: 50%; border: 3px solid var(--ttp-line); cursor: pointer; }
.ttp-csw.ttp-on { border-color: var(--ttp-bg); box-shadow: 0 0 0 3px var(--ttp-gold); }
.ttp-bottom { position: sticky; bottom: var(--ttp-bottom, 0px); z-index: 5; padding: 12px 16px; background: var(--ttp-bg); border-top: 1px solid var(--ttp-line2); }
.ttp-reset { width: 100%; min-height: 44px; margin-top: 4px; background: none; border: 0; color: var(--ttp-soft); font-size: 14px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* гардероб: рамки й рівні */
.ttp-frame { background: var(--ttp-card); border: 2px solid transparent; border-radius: 14px; padding: 12px 6px 10px; display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer; min-width: 0; text-align: center; }
.ttp-frame.ttp-sel { border-color: var(--ttp-gold); }
.ttp-frame.ttp-locked { opacity: .55; }
.ttp-lvcard { text-align: center; }
.ttp-lvcard > b { display: block; font-family: var(--ttp-num); font-variant-numeric: tabular-nums; font-size: 34px; font-weight: 600; line-height: 1.2; color: var(--ttp-gold2); }
.ttp-lvcard .ttp-xp { margin: 12px auto 0; }
.ttp-rank { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px; background: var(--ttp-card); border: 1px solid transparent; margin-bottom: 6px; }
.ttp-rank.ttp-me { background: var(--ttp-goldbg); border-color: var(--ttp-gold); color: var(--ttp-gold2); }
.ttp-rank b { flex: 1; font-weight: 600; }
.ttp-rank span { font-size: 13px; }
.ttp-rl { width: 52px; font-size: 13px; color: var(--ttp-muted); font-family: var(--ttp-num); font-variant-numeric: tabular-nums; }
.ttp-list { background: var(--ttp-card); border: 1px solid var(--ttp-line2); border-radius: 14px; overflow: hidden; }
.ttp-li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 16px; font-size: 15px; }
.ttp-li + .ttp-li { border-top: 1px solid var(--ttp-line2); }
.ttp-li.ttp-locked { opacity: .6; }
.ttp-li b { color: var(--ttp-gold2); }
.ttp-li i { font-style: normal; font-weight: 700; color: var(--ttp-green); }

/* склад: баланс, предмети з купівлею, підтримка */
.ttp-balance, .ttp-support { border-radius: 20px; padding: 18px; }
.ttp-balance b { display: block; font-family: var(--ttp-num); font-variant-numeric: tabular-nums; font-size: 28px; font-weight: 600; line-height: 1.25; color: var(--ttp-gold2); margin-bottom: 6px; }
.ttp-support { margin-top: 22px; }
.ttp-support .ttp-btn { margin-top: 12px; }
.ttp-items { display: grid; gap: 8px; }
.ttp-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--ttp-card); }
.ttp-e { flex: none; width: 34px; text-align: center; font-size: 26px; line-height: 1.15; }
.ttp-item .ttp-cnt { min-width: 0; font-size: 15px; font-weight: 600; color: var(--ttp-gold); }
.ttp-item.ttp-none .ttp-e, .ttp-item.ttp-none .ttp-tx > b { opacity: .55; }
.ttp-item.ttp-none .ttp-cnt { color: var(--ttp-muted); }
.ttp-buy { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 10px; }
.ttp-buy .ttp-btn { width: auto; min-height: 40px; padding: 0 16px; font-size: 14px; }
.ttp-use { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0; border: 0; background: none; color: var(--ttp-soft); font-size: 13px; cursor: pointer; }
.ttp-use span { margin: 0; color: inherit; }
.ttp-sw { flex: none; position: relative; width: 38px; height: 23px; border-radius: 999px; background: var(--ttp-chip); transition: background .2s; }
.ttp-sw::after { content: ""; position: absolute; left: 3px; top: 3px; width: 17px; height: 17px; border-radius: 50%; background: var(--ttp-soft); transition: transform .2s, background .2s; }
.ttp-sw.ttp-on { background: var(--ttp-gold); }
.ttp-sw.ttp-on::after { transform: translateX(15px); background: var(--ttp-ink); }

/* на весь екран поверх стола (TTProfile.open) */
.ttp-overlay { position: fixed; inset: 0; z-index: 10000; max-width: none; margin: 0; display: flex; flex-direction: column; background: var(--ttp-bg); }
.ttp-ov-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 0 8px 0 16px;
  padding-top: calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px)); border-bottom: 1px solid var(--ttp-line2); }
.ttp-ov-head b { font-family: var(--ttp-serif); font-size: 20px; font-weight: 700; }
.ttp-ov-close { width: 44px; height: 44px; border: 0; border-radius: 12px; background: none; color: var(--ttp-soft); font-size: 20px; cursor: pointer; }
.ttp-ov-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding-bottom: env(safe-area-inset-bottom); }

@media (prefers-reduced-motion: reduce) { .ttp-in { animation: none; } .ttp-sw, .ttp-sw::after { transition: none; } }
