/**
 * style.css
 *
 * カエレバ・リニューアル版の画面用CSSです。
 *
 * このCSSは、管理画面・検索画面・生成画面の見た目を整えます。
 * 実際にブログへ貼り付けるカエレバHTMLのCSSは、
 * 現行トマレバでは共通UIと旅行リンクプレビューへ適用します。
 */


/* ------------------------------------------------------------
   基本設定
------------------------------------------------------------ */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background: #f5f6f8;
    color: #222;
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Helvetica Neue",
        "Yu Gothic",
        "YuGothic",
        "Meiryo",
        sans-serif;
    font-size: 15px;
    line-height: 1.7;
}

a {
    color: #1769aa;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}


/* ------------------------------------------------------------
   全体レイアウト
------------------------------------------------------------ */

.kr-page {
    max-width: 1080px;
    margin: 0 auto;
    padding: 24px 16px 48px;
}

.kr-header {
    margin-bottom: 24px;
    padding: 28px 24px;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

/*
 * 共通ヘッダーのロゴ領域です。
 * Step1-3で検索フォームと横並びにすることを想定し、
 * ロゴ本体とページ見出しを独立したブロックにしています。
 */
.kr-header-brand {
    margin-bottom: 14px;
}

.kr-site-logo {
    display: inline-block;
    line-height: 0;
}

.kr-site-logo:hover {
    text-decoration: none;
}

.kr-site-logo img {
    display: block;
    width: 280px;
    max-width: 100%;
    height: auto;
}

.kr-header-copy {
    min-width: 0;
}

.kr-header h1 {
    margin: 0 0 8px;
    font-size: 28px;
    line-height: 1.4;
}

.kr-header p {
    margin: 0;
    color: #666;
}

.kr-main {
    display: block;
}


/* ------------------------------------------------------------
   セクション
------------------------------------------------------------ */

.kr-section {
    margin-bottom: 24px;
    padding: 24px;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.kr-section h2 {
    margin: 0 0 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
    font-size: 21px;
}

.kr-section h3 {
    margin: 24px 0 12px;
    font-size: 17px;
}

.kr-note {
    margin: 0 0 16px;
    color: #666;
    font-size: 14px;
}

.kr-small {
    color: #777;
    font-size: 12px;
}

.kr-message {
    margin-top: 12px;
    color: #1769aa;
    font-weight: bold;
}

.kr-error-box {
    border-left: 5px solid #d93025;
}

.kr-error-box h2 {
    color: #d93025;
}


/* ------------------------------------------------------------
   フォーム
------------------------------------------------------------ */

.kr-search-form,
.kr-generate-form {
    margin: 0;
}

.kr-form-row {
    margin-bottom: 18px;
}

.kr-form-row label,
.kr-form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: bold;
}

.kr-form-row input[type="text"],
.kr-form-row textarea,
.kr-form-row select,
.kr-html-output {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid #d8dce2;
    border-radius: 8px;
    background: #fff;
    color: #222;
    font-size: 15px;
    line-height: 1.6;
}

.kr-form-row input[type="text"]:focus,
.kr-form-row textarea:focus,
.kr-form-row select:focus,
.kr-html-output:focus {
    outline: none;
    border-color: #1769aa;
    box-shadow: 0 0 0 3px rgba(23, 105, 170, 0.15);
}

.kr-form-row textarea {
    resize: vertical;
}

.kr-radio,
.kr-checkbox {
    display: inline-flex;
    align-items: center;
    margin: 0 16px 8px 0;
    font-weight: normal;
}

.kr-radio input,
.kr-checkbox input {
    margin-right: 6px;
}

.kr-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}


/* ------------------------------------------------------------
   ボタン
------------------------------------------------------------ */

.kr-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 9px 18px;
    border: 1px solid #d8dce2;
    border-radius: 999px;
    background: #ffffff;
    color: #222;
    font-size: 14px;
    font-weight: bold;
    line-height: 1.4;
    cursor: pointer;
    text-decoration: none;
}

.kr-button:hover {
    background: #f1f3f5;
    text-decoration: none;
}

.kr-button-primary {
    border-color: #1769aa;
    background: #1769aa;
    color: #fff;
}

.kr-button-primary:hover {
    background: #125486;
}

.kr-button-danger {
    border-color: #b3261e;
    background: #fff;
    color: #a5221b;
}

.kr-button-danger:hover {
    border-color: #8f1d17;
    background: #fff1f0;
    color: #8f1d17;
}


/* ------------------------------------------------------------
   設定ボックス
------------------------------------------------------------ */

.kr-settings-box {
    margin-top: 12px;
}

.kr-affiliate-status {
    margin: 1rem 0;
    padding: 0.9rem 1rem;
    border: 1px solid #cfd8e3;
    border-left: 5px solid #59748f;
    border-radius: 8px;
    background: #f7f9fb;
}

.kr-affiliate-status-affiliate {
    border-left-color: #24833b;
    background: #f3fbf5;
}

.kr-affiliate-status-fallback {
    border-left-color: #b42318;
    background: #fff7f6;
}

.kr-settings-box hr {
    margin: 24px 0;
    border: none;
    border-top: 1px solid #eee;
}

.kr-settings-reset-box {
    margin-top: 28px;
    padding: 18px;
    border: 1px solid #ead3d1;
    border-radius: 10px;
    background: #fffafa;
}

.kr-settings-reset-box h3 {
    margin: 0 0 8px;
    color: #812019;
}

.kr-settings-reset-box p {
    margin: 0 0 14px;
    color: #66504e;
    font-size: 14px;
    line-height: 1.7;
}

.kr-settings-file-warning {
    margin: 14px 0;
    padding: 12px 14px;
    border: 1px solid #e4d4a8;
    border-radius: 8px;
    background: #fffaf0;
    color: #5f5132;
    font-size: 14px;
    line-height: 1.7;
}

.kr-settings-file-warning strong {
    color: inherit;
}

.kr-settings-file-import h3 {
    margin-top: 0;
}

.kr-settings-file-preview {
    margin-top: 18px;
    padding: 16px;
    border: 1px solid #ccd6e0;
    border-radius: 10px;
    background: #f8fbfd;
}

.kr-settings-file-preview h4 {
    margin: 0 0 6px;
}

.kr-settings-file-preview-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
    margin: 14px 0;
}

.kr-settings-file-preview-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    padding: 12px;
    border: 1px solid #dde3e8;
    border-radius: 8px;
    background: #fff;
}

.kr-settings-file-preview-card strong {
    overflow-wrap: anywhere;
}

.kr-settings-file-preview-card span {
    color: #66717d;
    font-size: 13px;
}

.kr-settings-file-backup-note {
    padding: 10px 12px;
    border-radius: 8px;
    background: #eef7ef;
    color: #2f6338;
    font-size: 13px;
    font-weight: bold;
}

.kr-settings-file-backup-restore {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 18px;
    padding: 14px;
    border: 1px solid #b9d5bd;
    border-radius: 10px;
    background: #f2faf3;
}

.kr-settings-file-backup-restore[hidden] {
    display: none;
}

.kr-settings-file-backup-restore strong {
    display: block;
    margin-bottom: 3px;
    color: #285f32;
}

.kr-settings-file-backup-restore p {
    margin: 0;
    color: #4c6751;
    font-size: 13px;
}

.kr-settings-file-backup-restore .kr-button {
    flex: 0 0 auto;
}

.kr-import-action-with-help {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    max-width: 100%;
}

.kr-import-action-with-help .kr-help-popover {
    top: calc(100% + 8px);
}

@media screen and (max-width: 700px) {
    .kr-settings-file-preview {
        padding: 13px;
    }

    .kr-settings-file-preview-list {
        grid-template-columns: 1fr;
    }

    .kr-import-action-with-help {
        width: 100%;
    }

    .kr-import-action-with-help .kr-button {
        flex: 1 1 auto;
    }

    .kr-settings-file-backup-restore {
        align-items: stretch;
        flex-direction: column;
    }

    .kr-settings-file-backup-restore .kr-button {
        width: 100%;
    }
}

/* ------------------------------------------------------------
   Ver1.7 Step3：au PAY マーケット スポンサー案内
------------------------------------------------------------- */
.kr-sponsor-strip {
    width: min(100%, 920px);
    margin: 14px auto 22px;
    border: 1px solid #f2b08d;
    border-radius: 12px;
    background: #fffaf7;
    box-shadow: 0 4px 14px rgba(92, 49, 24, .06);
}

.kr-sponsor-strip-link {
    display: grid;
    grid-template-columns: 168px minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    padding: 9px;
    color: inherit;
    text-decoration: none;
}

.kr-sponsor-strip-link:hover,
.kr-sponsor-strip-link:focus-visible {
    background: #fff4ed;
    border-radius: 11px;
}

.kr-sponsor-strip img {
    display: block;
    width: 168px;
    height: 72px;
    border-radius: 8px;
    object-fit: cover;
}

.kr-sponsor-strip-copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 2px;
}

.kr-sponsor-strip-copy strong {
    font-size: 16px;
    line-height: 1.4;
}

.kr-sponsor-strip-copy > span:last-child {
    color: #5d6570;
    font-size: 13px;
    line-height: 1.5;
}

.kr-sponsor-label {
    display: inline-block;
    width: fit-content;
    margin: 0 0 3px;
    padding: 2px 7px;
    border: 1px solid #d65a16;
    border-radius: 999px;
    color: #a83d05;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .04em;
}

.kr-sponsor-strip-action {
    padding-right: 10px;
    color: #a83d05;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.kr-sponsor-page {
    width: min(100%, 940px);
    margin: 0 auto;
}

.kr-sponsor-hero,
.kr-sponsor-toc,
.kr-sponsor-section {
    box-sizing: border-box;
    margin: 0 0 24px;
    border: 1px solid #eadfd8;
    border-radius: 16px;
    background: #fff;
}

