:root {
    --ink: #0f172a;
    --text: #334155;
    --muted: #64748b;
    --line: #dbe3ee;
    --soft: #f1f5f9;
    --paper: #ffffff;
    --blue: #0369a1;
    --blue-strong: #075985;
    --orange: #f08200;
    --green: #15803d;
    --red: #b42318;
    --shadow: 0 14px 34px rgba(15, 23, 42, 0.1);
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background:
        linear-gradient(180deg, #eef6fc 0, #f8fafc 180px, #f8fafc 100%);
    font-family: "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif;
    letter-spacing: 0;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

img {
    display: block;
    max-width: 100%;
}

a {
    color: inherit;
}

.app {
    width: min(100%, 520px);
    margin: 0 auto;
    padding: max(14px, env(safe-area-inset-top)) 14px max(28px, env(safe-area-inset-bottom));
}

.module {
    margin: 0 0 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 1px 1px rgba(15, 23, 42, 0.04);
    overflow: hidden;
}

.module-header {
    display: flex;
    min-height: 65px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid #d97706;
    background: var(--orange);
    padding: 0 14px;
}

.module-title {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 10px;
    margin: 0;
    color: #fff;
    font-size: 18px;
    font-weight: 800;
    line-height: 1.15;
}

.module-title i,
.module-title svg {
    width: 21px;
    height: 21px;
    color: #fff;
    flex: 0 0 auto;
}

.module-count {
    color: rgba(255, 255, 255, 0.9);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

#answers-module .module-header {
    border-bottom: 1px solid #e7edf5;
    background: #fff;
}

#answers-module .module-title {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

#answers-module .module-title i,
#answers-module .module-title svg {
    width: 15px;
    height: 15px;
    color: var(--muted);
}

#answers-module .module-count {
    color: var(--muted);
}

.header-button {
    display: inline-flex;
    min-height: 34px;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid rgba(255, 255, 255, 0.54);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
    transition: border-color 180ms ease, background 180ms ease, color 180ms ease;
}

.header-button:hover {
    border-color: rgba(255, 255, 255, 0.82);
    background: rgba(255, 255, 255, 0.24);
}

[hidden] {
    display: none !important;
}

.machine-strip {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px 14px 16px;
}

.machine-card {
    display: grid;
    grid-template-columns: 90px 1fr;
    gap: 12px;
    min-height: 116px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    padding: 12px;
    text-align: left;
    transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.machine-card.is-selected {
    border-color: var(--blue);
    background: #f0f9ff;
    box-shadow: 0 0 0 3px rgba(3, 105, 161, 0.12);
}

.machine-card:hover {
    border-color: rgba(3, 105, 161, 0.48);
    box-shadow: var(--shadow);
}

.machine-image {
    display: flex;
    width: 90px;
    height: 90px;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    background: linear-gradient(180deg, #f8fafc, #eaf4fd);
}

.machine-image img {
    width: 82px;
    height: 70px;
    object-fit: contain;
    filter: drop-shadow(0 10px 14px rgba(15, 23, 42, 0.16));
}

.machine-name {
    display: block;
    color: var(--ink);
    font-size: 14px;
    font-weight: 800;
    line-height: 1.32;
}

#machine-module {
    background: #fff;
}

#machine-module .module-header {
    min-height: auto;
    align-items: flex-start;
    border-bottom: 0;
    background: #fff;
    padding: 28px 18px 12px;
}

#machine-module .module-title {
    color: var(--ink);
    font-size: 25px;
    line-height: 1.18;
}

#machine-module .module-title i,
#machine-module .module-title svg {
    display: none;
}

#machine-module .module-count {
    display: inline-flex;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    border: 1px solid #e5e7eb;
    border-radius: var(--radius);
    background: #fff;
    color: #737985;
    padding: 0 16px;
    font-size: 15px;
    font-weight: 700;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
}

#machine-module .machine-strip {
    gap: 14px;
    padding: 16px 18px 30px;
}

#machine-module .machine-card {
    position: relative;
    border-color: #e7e9ef;
    background: #fff;
    padding-right: 42px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.03);
    transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

#machine-module .machine-card > span:not(.machine-image) {
    min-width: 0;
}

#machine-module .machine-card::after {
    content: "";
    position: absolute;
    right: 18px;
    top: 50%;
    width: 10px;
    height: 10px;
    border-top: 2px solid #737985;
    border-right: 2px solid #737985;
    opacity: 0.45;
    transform: translateY(-50%) rotate(45deg);
    transition: opacity 180ms ease, border-color 180ms ease, transform 180ms ease;
}

