/**
 * ap00.net 共通スタイル（Tailwind で表現できない最小限のみ）
 */

/*
 * スマホの誤ズーム抑止
 * - touch-action: manipulation … ダブルタップズームを無効化（ピンチズームは可）
 * - 入力欄 16px 以上 … iOS のフォーカス時自動ズームを防ぐ
 */
button,
a,
summary,
label,
[type="button"],
[type="submit"],
[type="reset"],
[role="button"] {
    touch-action: manipulation;
}

input,
select,
textarea {
    touch-action: manipulation;
}

@media (max-width: 1023px) {
    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="hidden"]):not([type="image"]):not([type="button"]):not([type="submit"]):not([type="reset"]),
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* サイドバー z-index（TailAdmin 相当） */
.z-999 {
    z-index: 999;
}

.z-9998 {
    z-index: 9998;
}

.z-9999 {
    z-index: 9999;
}

/* フォームヘルパーのラッパー余白調整 */
.input {
    margin-bottom: 0;
}

.input input {
    margin-bottom: 0;
}

/* 投稿パネル */
.upload-panel {
    overflow: hidden;
    border: 1px solid #e2e8f0;
    border-radius: 1.5rem;
    background:
        radial-gradient(120% 80% at 100% 0%, rgba(60, 80, 224, 0.12), transparent 55%),
        radial-gradient(90% 70% at 0% 100%, rgba(14, 165, 233, 0.08), transparent 50%),
        #ffffff;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
    padding: 1.5rem;
}

@media (min-width: 768px) {
    .upload-panel {
        padding: 2rem 2.25rem;
    }
}

.upload-panel__eyebrow {
    margin: 0;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #3c50e0;
}

.upload-panel__title {
    margin: 0.5rem 0 0;
    font-size: clamp(1.6rem, 3vw, 2rem);
    font-weight: 800;
    line-height: 1.25;
    color: #0f172a;
}

.upload-panel__lead {
    margin: 0.75rem 0 0;
    max-width: 36rem;
    font-size: 0.9375rem;
    line-height: 1.7;
    color: #64748b;
}

.upload-panel__storage {
    margin: 0.85rem 0 0;
    display: inline-flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.35rem 0.5rem;
    border-radius: 9999px;
    background: rgba(15, 23, 42, 0.06);
    color: #334155;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.4;
    padding: 0.4rem 0.85rem;
}

.upload-panel__storage strong {
    color: #0f172a;
    font-size: 0.9375rem;
    font-weight: 800;
}

.upload-panel__storage-count {
    color: #64748b;
    font-weight: 500;
}

.upload-panel__admin-link {
    margin-top: 0.75rem;
}

.upload-panel__admin-link-anchor {
    display: inline-flex;
    align-items: center;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #3c50e0;
    text-decoration: none;
}

.upload-panel__admin-link-anchor:hover,
.upload-panel__admin-link-anchor:focus-visible {
    color: #2a3eb1;
    text-decoration: underline;
}

.upload-panel__sparse-tags {
    margin-top: 0.85rem;
}

.upload-panel__sparse-tags-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 2.5rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.625rem;
    background: #ffffff;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #334155;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
    transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.upload-panel__sparse-tags-btn:hover,
.upload-panel__sparse-tags-btn:focus-visible {
    border-color: #3c50e0;
    background: #f8fafc;
    color: #3c50e0;
}

.upload-panel__sparse-tags-badge {
    display: inline-flex;
    min-width: 1.375rem;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    background: #eef2ff;
    padding: 0.1rem 0.45rem;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.3;
    color: #3c50e0;
}

.upload-panel__form {
    display: grid;
    gap: 1.25rem;
    margin-top: 1.75rem;
}

.upload-field__label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #334155;
}

.upload-field__optional,
.upload-field__required {
    display: inline-flex;
    align-items: center;
    border-radius: 9999px;
    padding: 0.1rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 700;
    line-height: 1.4;
}

.upload-field__optional {
    background: #f1f5f9;
    color: #64748b;
}

.upload-field__required {
    background: #fee2e2;
    color: #b91c1c;
}

.upload-field__input {
    width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 0.9rem;
    background: rgba(255, 255, 255, 0.9);
    padding: 0.9rem 1rem;
    font-size: 1rem;
    color: #0f172a;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.upload-field__input:focus {
    border-color: #3c50e0;
    box-shadow: 0 0 0 4px rgba(60, 80, 224, 0.15);
}

/* iOS Safari の日付・時刻入力は既定の最小幅が広く、枠からはみ出すため打ち消す */
.upload-field__input[type="date"],
.upload-field__input[type="time"],
.date-input-fit,
.time-input-fit {
    -webkit-appearance: none;
    appearance: none;
    min-width: 0;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
}

.upload-field__input[type="date"] {
    height: 3.25rem;
}

/* 時刻入力: appearance:none でも数字が見えるようにする */
.upload-field__input[type="time"],
.time-input-fit {
    display: flex;
    align-items: center;
    min-height: 2.75rem;
    color: #111827;
    line-height: 1.25;
}

.upload-field__input[type="time"]::-webkit-datetime-edit,
.upload-field__input[type="time"]::-webkit-datetime-edit-fields-wrapper,
.time-input-fit::-webkit-datetime-edit,
.time-input-fit::-webkit-datetime-edit-fields-wrapper {
    display: inline-flex;
    align-items: center;
    color: inherit;
    padding: 0;
}

.upload-field__input[type="time"]::-webkit-calendar-picker-indicator,
.time-input-fit::-webkit-calendar-picker-indicator {
    opacity: 1;
    cursor: pointer;
}

/* ダイエット: 体重・血圧一覧の編集行 */
.diet-record-row {
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.15s ease;
}

.diet-record-row:focus,
.diet-record-row:focus-visible {
    outline: none;
}

@media (hover: hover) {
    .diet-record-row:hover {
        background-color: rgba(249, 250, 251, 0.8);
    }
}

.diet-note-cell {
    white-space: pre-wrap;
    word-break: break-word;
}

textarea.upload-field__input {
    min-height: 6rem;
    line-height: 1.6;
    resize: vertical;
}

.upload-field__hint {
    margin: 0.5rem 0 0;
    font-size: 0.75rem;
    line-height: 1.6;
    color: #94a3b8;
}

.upload-field__status {
    margin: 0.5rem 0 0;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #3c50e0;
}

.upload-field__error {
    margin: 0.5rem 0 0;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #dc2626;
}

.upload-dropzone {
    position: relative;
    display: block;
    min-height: 12rem;
    border: 1.5px dashed #cbd5e1;
    border-radius: 1.15rem;
    background: rgba(248, 250, 252, 0.9);
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
    -webkit-tap-highlight-color: rgba(60, 80, 224, 0.18);
    touch-action: manipulation;
}

.upload-dropzone:hover,
.upload-dropzone:focus-within,
.upload-dropzone.is-dragover {
    border-color: #3c50e0;
    background: #eef2ff;
    box-shadow: 0 0 0 4px rgba(60, 80, 224, 0.12);
}

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

.upload-dropzone__placeholder {
    display: flex;
    min-height: 12rem;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    padding: 1.5rem 1rem;
    text-align: center;
}

.upload-dropzone__icon {
    display: inline-flex;
    height: 3.25rem;
    width: 3.25rem;
    align-items: center;
    justify-content: center;
    border-radius: 1rem;
    background: #ffffff;
    color: #3c50e0;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.upload-dropzone__icon svg {
    width: 1.5rem;
    height: 1.5rem;
}

.upload-dropzone__main {
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
}

.upload-dropzone__sub {
    font-size: 0.8125rem;
    line-height: 1.6;
    color: #64748b;
}

.upload-dropzone__preview {
    display: flex;
    min-height: 12rem;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    padding: 1rem;
    text-align: center;
}

.upload-dropzone__preview[hidden] {
    display: none !important;
}

.upload-dropzone__preview-img {
    max-width: 100%;
    max-height: 11rem;
    border-radius: 0.85rem;
    object-fit: contain;
    background: #0f172a;
}

.upload-dropzone__preview-video {
    max-width: 100%;
    max-height: 11rem;
    border-radius: 0.85rem;
    object-fit: contain;
    background: #0f172a;
}

.upload-dropzone__preview-video[hidden] {
    display: none !important;
}