.kr-sponsor-hero {
    display: grid;
    grid-template-columns: minmax(280px, .9fr) minmax(0, 1.1fr);
    align-items: center;
    gap: clamp(24px, 5vw, 50px);
    padding: clamp(24px, 5vw, 46px);
    background: linear-gradient(135deg, #fff4ec 0%, #fff 68%);
}

.kr-sponsor-hero-image img {
    display: block;
    width: 100%;
    border-radius: 13px;
    box-shadow: 0 14px 30px rgba(168, 61, 5, .16);
}

.kr-sponsor-hero h1 {
    margin: 8px 0 18px;
    font-size: clamp(27px, 4vw, 40px);
    line-height: 1.35;
}

.kr-sponsor-toc {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 22px;
    padding: 16px 22px;
}

.kr-sponsor-toc a {
    text-underline-offset: 3px;
}

.kr-sponsor-section {
    padding: clamp(22px, 4vw, 36px);
}

.kr-sponsor-step-label {
    margin: 0 0 5px;
    color: #a83d05;
    font-weight: 800;
}

.kr-sponsor-steps {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 0;
    list-style: none;
    counter-reset: sponsor-step;
}

.kr-sponsor-steps li {
    padding: 17px;
    border: 1px solid #ebe1da;
    border-radius: 12px;
    background: #fffaf7;
    counter-increment: sponsor-step;
}

.kr-sponsor-steps li::before {
    display: block;
    margin-bottom: 5px;
    color: #a83d05;
    font-size: 12px;
    font-weight: 800;
    content: "STEP " counter(sponsor-step);
}

.kr-sponsor-steps strong,
.kr-sponsor-steps span {
    display: block;
}

.kr-sponsor-steps span {
    margin-top: 5px;
    color: #59616b;
    font-size: 14px;
    line-height: 1.65;
}

.kr-sponsor-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 24px 0 12px;
}

.kr-sponsor-note {
    color: #616872;
    font-size: 13px;
}

.kr-aupay-code-settings {
    margin: 22px 0 16px;
    padding: 16px 18px;
    border: 1px solid #f0c4aa;
    border-radius: 12px;
    background: #fff9f5;
}

.kr-aupay-code-preview {
    margin: 22px 0 0;
    padding: 16px 18px;
    border: 1px solid #dfe5eb;
    border-radius: 12px;
    background: #f7f8fa;
}

.kr-aupay-code-preview pre {
    overflow-x: auto;
    margin: 10px 0 0;
    padding: 14px;
    border-radius: 8px;
    background: #20252b;
    color: #f8fafc;
    font-size: 13px;
    line-height: 1.6;
}

#aupay_auto_link_code {
    min-height: 128px;
    font-family: Consolas, Monaco, monospace;
    font-size: 13px;
    line-height: 1.55;
}

.kr-sponsor-benefits {
    padding: 18px 20px 18px 40px;
    border-left: 5px solid #ef5b0c;
    border-radius: 10px;
    background: #fff7f2;
}

.kr-sponsor-cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    background: #fff4ec;
}

.kr-sponsor-cta h2 {
    margin: 8px 0;
}

.kr-sponsor-cta .kr-button {
    flex: 0 0 auto;
}

@media screen and (max-width: 700px) {
    .kr-sponsor-strip {
        margin-top: 10px;
    }

    .kr-sponsor-strip-link {
        grid-template-columns: 112px minmax(0, 1fr);
        gap: 10px;
        padding: 8px;
    }

    .kr-sponsor-strip img {
        width: 112px;
        height: 64px;
    }

    .kr-sponsor-strip-copy > span:last-child,
    .kr-sponsor-strip-action {
        display: none;
    }

    .kr-sponsor-strip-copy strong {
        font-size: 14px;
    }

    .kr-sponsor-hero,
    .kr-sponsor-steps {
        grid-template-columns: 1fr;
    }

    .kr-sponsor-hero-image {
        max-width: 460px;
        margin: 0 auto;
    }

    .kr-sponsor-toc,
    .kr-sponsor-actions,
    .kr-sponsor-cta {
        flex-direction: column;
        align-items: stretch;
    }

    .kr-sponsor-toc {
        text-align: center;
    }

    .kr-sponsor-actions .kr-button,
    .kr-sponsor-cta .kr-button {
        width: 100%;
        text-align: center;
    }
}

/* ------------------------------------------------------------
   Ver1.7 Step2：公式マニュアル
------------------------------------------------------------- */
.kr-manual {
    width: min(100%, 940px);
    margin: 0 auto;
}

.kr-manual-hero,
.kr-manual-toc,
.kr-manual-section,
.kr-manual-detail {
    box-sizing: border-box;
    margin: 0 0 24px;
    border: 1px solid #dfe5eb;
    border-radius: 16px;
    background: #fff;
}

.kr-manual-hero {
    padding: clamp(24px, 5vw, 48px);
    background: linear-gradient(135deg, #fff8ef 0%, #fff 72%);
}

.kr-manual-hero h1 {
    margin: 4px 0 18px;
    font-size: clamp(28px, 5vw, 42px);
    line-height: 1.25;
}

.kr-manual-eyebrow {
    margin: 0;
    color: #b85615;
    font-weight: 700;
    letter-spacing: .08em;
}

.kr-manual-toc,
.kr-manual-section {
    padding: clamp(20px, 4vw, 34px);
}

.kr-manual-toc ol {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px 28px;
    padding-left: 24px;
}

.kr-manual-toc a,
.kr-manual-back-top a {
    text-underline-offset: 3px;
}

.kr-manual-section h2,
.kr-manual-detail-body h2 {
    line-height: 1.45;
}

.kr-manual-steps {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    padding: 0;
    counter-reset: manual-step;
    list-style: none;
}

.kr-manual-steps li {
    position: relative;
    min-height: 84px;
    padding: 18px 14px 14px;
    border-radius: 12px;
    background: #f7f8fa;
    counter-increment: manual-step;
}

.kr-manual-steps li::before {
    display: block;
    margin-bottom: 8px;
    color: #b85615;
    font-weight: 800;
    content: "STEP " counter(manual-step);
}

.kr-manual-columns {
    columns: 2;
    column-gap: 36px;
}

.kr-manual-columns li {
    break-inside: avoid;
    margin-bottom: 7px;
}

.kr-manual-media-placeholder {
    margin-top: 22px;
    padding: 28px 18px;
    border: 1px dashed #b8c1cb;
    border-radius: 12px;
    background: #f8fafc;
    color: #5b6570;
    text-align: center;
}

.kr-manual-detail {
    overflow: hidden;
}

.kr-manual-detail > summary {
    padding: 20px 54px 20px 24px;
    background: #f7f8fa;
    cursor: pointer;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.45;
}

.kr-manual-detail[open] > summary {
    border-bottom: 1px solid #dfe5eb;
}

.kr-manual-detail-body {
    padding: clamp(20px, 4vw, 34px);
}

.kr-manual-faq {
    margin: 10px 0;
    border: 1px solid #e1e6eb;
    border-radius: 10px;
}

.kr-manual-faq summary {
    padding: 15px 18px;
    cursor: pointer;
    font-weight: 700;
}

.kr-manual-faq p {
    margin: 0;
    padding: 0 18px 18px;
}

.kr-manual-checklist {
    margin-top: 24px;
    padding: 18px 22px;
    border-left: 5px solid #e5823a;
    border-radius: 10px;
    background: #fff8ef;
}

.kr-manual-anchor {
    scroll-margin-top: 20px;
}

.kr-manual-back-top {
    margin: 28px 0;
    text-align: center;
}

.kr-footer-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 20px;
    margin-bottom: 12px;
}

.kr-footer-nav a[aria-current="page"] {
    font-weight: 700;
    text-decoration-thickness: 2px;
}

@media screen and (max-width: 700px) {
    .kr-manual-toc ol,
    .kr-manual-steps {
        grid-template-columns: 1fr;
    }

    .kr-manual-columns {
        columns: 1;
    }

    .kr-manual-hero,
    .kr-manual-toc,
    .kr-manual-section,
    .kr-manual-detail {
        border-radius: 12px;
    }

    .kr-manual-detail > summary {
        padding: 17px 42px 17px 18px;
        font-size: 18px;
    }

    .kr-footer-nav {
        flex-direction: column;
        align-items: center;
    }
}


/* ------------------------------------------------------------
   検索結果一覧
------------------------------------------------------------ */

.kr-result-list {
    display: grid;
    gap: 16px;
}

.kr-result-item {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 18px;
    padding: 18px;
    border: 1px solid #e7e9ee;
    border-radius: 12px;
    background: #fff;
}

.kr-result-image {
    text-align: center;
}

.kr-result-image img {
    max-width: 140px;
    height: auto;
    border-radius: 6px;
}

.kr-no-image {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 140px;
    height: 140px;
    border-radius: 8px;
    background: #f1f3f5;
    color: #888;
    font-size: 13px;
}

.kr-result-title {
    margin: 0 0 8px;
    font-size: 17px;
    line-height: 1.5;
}

.kr-result-price {
    margin: 0 0 4px;
    color: #bf0000;
    font-weight: bold;
}

.kr-result-shop,
.kr-result-review {
    margin: 0 0 4px;
    color: #666;
    font-size: 13px;
}

.kr-result-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
}

.kr-select-product-form {
    margin: 0;
}

.kr-button-secondary {
    background: #fff;
}

.kr-search-more {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
}

.kr-search-more .kr-button {
    min-width: 180px;
}

.kr-search-more-message {
    min-height: 1.5em;
    margin: 0;
    color: #5f6368;
    font-size: 14px;
    text-align: center;
}


/* ------------------------------------------------------------
   プレビュー・HTML出力
------------------------------------------------------------ */

.kr-preview-box {
    padding: 16px;
    border: 1px dashed #ccd1d8;
    border-radius: 10px;
    background: #fafafa;
    overflow-x: auto;
}

/* ------------------------------------------------------------
   Ver1.6 PC・スマートフォンプレビュー切替
------------------------------------------------------------ */

.kr-preview-heading-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.kr-preview-heading-row h2 {
    margin-bottom: 2px;
}

