* {
    box-sizing: border-box;
}

:root {
    --header-height: 104px;
    --page-bg: #fff7f9;
    --panel-bg: #ffffff;
    --border: #f0d7df;
    --text: #2f1720;
    --muted: #7c5b66;
    --primary: #9F1239;
    --primary-hover: #881337;
    --danger: #be123c;
}

html {
    margin: 0;
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
    color: var(--text);
    background: var(--page-bg);
}

main {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

button,
input {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

.global-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-height);
    background: rgba(255,255,255,0.92);
    backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--border);
}

.global-header__inner {
    width: min(1500px, 100%);
    height: 100%;
    margin: 0 auto;
    padding: 8px 24px;
    display: flex;
    align-items: center;
    gap: 30px;
}

.brand {
    display: inline-flex;
    align-items: center;
    align-self: stretch;
    gap: 0;
    color: #3b1020;
    text-decoration: none;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.04em;
    white-space: nowrap;
}

.global-nav {
    min-width: 0;
    height: 100%;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0;
}

.global-nav__row {
    width: 100%;
    min-height: 44px;
    display: flex;
    align-items: stretch;
    gap: 4px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
}

.global-nav__row::-webkit-scrollbar {
    display: none;
}

.global-nav__item {
    position: relative;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 15px;
    color: #5a2334;
    text-decoration: none;
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
}

.global-nav__item:hover {
    color: var(--primary);
}

.global-nav__item--disabled {
    gap: 6px;
    color: #a58b94;
    cursor: default;
    user-select: none;
}

.global-nav__item--disabled:hover {
    color: #a58b94;
}

.global-nav__status {
    display: inline-flex;
    align-items: center;
    min-height: 18px;
    padding: 1px 6px;
    border: 1px solid #efc9d3;
    border-radius: 999px;
    background: #fff1f2;
    color: #9f1239;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
}

.global-nav__item.is-active {
    color: var(--primary);
}

.global-nav__item.is-active::after {
    content: "";
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 0;
    height: 3px;
    border-radius: 3px 3px 0 0;
    background: var(--primary);
}

.global-footer {
    border-top: 1px solid var(--border);
    background: #ffffff;
    color: var(--muted);
    font-size: 12px;
}

.global-footer__inner {
    width: min(1500px, 100%);
    margin: 0 auto;
    padding: 18px 24px;
}

.primary-button,
.secondary-button {
    border: 0;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
    transition: 0.15s ease;
}

.primary-button {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(159, 18, 57, 0.18);
}

.primary-button:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.primary-button:disabled {
    opacity: 0.48;
    cursor: not-allowed;
    box-shadow: none;
}

.primary-button--large {
    min-width: 290px;
    padding: 19px 36px;
    font-size: 18px;
}

.secondary-button {
    padding: 10px 16px;
    background: #fff7f9;
    color: var(--primary);
    border: 1px solid #f2b5c5;
}

.secondary-button:hover:not(:disabled) {
    background: #ffe4ea;
}

.secondary-button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.is-hidden {
    display: none !important;
}

.simple-message-page {
    min-height: calc(100vh - var(--header-height) - 54px);
    padding: 80px 24px;
    display: grid;
    place-items: start center;
}

.simple-message-card {
    width: min(620px, 100%);
    padding: 48px;
    text-align: center;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 18px 38px rgba(159, 18, 57, 0.08);
}

.simple-message-card h1 {
    margin: 0 0 16px;
}

.simple-message-card p {
    color: var(--muted);
    line-height: 1.8;
}

.simple-message-card a {
    color: var(--primary);
}

@media (max-width: 820px) {
    :root {
        --header-height: 142px;
    }

    .global-header__inner {
        padding: 7px 14px 5px;
        align-items: flex-start;
        flex-direction: column;
        gap: 2px;
    }

    .brand {
        align-self: auto;
        height: 38px;
        font-size: 21px;
    }

    .global-nav {
        width: 100%;
        height: 90px;
        flex: 0 0 90px;
    }

    .global-nav__row {
        min-height: 44px;
    }

    .global-nav__item {
        min-height: 44px;
        padding: 0 13px;
        font-size: 13px;
    }
}

/* ========================================================
   SEO / Site information contents
======================================================== */
.tool-guide,
.content-page {
    width: 100%;
    flex: 0 0 auto;
}

