:root {
    --bg: #f4f7fc;
    --text: #101928;
    --muted: #52607a;
    --surface: rgba(255, 255, 255, 0.82);
    --surface-strong: #ffffff;
    --line: rgba(16, 25, 40, 0.1);
    --primary: #1f5dff;
    --primary-soft: rgba(31, 93, 255, 0.12);
    --accent: #00a6a6;
    --glow: rgba(31, 93, 255, 0.22);
    --shadow: 0 18px 48px rgba(16, 25, 40, 0.12);
    --radius-xl: 26px;
    --radius-lg: 18px;
    --radius-md: 12px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Manrope", "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(80rem 80rem at -10% -10%, rgba(0, 166, 166, 0.18), transparent 55%),
        radial-gradient(64rem 64rem at 105% 0%, rgba(31, 93, 255, 0.15), transparent 52%),
        linear-gradient(180deg, #f8fbff 0%, #edf2fa 100%);
    position: relative;
    overflow-x: hidden;
}

.bg-shape {
    position: fixed;
    border-radius: 999px;
    pointer-events: none;
    filter: blur(42px);
    z-index: 0;
}

.bg-shape-a {
    width: 26rem;
    height: 26rem;
    top: -8rem;
    right: -8rem;
    background: rgba(31, 93, 255, 0.22);
}

.bg-shape-b {
    width: 22rem;
    height: 22rem;
    left: -9rem;
    bottom: -7rem;
    background: rgba(0, 166, 166, 0.22);
}

.app {
    position: relative;
    z-index: 1;
    width: min(1120px, 94vw);
    margin: 0 auto;
    padding: 36px 0 64px;
}

.app-shell {
    display: grid;
    gap: 18px;
}

.block {
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    background: var(--surface);
    backdrop-filter: blur(8px);
    box-shadow: var(--shadow);
}

.app-header {
    padding: 34px 34px 30px;
    margin-bottom: 0;
    animation: rise 0.6s ease both;
}

.eyebrow {
    margin: 0 0 8px;
    font-family: "Space Grotesk", sans-serif;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--accent);
}

.app-title {
    margin: 0;
    font-family: "Space Grotesk", sans-serif;
    font-size: clamp(2rem, 5vw, 3.8rem);
    letter-spacing: -0.03em;
    line-height: 1.05;
}

.app-subtitle {
    margin: 12px 0 0;
    max-width: 56ch;
    color: var(--muted);
    font-size: clamp(0.95rem, 2vw, 1.08rem);
}

.app-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: 1.3fr 1fr;
    margin-bottom: 0;
}

.app-section {
    padding: 28px;
}

.block-title {
    margin: 0 0 14px;
    font-family: "Space Grotesk", sans-serif;
    font-size: 1.06rem;
    letter-spacing: 0.01em;
}

.input-block {
    animation: rise 0.75s ease both;
}

.prompt-block {
    animation: rise 0.9s ease both;
}

.prompt-form {
    margin: 0;
}

.prompt-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: start;
}

.prompt-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    align-self: start;
    align-content: start;
}

#prompt-input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface-strong);
    color: var(--text);
    min-height: 120px;
    padding: 12px 14px;
    font-size: 1rem;
    line-height: 1.45;
    resize: vertical;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#prompt-input::placeholder {
    color: #8291aa;
}

#prompt-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-soft);
}

#send-btn {
    min-height: 52px;
    min-width: 124px;
    border: 0;
    border-radius: var(--radius-md);
    padding: 0 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: "Space Grotesk", sans-serif;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    color: #ffffff;
    background: linear-gradient(135deg, #1f5dff 0%, #0f7ec8 100%);
    box-shadow: 0 8px 22px rgba(31, 93, 255, 0.32);
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

#send-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 14px 24px rgba(31, 93, 255, 0.34);
}

#send-btn:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

#reset-style-btn {
    min-height: 44px;
    min-width: 124px;
    border: 1px solid rgba(16, 25, 40, 0.15);
    border-radius: var(--radius-md);
    padding: 0 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: "Space Grotesk", sans-serif;
    font-size: 0.84rem;
    letter-spacing: 0.01em;
    color: #274368;
    background: #ffffff;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

#reset-style-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    border-color: rgba(31, 93, 255, 0.35);
    box-shadow: 0 8px 18px rgba(31, 93, 255, 0.12);
}