.kr-preview-device-note {
    margin: 0;
    color: #68717b;
    font-size: 12px;
}

.kr-preview-device-switch {
    display: inline-flex;
    flex: 0 0 auto;
    padding: 3px;
    border: 1px solid #d5dbe1;
    border-radius: 999px;
    background: #f2f4f6;
}

.kr-preview-device-button {
    min-height: 34px;
    padding: 5px 13px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #4d5660;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
}

.kr-preview-device-button.is-active {
    background: #1769aa;
    color: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .16);
}

.kr-preview-device-button:focus-visible {
    outline: 2px solid #1769aa;
    outline-offset: 2px;
}

.kr-preview-stage {
    width: 100%;
    padding: 0;
    transition: padding .2s ease, background-color .2s ease;
}

.kr-preview-stage.is-mobile {
    padding: 18px;
    border-radius: 12px;
    background: #e9edf1;
}

.kr-preview-stage.is-mobile .kr-preview-box {
    width: 100%;
    max-width: 390px;
    margin: 0 auto;
    background: #fff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .08);
}

/* スマホプレビューは枠幅だけを変えるため、選択状態でも1カラムを再現します。 */
.kr-preview-stage.is-mobile .cstmreba .kaerebalink-image {
    float: none;
    margin: 0 0 14px;
    text-align: center;
}

.kr-preview-stage.is-mobile .cstmreba .kaerebalink-info {
    overflow: visible;
}

.kr-preview-stage.is-mobile .cstmreba .kaerebalink-link1 {
    display: block;
}

.kr-preview-stage.is-mobile .cstmreba .kaerebalink-link1 > div {
    margin: 0 0 8px !important;
}

.kr-preview-stage.is-mobile .cstmreba .kaerebalink-link1 > div:empty {
    display: none;
}

.kr-preview-stage.is-mobile .cstmreba .kaerebalink-link1 > div > img {
    position: absolute;
    width: 1px !important;
    height: 1px !important;
    border: 0 !important;
}

.kr-preview-stage.is-mobile .cstmreba .kaerebalink-link1 a {
    display: block;
    box-sizing: border-box;
    width: 100%;
    text-align: center;
}

@media screen and (max-width: 700px) {
    .kr-preview-heading-row {
        flex-direction: column;
        gap: 10px;
    }

    .kr-preview-device-switch {
        width: 100%;
    }

    .kr-preview-device-button {
        flex: 1 1 50%;
    }

    .kr-preview-stage.is-mobile {
        padding: 10px;
    }
}

.kr-html-output {
    min-height: 280px;
    font-family:
        Menlo,
        Monaco,
        Consolas,
        "Courier New",
        monospace;
    font-size: 13px;
    white-space: pre;
}


/* ------------------------------------------------------------
   スマホ対応
------------------------------------------------------------ */

@media screen and (max-width: 700px) {
    .kr-page {
        padding: 16px 10px 32px;
    }

    .kr-header,
    .kr-section {
        padding: 18px;
        border-radius: 12px;
    }

    .kr-header h1 {
        font-size: 23px;
    }

    .kr-section h2 {
        font-size: 19px;
    }

    .kr-result-item {
        grid-template-columns: 1fr;
    }

    .kr-result-image {
        text-align: left;
    }

    .kr-result-image img,
    .kr-no-image {
        max-width: 160px;
        width: 160px;
    }

    .kr-form-actions,
    .kr-result-actions {
        display: block;
    }

    .kr-button {
        width: 100%;
        margin-bottom: 10px;
    }

    .kr-result-actions .kr-button:last-child {
        margin-bottom: 0;
    }

    .kr-radio,
    .kr-checkbox {
        display: flex;
        margin-right: 0;
    }
}
/* ------------------------------------------------------------
   リンク生成画面：表示ボタン・ASP選択
------------------------------------------------------------ */

.kr-generate-options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 14px;
    margin: 18px 0;
    align-items: start;
}

.kr-generate-option-box {
    min-width: 0;
    padding: 14px;
    border: 1px solid #e1e4e8;
    border-radius: 10px;
    background: #fafafa;
}

.kr-generate-option-box .kr-form-label {
    margin-bottom: 10px;
}

.kr-generate-option-box .kr-radio,
.kr-generate-option-box .kr-checkbox {
    display: flex;
    width: 100%;
    margin: 0 0 7px;
}

.kr-generate-option-box .kr-radio:last-child,
.kr-generate-option-box .kr-checkbox:last-child {
    margin-bottom: 0;
}


/* ------------------------------------------------------------
   サイト選択・管理ボタン
------------------------------------------------------------ */

/*
 * PCでは、ラベル・サイト選択欄・管理ボタンを1行にまとめます。
 * サイト選択部分は画面幅のおよそ半分を使い、
 * 管理ボタンをその右側へコンパクトに並べます。
 */
.kr-site-management-row {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 10px;
    margin-bottom: 8px;
}

.kr-site-select-row {
    display: flex;
    flex: 0 1 50%;
    align-items: center;
    gap: 10px;
    min-width: 360px;
    margin-bottom: 0;
}

.kr-site-select-row label {
    flex: 0 0 auto;
    margin-bottom: 0;
    white-space: nowrap;
}

.kr-site-select-row select {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
}

.kr-site-management-actions {
    display: flex;
    flex: 1 1 auto;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    margin-top: 0;
}

.kr-site-management-actions .kr-button {
    min-height: 42px;
    padding-right: 12px;
    padding-left: 12px;
    white-space: nowrap;
}

/*
 * 横幅が足りない場合だけ2段へ切り替えます。
 * PCの通常幅では1行表示を維持します。
 */
@media screen and (max-width: 900px) {
    .kr-site-management-row {
        align-items: stretch;
        flex-wrap: wrap;
    }

    .kr-site-select-row {
        flex-basis: 100%;
        min-width: 0;
    }
}

@media screen and (max-width: 700px) {
    .kr-site-select-row {
        display: block;
    }

    .kr-site-select-row label {
        display: block;
        margin-bottom: 6px;
    }

    .kr-site-select-row select {
        width: 100%;
    }

    .kr-site-management-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
    }

    .kr-site-management-actions .kr-button {
        width: 100%;
    }
}

@media screen and (max-width: 430px) {
    .kr-site-management-actions {
        grid-template-columns: 1fr;
    }
}

/* ------------------------------------------------------------
   ユーザー設定：コンパクト表示・自動保存
------------------------------------------------------------ */

.kr-settings-basic-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px 16px;
    align-items: start;
    margin-bottom: 18px;
}

.kr-settings-basic-grid .kr-form-row {
    min-width: 0;
    margin-bottom: 0;
}

.kr-settings-basic-grid input[type="text"],
.kr-settings-basic-grid select {
    width: 100%;
    min-width: 0;
}

.kr-image-size-options {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 14px;
    min-height: 48px;
    padding: 8px 10px;
    border: 1px solid #d8dce2;
    border-radius: 8px;
    background: #fff;
}

.kr-image-size-options .kr-radio {
    display: inline-flex;
    align-items: center;
    margin: 0;
    white-space: nowrap;
}

.kr-image-size-options .kr-radio input {
    margin: 0 6px 0 0;
}

.kr-settings-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
    margin: 0 0 16px;
}

.kr-settings-toolbar .kr-form-actions {
    margin-top: 0;
}

.kr-site-settings-toolbar {
    justify-content: flex-start;
}

.kr-site-settings-toolbar > .kr-form-row {
    display: grid;
    flex: 1 1 430px;
    grid-template-columns: auto minmax(240px, 1fr);
    align-items: center;
    gap: 12px;
    margin-bottom: 0;
}

.kr-site-settings-toolbar > .kr-form-row label {
    margin-bottom: 0;
    white-space: nowrap;
}

.kr-site-settings-toolbar > .kr-form-actions {
    flex: 0 1 auto;
}

.kr-settings-save-status {
    min-height: 22px;
    margin: 0;
    color: #1769aa;
    font-size: 13px;
    font-weight: bold;
}

/* ------------------------------------------------------------
   Ver1.2 ASP設定診断
------------------------------------------------------------ */

.kr-settings-diagnostic-result {
    margin: 0 0 22px;
    padding: 18px;
    border: 1px solid #cbd9e6;
    border-radius: 12px;
    background: #f8fbfd;
}

/* ------------------------------------------------------------
   Ver1.6 リンク生成履歴
------------------------------------------------------------ */

.kr-link-history-section {
    border-top: 4px solid #5b7f62;
}

.kr-link-history-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 16px;
}

.kr-link-history-heading h2 {
    margin: 2px 0 5px;
}

.kr-link-history-heading .kr-note {
    margin: 0;
}

.kr-link-history-eyebrow {
    margin: 0;
    color: #47704f;
    font-size: 12px;
    font-weight: bold;
    letter-spacing: .06em;
}

.kr-link-history-heading-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 10px;
}

.kr-link-history-count {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 4px 11px;
    border-radius: 999px;
    background: #eef4ef;
    color: #31583a;
    font-size: 13px;
    font-weight: bold;
}

.kr-link-history-clear {
    min-height: 36px;
    padding: 6px 13px;
    font-size: 12px;
}

.kr-link-history-empty {
    padding: 22px;
    border: 1px dashed #cbd5cd;
    border-radius: 10px;
    background: #fafcfb;
    text-align: center;
}

.kr-link-history-empty strong {
    display: block;
    margin-bottom: 4px;
}

.kr-link-history-empty p {
    margin: 0;
    color: #667069;
    font-size: 13px;
}

.kr-link-history-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.kr-link-history-list[hidden],
.kr-link-history-empty[hidden],
.kr-link-history-clear[hidden],
#toggle_link_history[hidden] {
    display: none;
}

.kr-link-history-item.is-history-hidden {
    display: none;
}

.kr-link-history-more-actions {
    display: flex;
    justify-content: center;
    margin-top: 14px;
}

.kr-link-history-more-actions[hidden] {
    display: none;
}