.tool-guide {
    padding: 72px 24px 80px;
    background: #ffffff;
    border-top: 1px solid var(--border);
}

.tool-guide__inner {
    width: min(1040px, 100%);
    margin: 0 auto;
}

.tool-guide__lead {
    margin-bottom: 38px;
}

.tool-guide__lead h2 {
    margin: 0 0 14px;
    font-size: clamp(24px, 3vw, 32px);
    color: #3b1020;
}

.tool-guide__lead p,
.tool-guide__section p,
.tool-guide__section li {
    color: #604a52;
    line-height: 1.9;
}

.tool-guide__grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin: 28px 0 38px;
}

.tool-guide__card {
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fffafb;
}

.tool-guide__card strong {
    display: block;
    margin-bottom: 8px;
    color: #3b1020;
    font-size: 16px;
}

.tool-guide__card p {
    margin: 0;
    color: #745d65;
    line-height: 1.75;
    font-size: 14px;
}

.tool-guide__section {
    margin-top: 34px;
}

.tool-guide__section h3 {
    margin: 0 0 12px;
    font-size: 20px;
    color: #3b1020;
}

.tool-guide__steps {
    margin: 0;
    padding-left: 1.5em;
}

.related-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.related-tools a {
    display: inline-flex;
    align-items: center;
    min-height: 42px;
    padding: 9px 14px;
    border: 1px solid #efc9d3;
    border-radius: 10px;
    background: #fff7f9;
    color: var(--primary);
    text-decoration: none;
    font-weight: 700;
    font-size: 14px;
}

.related-tools a:hover {
    background: #ffe8ee;
}

.content-page {
    padding: 64px 24px 88px;
}

.content-page__header,
.content-page__body {
    width: min(960px, 100%);
    margin-left: auto;
    margin-right: auto;
}

.content-page__header {
    margin-bottom: 32px;
    text-align: center;
}

.content-page__eyebrow {
    margin: 0 0 8px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.content-page__header h1 {
    margin: 0 0 12px;
    font-size: clamp(30px, 4vw, 42px);
    color: #3b1020;
}

.content-page__header > p:last-child {
    margin: 0;
    color: var(--muted);
    line-height: 1.8;
}

.content-page__body {
    padding: 36px 42px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 16px 36px rgba(159, 18, 57, 0.06);
}

.content-page__body--narrow {
    max-width: 760px;
}

.content-block + .content-block {
    margin-top: 38px;
    padding-top: 34px;
    border-top: 1px solid #f2e1e6;
}

.content-block h2 {
    margin: 0 0 14px;
    font-size: 22px;
    color: #3b1020;
}

.content-block h3 {
    margin: 24px 0 10px;
    font-size: 17px;
    color: #4b2432;
}

.content-block p,
.content-block li {
    color: #5f4a52;
    line-height: 1.9;
}

.content-block p {
    margin: 0 0 12px;
}

.content-block p:last-child {
    margin-bottom: 0;
}

.content-block ul {
    margin: 0;
    padding-left: 1.5em;
}

.content-block a,
.content-page a {
    color: var(--primary);
}

.info-card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.info-card {
    min-height: 120px;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fffafb;
    color: inherit !important;
    text-decoration: none;
    transition: 0.15s ease;
}

.info-card:hover {
    border-color: #dca9b8;
    box-shadow: 0 8px 20px rgba(159, 18, 57, 0.08);
    transform: translateY(-1px);
}

.info-card strong {
    display: block;
    margin-bottom: 7px;
    color: var(--primary);
}

.info-card span {
    color: #6e5860;
    line-height: 1.7;
    font-size: 14px;
}

.contact-form {
    display: grid;
    gap: 22px;
}

.contact-form__honeypot {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    white-space: nowrap !important;
}

.form-field {
    display: grid;
    gap: 8px;
}

.form-field > span {
    font-weight: 700;
    color: #3b1020;
}

.form-field > span strong {
    margin-left: 6px;
    color: var(--primary);
    font-size: 12px;
}

.form-field > span small {
    margin-left: 6px;
    color: #8d737c;
    font-weight: 500;
}

.form-field input,
.form-field select,
.form-field textarea {
    width: 100%;
    border: 1px solid #d9b5c0;
    border-radius: 9px;
    background: #fff;
    color: var(--text);
    outline: none;
}

.form-field input,
.form-field select {
    height: 46px;
    padding: 0 12px;
}

.form-field textarea {
    min-height: 180px;
    padding: 12px;
    resize: vertical;
    font: inherit;
    line-height: 1.7;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(159, 18, 57, 0.12);
}

.form-field__note {
    color: #806a72;
    line-height: 1.6;
}

.form-check {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    color: #5f4a52;
    line-height: 1.6;
}

.form-check input {
    width: 18px;
    height: 18px;
    margin-top: 3px;
    accent-color: var(--primary);
}

.contact-form__submit {
    min-height: 52px;
    padding: 14px 24px;
    font-size: 16px;
}

.form-message {
    margin-bottom: 24px;
    padding: 15px 17px;
    border-radius: 10px;
    line-height: 1.7;
}

.form-message ul {
    margin: 8px 0 0;
    padding-left: 1.5em;
}

.form-message--success {
    border: 1px solid #b8dcc6;
    background: #f1fbf5;
    color: #245c38;
}

.form-message--error {
    border: 1px solid #efc9d3;
    background: #fff1f2;
    color: #8f1636;
}

.contact-page__note {
    margin: 24px 0 0;
    color: #806a72;
    font-size: 13px;
    line-height: 1.7;
}

/* ========================================================
   Footer
======================================================== */
.global-footer {
    font-size: 13px;
}

.global-footer__inner {
    padding-top: 34px;
    padding-bottom: 20px;
}

.global-footer__main {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(420px, 1.4fr);
    gap: 48px;
    padding-bottom: 28px;
}

.global-footer__brand > a {
    color: #3b1020;
    text-decoration: none;
    font-size: 21px;
    font-weight: 800;
    letter-spacing: -0.04em;
}

.global-footer__brand p {
    margin: 9px 0 0;
    color: var(--muted);
    line-height: 1.7;
}

.global-footer__nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 28px;
}

