/* Minimal fresh stylesheet */
:root {
    color-scheme: var(--tg-color-scheme, light);

    /* Design tokens (defaults map to Telegram vars with tasteful fallbacks) */
    --color-bg: var(--tg-theme-bg-color, #f7f8fb);
    --color-text: var(--tg-theme-text-color, #0b1220);
    --color-muted: var(--tg-theme-hint-color, #6b7280);
    --color-border: var(--tg-theme-section-separator-color, #e5e7eb);
    --color-surface: var(--tg-theme-secondary-bg-color, #ffffff);
    --color-surface-2: var(--tg-theme-section-bg-color, #f3f4f6);
    --color-surface-hover: #eef1f6;
    --color-primary: var(--tg-theme-button-color, #2f6df6);
    --color-on-primary: var(--tg-theme-button-text-color, #ffffff);
    --color-link: var(--tg-theme-link-color, #2563eb);
    --color-ring: var(--tg-theme-link-color, var(--tg-theme-accent-text-color, #3b82f6));

    /* Back-compat aliases */
    --border-color: var(--color-border);
    --muted-color: var(--color-muted);
}

/* Opinionated modern light palette overrides */
:root[data-scheme="light"] {
    --color-bg: #f7f8fb;           /* soft neutral background */
    --color-text: #0b1220;         /* near-black for high readability */
    --color-muted: #6b7280;        /* slate-muted */
    --color-border: #e5e7eb;       /* subtle separators */
    --color-surface: #ffffff;      /* cards, tiles */
    --color-surface-2: #f3f4f6;    /* controls, avatars */
    --color-surface-hover: #eceff3;/* hover state */
    --color-primary: #2f6df6;      /* modern blue accent */
    --color-on-primary: #ffffff;   /* text on primary */
    --color-link: #2563eb;         /* link/interactive */
    --color-ring: #3b82f6;         /* focus ring */
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
}

#app {
    min-height: 100dvh;
}

.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 16px;
}

.card {
    padding: 16px 0;
    border: none;
}

h1, h2, h3 {
    margin: 0 0 12px;
}

p {
    margin: 0 0 12px;
}

.muted {
    color: var(--muted-color, #6b7280);
    font-size: 10px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 10px;
    background: var(--color-surface-2);
    color: var(--color-text);
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    border: none;
}

.btn:hover { background: #ef4444; color: #ffffff; }

.btn-primary {
    background: var(--color-primary);
    color: var(--color-on-primary);
    border: none;
}

.btn-secondary {
    background: transparent;
    color: var(--color-text);
    border: none;
}

.btn-outline {
    background: transparent;
    color: var(--color-link);
    border: none;
}

.btn-ghost {
    background: transparent;
    color: var(--color-link);
    border: none;
}

.list { display: grid; gap: 12px; }

.hidden { display: none; }

/* --- TWA Trubute B&W UI --- */
 

.profile-header {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Allow wrapping for narrow screens */
.profile-header { flex-wrap: wrap; }

.avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--color-surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.avatar-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 24px;
    color: var(--color-text);
}

/* Inline SVG sizing inside avatar containers */
.avatar-fallback svg { width: 60%; height: 60%; display: block; }
.tile-avatar svg { width: 60%; height: 60%; display: block; }

/* Generic inline icon container (e.g., for close button) */
.icon svg { width: 20px; height: 20px; display: block; }

.profile-meta { flex: 1; }

.profile-name {
    font-weight: 600;
    font-size: 18px;
}

.profile-actions { margin-left: auto; }

/* Profile actions layout */
.profile-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Smaller buttons for profile actions */
.btn-sm { padding: 8px 12px; border-radius: 10px; }

/* Compact profile card */
.profile-card { padding: 12px 16px; }
.profile-card .avatar { width: 96px; height: 96px; }
.profile-card .profile-name { font-size: 16px; }

 

.profile-submeta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 2px;
}

/* Center-align the main bot header card content */
.profile-header.card.profile-card {
    justify-content: center;
    text-align: center;
    flex-direction: column;
    align-items: center;
}
.profile-header.card.profile-card .profile-meta {
    flex: 0 1 auto;
    text-align: center;
}


.section { margin-top: 16px; }

.grid { display: grid; gap: 12px; }

.grid-2 { grid-template-columns: repeat(2, 1fr); }

.grid-1 { grid-template-columns: 1fr; }

.tile {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    padding: 12px;
    border-radius: 12px;
    background: var(--color-surface);
    color: var(--color-text);
    text-decoration: none;
    border: none;
    cursor: pointer;
}

.tile-emoji { font-size: 24px; }

.tile-title { margin-top: 6px;}

/* Partner tile layout */
.tile-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.tile-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--color-surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.tile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
    display: block;
}

.tile-content { display: flex; flex-direction: column; }
.tile-subtitle { color: var(--muted-color); font-size: 14px; }

/* Removed empty-state styles */

/* Partners in a single horizontal row */
.partners-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    overflow: visible;
    padding-bottom: 0;
}

.partners-row .tile {
    width: 100%;
}

/* Partner cards - modern, subtle, tactile */
.partner-card {
    min-width: 0;
    background: var(--color-surface);
    border: none;
    border-radius: 12px;
    padding: 8px 16px; /* tighter vertical rhythm */
    box-shadow: none;
    transition: none;
}

.partners-row .partner-card { border-radius: 0; }
.partners-row .partner-card:first-child { border-top-left-radius: 12px; border-top-right-radius: 12px; }
.partners-row .partner-card:last-child { border-bottom-left-radius: 12px; border-bottom-right-radius: 12px; }

.partner-card:hover { transform: none; box-shadow: none; }

.partner-card .tile-title { margin-top: 0; font-size: 14px; }
.partner-card .tile-subtitle { display: none; }

.partner-card:hover { transform: none; }

/* Row separators for compact list */
.partners-row .partner-card { border-bottom: 1px solid var(--border-color); }
.partners-row .partner-card:last-child { border-bottom: none; }

/* Keep separators for connected bots list including the last item */
#my-bots-grid .partner-card { border-bottom: 1px solid var(--border-color); }
#my-bots-grid .partner-card:last-child { border-bottom: 1px solid var(--border-color); }

/* Square avatars for partner rows */
.partner-card .tile-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--color-surface-2);
}

/* Note row: top align icon and prevent stretching for security note */
.note-row { align-items: flex-start; }
.note-row .tile-avatar {
    align-self: flex-start;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
}

/* Connect banner illustration */
.connect-illustration {
    background: var(--color-surface);
    border-radius: 12px;
    overflow: hidden;
}
.connect-illustration svg { display: block; width: 100%; height: auto; }

/* Guided connect banner */
.connect-banner {
    position: relative;
    border-radius: 16px;
    padding: 28px 24px;
    background: linear-gradient(135deg, #2563eb 0%, #4338ca 46%, #7c3aed 100%);
    color: #f8fafc;
    overflow: hidden;
    border: 1px solid rgba(99, 102, 241, 0.35);
    border: 1px solid color-mix(in srgb, rgba(255, 255, 255, 0.18) 35%, transparent);
    box-shadow: 0 28px 54px -36px rgba(67, 56, 202, 0.55);
}
.connect-banner::before {
    content: "";
    position: absolute;
    inset: -20% -15% 45% -30%;
    background: radial-gradient(circle at top left, rgba(255,255,255,0.44), transparent 60%);
    opacity: 0.9;
    pointer-events: none;
    mix-blend-mode: screen;
}
.connect-banner::after {
    content: "";
    position: absolute;
    inset: 55% -20% -35% 25%;
    background: radial-gradient(circle at center, rgba(14,165,233,0.35), transparent 70%);
    pointer-events: none;
    opacity: 0.7;
}
.connect-banner-inner {
    position: relative;
    display: grid;
    gap: 24px;
}
.connect-banner-meta {
    display: grid;
    gap: 12px;
    max-width: 420px;
}
.connect-banner-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 14px;
    background: rgba(15, 23, 42, 0.35);
    color: rgba(226, 232, 240, 0.9);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}
.connect-banner-title {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.2;
    color: #f9fafb;
}
.connect-banner-subtitle {
    margin: 0;
    font-size: 14px;
    line-height: 1.55;
    color: rgba(226, 232, 240, 0.92);
}
.connect-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.connect-step {
    position: relative;
    display: flex;
    gap: 16px;
    align-items: flex-start;
    padding-left: 0;
}
.connect-step::before {
    content: "";
    position: absolute;
    left: 20px;
    top: 44px;
    bottom: -24px;
    width: 2px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0));
    opacity: 0.8;
}
.connect-step:last-child::before {
    display: none;
}
.connect-step-index {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.32);
    font-weight: 600;
    font-size: 18px;
    color: rgba(226, 232, 240, 0.95);
    flex-shrink: 0;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.connect-step--active .connect-step-index {
    background: #f8fafc;
    color: #312e81;
    border-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 12px 28px -20px rgba(15, 23, 42, 0.7), inset 0 0 0 1px rgba(255, 255, 255, 0.55);
}
.connect-step-body {
    display: grid;
    gap: 6px;
}
.connect-step-body h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #f8fafc;
}
.connect-step-body p {
    margin: 0;
    font-size: 14px;
    line-height: 1.55;
    color: rgba(226, 232, 240, 0.88);
}
.connect-banner-footnote {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: rgba(226, 232, 240, 0.88);
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.18);
    width: fit-content;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(6px);
}
.connect-banner-footnote-icon {
    font-size: 14px;
}
@media (min-width: 640px) {
    .connect-banner-inner {
        grid-template-columns: minmax(0, 260px) minmax(0, 1fr);
        gap: 32px;
    }
    .connect-banner-footnote {
        grid-column: 1 / -1;
    }
}

/* Tile-styled form controls */
.tile-input { padding: 12px; }
.tile-input .input {
    width: 100%;
    border: none;
    background: transparent;
    padding: 0;
    color: var(--color-text);
}
.tile-input .input::placeholder { color: var(--muted-color); }
.tile-input .input:focus { outline: none; box-shadow: none; }
.tile-button {
    width: 100%;
    text-align: left;
}
/* Headings inside sections */
.section > h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 8px;
}

/* Optional page title */
.page-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 8px;

}