.kr-link-history-item {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 13px;
    min-width: 0;
    padding: 13px;
    border: 1px solid #dfe5e0;
    border-radius: 10px;
    background: #fff;
}

.kr-link-history-item-no-image {
    grid-template-columns: minmax(0, 1fr);
}

.kr-link-history-image {
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.kr-link-history-image img {
    display: block;
    width: 88px;
    height: 88px;
    border: 1px solid #edf0ed;
    border-radius: 7px;
    background: #f7f8f7;
    object-fit: contain;
}

.kr-link-history-content {
    min-width: 0;
}

.kr-link-history-title {
    display: -webkit-box;
    margin: 0 0 5px;
    overflow: hidden;
    font-size: 14px;
    line-height: 1.5;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.kr-link-history-keyword,
.kr-link-history-meta {
    margin: 0 0 4px;
    overflow: hidden;
    color: #626b64;
    font-size: 12px;
    line-height: 1.5;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kr-link-history-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 9px;
}

.kr-link-history-actions .kr-button {
    min-height: 34px;
    padding: 5px 11px;
    font-size: 12px;
}

#link_history_message:not(:empty) {
    margin-top: 12px;
}

@media screen and (max-width: 820px) {
    .kr-link-history-list {
        grid-template-columns: 1fr;
    }
}

@media screen and (max-width: 700px) {
    .kr-link-history-heading {
        flex-direction: column;
    }

    .kr-link-history-heading-actions {
        width: 100%;
        justify-content: space-between;
    }

    .kr-link-history-heading-actions .kr-button {
        width: auto;
        margin-bottom: 0;
    }

    .kr-link-history-item {
        grid-template-columns: 76px minmax(0, 1fr);
        gap: 11px;
        padding: 11px;
    }

    .kr-link-history-image img {
        width: 72px;
        height: 72px;
    }

    .kr-link-history-actions {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .kr-link-history-actions .kr-button {
        width: 100%;
        margin-bottom: 0;
    }
}

.kr-settings-diagnostic-result.is-stale {
    border-color: #d9c27b;
    background: #fffdf5;
}

.kr-settings-diagnostic-heading-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.kr-settings-diagnostic-heading-row h4 {
    margin: 2px 0 0;
    font-size: 19px;
}

.kr-settings-diagnostic-heading-row h3 {
    margin: 2px 0 0;
    font-size: 24px;
}

.kr-settings-diagnostic-heading-row h3:focus {
    outline: 2px solid #1769aa;
    outline-offset: 3px;
}

.kr-settings-diagnostic-heading-row h4:focus {
    outline: 2px solid #1769aa;
    outline-offset: 3px;
}

.kr-settings-diagnostic-eyebrow {
    margin: 0;
    color: #1769aa;
    font-size: 12px;
    font-weight: bold;
    letter-spacing: .06em;
}

.kr-settings-diagnostic-close {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid #ccd3da;
    border-radius: 50%;
    background: #fff;
    color: #47515b;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.kr-settings-diagnostic-summary {
    display: grid;
    grid-template-columns: minmax(220px, 1.5fr) repeat(3, minmax(110px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.kr-settings-diagnostic-mode,
.kr-settings-diagnostic-count {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 11px 12px;
    border: 1px solid #dde3e8;
    border-radius: 9px;
    background: #fff;
    font-size: 13px;
}

.kr-settings-diagnostic-count.is-ok {
    border-color: #aed3b5;
}

.kr-settings-diagnostic-count.is-review {
    border-color: #dbc57e;
}

.kr-settings-diagnostic-note {
    margin: 0 0 14px;
    color: #59636e;
    font-size: 13px;
    line-height: 1.7;
}

.kr-settings-diagnostic-result.is-stale .kr-settings-diagnostic-note {
    color: #705b17;
    font-weight: bold;
}

.kr-settings-diagnostic-items {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.kr-settings-diagnostic-item {
    min-width: 0;
    padding: 14px;
    border: 1px solid #dde3e8;
    border-left-width: 4px;
    border-radius: 9px;
    background: #fff;
}

.kr-settings-diagnostic-item.is-ok {
    border-left-color: #438a50;
}

.kr-settings-diagnostic-item.is-unset {
    border-left-color: #8a939c;
}

.kr-settings-diagnostic-item.is-review {
    border-left-color: #b78a0d;
}

.kr-settings-diagnostic-item-heading {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin-bottom: 8px;
}

.kr-settings-diagnostic-item-heading h5 {
    min-width: 0;
    margin: 1px 0 0;
    font-size: 14px;
    line-height: 1.45;
}

.kr-settings-diagnostic-status {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    min-height: 24px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #eef1f4;
    color: #47515b;
    font-size: 11px;
    font-weight: bold;
}

.kr-settings-diagnostic-item.is-ok .kr-settings-diagnostic-status {
    background: #eaf6ec;
    color: #286235;
}

.kr-settings-diagnostic-item.is-review .kr-settings-diagnostic-status {
    background: #fff6d9;
    color: #705600;
}

.kr-settings-diagnostic-message,
.kr-settings-diagnostic-action-text {
    margin: 0 0 7px;
    font-size: 13px;
    line-height: 1.6;
}

.kr-settings-diagnostic-action-text {
    color: #616b75;
}

.kr-settings-diagnostic-field-link {
    min-height: 34px;
    margin-top: 4px;
    padding: 5px 12px;
    font-size: 12px;
}

@media screen and (max-width: 900px) {
    .kr-settings-diagnostic-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media screen and (max-width: 700px) {
    .kr-settings-diagnostic-result {
        padding: 14px;
    }

    .kr-settings-diagnostic-summary,
    .kr-settings-diagnostic-items {
        grid-template-columns: 1fr;
    }

    .kr-settings-diagnostic-field-link {
        width: 100%;
        margin-bottom: 0;
    }
}

@media screen and (max-width: 900px) {
    .kr-settings-basic-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media screen and (max-width: 700px) {
    .kr-settings-basic-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px 10px;
    }

    .kr-settings-basic-grid .kr-form-row label,
    .kr-settings-basic-grid .kr-form-label {
        font-size: 13px;
    }

    .kr-settings-basic-grid input[type="text"],
    .kr-settings-basic-grid select {
        padding: 9px 8px;
        font-size: 13px;
    }

    .kr-image-size-options {
        gap: 5px 10px;
        min-height: 42px;
        padding: 7px 8px;
        font-size: 13px;
    }

    .kr-settings-toolbar {
        display: block;
    }

    .kr-site-settings-toolbar > .kr-form-row {
        display: block;
        margin-bottom: 12px;
    }

    .kr-site-settings-toolbar > .kr-form-row label {
        margin-bottom: 6px;
    }

    .kr-settings-toolbar .kr-form-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .kr-settings-toolbar .kr-button {
        width: 100%;
        margin-bottom: 0;
    }

    .kr-settings-save-status {
        margin-top: 10px;
    }
}

@media screen and (max-width: 430px) {
    .kr-settings-basic-grid {
        grid-template-columns: 1fr;
    }

    .kr-settings-toolbar .kr-form-actions {
        grid-template-columns: 1fr;
    }
}



/* ------------------------------------------------------------
   amazlet風-2 CSSカスタマイズ画面
------------------------------------------------------------ */

/**
 * CSS編集欄はHTML出力欄と基本デザインを揃えつつ、
 * 少し高めにして長いCSSも編集しやすくします。
 */

/**
 * CSSプリセット選択欄です。
 * CSSコード欄とは少し間を空け、選択肢のまとまりを明確にします。
 */
.kr-css-preset-box {
    margin: 0 0 16px;
    padding: 14px 16px 8px;
    border: 1px solid #dfe3e8;
    border-radius: 8px;
    background: #f8f9fa;
}

.kr-css-preset-box .kr-form-label {
    margin-bottom: 8px;
}

.kr-css-preset-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.kr-css-preset-options {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
}

.kr-css-preset-options .kr-form-label {
    margin: 0 12px 0 0;
}

.kr-css-preset-options .kr-radio {
    margin-bottom: 0;
}

.kr-css-preset-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0;
}

.kr-css-preset-box .kr-small {
    margin: 2px 0 6px;
}

.kr-css-output {
    min-height: 520px;
    tab-size: 4;
    white-space: pre;
    overflow: auto;
}

/**
 * CSSカスタマイズ欄であることが分かりやすいよう、
 * セクション上部に控えめなアクセントを付けます。
 */
#custom_css_section {
    position: relative;
    border-top: 4px solid #1769aa;
}

#custom_css_section .kr-note {
    max-width: 850px;
}

/**
 * コピー結果と自動保存結果を並べても読みやすいようにします。
 */
#copy_css_message,
#custom_css_save_message {
    min-height: 22px;
    margin: 10px 0 0;
}

#custom_css_save_message {
    color: #5f6368;
    font-size: 13px;
    font-weight: normal;
}

/**
 * 初期デザインへ戻すボタンは破壊的操作ではありませんが、
 * 通常のコピーボタンとは役割が違うため少し見分けやすくします。
 */
#reset_custom_css_button {
    border-color: #b8bec7;
    background: #f8f9fa;
}

#reset_custom_css_button:hover {
    background: #eceff3;
}

/**
 * プレビュー内の商品リンクが画面全体のCSSにはみ出さないよう、
 * 表示領域を明確にします。
 */
#generated_preview {
    min-height: 120px;
    background: #fff;
}

#generated_preview_html {
    width: 100%;
}

/**
 * 商品画像がプレビュー領域を超えて横にはみ出すのを防ぎます。
 * amazlet風-2側のカスタムCSSで上書き可能です。
 */
#generated_preview_html img {
    max-width: 100%;
    height: auto;
}

/**
 * コード欄の横スクロールを維持しながら、
 * スマートフォンでは高さを少し抑えます。
 */
@media screen and (max-width: 700px) {
    .kr-css-output {
        min-height: 420px;
        padding: 10px;
        font-size: 12px;
    }

    #custom_css_section .kr-form-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    #custom_css_section .kr-button {
        width: 100%;
    }

    #generated_preview {
        padding: 12px;
    }
}

