/* TG Parser — light blue interface */
:root {
    color-scheme: light;
    --bg: #f3f7ff;
    --surface: #ffffff;
    --surface-soft: #f7faff;
    --text: #14233f;
    --text-muted: #7b8ba7;
    --accent: #3478f6;
    --accent-hover: #2364df;
    --accent-soft: #eaf2ff;
    --danger: #e45464;
    --border: #e5ecf7;
    --radius: 20px;
    --shadow: 0 10px 30px rgba(39, 88, 160, .07);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html {
    min-height: 100%;
    background: var(--bg);
}

body {
    min-height: 100vh;
    padding: max(18px, env(safe-area-inset-top)) 0 calc(100px + env(safe-area-inset-bottom));
    background:
        radial-gradient(ellipse at 90% 0%, rgba(74, 144, 255, .11), transparent 34%),
        var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

button, input, textarea {
    font: inherit;
}

button {
    -webkit-appearance: none;
    appearance: none;
}

.loader {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    color: var(--accent);
    font-size: 15px;
    font-weight: 650;
}

.loader::before {
    content: "";
    width: 18px;
    height: 18px;
    margin-right: 11px;
    border: 2px solid #d9e7ff;
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .75s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.page {
    display: none;
    padding: 18px 18px 24px;
    animation: fadeIn .22s ease both;
}

.page.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(7px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-title {
    position: relative;
    margin: 5px 0 20px;
    color: var(--text);
    font-size: 28px;
    line-height: 1.15;
    font-weight: 800;
    letter-spacing: -.8px;
}

.page-title::after {
    content: "";
    display: block;
    width: 34px;
    height: 4px;
    margin-top: 11px;
    border-radius: 10px;
    background: linear-gradient(90deg, #3478f6, #75b5ff);
}

.hint {
    margin: -8px 0 15px;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.5;
}

.hint.warning {
    color: #b47726;
    padding: 11px 13px;
    background: #fff8e9;
    border: 1px solid #ffedc6;
    border-radius: 12px;
}

.card {
    margin-bottom: 16px;
    padding: 18px;
    background: var(--surface);
    border: 1px solid rgba(222, 233, 249, .9);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.input-group { margin-bottom: 13px; }
.input-group:last-child { margin-bottom: 0; }

.input-row {
    display: flex;
    align-items: stretch;
    gap: 9px;
}

input, textarea {
    display: block;
    width: 100%;
    min-width: 0;
    margin: 0 0 11px;
    padding: 14px 15px;
    color: var(--text);
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 13px;
    outline: none;
    font-size: 15px;
    line-height: 1.4;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
    appearance: none;
}

input::placeholder, textarea::placeholder {
    color: #9aa9bf;
    opacity: 1;
}

input:focus, textarea:focus {
    background: #fff;
    border-color: #75a8ff;
    box-shadow: 0 0 0 4px rgba(52, 120, 246, .11);
}

input[type="search"]::-webkit-search-cancel-button {
    cursor: pointer;
}

textarea {
    min-height: 100px;
    resize: vertical;
}

.input-row input {
    flex: 1;
    margin-bottom: 0;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 48px;
    padding: 13px 17px;
    color: #fff;
    background: #3478f6;
    border: 0;
    border-radius: 13px;
    box-shadow: 0 6px 14px rgba(52, 120, 246, .2);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: transform .16s ease, background .16s ease, box-shadow .16s ease;
}

.btn:active {
    transform: translateY(1px) scale(.985);
    box-shadow: 0 3px 8px rgba(52, 120, 246, .16);
}

.btn.primary {
    background: linear-gradient(135deg, #4389ff, #2869e8);
}

.btn.primary:active { background: var(--accent-hover); }

.btn.danger {
    background: #fff0f1;
    color: var(--danger);
    border: 1px solid #ffdade;
    box-shadow: none;
}

.btn.icon {
    flex: 0 0 49px;
    width: 49px;
    min-height: 49px;
    padding: 0;
    border-radius: 14px;
    font-size: 25px;
    line-height: 1;
}

.list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 15px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 5px 18px rgba(39, 88, 160, .045);
}

.item-text {
    color: var(--text);
    font-size: 15px;
    font-weight: 700;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.item-sub {
    margin-top: 5px;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.list-item .btn {
    flex: 0 0 auto;
    width: auto;
    min-height: 36px;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 13px;
}

.nav {
    position: fixed;
    z-index: 100;
    right: 12px;
    bottom: max(10px, env(safe-area-inset-bottom));
    left: 12px;
    display: flex;
    justify-content: space-around;
    gap: 2px;
    padding: 9px 5px;
    background: rgba(255, 255, 255, .94);
    border: 1px solid rgba(224, 234, 248, .95);
    border-radius: 22px;
    box-shadow: 0 12px 35px rgba(34, 73, 132, .13);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.nav-item {
    display: flex;
    flex: 1 1 0;
    min-width: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 7px 1px 6px;
    color: #91a0b8;
    border-radius: 15px;
    font-size: 10px;
    line-height: 1.15;
    font-weight: 650;
    cursor: pointer;
    transition: color .18s ease, background .18s ease, transform .18s ease;
}

.nav-item .icon {
    display: grid;
    place-items: center;
    min-height: 23px;
    font-size: 20px;
    line-height: 1;
    filter: saturate(.75);
}

.nav-item.active {
    color: var(--accent);
    background: var(--accent-soft);
}

.nav-item.active .icon {
    filter: none;
    transform: translateY(-1px);
}

@media (min-width: 600px) {
    body {
        max-width: 620px;
        margin: 0 auto;
        padding-top: 28px;
    }
    .page { padding: 24px 24px 30px; }
    .nav {
        right: max(20px, calc((100vw - 580px) / 2));
        left: max(20px, calc((100vw - 580px) / 2));
        bottom: 18px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