.global-footer__group {
    display: grid;
    align-content: start;
    gap: 9px;
}

.global-footer__group strong {
    margin-bottom: 2px;
    color: #3b1020;
    font-size: 13px;
}

.global-footer__group a {
    width: fit-content;
    color: var(--muted);
    text-decoration: none;
}

.global-footer__group a:hover {
    color: var(--primary);
    text-decoration: underline;
}

.global-footer__bottom {
    padding-top: 18px;
    border-top: 1px solid var(--border);
    color: #927984;
    font-size: 12px;
}

@media (max-width: 820px) {
    .tool-guide {
        padding: 52px 18px 60px;
    }

    .tool-guide__grid {
        grid-template-columns: 1fr;
    }

    .content-page {
        padding: 46px 16px 64px;
    }

    .content-page__body {
        padding: 26px 20px;
        border-radius: 14px;
    }

    .info-card-grid {
        grid-template-columns: 1fr;
    }

    .global-footer__main {
        grid-template-columns: 1fr;
        gap: 28px;
    }

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

@media (max-width: 520px) {
    .global-footer__nav {
        grid-template-columns: 1fr;
    }
}

/* ========================================================
   Processing result / error message (shared by all tools)
   ======================================================== */
.process-message {
    margin: -4px 0 15px;
    padding: 13px 15px;
    border: 1px solid #efb3c2;
    border-radius: 8px;
    background: #fff5f7;
    color: var(--danger);
    font-size: 13px;
    line-height: 1.65;
    white-space: pre-line;
}

.process-message.is-success {
    border-color: #9fd4cb;
    background: #f2fbf9;
    color: #0f766e;
}


/* ========================================================
   Shared toolbar button consistency
   2026-08: all public image tools
   ======================================================== */

/*
 * 各ツールの「すべて解除」「画像を追加」など、
 * workspace toolbar に並ぶ操作ボタンの高さ・文字サイズ・余白を統一する。
 * ツール固有CSSが common.css より後に読み込まれるため、
 * レイアウトに関わる値のみ !important で最終統一する。
 */
.workspace-toolbar__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.workspace-toolbar__actions > button {
    box-sizing: border-box !important;
    height: 42px !important;
    min-height: 42px !important;
    padding: 0 16px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 10px !important;
    font: inherit !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    white-space: nowrap;
    vertical-align: middle;
}

/*
 * clear-all-button は一部の新規ツールで固有CSSが未定義だったため、
 * 全画面で同じワインレッド系アウトラインボタンに統一する。
 */
.clear-all-button {
    box-sizing: border-box !important;
    min-height: 42px !important;
    padding: 0 16px !important;
    border: 1px solid #e6a9bc !important;
    border-radius: 10px !important;
    background: #ffffff !important;
    color: #9f1239 !important;
    font: inherit !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer;
    transition:
        background-color 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease,
        opacity 0.15s ease;
}

.clear-all-button:hover:not(:disabled) {
    border-color: #c94b72 !important;
    background: #fff4f7 !important;
    color: #861331 !important;
}

.clear-all-button:focus-visible,
.workspace-toolbar__actions > .secondary-button:focus-visible {
    outline: 3px solid rgba(159, 18, 57, 0.16) !important;
    outline-offset: 2px;
}

.clear-all-button:disabled,
.workspace-toolbar__actions > .secondary-button:disabled {
    opacity: 0.45 !important;
    cursor: not-allowed !important;
}

/* 画像レイアウトのレイヤー操作は2列を同じ幅で揃える。 */
.layer-button-row {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
}

.layer-button-row > button {
    width: 100% !important;
    height: 42px !important;
    min-height: 42px !important;
    padding: 0 14px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
    line-height: 1 !important;
}

/* 「削除」は解除系ではなく破壊操作なので塗りボタンにする。 */
#deleteLayerButton {
    border-color: #9f1239 !important;
    background: #9f1239 !important;
    color: #ffffff !important;
}