@media screen and (max-width: 820px) {
    .kr-css-preset-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .kr-css-preset-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

/* ------------------------------------------------------------
   旧Cookie移行
------------------------------------------------------------ */

.kr-legacy-notice {
    margin-bottom: 20px;
    padding: 16px 18px;
    border: 1px solid #e0b84f;
    border-radius: 10px;
    background: #fff8df;
}

.kr-legacy-notice strong {
    display: block;
    margin-bottom: 6px;
    font-size: 16px;
}

.kr-legacy-notice p {
    margin: 0 0 12px;
}

.kr-legacy-manual-box {
    margin-top: 18px;
    padding: 14px 16px;
    border: 1px solid #e3e6ea;
    border-radius: 10px;
    background: #fafafa;
}

.kr-legacy-manual-box summary {
    cursor: pointer;
    font-weight: bold;
}

.kr-legacy-manual-box[open] summary {
    margin-bottom: 14px;
}

.kr-legacy-preview-area {
    margin-top: 20px;
    padding: 18px;
    border: 1px solid #ccd6e0;
    border-radius: 12px;
    background: #f8fbfd;
}

.kr-legacy-preview-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
    margin: 16px 0 20px;
}

.kr-legacy-preview-card {
    padding: 15px;
    border: 1px solid #dde3e8;
    border-radius: 10px;
    background: #fff;
}

.kr-legacy-preview-card h4 {
    margin: 0 0 12px;
    font-size: 15px;
}

.kr-legacy-preview-status {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 5px 12px;
    margin: 0;
    font-size: 13px;
}

.kr-legacy-preview-status dt,
.kr-legacy-preview-status dd {
    margin: 0;
}

.kr-legacy-preview-status dd {
    font-weight: bold;
}

.kr-legacy-preview-status .is-found {
    color: #1769aa;
}

.kr-legacy-preview-status .is-empty {
    color: #888;
}

/* ------------------------------------------------------------
   旧カエレバ移行エリア（置き換え専用UI）
------------------------------------------------------------ */

