*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
}

body {
    font-family: Georgia, 'Times New Roman', serif;
    background: #f5f3ef;
    color: #2c2c2c;
    min-height: 100vh;
}

.screen {
    display: none;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.screen.active {
    display: flex;
}

.card {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.07);
    padding: 2.75rem;
    width: 100%;
    max-width: 540px;
}

.eyebrow {
    font-family: Arial, sans-serif;
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #b0a898;
    margin-bottom: 0.75rem;
}

h1 {
    font-size: 2rem;
    font-weight: normal;
    color: #1a1a1a;
    margin-bottom: 1.75rem;
    line-height: 1.2;
}

h2 {
    font-size: 1.35rem;
    font-weight: normal;
    color: #1a1a1a;
    margin-bottom: 0.4rem;
}

.intro-body p {
    color: #555;
    font-size: 0.95rem;
    line-height: 1.8;
    margin-bottom: 0.9rem;
}

.intro-body p:last-child {
    margin-bottom: 0;
    color: #888;
    font-size: 0.88rem;
}

.subtitle {
    font-family: Arial, sans-serif;
    color: #999;
    font-size: 0.88rem;
    margin-bottom: 2rem;
    line-height: 1.5;
}

.btn-primary {
    display: inline-block;
    margin-top: 2rem;
    background: #2c2c2c;
    color: #ffffff;
    border: none;
    padding: 0.8rem 2rem;
    font-size: 0.9rem;
    font-family: Arial, sans-serif;
    letter-spacing: 0.04em;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-primary:hover {
    background: #444;
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.field {
    margin-bottom: 1.5rem;
}

.field > label {
    display: block;
    font-family: Arial, sans-serif;
    font-size: 0.85rem;
    color: #555;
    margin-bottom: 0.5rem;
}

textarea {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: Georgia, serif;
    font-size: 0.95rem;
    color: #2c2c2c;
    background: #fafaf8;
    resize: vertical;
    line-height: 1.6;
    transition: border-color 0.15s;
}

textarea:focus {
    outline: none;
    border-color: #999;
    background: #fff;
}

input[type="number"] {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: Georgia, serif;
    font-size: 0.95rem;
    color: #2c2c2c;
    background: #fafaf8;
    box-sizing: border-box;
    transition: border-color 0.15s;
}

input[type="number"]:focus {
    outline: none;
    border-color: #999;
    background: #fff;
}

.radio-group {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.radio-label {
    font-family: Arial, sans-serif;
    font-size: 0.88rem;
    color: #444;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.error-msg {
    font-family: Arial, sans-serif;
    color: #c0392b;
    font-size: 0.83rem;
    margin-top: 0.75rem;
    min-height: 1.1em;
}

.chat-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 660px;
    height: 100vh;
    background: #ffffff;
    margin: 0 auto;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.05);
}

.chat-header {
    display: flex;
    align-items: baseline;
    gap: 0.85rem;
    padding: 1.25rem 1.75rem;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.chat-title {
    font-size: 1.05rem;
    color: #1a1a1a;
}

.chat-thread {
    flex: 1;
    overflow-y: auto;
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.message {
    display: flex;
}

.message.user {
    justify-content: flex-end;
}

.message.decoder {
    justify-content: flex-start;
}

.bubble {
    max-width: 78%;
    padding: 0.85rem 1.1rem;
    border-radius: 14px;
    font-size: 0.95rem;
    line-height: 1.7;
    white-space: pre-wrap;
}

.message.user .bubble {
    background: #2c2c2c;
    color: #ffffff;
    border-bottom-right-radius: 3px;
    font-family: Arial, sans-serif;
    font-size: 0.9rem;
}

.message.decoder .bubble {
    background: #f5f3ef;
    color: #2c2c2c;
    border-bottom-left-radius: 3px;
}

.typing-dots {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 1rem 1.1rem;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #b0a898;
    animation: pulse 1.3s ease-in-out infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes pulse {
    0%, 80%, 100% { opacity: 0.25; transform: scale(0.9); }
    40% { opacity: 1; transform: scale(1); }
}

.chat-input-area {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.75rem 1.25rem;
    border-top: 1px solid #eee;
    flex-shrink: 0;
}

.chat-input-area textarea {
    flex: 1;
    resize: none;
    background: #f5f3ef;
    border: 1px solid #e5e0d8;
    border-radius: 8px;
    padding: 0.65rem 0.9rem;
    font-size: 0.93rem;
    max-height: 120px;
}

.btn-send {
    background: #2c2c2c;
    color: #ffffff;
    border: none;
    padding: 0.65rem 1.2rem;
    border-radius: 6px;
    font-family: Arial, sans-serif;
    font-size: 0.88rem;
    letter-spacing: 0.03em;
    cursor: pointer;
    flex-shrink: 0;
    white-space: nowrap;
    transition: background 0.15s;
}

.btn-send:hover {
    background: #444;
}

.btn-send:disabled {
    background: #ccc;
    cursor: not-allowed;
}

@media (max-width: 480px) {
    .card {
        padding: 1.75rem;
    }

    .chat-header,
    .chat-thread,
    .chat-input-area {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .bubble {
        max-width: 90%;
    }
}
