:root {
    --text-light: #1f2937;
    --text-dark: #f8fafc;
    --box-light: rgba(255, 255, 255, 0.20);
    --box-dark: rgba(255, 255, 255, 0.08);
    --border-light: rgba(255, 255, 255, 0.28);
    --border-dark: rgba(255, 255, 255, 0.14);
}

html, body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    width: 100%;
}

body {
    height: auto;
    overflow-x: hidden;
    min-height: 100vh;
    margin: 0;
    flex: 1;
    font-family: 'Inter', sans-serif;
    overflow: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    color: var(--text-light);
    background:
        linear-gradient(135deg, #fff1eb, #ace0f9, #fad0c4, #ffd1ff, #f6d365, #fda085, #c2e9fb);
    transition: background 0.3s ease, color 0.3s ease;
    position: relative;
}

/*! ТЕМА !*/
html.dark-mode body {
    color: var(--text-dark);
    background:
        linear-gradient(135deg, #0f172a, #111827, #1e1b4b, #312e81, #1f2937, #0f1a2b, #111111);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
    mix-blend-mode: soft-light;
    opacity: 0.9;
}

html.dark-mode body::before {
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
}

.theme-toggle {
    position: absolute;
    top: 5px;
    right: 16px;
    width: 54px;
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.22);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.24);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    appearance: none;
    padding: 0;
}

html.dark-mode .theme-toggle {
    background: rgba(10, 15, 25, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.14);
}

label, input {
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.theme-icon {
    display: block;
    width: 30px;
    height: 30px;
    background: url("/static/images/sun.png") center / contain no-repeat;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.45)) brightness(1.15) contrast(1.15);
    transition: background-image 0.2s ease, transform 0.2s ease, filter 0.2s ease;
}

html.dark-mode .theme-icon {
    background-image: url("/static/images/moon.png");
}

.theme-toggle:active .theme-icon {
    transform: scale(0.94);
}

/*! HEADER !*/
.box {
    display: flex;
    flex-direction: column;
    max-width: 270px;
    max-height: 60px;
    margin: 17px;
    padding: 1px;
    text-align: center;
    gap: 8px;
    border-radius: 18px;
    justify-content: center;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
    border: 1px solid var(--border-light);
    background: var(--box-light);
    color: var(--text-light);
}

html.dark-mode .box {
    background: var(--box-dark);
    border: 1px solid var(--border-dark);
    color: var(--text-dark);
}

/*! МЕНЮ !*/
.menu-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px;
}

.bot-card {
    display: grid;
    grid-template-columns: 48px 1fr auto;
    gap: 14px;
    align-items: start;
    padding: 16px;
    border-radius: 18px;
    text-decoration: none;
    color: var(--text-light);
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.16);
    transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}

html.dark-mode .bot-card {
    background: rgba(10, 15, 25, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-dark);
}

.bot-card:hover {
    transform: translateY(-2px);
}

.bot-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
}

.bot-content {
    min-width: 0;
    text-align: left;
}

.bot-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.2;
    color: inherit;
}

.bot-description {
    margin: 6px 0 0;
    font-size: 0.92rem;
    line-height: 1.4;
    opacity: 0.82;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
}

.bot-arrow {
    margin-top: 20px;
    font-size: 1.3rem;
    opacity: 0.75;
}

/* !BOT! */

.input-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.input-group input {
    width: 100%;
    box-sizing: border-box;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid var(--border-light);
    background: var(--box-light);
    color: var(--text-light);
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: all 0.2s ease;
}

html.dark-mode .input-group input {
    background: var(--box-dark);
    border: 1px solid var(--border-dark);
    color: var(--text-dark);
}

.input-group input::placeholder {
    color: inherit;
    opacity: 0.5;
}

.input-group input:focus {
    outline: none;
    border-color: #3b82f6;
    background: rgba(255, 255, 255, 0.35);
}

html.dark-mode .input-group input:focus {
    background: rgba(255, 255, 255, 0.12);
}

.generate-btn {
    width: 100%;
    padding: 14px;
    border-radius: 14px;
    border: none;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    transition: transform 0.1s ease, box-shadow 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.generate-btn:active {
    transform: scale(0.97);
}

.error-message {
    color: #ef4444;
    font-size: 0.9rem;
    font-weight: 500;
    text-align: center;
    margin: 0;
    display: none;
    background: rgba(239, 68, 68, 0.1);
    padding: 10px;
    border-radius: 10px;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.result-container {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 24px 16px;
    border-radius: 18px;
    background: var(--box-light);
    border: 1px solid var(--border-light);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.1);
    animation: fadeIn 0.4s ease;
}

html.dark-mode .result-container {
    background: var(--box-dark);
    border: 1px solid var(--border-dark);
}

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

#qrcode {
    padding: 16px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

#qrcode img, #qrcode canvas {
    display: block;
    max-width: 100%;
    height: auto;
}

.result-text {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: inherit;
}

.download-btn {
    padding: 10px 20px;
    border-radius: 10px;
    border: 1px solid var(--border-light);
    background: rgba(255, 255, 255, 0.3);
    color: inherit;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
}

html.dark-mode .download-btn {
    border: 1px solid var(--border-dark);
    background: rgba(255, 255, 255, 0.08);
}

.download-btn:active {
    background: rgba(255, 255, 255, 0.5);
}

.hint-text {
    margin: 8px 0 0 0;
    font-size: 0.8rem;
    opacity: 0.6;
    text-align: center;
    line-height: 1.3;
}
