:root {
  --bg: var(--tg-theme-bg-color, #14121f);
  --bg2: var(--tg-theme-secondary-bg-color, #1e1b2e);
  --text: var(--tg-theme-text-color, #ece8f7);
  --hint: var(--tg-theme-hint-color, #8f89a8);
  --accent: var(--tg-theme-button-color, #8b6cf6);
  --accent-text: var(--tg-theme-button-text-color, #fff);
  --danger: #e5484d;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
h1 { font-size: 22px; margin: 8px 0 14px; }
h2 { font-size: 17px; margin: 20px 0 8px; }
.hidden { display: none !important; }
.screen, .tab { padding: 16px 16px 90px; max-width: 640px; margin: 0 auto; }
.center { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.center-text { text-align: center; }
.card { background: var(--bg2); border-radius: 14px; padding: 14px 16px; margin: 10px 0; }
.card.small { font-size: 14px; color: var(--hint); }
.card.small b { color: var(--text); }
label { display: block; margin: 12px 0 4px; font-size: 14px; color: var(--hint); }
input, textarea { width: 100%; margin-top: 4px; padding: 11px 12px; border-radius: 10px; border: 1px solid transparent;
  background: var(--bg2); color: var(--text); font: inherit; outline: none; }
input:focus, textarea:focus { border-color: var(--accent); }
label.check { display: flex; gap: 10px; align-items: flex-start; color: var(--text); font-size: 14px; }
label.check input { width: auto; margin-top: 3px; }
.btn { width: 100%; padding: 13px; margin-top: 16px; border: 0; border-radius: 12px; font: inherit; font-weight: 600;
  background: var(--accent); color: var(--accent-text); cursor: pointer; }
.btn:disabled { opacity: .45; }
.btn.secondary { background: var(--bg2); color: var(--text); }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); margin-top: 28px; }
.hint { color: var(--hint); font-size: 13px; margin-top: 6px; }
.error { color: var(--danger); font-size: 14px; min-height: 1em; margin-top: 8px; }
.suggest div { padding: 10px 12px; background: var(--bg2); border-bottom: 1px solid var(--bg); font-size: 14px; cursor: pointer; }
.suggest div:first-child { border-radius: 10px 10px 0 0; }
.suggest div:last-child { border-radius: 0 0 10px 10px; border-bottom: 0; }
.answer p { margin: 0 0 10px; } .answer p:last-child { margin: 0; }
.answer ul { margin: 0 0 10px; padding-left: 20px; }
.list .row { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--bg); font-size: 14px; }
.list .row:last-child { border-bottom: 0; }
.list .row span:last-child { color: var(--hint); text-align: right; }

/* чат */
#tab-chat { display: flex; flex-direction: column; min-height: 100vh; padding-bottom: 140px; }
.chatlog { flex: 1; }
.msg { max-width: 88%; padding: 10px 14px; border-radius: 16px; margin: 8px 0; white-space: normal; }
.msg.user { margin-left: auto; background: var(--accent); color: var(--accent-text); border-bottom-right-radius: 4px; }
.msg.assistant { background: var(--bg2); border-bottom-left-radius: 4px; }
.msg.assistant p { margin: 0 0 8px; } .msg.assistant p:last-child { margin: 0; }
.msg.typing { color: var(--hint); font-style: italic; }
.chatbar { position: fixed; left: 0; right: 0; bottom: 64px; display: flex; gap: 8px; padding: 8px 12px;
  background: var(--bg); max-width: 640px; margin: 0 auto; }
.chatbar textarea { margin: 0; resize: none; max-height: 120px; }
.send { width: 46px; flex: none; border: 0; border-radius: 12px; background: var(--accent); color: var(--accent-text); font-size: 18px; }
#chatLeft { position: fixed; left: 0; right: 0; bottom: 122px; }

/* нижние вкладки */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: var(--bg2);
  padding-bottom: env(safe-area-inset-bottom); }
.tabs button { flex: 1; border: 0; background: none; color: var(--hint); padding: 8px 0 10px; font-size: 20px;
  display: flex; flex-direction: column; align-items: center; cursor: pointer; }
.tabs button span { font-size: 11px; margin-top: 2px; }
.tabs button.active { color: var(--accent); }

/* колесо карты */
.wheel svg { width: 100%; max-width: 420px; display: block; margin: 0 auto; }
.wheel text { fill: var(--text); font-family: inherit; }
.wheel .ring { fill: none; stroke: var(--hint); stroke-opacity: .5; }
.wheel .sector { stroke: var(--hint); stroke-opacity: .35; }
.wheel .sign { fill: var(--hint); font-size: 15px; }
.wheel .pl { font-size: 17px; }
.wheel .axis { stroke: var(--accent); stroke-width: 1.5; }
.wheel .asp-hard { stroke: #e5484d; stroke-opacity: .7; }
.wheel .asp-soft { stroke: #3e9bf5; stroke-opacity: .7; }

.spinner { width: 36px; height: 36px; border: 3px solid var(--bg2); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