.upload-dropzone__preview-name {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #334155;
}

.upload-dropzone__change {
    font-size: 0.75rem;
    font-weight: 700;
    color: #3c50e0;
}

.upload-panel__actions {
    display: grid;
    gap: 0.75rem;
}

.upload-panel__submit {
    display: inline-flex;
    min-height: 3.25rem;
    width: 100%;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    border: 0;
    border-radius: 9999px;
    background: linear-gradient(135deg, #3c50e0 0%, #2563eb 100%);
    color: #ffffff;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 14px 28px rgba(60, 80, 224, 0.28);
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.upload-panel__submit svg {
    width: 1.1rem;
    height: 1.1rem;
}

.upload-panel__submit:hover:not(:disabled),
.upload-panel__submit:focus-visible:not(:disabled) {
    filter: brightness(1.05);
    box-shadow: 0 16px 32px rgba(60, 80, 224, 0.34);
}

.upload-panel__submit:active:not(:disabled) {
    transform: translateY(1px);
}

/* AIタグ取得中・HEIC変換中・投稿中は押せないことが見た目で分かるようにする */
.upload-panel__submit:disabled {
    background: linear-gradient(135deg, #aab2cd 0%, #9aa3bd 100%);
    box-shadow: none;
    cursor: not-allowed;
    opacity: 0.65;
    filter: none;
    transform: none;
}

@media (min-width: 640px) {
    .upload-panel__submit {
        width: auto;
        min-width: 12rem;
        justify-self: start;
        padding: 0 1.75rem;
    }
}

/* AIタグ再取得ボタンを投稿ボタンの左隣に並べる */
.upload-panel__buttons {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.upload-panel__buttons .upload-panel__submit {
    width: auto;
    flex: 1 1 12rem;
    min-width: 12rem;
    padding: 0 1.75rem;
}

.upload-panel__buttons .upload-panel__ai-btn {
    flex: 0 0 auto;
    min-height: 3.25rem;
    border-radius: 9999px;
    padding: 0 1.25rem;
    font-size: 0.875rem;
}

.upload-panel__similar-btn {
    border-color: #c7d2fe;
    background: #eef2ff;
    color: #3730a3;
}

.upload-panel__similar-btn:hover:not(:disabled),
.upload-panel__similar-btn:focus-visible:not(:disabled) {
    background: #e0e7ff;
}

.upload-panel__similar-btn:disabled {
    opacity: 0.55;
}

/* AI動作中の文言はボタンの上に置く */
.upload-panel__actions .upload-panel__ai-status {
    margin-top: 0;
}

@media (max-width: 639px) {
    /* 横に並びきらないときは折り返して全幅にする */
    .upload-panel__buttons .upload-panel__ai-btn {
        flex: 1 1 auto;
    }
}

/* 投稿中の進行バー */
.upload-progress {
    display: grid;
    gap: 0.4rem;
}

.upload-progress[hidden] {
    display: none;
}

.upload-progress__track {
    position: relative;
    height: 0.5rem;
    width: 100%;
    overflow: hidden;
    border-radius: 9999px;
    background: #e2e8f0;
}

.upload-progress__fill {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 9999px;
    background: linear-gradient(135deg, #3c50e0 0%, #2563eb 100%);
    transition: width 0.2s ease;
}

/* 送信完了後のサーバー処理待ちは進み具合が取れないため点滅で待機を示す */
.upload-progress.is-processing .upload-progress__fill {
    animation: upload-progress-pulse 1.2s ease-in-out infinite;
}

@keyframes upload-progress-pulse {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.upload-progress__text {
    font-size: 0.75rem;
    color: #64748b;
}

.upload-progress__text.is-error {
    color: #b91c1c;
}

/* 画像投稿: モーダル拡大表示（元サイズ以内・画面内に収める） */
.image-lightbox-trigger {
    -webkit-tap-highlight-color: rgba(60, 80, 224, 0.25);
    touch-action: manipulation;
    cursor: zoom-in;
    text-decoration: none;
    color: inherit;
}

.image-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    box-sizing: border-box;
}

.image-modal[hidden] {
    display: none !important;
}

.image-modal.is-open {
    animation: image-modal-fade-in 0.18s ease-out;
}

.image-modal__backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    padding: 0;
    margin: 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    cursor: pointer;
    background: rgba(15, 23, 42, 0.65);
}

.image-modal__dialog {
    position: relative;
    z-index: 1;
    display: flex;
    width: min(72rem, calc(100vw - 2rem));
    height: min(46rem, calc(100vh - 2rem));
    height: min(46rem, calc(100dvh - 2rem));
    max-width: calc(100vw - 2rem);
    max-height: calc(100vh - 2rem);
    max-height: calc(100dvh - 2rem);
    flex-direction: column;
    overflow: hidden;
    border-radius: 1rem;
    background: #ffffff;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.45);
    animation: image-modal-pop-in 0.2s ease-out;
    touch-action: auto;
}

.image-modal__close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 2;
    display: inline-flex;
    height: 2.5rem;
    width: 2.5rem;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 9999px;
    background: rgba(15, 23, 42, 0.72);
    color: #ffffff;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.image-modal__close:hover,
.image-modal__close:focus-visible {
    background: rgba(15, 23, 42, 0.9);
}

.image-modal__body {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 0;
    width: 100%;
    max-width: 100%;
    flex: 1 1 auto;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 0;
    background: #0f172a;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}

.image-modal__img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transform-origin: center center;
    will-change: transform;
    -webkit-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: auto;
    vertical-align: top;
}

.image-modal__video {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    background: #000000;
    transform-origin: center center;
    will-change: transform;
    -webkit-user-select: none;
    user-select: none;
}

.image-modal__details {
    flex: 0 0 auto;
    max-height: 14rem;
    overflow-y: auto;
    padding: 1.25rem;
    padding-right: 3.75rem;
    background: #ffffff;
    color: #0f172a;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
}

.image-modal__details-title {
    margin: 0 0 1rem;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.5;
}

.image-modal__details-list {
    margin: 0;
}

.image-modal__details-row {
    display: grid;
    grid-template-columns: 4.25rem minmax(0, 1fr);
    gap: 0.75rem;
    padding: 0.7rem 0;
    border-top: 1px solid #e2e8f0;
    font-size: 0.8125rem;
    line-height: 1.5;
}

.image-modal__details-row dt {
    color: #64748b;
    font-weight: 600;
}

.image-modal__details-row dd {
    min-width: 0;
    margin: 0;
    color: #0f172a;
    overflow-wrap: anywhere;
}

.image-modal__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.image-modal__location-link {
    color: #3c50e0;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 0.15em;
}

.image-modal__location-link:hover,
.image-modal__location-link:focus-visible {
    color: #2a3bb8;
    outline: none;
}

.image-modal__location-empty {
    color: #94a3b8;
}

.image-modal__fullscreen {
    position: absolute;
    right: 0.75rem;
    bottom: 0.75rem;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border: 0;
    border-radius: 9999px;
    background: rgba(15, 23, 42, 0.72);
    color: #ffffff;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.image-modal__fullscreen:hover,
.image-modal__fullscreen:focus-visible {
    background: rgba(15, 23, 42, 0.9);
    outline: none;
}

.image-modal__fullscreen-icon {
    width: 1.25rem;
    height: 1.25rem;
    display: block;
}

.image-modal.is-zoomed .image-modal__fullscreen {
    display: none;
}

/* iPhone 等: Fullscreen API の代替（画面端まで黒背景で広げる） */
.image-modal.is-immersive,
.image-modal:fullscreen,
.image-modal:-webkit-full-screen {
    padding: 0 !important;
    align-items: stretch;
    justify-content: stretch;
    background: #000000;
}

.image-modal.is-immersive .image-modal__backdrop,
.image-modal:fullscreen .image-modal__backdrop,
.image-modal:-webkit-full-screen .image-modal__backdrop {
    background: #000000;
}

.image-modal.is-immersive .image-modal__dialog,
.image-modal:fullscreen .image-modal__dialog,
.image-modal:-webkit-full-screen .image-modal__dialog {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    flex-direction: column !important;
    border-radius: 0;
    background: #000000;
    box-shadow: none;
}

.image-modal.is-immersive .image-modal__details,
.image-modal:fullscreen .image-modal__details,
.image-modal:-webkit-full-screen .image-modal__details {
    display: none !important;
}

.image-modal.is-immersive .image-modal__body,
.image-modal:fullscreen .image-modal__body,
.image-modal:-webkit-full-screen .image-modal__body {
    flex: 1 1 auto !important;
    width: 100%;
    height: 100%;
    max-height: none;
    background: #000000;
}

.image-modal.is-immersive .image-modal__img,
.image-modal.is-immersive .image-modal__video,
.image-modal:fullscreen .image-modal__img,
.image-modal:fullscreen .image-modal__video,
.image-modal:-webkit-full-screen .image-modal__img,
.image-modal:-webkit-full-screen .image-modal__video {
    max-width: 100vw;
    max-height: 100vh;
    max-height: 100dvh;
}

body.image-lightbox-immersive {
    overflow: hidden;
}

.image-modal__tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.25rem;
    border: 0;
    border-radius: 9999px;
    padding: 0.25rem 0.65rem;
    background: rgba(60, 80, 224, 0.1);
    color: #3c50e0;
    font: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

a.image-modal__tag,
button.image-modal__tag {
    transition: background-color 0.2s ease, color 0.2s ease;
}

a.image-modal__tag:hover,
a.image-modal__tag:focus-visible,
button.image-modal__tag:hover,
button.image-modal__tag:focus-visible {
    background: #3c50e0;
    color: #fff;
    outline: none;
}

a.image-modal__tag:focus-visible,
button.image-modal__tag:focus-visible {
    box-shadow: 0 0 0 3px rgba(60, 80, 224, 0.25);
}

.image-modal__tags-empty {
    color: #94a3b8;
}

/* コントロール表示時も中央の大きな再生／一時停止オーバーレイは出さない */
.image-modal__video::-webkit-media-controls-overlay-play-button {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
    width: 0 !important;
    height: 0 !important;
}

.image-modal__video::-webkit-media-controls-start-playback-button {
    display: none !important;
    -webkit-appearance: none;
    opacity: 0 !important;
    pointer-events: none !important;
}

.image-modal.is-video:not(.is-zoomed) .image-modal__video {
    cursor: pointer;
}

.image-modal__video[hidden],
.image-modal__img[hidden] {
    display: none !important;
}

.image-modal.is-zoomed .image-modal__img,
.image-modal.is-zoomed .image-modal__video {
    cursor: grab;
}

.image-modal.is-zoomed.is-panning .image-modal__img,
.image-modal.is-zoomed.is-panning .image-modal__video {
    cursor: grabbing;
}

.image-modal__body,
.image-modal__img,
.image-modal__video {
    -ms-touch-action: none;
}

/* 投稿カード: 動画再生アイコン */
.image-card__play,
.image-gallery__play {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 2;
    display: inline-flex;
    height: 2.75rem;
    width: 2.75rem;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    background: rgba(15, 23, 42, 0.72);
    color: #ffffff;
    pointer-events: none;
    transform: translate(-50%, -50%);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.35);
}

.image-card__play svg,
.image-gallery__play svg {
    width: 1.15rem;
    height: 1.15rem;
    margin-left: 0.1rem;
}

/* サムネ左下: 再生時間・縦横 */
.media-meta {
    position: absolute;
    left: 0.5rem;
    bottom: 0.5rem;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    max-width: calc(100% - 3.5rem);
    pointer-events: none;
}

.media-meta__duration,
.media-meta__dims {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    border-radius: 0.35rem;
    background: rgba(15, 23, 42, 0.72);
    color: #ffffff;
    font-size: 0.6875rem;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0.02em;
    padding: 0.2rem 0.4rem;
}

.media-meta__duration[hidden],
.media-meta__dims[hidden] {
    display: none !important;
}

.image-gallery__item .media-meta {
    left: 0.35rem;
    bottom: 0.35rem;
    max-width: calc(100% - 0.7rem);
}

.image-gallery__item .media-meta__duration,
.image-gallery__item .media-meta__dims {
    font-size: 0.625rem;
    padding: 0.15rem 0.3rem;
}

/* Google 画像検索リンク */
.google-image-search {
    position: absolute;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    background: rgba(15, 23, 42, 0.72);
    color: #ffffff;
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.25);
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    border: 0;
    padding: 0;
    cursor: pointer;
}

.google-image-search svg {
    display: block;
}

.google-image-search:hover,
.google-image-search:focus-visible {
    background: rgba(60, 80, 224, 0.92);
    color: #ffffff;
}

.google-image-search--yandex:hover,
.google-image-search--yandex:focus-visible {
    background: rgba(226, 37, 27, 0.92);
    color: #ffffff;
}

.google-image-search[aria-busy="true"] {
    cursor: wait;
    opacity: 0.65;
}

.google-image-search--card {
    top: 0.65rem;
    right: 0.65rem;
    height: 2.25rem;
    width: 2.25rem;
}

.google-image-search--card svg {
    width: 1rem;
    height: 1rem;
}

.google-image-search--card.google-image-search--yandex {
    top: 50%;
    right: 0.65rem;
    transform: translateY(-50%);
}

.google-image-search--gallery {
    top: 0.35rem;
    right: 0.35rem;
    height: 2rem;
    width: 2rem;
}

.google-image-search--gallery svg {
    width: 0.95rem;
    height: 0.95rem;
}

.google-image-search--gallery.google-image-search--yandex {
    top: 50%;
    right: 0.35rem;
    transform: translateY(-50%);
}

.image-gallery__cell {
    position: relative;
}

.image-gallery__group-count {
    position: absolute;
    right: 0.5rem;
    bottom: 0.5rem;
    z-index: 4;
    display: inline-flex;
    min-width: 2rem;
    height: 1.75rem;
    align-items: center;
    justify-content: center;
    padding: 0 0.45rem;
    border-radius: 9999px;
    background: rgba(15, 23, 42, 0.78);
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    pointer-events: none;
}

/* 投稿カード: まとめ選択・バッジ */
.image-card__group-select {
    position: absolute;
    left: 0.65rem;
    top: 0.65rem;
    z-index: 6;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    margin: 0;
    border-radius: 0.4rem;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.18);
    cursor: pointer;
}

.image-card__group-checkbox {
    width: 1.1rem;
    height: 1.1rem;
    margin: 0;
    accent-color: #2563eb;
    cursor: pointer;
}

.image-card__group-checkbox:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.image-card__group-badge {
    position: absolute;
    left: 0.65rem;
    top: 0.65rem;
    z-index: 4;
    display: inline-flex;
    align-items: center;
    max-width: calc(100% - 4rem);
    padding: 0.2rem 0.5rem;
    border-radius: 9999px;
    background: rgba(37, 99, 235, 0.92);
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}

.js-image-list-card.is-group-mode .image-card__group-badge {
    top: 2.6rem;
}

.js-group-gallery-item.is-group-selected .image-gallery__item::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 3;
    box-shadow: inset 0 0 0 3px #2563eb;
    background: rgba(37, 99, 235, 0.18);
    pointer-events: none;
}

.image-gallery__group-actions {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.65rem;
    margin: 0;
    padding: 0.45rem 0.5rem 0.5rem;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0) 0%, rgba(15, 23, 42, 0.78) 55%);
}

