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

/* サイドバー 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__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"],
.date-input-fit {
    -webkit-appearance: none;
    appearance: none;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

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

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;
}

/* 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__tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.25rem;
    border-radius: 9999px;
    padding: 0.25rem 0.65rem;
    background: rgba(60, 80, 224, 0.1);
    color: #3c50e0;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
}

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

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

a.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[aria-busy="true"] {
    cursor: wait;
    opacity: 0.65;
}

.google-image-search--card {
    top: 0.75rem;
    right: 0.75rem;
    height: 2.75rem;
    width: 2.75rem;
}

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

.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;
}

.image-gallery__cell {
    position: relative;
}

/* 投稿カード: ゴミ箱（画像右下） */
.image-card__trash {
    position: absolute;
    right: 0.75rem;
    bottom: 0.75rem;
    z-index: 5;
    display: inline-flex;
    height: 2.75rem;
    width: 2.75rem;
    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: 1.25rem;
    height: 1.25rem;
}

.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: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;
    font-size: 0.875rem;
    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-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-location-modal__dialog {
    max-width: min(46rem, calc(100vw - 2rem));
    max-height: calc(100vh - 2rem);
    max-height: calc(100dvh - 2rem);
    overflow-y: auto;
}

.diet-location-map {
    width: 100%;
    height: min(52vh, 25rem);
    min-height: 18rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.9rem;
    background: #e2e8f0;
    overflow: hidden;
    z-index: 0;
}

.diet-location-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;
}

.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,
body.image-confirm-open {
    overflow: hidden;
    touch-action: none;
    overscroll-behavior: none;
}

@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;
}

.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__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__grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2px;
    margin: 0 -1rem;
    background: #ffffff;
}

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

.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;
}
