.yw-lookup {
    --yw-green: #138a4b;
    --yw-green-soft: #eaf8f0;
    --yw-red: #b42318;
    --yw-red-soft: #fff0ef;
    --yw-yellow: #8a5a00;
    --yw-yellow-soft: #fff7df;
    box-sizing: border-box;
    max-width: 820px;
    margin: 24px auto;
    padding: 28px;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 14px 40px rgba(15, 23, 42, .07);
    color: #1f2937;
}

.yw-lookup *,
.yw-lookup *::before,
.yw-lookup *::after {
    box-sizing: inherit;
}

.yw-lookup__header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
}

.yw-lookup__icon {
    display: inline-flex;
    width: 52px;
    height: 52px;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border-radius: 14px;
    background: var(--yw-green-soft);
    color: var(--yw-green);
}

.yw-lookup__header h2 {
    margin: 0 0 4px;
    font-size: 23px;
    line-height: 1.5;
}

.yw-lookup__header p {
    margin: 0;
    color: #6b7280;
}

.yw-lookup__form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
}

.yw-lookup__controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: stretch;
}

.yw-lookup__controls textarea {
    width: 100%;
    min-height: 54px;
    margin: 0;
    padding: 13px 15px;
    resize: vertical;
    direction: ltr;
    text-align: left;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    outline: none;
    font: 15px/1.6 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    transition: border-color .2s, box-shadow .2s;
}

.yw-lookup__controls textarea:focus {
    border-color: var(--yw-green);
    box-shadow: 0 0 0 3px rgba(19, 138, 75, .12);
}

.yw-lookup__controls button {
    min-width: 150px;
    padding: 0 22px;
    border: 0;
    border-radius: 10px;
    background: var(--yw-green);
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.yw-lookup__controls button:disabled {
    opacity: .65;
    cursor: wait;
}

.yw-lookup__form small {
    display: block;
    margin-top: 8px;
    color: #6b7280;
}

.yw-lookup__result:empty {
    display: none;
}

.yw-result {
    margin-top: 22px;
    padding: 20px;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    background: #f9fafb;
}

.yw-result__top {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.yw-result__mark {
    width: 12px;
    height: 12px;
    margin-top: 8px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: #6b7280;
    box-shadow: 0 0 0 5px rgba(107, 114, 128, .12);
}

.yw-result h3 {
    margin: 0 0 4px;
    font-size: 19px;
}

.yw-result p {
    margin: 0;
    color: #6b7280;
}

.yw-result--active,
.yw-result--valid {
    border-color: #b7e4c7;
    background: var(--yw-green-soft);
}

.yw-result--active .yw-result__mark,
.yw-result--valid .yw-result__mark {
    background: var(--yw-green);
    box-shadow: 0 0 0 5px rgba(19, 138, 75, .12);
}

.yw-result--expired,
.yw-result--void,
.yw-result--not_found,
.yw-result--error {
    border-color: #fecaca;
    background: var(--yw-red-soft);
}

.yw-result--expired .yw-result__mark,
.yw-result--void .yw-result__mark,
.yw-result--not_found .yw-result__mark,
.yw-result--error .yw-result__mark {
    background: var(--yw-red);
    box-shadow: 0 0 0 5px rgba(180, 35, 24, .12);
}

.yw-result--registered {
    border-color: #fde68a;
    background: var(--yw-yellow-soft);
}

.yw-result--registered .yw-result__mark {
    background: var(--yw-yellow);
    box-shadow: 0 0 0 5px rgba(138, 90, 0, .12);
}

.yw-result--used {
    border-color: #c7d2fe;
    background: #eef2ff;
}

.yw-result--used .yw-result__mark {
    background: #4f46e5;
    box-shadow: 0 0 0 5px rgba(79, 70, 229, .12);
}

.yw-result__details {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    margin: 18px 0 0;
    padding-top: 8px;
    border-top: 1px solid rgba(107, 114, 128, .15);
}

.yw-result__details > div {
    min-width: 0;
    padding: 11px 0;
    border-bottom: 1px solid rgba(107, 114, 128, .12);
}

.yw-result__details > div:nth-child(odd) {
    padding-left: 18px;
}

.yw-result__details dt {
    margin-bottom: 4px;
    color: #6b7280;
    font-size: 13px;
}

.yw-result__details dd {
    margin: 0;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.yw-result__code {
    direction: ltr;
    text-align: left;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.yw-result--loading {
    display: flex;
    align-items: center;
    gap: 10px;
}

.yw-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #d1d5db;
    border-top-color: var(--yw-green);
    border-radius: 50%;
    animation: yw-spin .7s linear infinite;
}

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

@media (max-width: 640px) {
    .yw-lookup {
        padding: 20px;
        border-radius: 14px;
    }

    .yw-lookup__controls,
    .yw-result__details {
        grid-template-columns: 1fr;
    }

    .yw-lookup__controls button {
        min-height: 50px;
    }

    .yw-result__details > div:nth-child(odd) {
        padding-left: 0;
    }
}