/* Focus states for accessibility */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
.tile:focus-visible {
    outline: 2px solid var(--color-ring);
    outline-offset: 2px;
}

/* Simple divider */
.divider {
    height: 1px;
    background: var(--border-color);
    margin: 8px 0;
}

/* Removed old CTA-specific styles */

/* Removed: Profile ID copy icon styles */

/* Full-bleed partners grid (no side paddings) */
 

/* Full-bleed my bots list */
 

/* Removed full-bleed utility */

/* Full-bleed connect CTA row */
 
 

/* Full-bleed profile section */
 


/* Full-width variant for page container */
.container.container-full {
    max-width: none;
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
}

/* Full-bleed sections for bot page */
 


/* --- Forms --- */
.form { display: block; }
.form-group { margin-bottom: 12px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 500; }
.input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: 3px;
    background: var(--color-surface);
    color: var(--color-text);
    outline: none;
}
.input::placeholder { color: var(--color-muted); }
.input:focus {
    border-color: var(--color-ring);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-ring) 20%, transparent);
}
.input-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}
.input-row .input { flex: 1 1 auto; }
.form-actions { margin-top: 8px; display: flex; gap: 8px; align-items: center; }

/* Form helpers and states */
.btn[disabled] { opacity: 0.7; cursor: default; }
.msg { font-size: 14px; margin-top: 8px; }
.msg--muted { color: var(--muted-color, #6b7280); }
.msg--ok { color: var(--color-success, #10b981); }
.msg--error { color: #ef4444; }
.input-error { border-color: #ef4444; }
.input-error:focus {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px color-mix(in srgb, #ef4444 20%, transparent);
}

/* Inputs inside partner-card rows (used on connect page) */
#connect-token-section .partner-card .input {
    border: none;
    background: transparent;
    padding: 0; /* taller touch target */
    font-size: 14px;
    line-height: 20px;
}
#connect-token-section .partner-card .tile-content {
    width: 100%;
}

/* Left-align text inside button tiles */
.partners-row button.tile.partner-card { text-align: left; }

/* Visual disabled state for tile buttons */
.tile[disabled] { opacity: 0.7; cursor: default; }

/* Make the "Подключить" tile green */
#connect-action-section .partner-card {
    background: var(--color-success, #10b981);
    color: #ffffff;
    border: none;
}
#connect-action-section .partner-card .tile-title { color: inherit; }
#connect-action-section .partner-card .tile-subtitle { color: rgba(255,255,255,0.9); }
#connect-action-section .partner-card .tile-avatar {
    background: #059669; /* deeper green for contrast */
    color: #ffffff;
}

