/* =========================================================
   Hangul Match Translation Result Learning UI v4
   - Translation first
   - Japanese learner-facing explanations
   - Inline listen/copy actions
   - Result adjustment tags
   - Hide SEO guide while a translation result is open
   ========================================================= */

.hm-has-result .hm-seo {
    display: none !important;
}

.hm-result-v4 {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.hm-result-v4 .hm-result-head-v4 {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding-bottom: 4px;
}

.hm-result-v4 .hm-result-head-v4 h2 {
    margin: 5px 0 5px;
    font-size: clamp(1.35rem, 2.2vw, 1.8rem);
    line-height: 1.35;
    color: var(--ink, #172033);
}

.hm-result-v4 .hm-result-direction {
    margin: 0;
    color: var(--ink-soft, #6f8192);
    font-size: .82rem;
    font-weight: 750;
}

.hm-result-v4 .hm-save-state {
    display: block;
    margin-top: 7px;
    color: var(--ink-soft, #6f8192);
    font-size: .78rem;
}

.hm-result-v4 .hm-result-source-section {
    padding: 14px 16px;
    border: 1px solid rgba(50, 158, 255, .12);
    border-radius: 14px;
    background: rgba(50, 158, 255, .035);
}

.hm-result-v4 .hm-result-source-section p {
    margin: 7px 0 0;
    color: var(--ink, #172033);
    font-size: .96rem;
    line-height: 1.7;
}

.hm-result-v4 .hm-result-primary-v4 {
    padding: 22px;
    border: 1px solid rgba(50, 158, 255, .19);
    border-radius: 19px;
    background: #fff;
    box-shadow: 0 10px 28px rgba(18, 101, 184, .065);
}

.hm-result-v4 .hm-result-primary-head-v4 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.hm-result-v4 .hm-result-translation {
    margin: 11px 0 0;
    color: var(--ink, #172033);
    font-size: clamp(1.45rem, 3vw, 2rem);
    font-weight: 850;
    line-height: 1.55;
    letter-spacing: -.015em;
    word-break: keep-all;
}

.hm-result-inline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.hm-result-inline-action {
    appearance: none;
    border: 1px solid rgba(50, 158, 255, .2);
    border-radius: 999px;
    background: #f7fbff;
    color: #1265b8;
    padding: 9px 13px;
    font: inherit;
    font-size: .82rem;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
}

.hm-result-inline-action:hover {
    background: #edf7ff;
}

.hm-result-inline-action.is-primary {
    color: #fff;
    border-color: #329eff;
    background: #329eff;
}

.hm-result-v4 .hm-result-nuance-v4,
.hm-result-v4 .hm-result-tone-v4,
.hm-result-v4 .hm-result-adjust-v4 {
    border: 1px solid rgba(50, 158, 255, .13);
    border-radius: 18px;
    background: #f8fcff;
    padding: 19px 20px;
}

.hm-result-v4 .hm-result-nuance-v4 p {
    margin: 9px 0 0;
    color: var(--ink, #172033);
    line-height: 1.8;
}

.hm-result-v4 .hm-result-tone-head {
    margin-bottom: 12px;
}

.hm-result-v4 .hm-result-tone-head small {
    display: block;
    margin-top: 4px;
    color: var(--ink-soft, #6f8192);
}

.hm-result-v4 .hm-result-tone-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.hm-result-v4 .hm-result-tone-item {
    min-width: 0;
    padding: 13px 14px;
    border-radius: 13px;
    background: #fff;
    border: 1px solid rgba(50, 158, 255, .10);
}

.hm-result-v4 .hm-result-tone-item small {
    display: block;
    margin-bottom: 6px;
    color: var(--ink-soft, #6f8192);
    font-size: .72rem;
    font-weight: 750;
}

.hm-result-v4 .hm-result-tone-item strong,
.hm-result-v4 .hm-result-address-terms {
    color: var(--ink, #172033);
    font-size: .9rem;
    line-height: 1.65;
    font-weight: 750;
}

.hm-result-adjust-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.hm-result-adjust-head small {
    color: var(--ink-soft, #6f8192);
    font-size: .74rem;
}

.hm-result-adjust-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.hm-result-adjust-tag {
    appearance: none;
    border: 1px solid #cfe8ff;
    border-radius: 999px;
    background: #fff;
    color: #1265b8;
    padding: 9px 13px;
    font: inherit;
    font-size: .82rem;
    font-weight: 800;
    cursor: pointer;
}

.hm-result-adjust-tag:hover {
    border-color: #8cc9ff;
    background: #f2f9ff;
}

.hm-result-adjust-tag:disabled {
    opacity: .55;
    cursor: wait;
}

.hm-result-v4 .hm-details-v4 {
    overflow: hidden;
    border: 1px solid rgba(50, 158, 255, .15);
    border-radius: 18px;
    background: #fff;
}

.hm-result-v4 .hm-details-v4 > summary {
    list-style: none;
    cursor: pointer;
    padding: 18px 20px;
}

.hm-result-v4 .hm-details-v4 > summary::-webkit-details-marker {
    display: none;
}

.hm-result-v4 .hm-details-v4 > summary span {
    display: block;
    color: var(--ink, #172033);
    font-weight: 850;
}

.hm-result-v4 .hm-details-v4 > summary small {
    display: block;
    margin-top: 4px;
    color: var(--ink-soft, #6f8192);
}

.hm-result-v4 .hm-details-v4[open] > summary {
    border-bottom: 1px solid rgba(50, 158, 255, .12);
}

.hm-result-v4 .hm-alternative-result-card {
    gap: 14px;
}

.hm-result-v4 .hm-alternative-result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 10px;
}

.hm-result-v4 .hm-alt-action {
    border-radius: 999px;
}

@media (max-width: 720px) {
    .hm-result-v4 {
        gap: 14px;
    }

    .hm-result-v4 .hm-result-head-v4 {
        display: block;
    }

    .hm-result-v4 .hm-result-primary-v4,
    .hm-result-v4 .hm-result-nuance-v4,
    .hm-result-v4 .hm-result-tone-v4,
    .hm-result-v4 .hm-result-adjust-v4 {
        padding: 16px;
        border-radius: 16px;
    }

    .hm-result-v4 .hm-result-tone-grid {
        grid-template-columns: 1fr;
    }

    .hm-result-v4 .hm-result-translation {
        font-size: 1.35rem;
    }
}

/* HANGUL_RESULT_COMPACT_V41 */
/* Result starts directly from the translation card. */
.hm-result-v4 .hm-save-state-v41 {
    margin: -8px 2px 0;
    min-height: 0;
}

/*
 * Learning detail: one continuous pale-blue canvas.
 * Spacing is created with padding instead of white margin gaps.
 */
.hm-result-v4 .hm-details-v4 {
    background: #eaf5ff !important;
}

.hm-result-v4 .hm-details-v4 > summary {
    background: #eaf5ff !important;
}

.hm-result-v4 .hm-details-v4[open] > summary {
    border-bottom: 1px solid rgba(50, 158, 255, .13);
}

.hm-result-v4 .hm-details-content-v3 {
    display: block !important;
    margin: 0 !important;
    padding: 4px 26px 28px !important;
    background: #eaf5ff !important;
}

.hm-result-v4 .hm-details-content-v3 > .hm-detail-section,
.hm-result-v4 .hm-details-content-v3 > .hm-detail-block {
    margin: 0 !important;
    padding: 28px 0 !important;
    background: transparent !important;
    border-radius: 0 !important;
}

.hm-result-v4 .hm-details-content-v3 > .hm-detail-section + .hm-detail-section,
.hm-result-v4 .hm-details-content-v3 > .hm-detail-block + .hm-detail-block {
    border-top: 1px solid rgba(50, 158, 255, .12);
}

.hm-result-v4 .hm-details-content-v3 > .hm-detail-section:first-child,
.hm-result-v4 .hm-details-content-v3 > .hm-detail-block:first-child {
    padding-top: 24px !important;
}

.hm-result-v4 .hm-details-content-v3 > .hm-detail-section:last-child,
.hm-result-v4 .hm-details-content-v3 > .hm-detail-block:last-child {
    padding-bottom: 4px !important;
}

/* Inner study cards stay white for contrast on the blue canvas. */
.hm-result-v4 .hm-word-result-card,
.hm-result-v4 .hm-grammar-result-card,
.hm-result-v4 .hm-alternative-result-card,
.hm-result-v4 .hm-pronunciation-result {
    background: #fff;
}

@media (max-width: 720px) {
    .hm-result-v4 .hm-details-content-v3 {
        padding: 2px 16px 20px !important;
    }

    .hm-result-v4 .hm-details-content-v3 > .hm-detail-section,
    .hm-result-v4 .hm-details-content-v3 > .hm-detail-block {
        padding: 22px 0 !important;
    }
}

/* HANGUL_RESULT_ADJUST_ORANGE_V42 */
/*
 * 「翻訳を調整」だけを淡いオレンジ系にして、
 * 青系のニュアンス/学習領域と役割を視覚的に分ける。
 */
.hm-result-v4 .hm-result-adjust-v4 {
    border-color: rgba(255, 138, 61, .24) !important;
    background: linear-gradient(180deg, #fff9f4 0%, #fff3e8 100%) !important;
    box-shadow: inset 0 0 0 1px rgba(255, 138, 61, .025);
}

.hm-result-v4 .hm-result-adjust-head .hm-result-label {
    color: #c85f1b;
}

.hm-result-v4 .hm-result-adjust-head small {
    color: #8b6a55;
}

.hm-result-v4 .hm-result-adjust-tag {
    border-color: #ffd0b1;
    background: rgba(255, 255, 255, .96);
    color: #bd5718;
    box-shadow: 0 2px 8px rgba(255, 138, 61, .055);
}

.hm-result-v4 .hm-result-adjust-tag:hover {
    border-color: #ffad75;
    background: #fff0e5;
    color: #a94b12;
}

.hm-result-v4 .hm-result-adjust-tag:focus-visible {
    outline: 3px solid rgba(255, 138, 61, .18);
    outline-offset: 2px;
}

.hm-result-v4 .hm-result-adjust-tag:disabled {
    background: #fff7f1;
    color: #b98a6d;
}

@media (max-width: 720px) {
    .hm-result-v4 .hm-result-adjust-v4 {
        padding: 17px 16px;
    }

    .hm-result-v4 .hm-result-adjust-tags {
        gap: 7px;
    }

    .hm-result-v4 .hm-result-adjust-tag {
        padding: 8px 11px;
        font-size: .8rem;
    }
}


/* HANGUL_REVISION_THREAD_V2
 * 親の結果デザインはそのまま。調整結果だけを下へスレッド表示する。
 */
.hm-result-v4 .hm-revision-thread {
    display: grid;
    gap: 0;
    margin-top: 4px;
}

.hm-result-v4 .hm-revision-card {
    position: relative;
    scroll-margin-top: 18px;
}

.hm-result-v4 .hm-revision-connector {
    height: 42px;
    display: grid;
    place-items: center;
}

.hm-result-v4 .hm-revision-connector::before {
    content: '';
    width: 2px;
    height: 28px;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(50,158,255,.18), rgba(255,138,61,.38));
}

.hm-result-v4 .hm-revision-connector span {
    position: absolute;
    top: 27px;
    width: 8px;
    height: 8px;
    border-right: 2px solid rgba(255,138,61,.62);
    border-bottom: 2px solid rgba(255,138,61,.62);
    transform: rotate(45deg);
}

.hm-result-v4 .hm-revision-card-inner {
    overflow: hidden;
    border: 1px solid rgba(50,158,255,.16);
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 12px 30px rgba(18,101,184,.07);
}

.hm-result-v4 .hm-revision-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 15px 18px 0;
}

.hm-result-v4 .hm-revision-head small {
    color: var(--ink-soft, #6f8192);
    font-size: .78rem;
    font-weight: 700;
}

.hm-result-v4 .hm-revision-badge {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 6px 11px;
    border: 1px solid #ffd0b1;
    border-radius: 999px;
    background: #fff4eb;
    color: #bd5718;
    font-size: .78rem;
    font-weight: 850;
}

.hm-result-v4 .hm-revision-primary {
    padding: 17px 18px 19px;
}

.hm-result-v4 .hm-revision-translation {
    margin: 9px 0 12px;
    color: var(--ink, #172033);
    font-size: clamp(1.24rem, 2.6vw, 1.6rem);
    font-weight: 850;
    line-height: 1.58;
    letter-spacing: -.015em;
    white-space: pre-wrap;
}

.hm-result-v4 .hm-revision-summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    border-top: 1px solid rgba(50,158,255,.11);
    border-bottom: 1px solid rgba(50,158,255,.11);
    background: rgba(50,158,255,.10);
}

.hm-result-v4 .hm-revision-summary-grid > article {
    min-width: 0;
    padding: 16px 18px;
    background: #f4faff;
}

.hm-result-v4 .hm-revision-summary-grid p {
    margin: 7px 0 0;
    color: var(--ink, #172033);
    line-height: 1.65;
}

.hm-result-v4 .hm-revision-summary-grid small {
    display: block;
    margin-top: 5px;
    color: var(--ink-soft, #6f8192);
    line-height: 1.55;
}

.hm-result-v4 .hm-revision-adjust {
    padding: 17px 18px 18px;
    border-bottom: 1px solid rgba(255,138,61,.14);
    background: linear-gradient(180deg, #fff9f4 0%, #fff3e8 100%);
}

.hm-result-v4 .hm-revision-adjust .hm-result-adjust-tags {
    margin-top: 11px;
}

.hm-result-v4 [data-result-adjust][aria-disabled='true'] {
    opacity: .42;
    cursor: default;
}

.hm-result-v4 .hm-revision-details {
    background: #eaf5ff;
}

.hm-result-v4 .hm-revision-details > summary {
    list-style: none;
    cursor: pointer;
    padding: 17px 18px;
}

.hm-result-v4 .hm-revision-details > summary::-webkit-details-marker {
    display: none;
}

.hm-result-v4 .hm-revision-details > summary span {
    display: block;
    color: var(--ink, #172033);
    font-weight: 850;
}

.hm-result-v4 .hm-revision-details > summary small {
    display: block;
    margin-top: 4px;
    color: var(--ink-soft, #6f8192);
}

.hm-result-v4 .hm-revision-details[open] > summary {
    border-bottom: 1px solid rgba(50,158,255,.12);
}

.hm-result-v4 .hm-revision-details-content {
    padding: 2px 22px 24px;
    background: #eaf5ff;
}

.hm-result-v4 .hm-revision-details-content > .hm-detail-section {
    margin: 0;
    padding: 24px 0;
    background: transparent;
    border-radius: 0;
}

.hm-result-v4 .hm-revision-details-content > .hm-detail-section + .hm-detail-section {
    border-top: 1px solid rgba(50,158,255,.12);
}

.hm-result-v4 .hm-revision-details-content .hm-word-result-card,
.hm-result-v4 .hm-revision-details-content .hm-grammar-result-card,
.hm-result-v4 .hm-revision-details-content .hm-alternative-result-card,
.hm-result-v4 .hm-revision-details-content .hm-pronunciation-result {
    background: #fff;
}

@media (max-width: 720px) {
    .hm-result-v4 .hm-revision-connector {
        height: 34px;
    }

    .hm-result-v4 .hm-revision-card-inner {
        border-radius: 17px;
    }

    .hm-result-v4 .hm-revision-head,
    .hm-result-v4 .hm-revision-primary,
    .hm-result-v4 .hm-revision-adjust {
        padding-left: 15px;
        padding-right: 15px;
    }

    .hm-result-v4 .hm-revision-summary-grid {
        grid-template-columns: 1fr;
    }

    .hm-result-v4 .hm-revision-summary-grid > article {
        padding: 15px;
    }

    .hm-result-v4 .hm-revision-details-content {
        padding: 2px 15px 18px;
    }
}
