* {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    outline: none;
}

html {
    font-size: 18px;
}

body {
    background-color: #1a1a1a;
    color: #fff;
}

.wrap {
    max-width: 42rem;
    margin: 0 auto;
    padding: 0 1rem
}

h1 {
    font-weight: 400;
    font-size: 2.5rem;
}

.form h1 {
    margin: 10rem 0 1rem 0;
    text-align: center;
}

form {
    position: relative;
    font-size: 0;
}

textarea {
    background: #333;
    color: #fff;
    font-size: 1rem;
    border: 2px solid #444;
    padding: .5rem .5rem 3rem;
    width: 100%;
    min-height: calc(6rem + 10px);
    resize: none;
    border-radius: .5rem;
    box-shadow: 0 0 1rem rgba(0, 0, 0, .1);
    appearance: none;
    transition: all .2s ease-in-out;
    margin: 0 0 1rem 0;
    overflow: hidden;
    height: max-content;
}

textarea:focus {
    border: 2px solid #666;
    box-shadow: 0 0 1rem rgba(0, 0, 0, .2);
}

button {
    background: none;
    border: 2px solid #fa3;
    color: #fa3;
    line-height: 100%;
    width: 32px;
    height: 32px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    position: absolute;
    left: calc(100% - 36px - 0.5rem);
    top: calc(100% - 36px - 1.5rem);
    appearance: none;
    transition: all .2s ease-in-out;
}

button:hover, button:active {
    border: 2px solid #ccc;
    color: #ccc;
    cursor: pointer;
}

a {
    color: #fff;
    text-decoration: none;
    transition: all .2s ease-in-out;
}

a:hover, a:active {
    color: #fa3;
}

article h1 {
    margin: 50px 0 20px 0;
}

.ttl {
    font-size: 1.5rem;
    margin: 0 0 20px 0;
}

.answer p {
    margin: 0 0 20px 0;
}

.related {
    margin: 20px 0 0 0;
}

.items-related a {
    padding: 10px 0;
    display: block;
    border-top: 1px solid #222;
    position: relative;
}

.items-related a:after {
    content: "+";
    font-weight: 800;
    right: 0;
    position: absolute;
}

.chat {
    margin: 20px 0 0 0;
}

.sub-ttl {
    font-size: 22px;
    margin: 0 0 10px 0;
}

.source-urls {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 0 0 20px 0;
    border-bottom: 1px solid #222;
    margin: 0 0 20px 0;
}

.source-urls::-webkit-scrollbar {
    display: none;
}

.source-url {
    border: 1px solid #666;
    min-width: 200px;
    height: calc(4em + 18px);
    padding: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    box-orient: vertical;
    overflow: hidden;
    border-radius: 6px
}

.source-urls:empty {
    padding: 20px;
}

.source-urls:empty:after {
    content: 'Ничего не найдено';
    display: flex;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    color: #666
}
.loading .answer,
.loading .sources,
.loading .related {
    display: none;
}

.refresh-button {
    margin: 20px 0;
    padding: 10px 20px;
    background: none;
    border: 2px solid #fa3;
    color: #fa3;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: all .2s ease-in-out;
    display: inline-block;
}

.refresh-button:hover {
    background: #fa3;
    color: #fff;
}

/* Улучшенный индикатор загрузки */
.loading-indicator {
    position: relative;
    margin: 40px auto;
    width: 100px;
    height: 100px;
    display: none;
}

.loading .loading-indicator {
    display: block;
}

.loading-spinner {
    border: 4px solid rgba(255, 170, 51, 0.2);
    border-radius: 50%;
    border-top: 4px solid #fa3;
    width: 60px;
    height: 60px;
    margin: 0 auto;
    animation: spin 1.5s linear infinite;
}

.loading-steps {
    margin-top: 20px;
    text-align: center;
}

.loading-step {
    display: none;
    font-size: 14px;
    color: #999;
}

.loading-step.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

.loading-progress {
    width: 100%;
    height: 4px;
    background-color: #333;
    margin: 20px auto;
    border-radius: 2px;
    overflow: hidden;
}

.loading-progress-bar {
    height: 100%;
    width: 0;
    background-color: #fa3;
    transition: width 0.5s ease;
}

.error-message {
    color: #ff6b6b;
    text-align: center;
    padding: 20px;
    margin: 20px 0;
    border: 1px solid #ff6b6b;
    border-radius: 4px;
    display: none;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}