.kr-legacy-migration-section {
    border: 1px solid #dfe7ee;
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.kr-legacy-migration-heading {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 20px;
}

.kr-legacy-migration-heading h2 {
    margin-bottom: 4px;
}

.kr-legacy-migration-heading p {
    margin: 0;
    color: #66717d;
}

.kr-legacy-migration-icon {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: #eef5fb;
    font-size: 24px;
}

.kr-legacy-detect-box {
    padding: 18px;
    border: 1px solid #cfdde8;
    border-radius: 12px;
    background: #f7fbff;
}

.kr-legacy-detect-box > strong {
    display: block;
    margin-bottom: 6px;
    font-size: 16px;
}

.kr-legacy-detect-box > p {
    margin: 0 0 12px;
}

.kr-legacy-detect-message {
    min-height: 1.7em;
    color: #1769aa;
    font-weight: bold;
}

.kr-legacy-preview-heading h3 {
    margin-top: 0;
    margin-bottom: 4px;
}

.kr-legacy-warning-box {
    margin-top: 18px;
    padding: 15px 16px;
    border: 1px solid #e0b84f;
    border-radius: 10px;
    background: #fff8df;
}

.kr-legacy-warning-box strong {
    display: block;
    margin-bottom: 5px;
}

.kr-legacy-warning-box p {
    margin: 0;
}

.kr-legacy-backup-note {
    margin-top: 14px;
    padding: 11px 13px;
    border-radius: 8px;
    background: #eef7ef;
    color: #2f6338;
    font-size: 13px;
    font-weight: bold;
}

.kr-legacy-import-actions {
    margin-top: 16px;
}

.kr-legacy-result-message:not(:empty) {
    margin-top: 18px;
    padding: 14px 16px;
    border: 1px solid #9ccca5;
    border-radius: 10px;
    background: #eef8f0;
    color: #245d2f;
}

@media screen and (max-width: 700px) {
    .kr-legacy-migration-heading {
        gap: 10px;
    }

    .kr-legacy-migration-icon {
        width: 40px;
        height: 40px;
        font-size: 21px;
    }

    .kr-legacy-detect-box,
    .kr-legacy-preview-area {
        padding: 14px;
    }
}

/* ------------------------------------------------------------
   入力欄ヘルプ
------------------------------------------------------------ */
.kr-field-help {
    margin: 6px 0 0;
    font-size: 13px;
}

.kr-field-help a {
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ------------------------------------------------------------
   アフィリエイト設定ガイド
------------------------------------------------------------ */
.kr-guide-section {
    scroll-margin-top: 16px;
}

.kr-guide-hero {
    padding: 24px;
    border: 1px solid #dfe8f2;
    border-radius: 12px;
    background: linear-gradient(135deg, #f7fbff 0%, #fff 100%);
}

.kr-guide-hero h2 {
    margin-top: 4px;
}

.kr-guide-eyebrow {
    margin: 0;
    color: #1769aa;
    font-weight: bold;
}

.kr-guide-example-note {
    margin-bottom: 0;
    padding: 12px 14px;
    border-radius: 8px;
    background: #fff8e1;
    color: #5f4a00;
    font-size: 13px;
}

.kr-guide-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 18px 0 0;
}

.kr-guide-nav a {
    padding: 7px 12px;
    border: 1px solid #d8dce2;
    border-radius: 999px;
    background: #fff;
    font-size: 13px;
    font-weight: bold;
}

.kr-guide-block {
    margin-top: 24px;
    padding: 22px;
    border: 1px solid #e2e6eb;
    border-radius: 12px;
    background: #fff;
    scroll-margin-top: 16px;
}

.kr-guide-block h3,
.kr-guide-block h4 {
    margin-top: 0;
}

.kr-guide-lead {
    margin-bottom: 18px;
}

.kr-asp-ranking-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.kr-asp-ranking-card {
    position: relative;
    padding: 20px;
    border: 1px solid #dfe3e8;
    border-radius: 12px;
    background: #fafafa;
}

.kr-asp-ranking-card-primary {
    border-color: #f0bd42;
    background: #fffaf0;
}

.kr-rank-badge {
    display: inline-block;
    margin-bottom: 10px;
    padding: 3px 9px;
    border-radius: 999px;
    background: #1769aa;
    color: #fff;
    font-size: 12px;
    font-weight: bold;
}

.kr-asp-ranking-card-primary .kr-rank-badge {
    background: #c88700;
}

.kr-asp-ranking-card ul {
    padding-left: 20px;
}

.kr-guide-related-service {
    padding: 10px 12px;
    border-left: 4px solid #1769aa;
    background: #f5f9fd;
    font-size: 14px;
}

.kr-recommended-settings {
    margin-top: 18px;
    padding: 18px;
    border-radius: 10px;
    background: #f6f7f9;
}

.kr-recommended-settings-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.kr-recommended-settings-grid > div {
    padding: 12px;
    border-radius: 8px;
    background: #fff;
}

.kr-recommended-settings-grid strong,
.kr-recommended-settings-grid span {
    display: block;
}

.kr-recommended-settings-grid span {
    margin-top: 5px;
    color: #555;
    font-size: 13px;
}

.kr-guide-title-row {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 16px;
}

.kr-guide-title-row h3,
.kr-guide-title-row p {
    margin-bottom: 4px;
}

.kr-guide-number {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #1769aa;
    color: #fff;
    font-weight: bold;
}

.kr-guide-figure {
    margin: 18px 0 0;
}

.kr-guide-figure img,
.kr-guide-step img {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid #dfe3e8;
    border-radius: 8px;
    background: #fff;
}

.kr-guide-figure figcaption {
    margin-top: 8px;
    color: #666;
    font-size: 13px;
}

.kr-guide-steps {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 18px;
}

.kr-guide-steps-three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.kr-guide-step {
    padding: 16px;
    border: 1px solid #e2e6eb;
    border-radius: 10px;
    background: #fafafa;
}

.kr-guide-step > strong {
    display: inline-block;
    margin-bottom: 5px;
    color: #1769aa;
}

.kr-guide-step p {
    min-height: 3.4em;
    margin-top: 0;
}

.kr-guide-tip {
    margin-top: 16px;
    padding: 12px 14px;
    border-left: 4px solid #f0a000;
    border-radius: 4px;
    background: #fff8e1;
}

.kr-guide-back {
    margin: 18px 0 0;
    text-align: right;
    font-size: 13px;
}

.kr-footer {
    margin-top: 28px;
    padding: 26px 16px;
    border-top: 1px solid #d9dde3;
    color: #666;
    text-align: center;
    font-size: 13px;
}

.kr-footer p {
    margin: 7px 0;
}

.kr-footer-copyright {
    color: #444;
}

.kr-footer-disclaimer {
    max-width: 760px;
    margin-right: auto !important;
    margin-left: auto !important;
    line-height: 1.7;
}

@media screen and (max-width: 900px) {
    .kr-asp-ranking-grid,
    .kr-guide-steps-three {
        grid-template-columns: 1fr;
    }

    .kr-recommended-settings-grid {
        grid-template-columns: 1fr;
    }
}

@media screen and (max-width: 700px) {
    .kr-guide-hero,
    .kr-guide-block {
        padding: 16px;
    }

    .kr-guide-steps {
        grid-template-columns: 1fr;
    }

    .kr-guide-step p {
        min-height: 0;
    }

    .kr-guide-nav a {
        flex: 1 1 45%;
        text-align: center;
    }
}


/* Step1-2: スマートフォンではロゴが画面幅を超えないよう調整します。 */
@media screen and (max-width: 700px) {
    .kr-site-logo img {
        width: 230px;
    }
}

/* ------------------------------------------------------------
   Step1-3: コンパクトヘッダー・共通商品検索
------------------------------------------------------------ */

.kr-visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* ------------------------------------------------------------
   Ver1.5 Step4: お試しモード案内
------------------------------------------------------------ */

.kr-trial-notice {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin: 0 0 18px;
    padding: 16px 18px;
    border: 1px solid #cfe0f2;
    border-radius: 10px;
    background: #f5f9fd;
    color: #24374a;
}

.kr-trial-notice[hidden],
.kr-mode-affiliate .kr-trial-notice {
    display: none;
}

.kr-trial-notice-content {
    min-width: 0;
}

.kr-trial-notice-content strong {
    display: block;
    margin-bottom: 4px;
    color: #1769aa;
    font-size: 15px;
}

.kr-trial-notice-content p {
    margin: 0;
    line-height: 1.7;
}

.kr-trial-notice-button {
    flex: 0 0 auto;
    margin: 0;
    border-color: #b8cce0;
    background: #fff;
    white-space: nowrap;
}

.kr-trial-notice-button:hover {
    background: #eaf3fb;
}

.kr-onboarding-bubble {
    position: relative;
    padding: 15px 18px;
    border: 1px solid #d7e5d5;
    border-radius: 12px;
    background: #f5faf4;
    box-shadow: 0 5px 16px rgba(31, 54, 35, 0.08);
    color: #2d4630;
}

.kr-onboarding-bubble[hidden] {
    display: none;
}

.kr-onboarding-bubble::after {
    position: absolute;
    bottom: -7px;
    left: 42px;
    width: 12px;
    height: 12px;
    border-right: 1px solid #d7e5d5;
    border-bottom: 1px solid #d7e5d5;
    background: inherit;
    content: '';
    transform: rotate(45deg);
}

.kr-onboarding-bubble strong {
    display: block;
    margin-bottom: 4px;
    color: #267332;
    font-size: 16px;
}

.kr-onboarding-bubble p {
    margin: 0;
    line-height: 1.7;
}

.kr-header-search-area {
    flex: 1 1 auto;
    min-width: 0;
}

.kr-onboarding-bubble-search {
    margin: 0 0 13px;
}

.kr-onboarding-bubble-action {
    max-width: 420px;
    margin: 0 0 13px;
}

.kr-onboarding-bubble-trial {
    border-color: #cfe0f2;
    background: #f5f9fd;
    color: #24374a;
}

.kr-onboarding-bubble-trial::after {
    border-color: #cfe0f2;
}

.kr-onboarding-bubble-legacy {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin: 0 0 18px;
    border-color: #ead19a;
    background: #fff8e6;
    color: #5d4818;
}

.kr-onboarding-bubble-legacy::after {
    border-color: #ead19a;
}

.kr-onboarding-bubble-legacy strong {
    color: #9a6200;
}

.kr-legacy-onboarding-button {
    flex: 0 0 auto;
    border-color: #d8b35b;
    background: #fff;
    white-space: nowrap;
}

.kr-legacy-onboarding-button:hover {
    background: #fff1c9;
}

@media screen and (max-width: 700px) {
    .kr-trial-notice {
        align-items: stretch;
        flex-direction: column;
        gap: 12px;
        padding: 15px;
    }

    .kr-trial-notice-button {
        width: 100%;
        white-space: normal;
    }

    .kr-onboarding-bubble {
        padding: 14px 15px;
    }

    .kr-onboarding-bubble-legacy {
        align-items: stretch;
        flex-direction: column;
        gap: 12px;
    }

    .kr-legacy-onboarding-button {
        width: 100%;
        white-space: normal;
    }
}

.kr-header {
    display: flex;
    align-items: center;
    gap: 28px;
    margin-bottom: 18px;
    padding: 16px 20px;
}

.kr-header-brand {
    flex: 0 0 auto;
    margin: 0;
}

.kr-site-logo img {
    width: 245px;
}

.kr-header-copy {
    display: none;
}

.kr-header-search {
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    gap: 8px;
    min-width: 0;
    margin: 0;
}

.kr-header-search-keyword {
    flex: 1 1 auto;
    min-width: 160px;
}

.kr-header-search input[type="search"],
.kr-header-search-type {
    width: 100%;
    height: 46px;
    border: 1px solid #d8dce2;
    border-radius: 9px;
    background: #fff;
    color: #222;
    font: inherit;
}

.kr-header-search input[type="search"] {
    padding: 0 14px;
    font-size: 15px;
    -webkit-appearance: none;
    appearance: none;
}

.kr-header-search input[type="search"]::-webkit-search-cancel-button {
    cursor: pointer;
}

.kr-header-search-type {
    flex: 0 0 138px;
    padding: 0 34px 0 12px;
    font-size: 14px;
}

.kr-header-search input[type="search"]:focus,
.kr-header-search-type:focus {
    outline: none;
    border-color: #1769aa;
    box-shadow: 0 0 0 3px rgba(23, 105, 170, 0.15);
}

.kr-header-search-button {
    flex: 0 0 auto;
    min-width: 82px;
    min-height: 46px;
    border-radius: 9px;
}

@media screen and (max-width: 760px) {
    .kr-header {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
        padding: 16px;
    }

    .kr-header-brand {
        text-align: center;
    }

    .kr-site-logo img {
        width: 230px;
        margin: 0 auto;
    }

    .kr-header-search {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 8px;
    }

    .kr-header-search-keyword {
        grid-column: 1 / -1;
        min-width: 0;
    }

    .kr-header-search-type {
        width: 100%;
        min-width: 0;
    }

    .kr-header-search-button {
        min-width: 100px;
    }
}

@media screen and (max-width: 430px) {
    .kr-header-search {
        grid-template-columns: 1fr;
    }

    .kr-header-search-keyword {
        grid-column: auto;
    }

    .kr-header-search-button {
        width: 100%;
    }
}

/* ------------------------------------------------------------
   Step1-4：トップページ ヒーローエリア
------------------------------------------------------------ */

.kr-hero {
    position: relative;
    overflow: hidden;
    margin-bottom: 18px;
    padding: 34px 32px;
    border: 1px solid #eef0f3;
    border-radius: 14px;
    background:
        radial-gradient(circle at 92% 16%, rgba(255, 43, 135, 0.10), transparent 28%),
        linear-gradient(135deg, #ffffff 0%, #fbfcfd 100%);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.05);
    text-align: left;
}


.kr-hero-dismissed .kr-hero {
    display: none;
}

.kr-hero-reopen {
    display: none;
    width: 32px;
    height: 32px;
    margin: 0 0 12px auto;
    padding: 0;
    border: 1px solid rgba(45, 49, 56, 0.20);
    border-radius: 999px;
    background: rgba(45, 49, 56, 0.12);
    color: rgba(45, 49, 56, 0.62);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.kr-hero-dismissed .kr-hero-reopen {
    display: flex;
    align-items: center;
    justify-content: center;
}

.kr-hero-reopen:hover,
.kr-hero-reopen:focus-visible {
    background: rgba(45, 49, 56, 0.22);
    color: rgba(45, 49, 56, 0.90);
    transform: scale(1.05);
    outline: none;
}

.kr-hero-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: rgba(45, 49, 56, 0.48);
    color: #fff;
    font-size: 23px;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
}

.kr-hero-close:hover,
.kr-hero-close:focus-visible {
    background: rgba(45, 49, 56, 0.72);
    transform: scale(1.05);
    outline: none;
}

.kr-hero::after {
    content: "";
    position: absolute;
    top: 22px;
    right: 34px;
    width: 11px;
    height: 11px;
    border-radius: 999px;
    background: #ff2b87;
    box-shadow: 20px 7px 0 -2px #ff2b87;
    transform: rotate(-12deg);
    opacity: 0.9;
}

.kr-hero-inner {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(420px, 1.1fr);
    align-items: center;
    gap: 28px;
    max-width: 1180px;
    margin: 0 auto;
}

.kr-hero-copy {
    min-width: 0;
}

.kr-hero-visual {
    overflow: hidden;
    border-radius: 12px;
}

.kr-hero-visual img {
    display: block;
    width: 100%;
    height: auto;
    transform: scale(1.02);
}

.kr-hero-eyebrow {
    margin: 0 0 8px;
    color: #ff2b87;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.06em;
}

.kr-hero h1 {
    margin: 0;
    color: #17191d;
    font-size: clamp(27px, 3.2vw, 40px);
    line-height: 1.35;
    letter-spacing: -0.025em;
}

.kr-hero-description {
    margin: 14px 0 0;
    color: #62666d;
    font-size: 15px;
    line-height: 1.8;
}

.kr-hero-break-mobile {
    display: none;
}

.kr-hero-break-desktop {
    display: block;
}

@media screen and (min-width: 901px) {
    .kr-hero h1 {
        word-break: keep-all;
        overflow-wrap: normal;
    }
}

@media screen and (max-width: 900px) {
    .kr-hero-break-desktop {
        display: none;
    }

    .kr-hero-inner {
        grid-template-columns: 1fr;
        gap: 22px;
    }

    .kr-hero-copy {
        text-align: center;
    }

    .kr-hero-description {
        margin-right: auto;
        margin-left: auto;
    }

    .kr-hero-visual {
        width: min(100%, 680px);
        margin: 0 auto;
    }
}

@media screen and (max-width: 700px) {
    .kr-hero {
        padding: 30px 20px;
    }

    .kr-hero::after {
        top: 18px;
        right: 22px;
    }

    .kr-hero-eyebrow {
        font-size: 13px;
    }

    .kr-hero h1 {
        font-size: clamp(25px, 7.5vw, 34px);
    }

    .kr-hero-description {
        font-size: 14px;
    }

    .kr-hero-visual {
        margin-right: -10px;
        margin-left: -10px;
        border-radius: 10px;
    }
}

@media screen and (max-width: 430px) {
    .kr-hero {
        padding: 27px 16px 25px;
    }

    .kr-hero-break-mobile {
        display: block;
    }
}

/* ============================================================
   Ver1.4 Step4: リンク生成画面の表示設定
============================================================ */
.kr-generate-display-settings {
    margin: 24px 0;
    padding: 18px;
    border: 1px solid #e2e6ea;
    border-radius: 8px;
    background: #fafbfc;
}

.kr-generate-display-settings h3 {
    margin-top: 0;
}

#instant_preview_message {
    min-height: 1.5em;
    margin-bottom: 0;
}

/* ------------------------------------------------------------
   Ver1.4 Step4-1：リンク生成画面のコンパクト化
------------------------------------------------------------ */

.kr-generate-product-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 14px 16px;
    align-items: start;
}

.kr-generate-product-grid .kr-form-row {
    min-width: 0;
    margin-bottom: 0;
}

.kr-generate-settings-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    align-items: start;
}