.image-gallery__group-actions .image-card__group-action {
    color: #ffffff;
    text-decoration: none;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.image-gallery__group-actions .image-card__group-action:hover,
.image-gallery__group-actions .image-card__group-action:focus-visible {
    color: #bfdbfe;
    text-decoration: underline;
}

.image-gallery--groups .image-gallery__head-actions {
    align-items: center;
}

.image-card__group-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
    margin-top: 0.4rem;
}

.image-card__group-action {
    display: inline-flex;
    padding: 0;
    border: 0;
    background: transparent;
    color: #2563eb;
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
}

.image-card__group-action:hover,
.image-card__group-action:focus-visible {
    color: #1d4ed8;
}

.image-group-mode-toggle {
    display: inline-flex;
    min-height: 2.25rem;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.85rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.55rem;
    background: #ffffff;
    color: #0f172a;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.image-group-mode-toggle:hover,
.image-group-mode-toggle:focus-visible {
    border-color: #94a3b8;
    background: #f8fafc;
}

.image-group-mode-toggle.is-active {
    border-color: #2563eb;
    background: #eff6ff;
    color: #1d4ed8;
}

.image-group-bar {
    position: fixed;
    left: 50%;
    bottom: 1rem;
    z-index: 60;
    display: flex;
    width: min(36rem, calc(100% - 1.5rem));
    transform: translateX(-50%);
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.9rem;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
}

.image-group-bar__count {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 700;
    color: #0f172a;
}

.image-group-bar__hint {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: #64748b;
}

.image-group-bar__actions {
    display: flex;
    gap: 0.5rem;
}

.image-group-bar__cancel,
.image-group-bar__create {
    display: inline-flex;
    min-height: 2.25rem;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.85rem;
    border-radius: 0.55rem;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
}

.image-group-bar__cancel {
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #334155;
}

.image-group-bar__create {
    border: 0;
    background: #2563eb;
    color: #ffffff;
}

.image-group-bar__create:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.js-image-list-card.is-group-selected {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.js-image-list-card.is-grouped.is-group-mode {
    opacity: 0.72;
}

.image-modal__nav {
    position: absolute;
    top: 50%;
    z-index: 8;
    display: inline-flex;
    width: 2.75rem;
    height: 2.75rem;
    transform: translateY(-50%);
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 9999px;
    background: rgba(15, 23, 42, 0.55);
    color: #ffffff;
    cursor: pointer;
    pointer-events: auto;
}

.image-modal__nav svg {
    width: 1.35rem;
    height: 1.35rem;
}

.image-modal__nav--prev {
    left: 0.75rem;
}

.image-modal__nav--next {
    right: 0.75rem;
}

.image-modal__nav:hover,
.image-modal__nav:focus-visible {
    background: rgba(15, 23, 42, 0.78);
}

.image-modal__counter {
    position: absolute;
    top: 0.85rem;
    left: 50%;
    z-index: 8;
    transform: translateX(-50%);
    margin: 0;
    padding: 0.25rem 0.65rem;
    border-radius: 9999px;
    background: rgba(15, 23, 42, 0.6);
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 700;
    pointer-events: none;
}

.image-modal.is-zoomed .image-modal__nav,
.image-modal.is-zoomed .image-modal__counter {
    opacity: 0.35;
}

.image-modal.is-immersive .image-modal__nav,
.image-modal:fullscreen .image-modal__nav,
.image-modal:-webkit-full-screen .image-modal__nav,
.image-modal.is-immersive .image-modal__counter,
.image-modal:fullscreen .image-modal__counter,
.image-modal:-webkit-full-screen .image-modal__counter {
    opacity: 0.85;
}

/* 投稿カード: ゴミ箱（画像右下） */
.image-card__trash {
    position: absolute;
    right: 0.65rem;
    bottom: 0.65rem;
    z-index: 5;
    display: inline-flex;
    height: 2.25rem;
    width: 2.25rem;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 9999px;
    background: rgba(15, 23, 42, 0.72);
    color: #ffffff;
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.25);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.image-card__trash svg {
    width: 1rem;
    height: 1rem;
}

.image-card__trash:hover,
.image-card__trash:focus-visible {
    background: rgba(185, 28, 28, 0.92);
}

.image-list-more {
    display: inline-flex;
    min-height: 2.75rem;
    align-items: center;
    justify-content: center;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    background: #ffffff;
    padding: 0.625rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #1f2937;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.image-list-more-wrap {
    display: flex;
    justify-content: center;
    margin-top: 1.5rem;
}

.image-list-more-wrap[hidden] {
    display: none !important;
}

.image-list-more:hover,
.image-list-more:focus-visible {
    border-color: #3c50e0;
    color: #3c50e0;
}

.image-list-more:disabled,
.image-list-more.is-loading {
    cursor: wait;
    opacity: 0.7;
}

.ai-tag-suggest__btn {
    display: inline-flex;
    min-height: 2.5rem;
    align-items: center;
    justify-content: center;
    border: 1px solid #c7d2fe;
    border-radius: 0.75rem;
    background: #eef2ff;
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #3730a3;
    cursor: pointer;
    transition: background-color 0.15s ease, opacity 0.15s ease;
}

.ai-tag-suggest__btn:hover:not(:disabled),
.ai-tag-suggest__btn:focus-visible:not(:disabled) {
    background: #e0e7ff;
}

.ai-tag-suggest__btn:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.ai-tag-suggest__status {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: #64748b;
}

.ai-tag-suggest__status.is-error {
    color: #b91c1c;
}

.ai-tag-suggest__usage {
    margin-top: 0.5rem;
    padding: 0;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    background: #f8fafc;
    overflow: hidden;
}

.ai-tag-suggest__usage-toggle {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    border: 0;
    background: transparent;
    padding: 0.625rem 0.75rem;
    text-align: left;
    cursor: pointer;
}

.ai-tag-suggest__usage-toggle:hover,
.ai-tag-suggest__usage-toggle:focus-visible {
    background: #f1f5f9;
}

.ai-tag-suggest__usage-summary {
    flex: 1 1 auto;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.5;
    color: #334155;
}

.ai-tag-suggest__usage-arrow {
    flex: 0 0 auto;
    font-size: 0.625rem;
    line-height: 1;
    color: #94a3b8;
    transition: transform 0.15s ease;
}

.ai-tag-suggest__usage-toggle[aria-expanded="true"] .ai-tag-suggest__usage-arrow {
    transform: rotate(180deg);
}

.ai-tag-suggest__usage-details {
    border-top: 1px solid #e2e8f0;
    padding: 0.5rem 0.75rem 0.625rem;
}

.ai-tag-suggest__usage-line {
    margin: 0;
    font-size: 0.75rem;
    line-height: 1.5;
    color: #475569;
}

.ai-tag-suggest__usage-line + .ai-tag-suggest__usage-line {
    margin-top: 0.15rem;
}

.ai-tag-suggest__usage-note {
    color: #94a3b8;
}

.ai-tag-suggest__usage-link {
    display: inline-block;
    margin-top: 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #3c50e0;
    text-decoration: underline;
}

.ai-tag-suggest__usage-link:hover,
.ai-tag-suggest__usage-link:focus-visible {
    color: #1e3a8a;
}

.ai-tag-suggest__hint {
    margin: 0.75rem 0 0.5rem;
    font-size: 0.75rem;
    color: #64748b;
}

.ai-tag-suggest__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.ai-tag-suggest__chip {
    display: inline-flex;
    align-items: center;
    border: 1px solid #e2e8f0;
    border-radius: 9999px;
    background: #ffffff;
    padding: 0.35rem 0.75rem;
    font-size: 0.8125rem;
    color: #1f2937;
    cursor: pointer;
}

.ai-tag-suggest__chip:hover,
.ai-tag-suggest__chip:focus-visible {
    border-color: #3c50e0;
    color: #3c50e0;
}

.ai-tag-suggest__chip.is-added {
    border-color: #86efac;
    background: #f0fdf4;
    color: #166534;
}

/* 一覧カードの後付け AI タグ（アイコン） */
.tag-panel__head {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.tag-panel__head .tag-panel__view {
    flex: 1 1 auto;
    min-width: 0;
}

.card-ai-tag__btn {
    display: inline-flex;
    height: 2.25rem;
    width: 2.25rem;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border: 1px solid #c7d2fe;
    border-radius: 9999px;
    background: #eef2ff;
    color: #3730a3;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease, transform 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.card-ai-tag__btn svg {
    width: 1.05rem;
    height: 1.05rem;
}

.card-ai-tag__btn:hover:not(:disabled),
.card-ai-tag__btn:focus-visible:not(:disabled) {
    border-color: #a5b4fc;
    background: #e0e7ff;
    transform: translateY(-1px);
}

.card-ai-tag__btn:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    transform: none;
}

.card-ai-tag__status {
    margin: 0.45rem 0 0;
    font-size: 0.75rem;
    color: #64748b;
}

.card-ai-tag__status.is-error {
    color: #b91c1c;
}

/* タグチップ入力 */
.tag-input__box {
    display: flex;
    min-height: 3rem;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    background: #ffffff;
    padding: 0.5rem 0.5rem 0.5rem 0.75rem;
    cursor: text;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tag-input__box:focus-within {
    border-color: #3c50e0;
    box-shadow: 0 0 0 3px rgba(60, 80, 224, 0.2);
}

.tag-input__list {
    display: contents;
}

.tag-input__chip {
    display: inline-flex;
    max-width: 100%;
    align-items: center;
    gap: 0.35rem;
    border-radius: 0.5rem;
    background: #eef2ff;
    color: #3730a3;
    padding: 0.25rem 0.35rem 0.25rem 0.6rem;
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.3;
}

.tag-input__chip-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tag-input__chip-remove {
    display: inline-flex;
    height: 1.25rem;
    width: 1.25rem;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 9999px;
    background: rgba(55, 48, 163, 0.12);
    color: #3730a3;
    font-size: 0.9rem;
    line-height: 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.tag-input__chip-remove:hover,
.tag-input__chip-remove:focus-visible {
    background: rgba(55, 48, 163, 0.22);
}

.tag-input__field {
    min-width: 6rem;
    flex: 1 1 6rem;
    border: 0;
    background: transparent;
    padding: 0.35rem 0.15rem;
    /* 16px未満だと iOS Safari がフォーカス時に自動ズームする */
    font-size: 16px;
    color: #111827;
    outline: none;
}

.tag-input__field::placeholder {
    color: #94a3b8;
}

.tag-input--with-save .tag-input__box {
    padding-right: 0.4rem;
}

.tag-input--with-save .tag-edit__save {
    margin-left: auto;
}

/* 一覧のタグ表示 → クリックで編集 */
.tag-panel__view {
    display: block;
    width: 100%;
    border: 0;
    background: transparent;
    padding: 0;
    text-align: left;
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(60, 80, 224, 0.15);
    touch-action: manipulation;
}

.tag-panel__view:hover .tag-panel__chip,
.tag-panel__view:focus-visible .tag-panel__chip {
    border-color: #c7d2fe;
    background: #eef2ff;
}

.tag-panel__view:hover .tag-panel__empty,
.tag-panel__view:focus-visible .tag-panel__empty {
    color: #3c50e0;
}

.tag-panel__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.tag-panel__chip {
    display: inline-flex;
    align-items: center;
    border: 1px solid #e2e8f0;
    border-radius: 9999px;
    background: #f8fafc;
    color: #334155;
    padding: 0.2rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.4;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.tag-panel__empty {
    font-size: 0.75rem;
    color: #94a3b8;
    transition: color 0.15s ease;
}

.tag-panel.is-editing .tag-panel__head {
    display: none;
}

.tag-panel.is-editing .tag-panel__view {
    display: none;
}

.tag-panel.is-editing .tag-panel__edit {
    display: block !important;
}

.tag-edit__save {
    display: inline-flex;
    height: 2.25rem;
    width: 2.25rem;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 9999px;
    background: #3c50e0;
    color: #ffffff;
    padding: 0;
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(60, 80, 224, 0.28);
    transition: background-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.tag-edit__save svg {
    width: 1rem;
    height: 1rem;
}

.tag-edit__save:hover,
.tag-edit__save:focus-visible {
    background: #2f40c4;
    box-shadow: 0 8px 18px rgba(60, 80, 224, 0.35);
}

.tag-edit__save:active {
    transform: translateY(1px);
}

/* 削除確認モーダル */
.image-confirm-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    box-sizing: border-box;
}

.image-confirm-modal[hidden] {
    display: none !important;
}

.image-confirm-modal__backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    padding: 0;
    margin: 0;
    background: rgba(15, 23, 42, 0.65);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.image-confirm-modal__dialog {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 28rem;
    border-radius: 1rem;
    background: #ffffff;
    padding: 1.5rem;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.45);
    animation: image-modal-pop-in 0.2s ease-out;
}

.image-confirm-modal__dialog--wide {
    max-width: min(32rem, calc(100vw - 2rem));
    max-height: calc(100vh - 2rem);
    max-height: calc(100dvh - 2rem);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.image-exif-modal__dialog {
    max-width: min(40rem, calc(100vw - 2rem));
    max-height: calc(100vh - 2rem);
    max-height: calc(100dvh - 2rem);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.diet-meal-edit-modal__dialog {
    max-width: min(46rem, calc(100vw - 2rem));
    max-height: calc(100vh - 2rem);
    max-height: calc(100dvh - 2rem);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
}

/* iOS: 14px未満の入力フォーカスでページがズームするのを防ぐ */
.diet-meal-edit-modal input,
.diet-meal-edit-modal select,
.diet-meal-edit-modal textarea {
    font-size: 16px !important;
    touch-action: manipulation;
}

.diet-meal-edit-modal button,
.diet-meal-edit-modal summary,
.diet-meal-edit-modal label {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

body.diet-meal-edit-open {
    overflow: hidden;
    overscroll-behavior: none;
}

.diet-meal-edit-photo__frame {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 12rem;
    padding: 0.75rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.9rem;
    background: #f8fafc;
    overflow: hidden;
}

.diet-meal-edit-photo__img {
    display: block;
    max-width: 100%;
    max-height: 16rem;
    object-fit: contain;
    transition: transform 0.2s ease;
}

.diet-meal-edit-photo__empty {
    margin: 0;
}

.diet-meal-edit-file__input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.diet-meal-edit-location__summary {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem 0.5rem;
    min-height: 2.75rem;
    padding: 0.25rem 0;
}

.diet-meal-edit-location__summary::-webkit-details-marker {
    display: none;
}

.diet-meal-edit-location__summary-label::before {
    content: '▶';
    display: inline-block;
    margin-right: 0.4rem;
    font-size: 0.7rem;
    color: #64748b;
    transition: transform 0.15s ease;
}

.diet-meal-edit-location[open] > .diet-meal-edit-location__summary .diet-meal-edit-location__summary-label::before {
    transform: rotate(90deg);
}

.diet-meal-edit-location__value {
    font-weight: 400;
}

.diet-meal-edit-map {
    width: 100%;
    height: min(38vh, 20rem);
    min-height: 15rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.9rem;
    background: #e2e8f0;
    overflow: hidden;
    z-index: 0;
}

.diet-meal-edit-map .leaflet-control-attribution {
    font-size: 0.625rem;
}

.image-exif-modal__body {
    min-height: 0;
    flex: 1 1 auto;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.image-exif-modal__list {
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    background: #f8fafc;
    overflow: hidden;
}

.image-exif-modal__table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
    line-height: 1.45;
}

.image-exif-modal__table th,
.image-exif-modal__table td {
    padding: 0.55rem 0.7rem;
    vertical-align: top;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
    word-break: break-word;
}

.image-exif-modal__table tr:last-child th,
.image-exif-modal__table tr:last-child td {
    border-bottom: 0;
}

.image-exif-modal__table th {
    width: 42%;
    color: #475569;
    font-weight: 600;
    background: #f1f5f9;
}

.image-exif-modal__table td {
    color: #0f172a;
    white-space: pre-wrap;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.6875rem;
}

.image-exif-modal__section td {
    background: #e2e8f0;
    color: #1e293b;
    font-weight: 700;
    font-family: inherit;
    font-size: 0.75rem;
}

.image-card__title-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
}

.image-card__title {
    min-width: 0;
    flex: 1 1 auto;
    margin: 0;
}

button.image-card__title--editable {
    display: block;
    width: 100%;
    max-width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    text-align: left;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

button.image-card__title--editable:hover,
button.image-card__title--editable:focus-visible {
    color: #3c50e0;
    text-decoration: underline;
    outline: none;
}

.image-card__exif-btn {
    display: inline-flex;
    height: 1.75rem;
    width: 1.75rem;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 9999px;
    background: rgba(60, 80, 224, 0.12);
    color: #3c50e0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.image-card__exif-btn svg {
    height: 1rem;
    width: 1rem;
}

.image-card__exif-btn:hover,
.image-card__exif-btn:focus-visible {
    background: rgba(60, 80, 224, 0.22);
}

.image-confirm-modal__close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 2;
    display: inline-flex;
    height: 2.25rem;
    width: 2.25rem;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 9999px;
    background: #f1f5f9;
    color: #334155;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.image-confirm-modal__close:hover,
.image-confirm-modal__close:focus-visible {
    background: #e2e8f0;
}

/* ライトボックスは背面操作を完全に止める */
body.image-lightbox-open {
    overflow: hidden;
    touch-action: none;
    overscroll-behavior: none;
}

/* 確認／アップロードモーダルはスクロール止めのみ（touch-action:none だとファイル選択が止まる端末がある） */
body.image-confirm-open {
    overflow: hidden;
    overscroll-behavior: none;
}

/* タグベース類似投稿モーダル */
.similar-posts-modal__dialog {
    width: min(100%, 42rem);
    max-height: min(90vh, 720px);
    display: flex;
    flex-direction: column;
}

.similar-posts-modal__body {
    flex: 1;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.similar-posts__lead,
.similar-posts__empty,
.similar-posts__status {
    margin: 0 0 0.75rem;
}

.similar-posts__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
    gap: 0.75rem;
}

.similar-posts__item {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    min-width: 0;
}

.similar-posts__thumb-wrap {
    position: relative;
}

.similar-posts__thumb {
    position: relative;
    display: block;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 0.5rem;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
}

.similar-posts__delete {
    position: absolute;
    right: 0.35rem;
    bottom: 0.35rem;
    z-index: 2;
    display: inline-flex;
    height: 2rem;
    width: 2rem;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 9999px;
    background: rgba(15, 23, 42, 0.72);
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.25);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.similar-posts__delete svg {
    width: 1rem;
    height: 1rem;
}

.similar-posts__delete:hover,
.similar-posts__delete:focus-visible {
    background: rgba(185, 28, 28, 0.92);
}

.similar-posts__media {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.similar-posts__match {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 0.2rem 0.35rem;
    background: rgba(15, 23, 42, 0.72);
    color: #fff;
    font-size: 0.6875rem;
    font-weight: 600;
    text-align: center;
    line-height: 1.3;
}

.similar-posts__meta {
    min-width: 0;
}

.similar-posts__title {
    margin: 0;
    font-size: 0.75rem;
    font-weight: 600;
    color: #0f172a;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.similar-posts__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin: 0.25rem 0 0;
    padding: 0;
    list-style: none;
}

.similar-posts__tags li {
    padding: 0.125rem 0.375rem;
    border-radius: 9999px;
    background: #eef2ff;
    color: #4338ca;
    font-size: 0.625rem;
    line-height: 1.4;
}

@keyframes image-modal-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes image-modal-pop-in {
    from {
        opacity: 0;
        transform: translateY(0.5rem) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (min-width: 768px) {
    .image-modal {
        padding: 1.5rem;
    }

    .image-modal__dialog {
        height: min(46rem, calc(100vh - 3rem));
        height: min(46rem, calc(100dvh - 3rem));
        max-width: calc(100vw - 3rem);
        max-height: calc(100vh - 3rem);
        max-height: calc(100dvh - 3rem);
        flex-direction: row;
    }

    .image-modal__details {
        width: 19rem;
        max-height: none;
        flex: 0 0 19rem;
        padding: 1.5rem;
        padding-top: 4rem;
        border-left: 1px solid #e2e8f0;
    }
}

/* 投稿画像ギャラリー（3列・正方形） */
.image-gallery__head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.image-gallery__head-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1rem;
}

.media-sort {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
}

.media-sort__label {
    margin-right: 0.15rem;
    color: #64748b;
    font-size: 0.75rem;
    font-weight: 600;
}

.media-sort__link {
    display: inline-flex;
    align-items: center;
    min-height: 1.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 9999px;
    background: #ffffff;
    color: #475569;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    padding: 0.3rem 0.7rem;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

.media-sort__link:hover,
.media-sort__link:focus-visible {
    border-color: #93c5fd;
    color: #1d4ed8;
}

.media-sort__link.is-active {
    border-color: #3c50e0;
    background: rgba(60, 80, 224, 0.1);
    color: #3c50e0;
}

.media-sort__sep {
    display: inline-block;
    width: 1px;
    height: 1rem;
    margin: 0 0.15rem;
    background: #cbd5e1;
}

.image-gallery__eyebrow {
    margin: 0;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #3c50e0;
}

.image-gallery__title {
    margin: 0.35rem 0 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
}

.image-gallery__lead {
    margin: 0.4rem 0 0;
    max-width: 28rem;
    font-size: 0.875rem;
    color: #64748b;
}

.image-gallery__upload-link {
    display: inline-flex;
    min-height: 2.5rem;
    align-items: center;
    justify-content: center;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    background: #ffffff;
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #1f2937;
    text-decoration: none;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.image-gallery__upload-link:hover,
.image-gallery__upload-link:focus-visible {
    border-color: #3c50e0;
    color: #3c50e0;
}

.image-gallery__empty {
    margin: 0;
    border: 1px dashed #e2e8f0;
    border-radius: 0.75rem;
    background: #ffffff;
    padding: 2rem 1.25rem;
    text-align: center;
    font-size: 0.875rem;
    color: #64748b;
}

.image-gallery__empty a {
    font-weight: 600;
    color: #3c50e0;
    text-decoration: none;
}

.image-gallery__empty a:hover,
.image-gallery__empty a:focus-visible {
    text-decoration: underline;
}

.image-gallery__filter-control {
    display: flex;
    margin: 0 0 0.75rem;
}

.image-gallery__filter-toggle {
    display: inline-flex;
    min-height: 2.5rem;
    max-width: 100%;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    background: #ffffff;
    padding: 0.5rem 0.8rem;
    color: #334155;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.3;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.image-gallery__filter-toggle:hover,
.image-gallery__filter-toggle:focus-visible,
.image-gallery__filter-toggle[aria-expanded="true"] {
    border-color: #3c50e0;
    background: rgba(60, 80, 224, 0.06);
    color: #3c50e0;
}

.image-gallery__filter-toggle-icon,
.image-gallery__filter-toggle-arrow {
    width: 1rem;
    height: 1rem;
    flex: 0 0 auto;
}

.image-gallery__filter-toggle-arrow {
    transition: transform 0.18s ease;
}

.image-gallery__filter-toggle[aria-expanded="true"] .image-gallery__filter-toggle-arrow {
    transform: rotate(180deg);
}

.image-gallery__filter-toggle-current {
    min-width: 0;
    overflow: hidden;
    border-radius: 9999px;
    padding: 0.2rem 0.55rem;
    background: #3c50e0;
    color: #ffffff;
    font-size: 0.75rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.image-gallery__filters {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.5rem;
    margin: 0 0 1rem;
    padding: 0.15rem 0 0.35rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.image-gallery__filters[hidden] {
    display: none !important;
}

.image-gallery__filter {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    gap: 0.35rem;
    min-height: 2.25rem;
    border: 1px solid #e2e8f0;
    border-radius: 9999px;
    background: #ffffff;
    padding: 0.35rem 0.85rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #334155;
    text-decoration: none;
    white-space: nowrap;
    transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.image-gallery__empty-reset {
    font-weight: 600;
    color: #3c50e0;
    text-decoration: underline;
}

.image-gallery__empty-reset:hover,
.image-gallery__empty-reset:focus-visible {
    color: #2a3bb8;
}

.image-gallery__filter:hover,
.image-gallery__filter:focus-visible {
    border-color: #3c50e0;
    color: #3c50e0;
}

.image-gallery__filter.is-active {
    border-color: #3c50e0;
    background: #3c50e0;
    color: #ffffff;
}

.image-gallery__filter-count {
    display: inline-flex;
    min-width: 1.25rem;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    background: rgba(15, 23, 42, 0.08);
    padding: 0.05rem 0.4rem;
    font-size: 0.6875rem;
    font-weight: 700;
    line-height: 1.2;
}

.image-gallery__filter.is-active .image-gallery__filter-count {
    background: rgba(255, 255, 255, 0.22);
}

.image-gallery__tag-panel .sparse-tags__list--scroll.image-gallery__tag-list {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    max-height: 18rem;
    gap: 0.35rem;
    overflow-y: auto;
}

.image-gallery__tag-panel .sparse-tags__item {
    display: flex;
    flex-shrink: 0;
    width: 100%;
    min-height: 2.25rem;
    border-radius: 0.5rem;
}

.image-gallery__tag-panel .sparse-tags__item[hidden],
.image-gallery__tag-panel .sparse-tags__item.is-filter-hidden {
    display: none !important;
}

.image-gallery__tag-panel .sparse-tags__link {
    flex: 1;
    width: 100%;
    justify-content: space-between;
}

.sparse-tags__list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.sparse-tags__list--scroll {
    max-height: 16rem;
    overflow-y: auto;
    padding: 0.15rem 0.15rem 0.35rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.sparse-tags__panel {
    overflow: hidden;
}

.sparse-tags__toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 2.25rem;
    border: 1px solid #e2e8f0;
    border-radius: 9999px;
    background: #ffffff;
    padding: 0.35rem 0.85rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.sparse-tags__toggle:hover,
.sparse-tags__toggle:focus-visible,
.sparse-tags__toggle[aria-expanded="true"] {
    border-color: #3c50e0;
    background: #f8fafc;
    color: #3c50e0;
}

.sparse-tags__toggle-current {
    max-width: 10rem;
    overflow: hidden;
    border-radius: 9999px;
    background: #eef2ff;
    padding: 0.15rem 0.55rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: #3c50e0;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sparse-tags__toggle-arrow {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    transition: transform 0.15s ease;
}

.sparse-tags__toggle[aria-expanded="true"] .sparse-tags__toggle-arrow {
    transform: rotate(180deg);
}

.sparse-tags__picker {
    padding: 1rem 1rem 1.15rem;
}

.sparse-tags__picker[hidden] {
    display: none !important;
}

.sparse-tags__controls {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}

.sparse-tags__search-wrap {
    display: block;
}

.sparse-tags__search {
    width: 100%;
    min-height: 2.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.625rem;
    background: #ffffff;
    padding: 0.55rem 0.85rem;
    font-size: 0.875rem;
    color: #0f172a;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.sparse-tags__search:focus {
    border-color: #3c50e0;
    box-shadow: 0 0 0 3px rgba(60, 80, 224, 0.15);
}

.sparse-tags__count-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.sparse-tags__count-filter {
    min-height: 2rem;
    border: 1px solid #e2e8f0;
    border-radius: 9999px;
    background: #ffffff;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.sparse-tags__count-filter:hover,
.sparse-tags__count-filter:focus-visible,
.sparse-tags__count-filter.is-active {
    border-color: #3c50e0;
    background: #eef2ff;
    color: #3c50e0;
}

.sparse-tags__search-empty,
.sparse-tags__empty,
.sparse-tags__status {
    margin: 0;
    font-size: 0.8125rem;
    color: #64748b;
}

.sparse-tags__list-wrap {
    border-top: 1px solid #e2e8f0;
    margin-top: 0.85rem;
    padding-top: 0.15rem;
}

.sparse-tags__rows {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sparse-tags__row {
    display: flex;
    align-items: stretch;
    gap: 0;
    border-bottom: 1px solid #e2e8f0;
}

.sparse-tags__row:last-child {
    border-bottom: 0;
}

.sparse-tags__name {
    display: flex;
    flex: 1;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    border: 0;
    background: transparent;
    padding: 0.85rem 0.25rem 0.85rem 0;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.sparse-tags__name:hover,
.sparse-tags__name:focus-visible {
    background: #f8fafc;
}

.sparse-tags__name-text {
    min-width: 0;
    overflow: hidden;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #0f172a;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sparse-tags__name:hover .sparse-tags__name-text,
.sparse-tags__name:focus-visible .sparse-tags__name-text {
    color: #3c50e0;
}

.sparse-tags__count {
    display: inline-flex;
    flex-shrink: 0;
    min-width: 2.5rem;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    background: #f1f5f9;
    padding: 0.2rem 0.55rem;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.2;
    color: #475569;
}

.sparse-tags__rename {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    align-self: stretch;
    border: 0;
    border-left: 1px solid #e2e8f0;
    background: #f8fafc;
    padding: 0 0.95rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #334155;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.sparse-tags__rename:hover,
.sparse-tags__rename:focus-visible {
    background: #e2e8f0;
    color: #0f172a;
}

.sparse-tags__rename:disabled {
    opacity: 0.6;
    cursor: wait;
}

.sparse-tags__delete {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    align-self: stretch;
    border: 0;
    border-left: 1px solid #e2e8f0;
    background: #fff5f5;
    padding: 0 0.95rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #dc2626;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.sparse-tags__delete:hover,
.sparse-tags__delete:focus-visible {
    background: #fee2e2;
    color: #b91c1c;
}

.sparse-tags__delete:disabled {
    opacity: 0.6;
    cursor: wait;
}

.image-gallery__grid--sparse-modal {
    margin: 0;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    gap: 2px;
    background: #ffffff;
    overflow: hidden;
}

.image-gallery__grid--sparse-modal .image-gallery__cell,
.image-gallery__grid--sparse-modal .image-gallery__item {
    min-width: 0;
}

.sparse-tags__item[hidden] {
    display: none !important;
}

.sparse-tags__item {
    display: inline-flex;
    align-items: stretch;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    border-radius: 9999px;
    background: #ffffff;
}

.sparse-tags__item.is-active {
    border-color: #3c50e0;
    box-shadow: 0 0 0 1px #3c50e0;
}

.sparse-tags__link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 2.25rem;
    padding: 0.35rem 0.85rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #334155;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.sparse-tags__item.is-active .sparse-tags__link {
    background: #3c50e0;
    color: #ffffff;
}

.sparse-tags__link:hover,
.sparse-tags__link:focus-visible {
    color: #3c50e0;
}

.sparse-tags__item.is-active .sparse-tags__link:hover,
.sparse-tags__item.is-active .sparse-tags__link:focus-visible {
    color: #ffffff;
}

.sparse-tags__item .sparse-tags__count {
    display: inline-flex;
    min-width: 1.25rem;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    background: rgba(15, 23, 42, 0.08);
    padding: 0.05rem 0.4rem;
    font-size: 0.6875rem;
    font-weight: 700;
    line-height: 1.2;
}

.sparse-tags__item.is-active .sparse-tags__count {
    background: rgba(255, 255, 255, 0.22);
}

.sparse-tags__item .sparse-tags__delete {
    border-left: 1px solid #e2e8f0;
    padding: 0 0.75rem;
    font-size: 0.75rem;
}

.sparse-tags__item.is-active .sparse-tags__delete {
    border-left-color: rgba(255, 255, 255, 0.35);
    background: rgba(220, 38, 38, 0.12);
    color: #ffffff;
}

.sparse-tags__item.is-active .sparse-tags__delete:hover,
.sparse-tags__item.is-active .sparse-tags__delete:focus-visible {
    background: rgba(220, 38, 38, 0.28);
    color: #ffffff;
}

.image-gallery__grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2px;
    margin: 0 -1rem;
    background: #ffffff;
}

/* アルバム詳細: PC では列数を増やしてサムネを小さく */
.image-gallery__grid--album {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (min-width: 640px) {
    .image-gallery__grid--album {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .image-gallery__grid--album {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

@media (min-width: 1280px) {
    .image-gallery__grid--album {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
}

.album-item__media {
    position: relative;
}

.album-sort-handle {
    position: absolute;
    left: 0.35rem;
    bottom: 0.35rem;
    top: auto;
    z-index: 12;
    display: inline-flex;
    min-height: 2rem;
    min-width: 2rem;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 0.45rem;
    background: rgba(15, 23, 42, 0.72);
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: -0.08em;
    cursor: grab;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
}

.album-sort-handle:active {
    cursor: grabbing;
}

.album-sort-handle--index {
    z-index: 15;
}

.js-album-index-sort-item.is-sorting {
    opacity: 0.92;
    z-index: 20;
}

.album-cover-badge {
    position: absolute;
    left: 0.35rem;
    top: 0.35rem;
    z-index: 12;
    display: inline-flex;
    border-radius: 0.35rem;
    background: rgba(245, 158, 11, 0.95);
    color: #ffffff;
    font-size: 0.6875rem;
    font-weight: 700;
    line-height: 1;
    padding: 0.35rem 0.45rem;
    pointer-events: none;
}

.album-item__actions {
    position: absolute;
    right: 0.35rem;
    top: 0.35rem;
    z-index: 12;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.25rem;
    max-width: calc(100% - 0.7rem);
}

.album-item__btn {
    display: inline-flex;
    height: 2rem;
    min-width: 2rem;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 0;
    border-radius: 0.45rem;
    background: rgba(15, 23, 42, 0.72);
    color: #ffffff;
    padding: 0 0.4rem;
    font-size: 0.6875rem;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.album-item__btn svg {
    width: 1rem;
    height: 1rem;
    display: block;
}

.album-item__btn--cover {
    min-width: auto;
    padding: 0 0.45rem;
}

.album-item__btn--cover.is-active {
    background: rgba(245, 158, 11, 0.95);
}

.album-item__btn:hover,
.album-item__btn:focus-visible {
    background: rgba(15, 23, 42, 0.9);
    color: #ffffff;
}

.album-item__btn--cover.is-active:hover,
.album-item__btn--cover.is-active:focus-visible {
    background: rgba(217, 119, 6, 0.98);
}

.album-item__btn--danger:hover,
.album-item__btn--danger:focus-visible {
    background: rgba(185, 28, 28, 0.92);
}

.js-album-sort-item.is-sorting {
    opacity: 0.92;
    z-index: 20;
}

.album-card__cover {
    position: relative;
    display: block;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: #e2e8f0;
    color: inherit;
    text-decoration: none;
}

.album-card__cover-wrap {
    position: relative;
}

.album-card__cover-link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.album-card__edit {
    display: inline-flex;
    min-height: 1.75rem;
    align-items: center;
    border: 1px solid #e2e8f0;
    border-radius: 0.375rem;
    background: #fff;
    padding: 0.125rem 0.5rem;
    color: #334155;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.25;
    cursor: pointer;
}

.album-card__edit:hover,
.album-card__edit:focus-visible {
    border-color: #94a3b8;
    background: #f8fafc;
    outline: none;
}

.album-card__delete {
    display: inline-flex;
    min-height: 1.75rem;
    align-items: center;
    border: 1px solid #fecaca;
    border-radius: 0.375rem;
    background: #fff;
    padding: 0.125rem 0.5rem;
    color: #dc2626;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.25;
    cursor: pointer;
}

.album-card__delete:hover,
.album-card__delete:focus-visible {
    border-color: #f87171;
    background: #fef2f2;
    outline: none;
}

.album-card__cover-media {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.album-card__cover-empty {
    display: flex;
    height: 100%;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 0.875rem;
    font-weight: 600;
}

.album-card__cover-play {
    position: absolute;
    right: 0.5rem;
    bottom: 0.5rem;
    display: inline-flex;
    height: 1.5rem;
    width: 1.5rem;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.7);
    color: #ffffff;
    font-size: 0.65rem;
}

@media (min-width: 768px) {
    .image-gallery__grid {
        margin: 0 -1.5rem;
    }

    .image-gallery__grid--sparse-modal {
        margin: 0;
    }
}

.image-gallery__item {
    position: relative;
    display: block;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #f3f4f6;
}

.image-gallery__img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.25s ease, opacity 0.2s ease;
}

.image-lightbox-trigger video,
.image-gallery__item video {
    pointer-events: none;
}

.image-gallery__item:hover .image-gallery__img,
.image-gallery__item:focus-visible .image-gallery__img {
    transform: scale(1.03);
}

.image-gallery__item:focus-visible {
    outline: 2px solid #3c50e0;
    outline-offset: -2px;
    z-index: 1;
}

.image-gallery__sentinel {
    width: 100%;
    height: 1px;
    margin: 0;
    pointer-events: none;
}

.image-gallery__status {
    margin: 1rem 0 0;
    text-align: center;
    font-size: 0.8125rem;
    color: #64748b;
}

/* 家系図キャンバス: スマホスワイプでパン */
.family-tree-canvas {
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}

.family-tree-canvas svg {
    overflow: visible;
}

.family-tree-canvas.is-panning {
    cursor: grabbing;
}

/* 家系図モーダル: スマホ横スクロール防止 */
.family-tree-modal {
    box-sizing: border-box;
    margin: auto;
    padding: 0;
    border: 0;
    width: calc(100vw - 2rem);
    width: calc(100dvw - 2rem);
    max-width: 42rem;
    max-height: calc(100vh - 2rem);
    max-height: calc(100dvh - 2rem);
    overflow: hidden;
    border-radius: 1rem;
    background: #ffffff;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.45);
}

.family-tree-modal::backdrop {
    background: rgba(15, 23, 42, 0.6);
}

.family-tree-modal__body {
    box-sizing: border-box;
    max-height: calc(100vh - 2rem);
    max-height: calc(100dvh - 2rem);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
    padding: 1.25rem;
}

@media (min-width: 768px) {
    .family-tree-modal__body {
        padding: 2rem;
    }
}

.family-tree-modal__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    min-width: 0;
    margin-bottom: 1.25rem;
}

.family-tree-modal__header-text {
    min-width: 0;
    flex: 1 1 auto;
}

.family-tree-modal__header-text h2 {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.family-tree-modal__header-text p {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.family-tree-modal__close {
    flex: 0 0 auto;
    border: 0;
    border-radius: 0.5rem;
    padding: 0.5rem;
    background: transparent;
    color: #6b7280;
    font-size: 1.25rem;
    line-height: 1;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.family-tree-modal__close:hover {
    background: #f3f4f6;
    color: #374151;
}

.family-tree-modal__content {
    min-width: 0;
    max-width: 100%;
}

html.family-tree-modal-open,
body.family-tree-modal-open {
    overflow: hidden;
    overscroll-behavior: none;
}

html.family-tree-modal-open {
    overflow-x: clip;
}

.family-tree-modal-form,
.family-tree-modal-form .input {
    min-width: 0;
    max-width: 100%;
}

.family-tree-modal-form input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.family-tree-modal-form select,
.family-tree-modal-form textarea {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    font-size: 16px;
    touch-action: manipulation;
}

.family-tree-modal-form input[type="date"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    min-width: 0;
}

.family-tree-modal-form input:not([type="checkbox"]):not([type="radio"]):focus,
.family-tree-modal-form select:focus,
.family-tree-modal-form textarea:focus {
    outline: none;
    --tw-ring-offset-shadow: 0 0 #0000;
    --tw-ring-shadow: 0 0 #0000;
    box-shadow: inset 0 0 0 2px rgba(60, 80, 224, 0.35);
}

.family-tree-modal-form .upload-dropzone {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.family-tree-modal-form .upload-dropzone:focus-within,
.family-tree-modal-form .upload-dropzone.is-dragover {
    box-shadow: inset 0 0 0 4px rgba(60, 80, 224, 0.12);
}

.family-tree-modal-form p,
.family-tree-modal-form label {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.family-tree-modal-form button,
.family-tree-modal-form summary {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* ダイエット: 食事カレンダー */
.diet-calendar-reload.is-reloading {
    opacity: 0.55;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.diet-meal-calendar__cell {
    min-height: 6.5rem;
    position: relative;
}

@media (min-width: 640px) {
    .diet-meal-calendar__cell {
        min-height: 7.5rem;
    }
}

.diet-meal-calendar__link {
    min-height: 100%;
    padding: 0.35rem;
    color: inherit;
    text-decoration: none;
    border: 0;
    background: transparent;
    width: 100%;
    font: inherit;
    text-align: left;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.diet-meal-calendar__day {
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.35rem;
    padding: 0.05rem 0.3rem;
    border-radius: 0.35rem;
    background: rgba(255, 255, 255, 0.88);
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1.2;
    color: #1f2937;
}

.diet-meal-calendar__media {
    position: relative;
    overflow: hidden;
    border-radius: 0.45rem;
    background: #f3f4f6;
}

.diet-meal-calendar__grid-item {
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 100%;
    background: #f3f4f6;
}

.diet-meal-calendar__grid-item--empty {
    background: #eef2f7;
}

.diet-meal-calendar__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 1px;
    aspect-ratio: 1 / 1;
}

.diet-meal-calendar__img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.diet-meal-calendar__placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 2rem;
    padding: 0.15rem;
    font-size: 0.55rem;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    color: #6b7280;
    background: #eef2f7;
}

.diet-meal-calendar__extra {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(17, 24, 39, 0.55);
    font-size: 0.65rem;
    font-weight: 700;
    color: #fff;
}

.diet-meal-calendar__calories {
    margin-top: 0.2rem;
    font-size: 0.625rem;
    line-height: 1.2;
    color: #6b7280;
}

.diet-meal-calendar__cell--selected .diet-meal-calendar__day {
    background: #3c50e0;
    color: #fff;
}