#machine-module .machine-card:hover,
#machine-module .machine-card.is-selected {
    border-color: #ff8a57;
    box-shadow: 0 14px 34px rgba(255, 74, 10, 0.1);
}

#machine-module .machine-card:hover::after,
#machine-module .machine-card.is-selected::after {
    border-color: #ff4a0a;
    opacity: 1;
    transform: translateY(-50%) rotate(45deg) translateX(2px);
}

#machine-module .machine-card:active {
    transform: translateY(1px);
}

#machine-module .machine-image {
    border: 1px solid #edf0f5;
    background: linear-gradient(180deg, #fbfdff, #eef7ff);
}

#machine-module .machine-name {
    color: var(--ink);
}

.search-body {
    padding: 14px;
}

.selected-row {
    display: grid;
    grid-template-columns: 46px 1fr;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
    border: 1px solid #e7edf5;
    border-radius: var(--radius);
    background: var(--soft);
    padding: 10px;
}

.selected-row img {
    width: 46px;
    height: 46px;
    object-fit: contain;
    border-radius: 7px;
    background: #fff;
    padding: 4px;
}

.selected-row strong {
    display: block;
    color: var(--ink);
    font-size: 13px;
    line-height: 1.35;
}

.selected-row span {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.search-label {
    display: block;
    margin: 0 0 8px;
    color: var(--ink);
    font-size: 13px;
    font-weight: 800;
}

.search-input {
    width: 100%;
    height: 52px;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius);
    background: #fff;
    color: var(--ink);
    outline: none;
    padding: 14px;
    line-height: 1.55;
    appearance: none;
}

.search-input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(3, 105, 161, 0.12);
}

.search-actions {
    display: grid;
    grid-template-columns: 1fr 48px;
    gap: 10px;
    margin-top: 10px;
}

.primary-button,
.icon-button,
.chip,
.answer-button,
.answer-action {
    display: inline-flex;
    min-height: 48px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: var(--radius);
    font-weight: 800;
    transition: border-color 180ms ease, background 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

.primary-button {
    border: 1px solid var(--blue);
    background: var(--blue);
    color: #fff;
    box-shadow: 0 12px 24px rgba(3, 105, 161, 0.2);
}

.primary-button:hover {
    border-color: var(--blue-strong);
    background: var(--blue-strong);
}

.primary-button:disabled {
    cursor: progress;
    opacity: 0.7;
}

.icon-button {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
}

.status {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

#search-module {
    background: #fff;
}

#search-module .module-header {
    min-height: auto;
    align-items: flex-start;
    border-bottom: 0;
    background: #fff;
    padding: 28px 18px 12px;
}

#search-module .module-title {
    color: var(--ink);
    font-size: 25px;
    line-height: 1.18;
}

#search-module .header-button {
    min-height: 46px;
    border-color: #e5e7eb;
    background: #fff;
    color: #737985;
    padding: 0 16px;
    font-size: 17px;
    font-weight: 700;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
}

#search-module .header-button i,
#search-module .header-button svg {
    width: 20px;
    height: 20px;
    color: #ff4a0a;
}

#search-module .header-button:hover {
    border-color: #ffd0bf;
    background: #fff8f5;
    color: var(--ink);
}

#search-module .search-body {
    padding: 16px 18px 30px;
}

#search-module .selected-row {
    width: 100%;
    grid-template-columns: 62px 1fr 22px;
    min-height: 82px;
    gap: 14px;
    margin-bottom: 0;
    border-color: #e7e9ef;
    background: #fff;
    padding: 12px 14px;
    color: var(--ink);
    text-align: left;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.03);
}

#search-module .selected-row img {
    width: 62px;
    height: 58px;
    border: 1px solid #edf0f5;
    border-radius: var(--radius);
    padding: 5px;
}

#search-module .selected-copy {
    display: block;
    min-width: 0;
    margin-top: 0;
    color: inherit;
    font-size: inherit;
    font-weight: inherit;
}

#search-module .selected-row strong {
    font-size: 17px;
    line-height: 1.3;
}

#search-module #selected-desc {
    display: none;
}

#search-module .selected-chevron {
    width: 22px;
    height: 22px;
    color: #737985;
}

#search-module .search-label,
#search-module .status {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.search-field {
    position: relative;
    margin-top: 38px;
}

#search-module .search-input {
    height: 58px;
    border-color: #d9dde5;
    padding: 0 58px 0 18px;
    color: var(--ink);
    font-size: 16px;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.03);
}

#search-module .search-input::placeholder {
    color: #737985;
    opacity: 0.95;
}

#search-module .search-input:hover {
    border-color: #d9dde5;
}