.kr-generate-settings-grid .kr-form-row {
    min-width: 0;
    margin-bottom: 0;
}

.kr-generate-settings-grid select,
.kr-generate-settings-grid .kr-image-size-options {
    width: 100%;
    min-width: 0;
}

.kr-generate-settings-grid .kr-image-size-options {
    flex-wrap: nowrap;
    justify-content: flex-start;
}

@media screen and (max-width: 1000px) {
    .kr-generate-settings-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media screen and (max-width: 700px) {
    .kr-generate-product-grid,
    .kr-generate-settings-grid {
        grid-template-columns: 1fr;
    }
}


/* ------------------------------------------------------------
   Ver1.4 Step4-2：生成中の共通表示設定を上部へ一本化
------------------------------------------------------------ */

.kr-settings-basic-grid-generate-view {
    grid-template-columns: minmax(240px, 420px);
}

.kr-shared-settings-note {
    margin-top: -4px;
    margin-bottom: 18px;
}

.kr-generate-product-grid .kr-form-row > label {
    min-height: 1.5em;
}

@media screen and (max-width: 700px) {
    .kr-settings-basic-grid-generate-view {
        grid-template-columns: 1fr;
    }
}


/* ------------------------------------------------------------
   Ver1.4 Step4-3：サイト設定とリンクパーツ設定の分離
------------------------------------------------------------ */
.kr-generate-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
    gap: 20px;
    align-items: start;
}

.kr-generate-workspace .kr-section {
    margin-top: 0;
}

.kr-generate-preview-panel {
    position: sticky;
    top: 16px;
    grid-column: 2;
    grid-row: 1;
}

.kr-generate-editor-panel {
    grid-column: 1;
    grid-row: 1;
}