#deleteLayerButton:hover:not(:disabled) {
    border-color: #881337 !important;
    background: #881337 !important;
    color: #ffffff !important;
}

@media (max-width: 640px) {
    .workspace-toolbar__actions > button {
        height: 42px !important;
        min-height: 42px !important;
    }
}

/* ========================================================
   Language menu
======================================================== */
.global-header__inner {
    position: relative;
}

.language-menu {
    position: relative;
    flex: 0 0 auto;
}

.language-menu__trigger {
    min-width: 118px;
    height: 38px;
    padding: 0 10px 0 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid #e7cdd5;
    border-radius: 10px;
    background: #ffffff;
    color: #5a2334;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(78, 22, 41, 0.04);
    transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}

.language-menu__trigger:hover,
.language-menu.is-open .language-menu__trigger {
    border-color: #d89aaa;
    background: #fffafb;
    color: var(--primary);
}

.language-menu__trigger:focus-visible {
    outline: 3px solid rgba(159, 18, 57, 0.14);
    outline-offset: 2px;
}

.language-menu__globe {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.language-menu__chevron {
    width: 15px;
    height: 15px;
    margin-left: 1px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform .15s ease;
}

.language-menu.is-open .language-menu__chevron {
    transform: rotate(180deg);
}

.language-menu__dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 120;
    width: 180px;
    max-height: min(70vh, 320px);
    overflow-y: auto;
    padding: 6px;
    border: 1px solid #ead5dc;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 14px 34px rgba(67, 19, 35, 0.14);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    pointer-events: none;
    transition: opacity .14s ease, transform .14s ease, visibility .14s ease;
}

.language-menu.is-open .language-menu__dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.language-menu__option {
    min-height: 42px;
    padding: 0 9px;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) 18px;
    align-items: center;
    gap: 7px;
    border-radius: 8px;
    color: #54313d;
    text-decoration: none;
    font-size: 13px;
}

.language-menu__option:hover {
    background: #fff1f4;
    color: var(--primary);
}

.language-menu__option.is-active {
    background: #fff6f8;
    color: var(--primary);
    font-weight: 700;
}

.language-menu__code {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 31px;
    height: 24px;
    border: 1px solid #ead5dc;
    border-radius: 6px;
    background: #ffffff;
    color: #8d5365;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .04em;
}

.language-menu__label {
    white-space: nowrap;
}

.language-menu__check {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: var(--primary);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

@media (max-width: 820px) {
    .language-menu {
        position: absolute;
        top: 7px;
        right: 14px;
    }

    .language-menu__trigger {
        min-width: 110px;
        height: 36px;
    }

    .language-menu__dropdown {
        top: calc(100% + 6px);
    }
}