#search-module .search-input:focus {
    border-color: #ff8a57;
    box-shadow: 0 0 0 3px rgba(255, 74, 10, 0.12);
}

#search-module .search-input:focus-visible {
    outline: none;
}

.search-field-icon {
    position: absolute;
    right: 20px;
    top: 50%;
    width: 24px;
    height: 24px;
    color: #4b5263;
    pointer-events: none;
    transform: translateY(-50%);
}

#search-module .search-actions {
    grid-template-columns: 1fr;
    margin-top: 24px;
}

#search-module .primary-button {
    min-height: 58px;
    border-color: #ff4a0a;
    background: #ff4a0a;
    color: #fff;
    font-size: 17px;
    box-shadow: 0 16px 30px rgba(255, 74, 10, 0.2);
}

#search-module .primary-button:hover {
    border-color: #f03f00;
    background: #f03f00;
}

#search-module .icon-button {
    display: none;
}

#answers-module {
    background: #fff;
}

#answers-module .module-header {
    min-height: 72px;
    border-bottom: 0;
    background: #fff;
    padding: 0 18px;
}

#answers-module .module-title {
    color: var(--ink);
    font-size: 17px;
    font-weight: 800;
}

#answers-module .module-title i,
#answers-module .module-title svg {
    width: 23px;
    height: 23px;
    color: #ff4a0a;
}

#answers-module .module-count {
    display: none;
}

.answers {
    display: grid;
    gap: 12px;
    padding: 0 18px 22px;
}

.answer-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    overflow: hidden;
}

.answer-card.is-open {
    border-color: #ffd0bf;
    box-shadow: 0 12px 28px rgba(255, 74, 10, 0.08);
}

.answer-button {
    display: grid;
    grid-template-columns: 24px 1fr 28px;
    gap: 12px;
    width: 100%;
    min-height: 82px;
    border: 0;
    background: transparent;
    color: var(--ink);
    padding: 16px 14px;
    text-align: left;
}

.answer-icon {
    display: inline-flex;
    width: 24px;
    height: 24px;
    align-items: center;
    justify-content: center;
    color: #737985;
}

.answer-icon svg {
    width: 22px;
    height: 22px;
}

.answer-copy {
    min-width: 0;
}

.answer-question {
    display: block;
    color: var(--ink);
    font-size: 15px;
    font-weight: 800;
    line-height: 1.35;
}

.answer-summary {
    display: block;
    margin-top: 6px;
    color: #676f80;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.45;
}

.chevron {
    display: inline-flex;
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    align-items: center;
    justify-content: center;
    border: 0;
    color: #737985;
}

.answer-card.is-open .chevron {
    color: #ff4a0a;
}

.answer-card.is-open .chevron svg {
    transform: rotate(90deg);
}

.answer-content {
    display: none;
    border-top: 1px solid #e7edf5;
    padding: 0 14px 14px;
}

.answer-card.is-open .answer-content {
    display: block;
    animation: reveal 180ms ease;
}

.answer-content p {
    margin: 13px 0 0;
    color: var(--text);
    font-size: 13px;
    line-height: 1.7;
}

.answer-html {
    margin-top: 13px;
    color: var(--text);
    font-size: 13px;
    line-height: 1.7;
}

.answer-html img,
.answer-html video {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
}

.answer-html a {
    color: var(--blue);
    text-decoration: underline;
}

.answer-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 14px;
}

.answer-action {
    min-height: 40px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    font-size: 12px;
    text-decoration: none;
}