.kr-generate-settings-grid-with-site {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.kr-settings-basic-grid-affiliate-only {
    grid-template-columns: minmax(260px, 520px);
}

@media screen and (max-width: 1120px) {
    .kr-generate-workspace {
        grid-template-columns: 1fr;
    }

    .kr-generate-preview-panel,
    .kr-generate-editor-panel {
        position: static;
        grid-column: 1;
    }

    .kr-generate-preview-panel {
        grid-row: 1;
    }

    .kr-generate-editor-panel {
        grid-row: 2;
    }

    .kr-generate-settings-grid-with-site {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media screen and (max-width: 700px) {
    .kr-generate-settings-grid-with-site {
        grid-template-columns: 1fr;
    }
}

/* ------------------------------------------------------------
   Ver1.4 Step4-4：プレビュー優先の1カラム化・クリックヘルプ
------------------------------------------------------------ */
.kr-generate-workspace {
    display: block;
}

.kr-generate-preview-panel,
.kr-generate-editor-panel {
    position: static;
    width: 100%;
    margin-top: 0;
}

.kr-generate-editor-panel {
    margin-top: 20px;
}

.kr-label-with-help,
.kr-heading-with-help {
    position: relative;
    display: flex;
    align-items: center;
    gap: 7px;
    width: fit-content;
    max-width: 100%;
}

.kr-heading-with-help {
    margin-bottom: 14px;
}

.kr-heading-with-help h3 {
    margin: 0;
}

.kr-help-button {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 1px solid #b8c2cc;
    border-radius: 50%;
    background: #fff;
    color: #52606d;
    font-size: 13px;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
}

.kr-help-button:hover,
.kr-help-button:focus-visible,
.kr-help-button[aria-expanded="true"] {
    border-color: #1769aa;
    background: #eef7ff;
    color: #1769aa;
    outline: none;
}

.kr-help-popover {
    position: absolute;
    z-index: 30;
    top: calc(100% + 8px);
    left: 0;
    width: min(360px, calc(100vw - 48px));
    padding: 11px 13px;
    border: 1px solid #cbd5df;
    border-radius: 9px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(35, 48, 60, 0.16);
    color: #46515c;
    font-size: 13px;
    font-weight: normal;
    line-height: 1.65;
}

.kr-help-popover::before,
.kr-help-popover::after {
    position: absolute;
    left: 12px;
    width: 0;
    height: 0;
    border-style: solid;
    content: "";
}

.kr-help-popover::before {
    top: -8px;
    border-width: 0 8px 8px;
    border-color: transparent transparent #cbd5df;
}

.kr-help-popover::after {
    top: -7px;
    border-width: 0 8px 8px;
    border-color: transparent transparent #fff;
}

.kr-help-popover[hidden] {
    display: none;
}

@media screen and (max-width: 700px) {
    .kr-generate-editor-panel {
        margin-top: 14px;
    }

    .kr-help-popover {
        width: min(320px, calc(100vw - 36px));
    }
}


/* Ver1.4 Step4-8: 表示設定内CSSプリセット */
.kr-css-preset-options-compact {
    min-height: 46px;
    padding: 9px 10px;
    border: 1px solid #d9dee5;
    border-radius: 10px;
    background: #fff;
}

.kr-css-preset-options-compact {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 18px;
}

.kr-form-row .kr-css-preset-options-compact .kr-radio {
    display: inline-flex;
    width: auto;
    margin: 0;
    white-space: nowrap;
}

@media screen and (max-width: 700px) {
    .kr-hero-close {
        top: 9px;
        right: 9px;
        width: 30px;
        height: 30px;
    }
}

/* ------------------------------------------------------------
   Ver1.4 Step4-10：上部CSSプリセットを確実に横並び化
------------------------------------------------------------ */
.kr-form-row .kr-css-preset-options.kr-css-preset-options-compact {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: 8px 20px;
}

.kr-form-row .kr-css-preset-options.kr-css-preset-options-compact > label.kr-radio {
    display: inline-flex !important;
    flex: 0 0 auto;
    width: auto !important;
    margin: 0 !important;
    white-space: nowrap;
}

.kr-form-row .kr-css-preset-options.kr-css-preset-options-compact > label.kr-radio input[type="radio"] {
    flex: 0 0 auto;
    width: auto;
}

/* ------------------------------------------------------------
   Ver1.4 Step4-11：上部CSSプリセットの外枠内へ収める
------------------------------------------------------------- */
.kr-generate-settings-grid .kr-generate-css-preset-row {
    grid-column: span 2;
}

.kr-form-row .kr-css-preset-options.kr-css-preset-options-compact {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    gap: 8px 16px;
}

.kr-form-row .kr-css-preset-options.kr-css-preset-options-compact > label.kr-radio {
    min-width: 0;
}

@media screen and (max-width: 700px) {
    .kr-generate-settings-grid .kr-generate-css-preset-row {
        grid-column: auto;
    }

    .kr-form-row .kr-css-preset-options.kr-css-preset-options-compact {
        flex-wrap: wrap;
    }
}
.kr-bookmarklet-import-notice,
.kr-bookmarklet-error {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
    padding: 18px 20px;
    border: 1px solid #c9d9ef;
    border-left: 5px solid #356fb3;
    border-radius: 12px;
    background: #f5f9ff;
}

.kr-bookmarklet-import-notice h2,
.kr-bookmarklet-error h2 {
    margin: 2px 0 6px;
    font-size: 1.15rem;
}

.kr-bookmarklet-import-notice p,
.kr-bookmarklet-error p {
    margin: 0;
}

.kr-bookmarklet-eyebrow {
    color: #315f95;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}

@media (max-width: 700px) {
    .kr-bookmarklet-import-notice,
    .kr-bookmarklet-error {
        align-items: stretch;
        flex-direction: column;
        gap: 12px;
        padding: 16px;
    }
}

/* ============================================================
   Ver1.7 Step6：ブックマークレット登録案内
============================================================ */

.kr-bookmarklet-guide {
    display: grid;
    gap: 20px;
}

.kr-hero-bookmarklet-link {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 14px;
    padding: 8px 13px;
    border: 1px solid #b9d0e9;
    border-radius: 999px;
    background: #eef6ff;
    color: #285f9f;
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
}

.kr-hero-bookmarklet-link:hover,
.kr-hero-bookmarklet-link:focus-visible {
    background: #dfeeff;
    color: #204f84;
}

/* Ver.1.1 Step20: 表示設定・利用ガイド */
.kr-display-settings { margin: 20px 0; padding: 18px; border: 1px solid #dfe5eb; border-radius: 12px; background: #fafbfc; }
.kr-display-settings legend { padding: 0 8px; font-weight: 700; font-size: 18px; }
.kr-display-primary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 22px; margin-bottom: 20px; }
.kr-display-primary-grid .kr-form-row { margin: 0; }
.kr-display-primary-grid label { margin-bottom: 9px; font-size: 17px; font-weight: 700; }
.kr-display-primary-grid input[type="text"] { width: 100%; min-height: 58px; padding: 14px 16px; border: 1px solid #cbd3dc; border-radius: 12px; background: #fff; box-sizing: border-box; font-size: 18px; line-height: 1.45; }
.kr-display-primary-grid input[type="text"]:focus { border-color: #4c8dc7; outline: 3px solid rgba(76,141,199,.16); }
.kr-display-settings-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 18px; }
.kr-preview-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin: 22px 0 18px; }
.kr-preview-heading h3 { margin: 0; font-size: 26px; }
.kr-preview-heading p { margin: 8px 0 0; padding-top: 8px; border-top: 1px solid #e0e5ea; color: #69737f; }
.kr-preview-switch { display: inline-flex; flex-shrink: 0; gap: 0; padding: 4px; border: 1px solid #ccd5df; border-radius: 999px; background: #f1f3f6; }
.kr-preview-switch-button { min-width: 112px; padding: 11px 20px; border: 0; border-radius: 999px; background: transparent; color: #59636e; font: inherit; font-weight: 700; cursor: pointer; }
.kr-preview-switch-button.is-active { background: #176faf; color: #fff; box-shadow: 0 2px 7px rgba(23,79,126,.28); }
.kr-device-previews { margin-bottom: 20px; }
.kr-device-preview { min-width: 0; box-sizing: border-box; }
.kr-device-preview-pc { min-height: 380px; padding: 36px 28px; border: 1px dashed #bcc8d5; border-radius: 12px; background: #fff; }
.kr-device-preview .kr-preview-wrap { min-height: 260px; margin: 0; padding: 24px; border: 1px solid #d9dee4; border-radius: 10px; background: #fff; box-sizing: border-box; }
.kr-device-preview[hidden] { display: none; }
.kr-device-preview-mobile { min-height: 720px; padding: 32px 20px; border-radius: 12px; background: #e8edf3; }
.kr-mobile-frame-shell { width: 428px; max-width: 100%; margin: 0 auto; padding: 18px; border: 1px dashed #bcc8d5; background: #fff; box-sizing: border-box; box-shadow: 0 7px 22px rgba(44,61,82,.14); }
#generated_mobile_preview { display: block; width: 390px; max-width: 100%; height: 650px; border: 1px solid #d9dee4; border-radius: 8px; background: #fff; }
.kr-inline-options { display: flex; flex-wrap: wrap; gap: 12px; min-height: 44px; align-items: center; }
.kr-inline-options label { margin: 0; }
.kr-guide-section { scroll-margin-top: 20px; }
.kr-guide-hero { padding: 20px; border-radius: 12px; background: linear-gradient(135deg, #fff7fb, #f5fbff); }
.kr-guide-eyebrow, .kr-manual-eyebrow { color: #ff2b87; font-weight: 700; }
.kr-guide-nav { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0; }
.kr-guide-nav a { padding: 8px 14px; border: 1px solid #dfe5eb; border-radius: 999px; text-decoration: none; }
.kr-guide-block { margin-top: 24px; padding-top: 12px; scroll-margin-top: 20px; }
.kr-guide-steps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.kr-guide-steps-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kr-guide-step, .kr-guide-figure { padding: 12px; border: 1px solid #e5e9ed; border-radius: 10px; background: #fff; }
.kr-guide-step img, .kr-guide-figure img { display: block; width: 100%; height: auto; }
.kr-manual { max-width: 960px; margin: 0 auto; }
.kr-manual-hero, .kr-manual-toc, .kr-manual-section { margin-bottom: 20px; padding: 24px; border: 1px solid #e5e9ed; border-radius: 14px; background: #fff; }
.kr-manual-toc li { margin: 7px 0; }
@media (max-width: 760px) {
    .kr-display-primary-grid, .kr-display-settings-grid, .kr-guide-steps, .kr-guide-steps-three { grid-template-columns: 1fr; }
    .kr-preview-heading { align-items: stretch; flex-direction: column; }
    .kr-preview-switch { align-self: flex-end; }
    .kr-device-preview-pc { padding: 18px 12px; }
    .kr-device-preview .kr-preview-wrap { padding: 14px; }
}

.kr-hero-bookmarklet-badge {
    padding: 2px 7px;
    border-radius: 999px;
    background: #356fb3;
    color: #fff;
    font-size: 0.72rem;
    line-height: 1.5;
}

.kr-bookmarklet-guide-hero,
.kr-bookmarklet-register,
.kr-bookmarklet-steps,
.kr-bookmarklet-targets,
.kr-bookmarklet-troubleshooting,
.kr-bookmarklet-mobile-note,
.kr-bookmarklet-privacy {
    padding: 24px;
    border: 1px solid #dde4ed;
    border-radius: 14px;
    background: #fff;
}

.kr-bookmarklet-guide-hero {
    background: linear-gradient(135deg, #f5f9ff, #fff);
}

.kr-bookmarklet-guide h1,
.kr-bookmarklet-guide h2 {
    margin-top: 0;
}

.kr-bookmarklet-register {
    text-align: center;
    border-color: #b7cce5;
    background: #f7fbff;
}

.kr-bookmarklet-drag-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    margin: 12px auto 4px;
    padding: 10px 24px;
    border: 2px solid #285f9f;
    border-radius: 999px;
    background: #356fb3;
    box-shadow: 0 5px 14px rgba(41, 91, 151, 0.2);
    color: #fff;
    font-weight: 700;
    text-decoration: none;
    cursor: grab;
}

.kr-bookmarklet-drag-figure {
    width: min(100%, 720px);
    margin: 1.25rem auto;
}

.kr-bookmarklet-drag-figure img {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid #d9e0e7;
    border-radius: 12px;
    background: #fff;
}

.kr-bookmarklet-drag-figure figcaption {
    margin-top: 0.55rem;
    color: #59636e;
    font-size: 0.9rem;
    line-height: 1.6;
    text-align: center;
}

.kr-bookmarklet-drag-link:hover,
.kr-bookmarklet-drag-link:focus-visible {
    background: #285f9f;
    color: #fff;
}

.kr-bookmarklet-drag-link:active {
    cursor: grabbing;
}

.kr-bookmarklet-code {
    width: 100%;
    margin: 8px 0 12px;
    padding: 12px;
    border: 1px solid #bac4d0;
    border-radius: 8px;
    background: #f7f8fa;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 0.78rem;
    line-height: 1.5;
    resize: vertical;
}

.kr-bookmarklet-mobile-note {
    border-left: 5px solid #a36a12;
    background: #fffaf1;
}

.kr-bookmarklet-privacy {
    border-left: 5px solid #45865b;
    background: #f5fbf7;
}

@media screen and (max-width: 700px) {
    .kr-bookmarklet-guide-hero,
    .kr-bookmarklet-register,
    .kr-bookmarklet-steps,
    .kr-bookmarklet-targets,
    .kr-bookmarklet-troubleshooting,
    .kr-bookmarklet-mobile-note,
    .kr-bookmarklet-privacy {
        padding: 18px 16px;
    }

    .kr-bookmarklet-drag-link {
        width: 100%;
    }

    .kr-hero-bookmarklet-link {
        justify-content: center;
        width: 100%;
        border-radius: 10px;
        text-align: center;
    }
}

.kr-jalan-status {
    margin: 18px 0;
    padding: 13px 15px;
    border: 1px solid #cbd5df;
    border-left: 5px solid #64748b;
    border-radius: 8px;
    background: #f8fafc;
}
.kr-jalan-status-matched,
.kr-jalan-status-manual_match { border-left-color: #238636; background: #f2fbf4; }
.kr-jalan-status-possible { border-left-color: #b7791f; background: #fffaf0; }
.kr-jalan-status-api_error,
.kr-jalan-status-not_found { border-left-color: #b42318; background: #fff7f6; }
.kr-jalan-candidates { margin: 22px 0; padding: 18px; border: 1px solid #e1e5e9; border-radius: 10px; }
.kr-jalan-candidate-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 16px 0; }
.kr-jalan-candidate { padding: 16px; border: 1px solid #d8dee5; border-radius: 9px; background: #fff; }
.kr-jalan-candidate h4 { margin: 0 0 8px; }
.kr-jalan-candidate p { margin: 6px 0; }
.kr-jalan-score { font-weight: 700; }
.kr-jalan-signals { color: #237a36; }
.kr-jalan-warning { color: #b42318; font-weight: 700; }
.kr-footer-jalan-credit a { color: inherit; }

/* ------------------------------------------------------------
   Step32：カエレバシリーズナビゲーション
------------------------------------------------------------ */

.kr-related-services-desktop {
    position: fixed;
    z-index: 20;
    top: 180px;
    right: 0;
}

.kr-related-services-desktop .kr-related-services-links {
    display: grid;
    gap: 10px;
}

.kr-related-services-desktop .kr-related-service-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    min-height: 96px;
    padding: 10px 8px;
    border: 1px solid rgba(70, 78, 86, 0.12);
    border-right: 0;
    border-radius: 14px 0 0 14px;
    box-shadow: 0 5px 14px rgba(0, 0, 0, 0.08);
    color: #5b6066;
    font-size: 15px;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: 0.08em;
    text-decoration: none;
    writing-mode: vertical-rl;
}

.kr-related-services-desktop .kr-related-service-kaereba {
    background: #f7eaf2;
}

.kr-related-services-desktop .kr-related-service-yomereba {
    background: #ebf1f7;
}

.kr-related-services-desktop .kr-related-service-tabereba {
    background: #f4ece9;
}

.kr-related-services-desktop .kr-related-service-link:hover,
.kr-related-services-desktop .kr-related-service-link:focus-visible {
    color: #363b40;
    text-decoration: none;
    transform: translateX(-3px);
}

.kr-related-services-desktop .kr-related-service-link:focus-visible,
.kr-related-services-mobile .kr-related-service-link:focus-visible {
    outline: 3px solid rgba(23, 105, 170, 0.35);
    outline-offset: 2px;
}

.kr-related-services-mobile {
    display: none;
}

@media screen and (max-width: 760px) {
    .kr-related-services-desktop {
        display: none;
    }

    .kr-related-services-mobile {
        display: block;
        margin: 0 auto 24px;
    }

    .kr-related-services-label {
        display: block;
        margin-bottom: 8px;
        color: #666;
        font-weight: bold;
    }

    .kr-related-services-mobile .kr-related-services-links {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
        max-width: 520px;
        margin: 0 auto;
    }

    .kr-related-services-mobile .kr-related-service-link {
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 42px;
        padding: 8px 6px;
        border: 1px solid #d8dce2;
        border-radius: 999px;
        background: #fff;
        color: #5b6066;
        font-weight: bold;
        text-decoration: none;
    }
}
@media (max-width: 640px) {
    .tomarebalink-image { float: none; width: 100%; max-width: 320px; margin: 0 auto 14px; }
    .kr-jalan-candidate-list { grid-template-columns: 1fr; }
}
