:root {
    --bg: #f4efe4;
    --panel: rgba(255, 251, 245, 0.82);
    --panel-solid: rgba(255, 255, 255, 0.74);
    --text: #1b1d1f;
    --muted: #5f655f;
    --accent: #1f6b57;
    --accent-strong: #0f4d3f;
    --accent-soft: #d7e7df;
    --border: rgba(31, 107, 87, 0.16);
    --shadow: 0 24px 80px rgba(32, 36, 39, 0.14);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Georgia, "Times New Roman", serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(31, 107, 87, 0.18), transparent 32%),
        radial-gradient(circle at bottom right, rgba(168, 129, 79, 0.22), transparent 30%),
        linear-gradient(145deg, #f7f2e8 0%, #efe5d5 52%, #f8f4eb 100%);
    padding: 24px;
}

.shell {
    width: min(1120px, 100%);
    margin: 0 auto;
}

.hero,
.tabs-section {
    width: 100%;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
}

.hero {
    background: var(--panel);
    border-radius: 32px;
    padding: 36px 32px 28px;
}

h1 {
    margin: 0;
    font-size: clamp(42px, 9vw, 72px);
    line-height: 0.95;
    letter-spacing: -0.04em;
}

.tabs-section {
    margin-top: 18px;
    background: var(--panel-solid);
    border-radius: 32px;
    overflow: hidden;
}

.tabs-nav {
    display: flex;
    gap: 12px;
    padding: 18px 18px 0;
    border-bottom: 1px solid rgba(31, 107, 87, 0.1);
}

.tab {
    appearance: none;
    border: 0;
    border-radius: 18px 18px 0 0;
    padding: 14px 20px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 16px;
    cursor: pointer;
}

.tab.is-active {
    background: rgba(255, 255, 255, 0.8);
    color: var(--accent);
    box-shadow: inset 0 0 0 1px rgba(31, 107, 87, 0.12);
}

.tab-panel {
    padding: 28px 24px 32px;
}

.chat-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.9fr);
    gap: 18px;
}

.panel-card {
    border-radius: 24px;
    border: 1px solid rgba(31, 107, 87, 0.14);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(246, 240, 231, 0.9));
    padding: 22px 20px;
}

.panel-card h2,
.panel-card h3 {
    margin: 0 0 12px;
    letter-spacing: -0.03em;
}

.panel-card h2 {
    font-size: clamp(28px, 4vw, 40px);
}

.panel-card h3 {
    font-size: 20px;
}

.side-heading {
    margin-top: 24px;
}

.side-copy {
    margin-top: 0;
    color: var(--muted);
    line-height: 1.7;
}

.panel-card p {
    margin: 0;
    color: var(--muted);
    font-size: 16px;
    line-height: 1.65;
}

.mode-switch {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.mode-button {
    background: rgba(31, 107, 87, 0.08);
    color: var(--accent-strong);
}

.mode-button.is-active {
    background: var(--accent);
    color: #fff;
}

.chat-log {
    margin-top: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 360px;
}

.message {
    border-radius: 20px;
    padding: 16px 18px;
    line-height: 1.6;
    border: 1px solid rgba(31, 107, 87, 0.12);
}

.message strong {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.message.user {
    background: rgba(31, 107, 87, 0.08);
}

.message.assistant {
    background: rgba(255, 255, 255, 0.82);
}

.message.system {
    background: rgba(247, 236, 209, 0.72);
}

.composer {
    margin-top: 18px;
}

.composer label,
.field-label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.composer textarea {
    width: 100%;
    min-height: 120px;
    resize: vertical;
}

textarea,
input[type="text"] {
    width: 100%;
    border: 1px solid rgba(31, 107, 87, 0.18);
    background: rgba(255, 255, 255, 0.84);
    border-radius: 18px;
    padding: 14px 16px;
    font: inherit;
    color: var(--text);
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.actions {
    margin-top: 12px;
}

button {
    appearance: none;
    border: 0;
    border-radius: 999px;
    padding: 12px 16px;
    font: inherit;
    cursor: pointer;
}

.button-primary {
    background: var(--accent);
    color: #fff;
}

.button-secondary {
    background: rgba(31, 107, 87, 0.12);
    color: var(--accent-strong);
}

.status {
    margin-top: 16px;
    min-height: 24px;
    color: var(--muted);
    font-size: 14px;
}

.debug-box {
    margin-top: 16px;
    border-radius: 18px;
    padding: 16px;
    background: rgba(27, 29, 31, 0.92);
    color: #f5f0e5;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 13px;
    overflow: auto;
    white-space: pre-wrap;
}

.hint-list {
    margin: 14px 0 0;
    padding-left: 18px;
    color: var(--muted);
    line-height: 1.7;
}

@media (max-width: 920px) {
    .chat-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    body {
        padding: 16px;
    }

    .hero {
        padding: 28px 22px 22px;
        border-radius: 24px;
    }

    .tabs-section {
        border-radius: 24px;
    }

    .tabs-nav {
        padding: 14px 14px 0;
    }

    .tab-panel {
        padding: 18px 16px 22px;
    }

    .panel-card {
        padding: 18px 16px;
    }

    .mode-switch {
        flex-direction: column;
    }
}