.answer-action.positive {
    border-color: #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}

.answer-action.support {
    border-color: #16a34a;
    background: #16a34a;
    color: #fff;
}

.empty {
    display: none;
    margin: 0 14px 14px;
    border: 1px dashed #cbd5e1;
    border-radius: var(--radius);
    background: #fff;
    color: var(--text);
    padding: 18px 14px;
    text-align: center;
}

.empty.is-visible {
    display: block;
}

.empty strong {
    display: block;
    color: var(--ink);
    font-size: 15px;
}

.empty span {
    display: block;
    margin-top: 7px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
}

.loading-row {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 22px 14px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.loading-row.is-visible {
    display: flex;
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid #cbd5e1;
    border-top-color: var(--orange);
    border-radius: 999px;
    animation: spin 800ms linear infinite;
}

.toast {
    position: fixed;
    right: 14px;
    bottom: max(14px, env(safe-area-inset-bottom));
    left: 14px;
    z-index: 20;
    display: none;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid rgba(21, 128, 61, 0.24);
    border-radius: var(--radius);
    background: #f0fdf4;
    color: #166534;
    box-shadow: var(--shadow);
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 800;
    text-align: center;
}

.toast.is-visible {
    display: flex;
    animation: reveal 180ms ease;
}

:focus-visible {
    outline: 3px solid rgba(3, 105, 161, 0.32);
    outline-offset: 3px;
}

@keyframes reveal {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@media (min-width: 560px) {
    .app {
        padding-inline: 18px;
    }

    .machine-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 820px) {
    .app {
        width: min(100%, 760px);
    }

    .machine-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .app {
        width: min(calc(100% - 64px), 1180px);
        padding-top: 24px;
    }

    .module-header {
        min-height: 71px;
        padding: 0 22px;
    }

    .module-title {
        font-size: 22px;
    }

    .machine-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 34px 38px;
        padding: 32px 34px 36px;
    }

    .machine-card {
        grid-template-columns: 1fr;
        align-content: start;
        min-height: 310px;
        gap: 22px;
        padding: 26px;
    }

    .machine-image {
        width: 100%;
        height: 198px;
    }

    .machine-image img {
        width: 260px;
        height: 160px;
    }

    .machine-name {
        min-height: 52px;
        font-size: 20px;
        line-height: 1.3;
    }

    .search-body,
    .answers {
        padding: 20px;
    }

    .answer-actions {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    #machine-module .module-header {
        padding: 56px 42px 26px;
    }

    #machine-module .module-title {
        font-size: 40px;
    }

    #machine-module .module-count {
        min-height: 78px;
        padding: 0 28px;
        font-size: 26px;
    }

    #machine-module .machine-strip {
        gap: 34px 38px;
        padding: 20px 42px 50px;
    }

    #machine-module .machine-card {
        min-height: 326px;
        gap: 26px;
        padding: 26px 26px 32px;
    }

    #machine-module .machine-card::after {
        right: 30px;
        top: calc(26px + 198px + 26px + 14px);
        width: 14px;
        height: 14px;
        border-width: 3px;
    }

    #machine-module .machine-image {
        height: 198px;
    }

    #machine-module .machine-image img {
        width: 260px;
        height: 160px;
    }

    #machine-module .machine-name {
        min-height: 58px;
        padding-right: 34px;
        font-size: 22px;
        line-height: 1.3;
    }

    #search-module {
        margin-bottom: 24px;
    }

    #search-module .module-header {
        padding: 56px 42px 26px;
    }

    #search-module .module-title {
        font-size: 40px;
    }

    #search-module .header-button {
        min-height: 78px;
        padding: 0 28px;
        font-size: 34px;
    }

    #search-module .header-button i,
    #search-module .header-button svg {
        width: 30px;
        height: 30px;
    }

    #search-module .search-body {
        padding: 20px 42px 100px;
    }

    #search-module .selected-row {
        grid-template-columns: 132px 1fr 34px;
        min-height: 156px;
        gap: 26px;
        padding: 20px 40px 20px 30px;
    }

    #search-module .selected-row img {
        width: 124px;
        height: 116px;
        padding: 10px;
    }

    #search-module .selected-row strong {
        font-size: 28px;
        line-height: 1.25;
    }

    #search-module .selected-chevron {
        width: 34px;
        height: 34px;
    }

    #search-module .search-field {
        margin-top: 118px;
    }

    #search-module .search-input {
        height: 90px;
        padding: 0 86px 0 30px;
        font-size: 24px;
    }

    #search-module .search-field-icon {
        right: 34px;
        width: 32px;
        height: 32px;
    }

    #search-module .search-actions {
        margin-top: 42px;
    }

    #search-module .primary-button {
        min-height: 88px;
        font-size: 24px;
    }

    #search-module .primary-button i,
    #search-module .primary-button svg {
        width: 32px;
        height: 32px;
    }

    #answers-module .module-header {
        min-height: 92px;
        padding: 0 42px;
    }

    #answers-module .module-title {
        gap: 18px;
        font-size: 24px;
    }

    #answers-module .module-title i,
    #answers-module .module-title svg {
        width: 28px;
        height: 28px;
    }

    #answers-module .answers {
        gap: 12px;
        padding: 0 42px 42px;
    }

    #answers-module .answer-button {
        grid-template-columns: 36px 1fr 34px;
        min-height: 108px;
        gap: 20px;
        padding: 20px 22px;
    }

    #answers-module .answer-icon,
    #answers-module .answer-icon svg {
        width: 28px;
        height: 28px;
    }

    #answers-module .answer-question {
        font-size: 20px;
    }

    #answers-module .answer-summary {
        margin-top: 8px;
        font-size: 15px;
    }

    #answers-module .chevron,
    #answers-module .chevron svg {
        width: 34px;
        height: 34px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