#reset-style-btn:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}

.quick-prompts {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.quick-prompts li {
    margin: 0;
}

.quick-prompt {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid rgba(31, 93, 255, 0.16);
    border-radius: 999px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.84rem;
    color: #22406f;
    background: #f3f7ff;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.quick-prompt:hover:not([aria-disabled="true"]) {
    transform: translateY(-1px);
    border-color: rgba(31, 93, 255, 0.45);
    box-shadow: 0 6px 14px rgba(31, 93, 255, 0.14);
}

.quick-prompt[aria-disabled="true"] {
    opacity: 0.46;
    cursor: not-allowed;
}

.result-block {
    padding-top: 18px;
    animation: rise 1.05s ease both;
}

.result-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4px 10px;
}

#save-pdf-btn {
    min-height: 38px;
    min-width: 112px;
    border: 1px solid rgba(16, 25, 40, 0.15);
    border-radius: var(--radius-md);
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: "Space Grotesk", sans-serif;
    font-size: 0.82rem;
    letter-spacing: 0.01em;
    color: #274368;
    background: #ffffff;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

#save-pdf-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    border-color: rgba(31, 93, 255, 0.35);
    box-shadow: 0 8px 18px rgba(31, 93, 255, 0.12);
}

#save-pdf-btn:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}

.app-result {
    min-height: 420px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 18px;
    background: rgba(255, 255, 255, 0.78);
    white-space: normal;
    overflow-wrap: anywhere;
}

.hint {
    margin: 0;
    color: var(--muted);
}

#result-container .cv-result {
    display: grid;
    gap: 14px;
    white-space: normal;
    line-height: 1.6;
}

#result-container .cv-result > header {
    border: 1px solid rgba(31, 93, 255, 0.14);
    border-radius: var(--radius-md);
    background: linear-gradient(120deg, #f5f9ff 0%, #eef7f7 100%);
    padding: 14px;
}

#result-container .cv-result > header h2 {
    margin: 0;
    font-family: "Space Grotesk", sans-serif;
    font-size: clamp(1.14rem, 2.6vw, 1.45rem);
    letter-spacing: -0.02em;
    color: #12336e;
}

#result-container .cv-result > header p {
    margin: 6px 0 0;
    color: #3f5578;
}

#result-container .cv-result section {
    border: 1px solid rgba(16, 25, 40, 0.09);
    border-radius: var(--radius-md);
    padding: 18px;
    background: #ffffff;
}

#result-container .cv-result section h3 {
    margin: 10px 0 9px;
    font-family: "Space Grotesk", sans-serif;
    font-size: 0.98rem;
    color: #173760;
}

#result-container .cv-result section p {
    margin: 0;
}

#result-container .cv-result section ul {
    margin: 10px 0 10px;
    padding-left: 1.1rem;
}

#result-container .cv-result section li + li {
    margin-top: 6px;
}

#result-container section section {
    margin-top: 12px;
}

#result-container section > section:first-child {
    margin-top: 0;
}

#result-container .app {
    width: 100%;
    margin: 0;
    padding: 0;
}

#result-container .app-shell {
    display: grid;
    gap: 12px;
}

#result-container .app-header {
    margin: 0;
    padding: 14px;
    animation: none;
}

#result-container .app-section {
    padding: 16px;
}

#result-container .app-section > .app-section,
#result-container .app-section > .app-section.block {
    margin-top: 12px;
}

#result-container .app-title {
    font-size: clamp(1.15rem, 2.6vw, 1.5rem);
}

#result-container .app-subtitle {
    margin-top: 6px;
}

#result-container p,
#result-container li {
    color: #243956;
}

#result-container a {
    color: #0f4ec8;
}

#result-container strong {
    color: #12336e;
}

#result-container em {
    color: #30599a;
}

.button-spinner {
    display: inline-block;
    box-sizing: border-box;
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

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

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

@media (max-width: 700px) {
    .app {
        width: min(1120px, 95vw);
        padding: 18px 0 36px;
    }

    .app-header {
        padding: 24px 20px;
    }

    .app-section {
        padding: 20px;
    }

    .prompt-row {
        grid-template-columns: 1fr;
    }

    #send-btn {
        width: 100%;
    }

    #reset-style-btn {
        width: 100%;
    }

    .app-result {
        min-height: 320px;
    }
}
