:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --background: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --success-bg: #dcfce7;
    --success-text: #166534;
    --warning-bg: #fef9c3;
    --warning-text: #854d0e;
    --danger-bg: #fee2e2;
    --danger-text: #991b1b;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --hover-bg: #f1f5f9;
    --zebra-bg: #f8fafc;
    --th-bg: #e2e8f0;
    --input-bg: #ffffff;
    --tab-inactive-bg: #f8fafc;
    --modal-overlay: rgba(0, 0, 0, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Noto Sans JP', sans-serif;
    background-color: var(--background);
    color: var(--text-main);
    line-height: 1.4;
    padding: 0.5rem;
    /* 大幅縮小 */
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.admin-link-global {
    all: unset !important;
    position: absolute !important;
    top: 5px !important;
    right: 5px !important;
    left: auto !important;
    width: 24px !important;
    height: 24px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    cursor: pointer !important;
    z-index: 2147483647 !important;
    font-size: 1rem !important;
    text-decoration: none !important;
    opacity: 0.6 !important;
    transition: opacity 0.2s !important;
    -webkit-tap-highlight-color: transparent !important;
}

.admin-link-global:hover {
    opacity: 1 !important;
    color: var(--primary-color) !important;
}

.container {
    width: 100%;
    max-width: 900px;
    margin-top: 2rem;
    position: relative;
    /* メモの基準点 */
    animation: fadeIn 0.3s ease-out;
    /* Optimized fadeIn animation */
}

.memo-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    width: 260px;
    background-color: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 0.75rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 1000;
    transition: transform 0.2s, box-shadow 0.2s;
    text-align: left;
    transform: rotate(1deg);
    /* 付箋風に少し傾ける */
}

.memo-container:hover {
    transform: rotate(0deg) scale(1.05);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.memo-container label {
    font-size: 0.85rem;
    font-weight: 800;
    color: #92400e;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding-bottom: 0.25rem;
}

#rules-memo {
    width: 100%;
    height: 120px;
    border: none;
    background: transparent;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #78350f;
    resize: none;
    outline: none;
    font-family: inherit;
    padding: 0;
}

header {
    margin-bottom: 0.5rem;
    /* 大幅縮小 */
    text-align: center;
}

header h1 {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.header-icon {
    display: inline-block;
}

header p {
    color: var(--text-muted);
    font-size: 1rem;
}

.table-card {
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.05), 0 4px 6px -4px rgb(0 0 0 / 0.05);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.table-card:hover {
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.05), 0 8px 10px -6px rgb(0 0 0 / 0.05);
    transform: translateY(-2px);
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th,
td {
    padding: 0.05rem 0.2rem;
    vertical-align: middle;
    border-bottom: 1px solid #cbd5e1 !important; /* 強制的に表示 */
    line-height: 1.0;
}

th {
    background-color: var(--th-bg);
    font-weight: 700;
    color: var(--text-main);
    text-transform: uppercase;
    font-size: 0.7rem;
    /* 最小限 */
    letter-spacing: 0.01em;
}

th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s;
}

th.sortable:hover {
    background-color: #cbd5e1;
}

.sort-icon {
    display: inline-block;
    width: 14px;
    opacity: 0.3;
    font-size: 0.8rem;
    margin-left: 4px;
}

th.sortable.active .sort-icon {
    opacity: 1;
    color: var(--primary-color);
}

tbody tr {
    transition: background-color 0.2s ease;
}

/* 偶数行に色をつけてシマシマ（ゼブラストライプ）にする */
tbody tr:nth-child(even) {
    background-color: var(--zebra-bg);
}

/* ホバー時の色を濃くし、左側にインジケーターを追加してフォーカスを明確に */
tbody tr:hover {
    background-color: var(--hover-bg);
    box-shadow: inset 4px 0 0 var(--primary-color);
}

tbody tr:last-child td {
    border-bottom: none;
}

.text-right {
    text-align: right;
}

/* --- ボタンと共通コンポーネント --- */
.primary-btn {
    background-color: var(--primary-color);
    color: white;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);
    margin-left: 1rem;
}

.primary-btn:hover {
    background-color: #4338ca;
    transform: translateY(-1px);
    box-shadow: 0 6px 8px -1px rgba(79, 70, 229, 0.3);
}

.secondary-btn {
    background-color: white;
    color: #475569;
    padding: 0.6rem 1.2rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: 0.75rem;
}

.secondary-btn:hover {
    background-color: #f8fafc;
    border-color: #cbd5e1;
    color: var(--primary-color);
}

.header-actions {
    display: flex;
    align-items: center;
}

/* --- メインカテゴリタブ（プロパー/キャラクター等） --- */
.main-category-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding: 0.35rem;
    background-color: #f1f5f9;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.05);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
}

.main-tab-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    color: #64748b;
    font-weight: 700;
    font-size: 1rem;
    border-radius: 9px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
}

.main-tab-btn:hover {
    color: var(--primary-color);
    background-color: rgba(255, 255, 255, 0.5);
}

.main-tab-btn.active {
    background-color: white;
    color: var(--primary-color);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transform: translateY(0);
}

/* --- カテゴリタブスタイル --- */
.category-tabs {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 0.25rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1px;
    -webkit-overflow-scrolling: touch;
}

.tab-btn {
    background: none;
    border: none;
    padding: 0.5rem 0.8rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: #475569;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
    background-color: var(--tab-inactive-bg);
    border-radius: 4px 4px 0 0;
    margin-bottom: -1px;
    flex-shrink: 0;
}

.tab-btn::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--primary-color);
    transform: scaleX(0);
    transition: transform 0.2s;
}

.tab-btn.active {
    color: var(--primary-color);
    font-weight: 700;
    background-color: white;
    border-bottom: 1px solid white;
}

/* サブタブのカラー装飾（見やすい色に再調整） */
.tab-btn:nth-child(7n+1) { border-top: 3px solid #ef4444; } /* 赤 */
.tab-btn:nth-child(7n+2) { border-top: 3px solid #f59e0b; } /* オレンジ */
.tab-btn:nth-child(7n+3) { border-top: 3px solid #10b981; } /* 緑 */
.tab-btn:nth-child(7n+4) { border-top: 3px solid #3b82f6; } /* 青 */
.tab-btn:nth-child(7n+5) { border-top: 3px solid #6366f1; } /* 藍色 */
.tab-btn:nth-child(7n+6) { border-top: 3px solid #a855f7; } /* 紫 */
.tab-btn:nth-child(7n+7) { border-top: 3px solid #ec4899; } /* ピンク */

/* PC版でスクロールバーを非表示にする */
.category-tabs::-webkit-scrollbar,
.main-category-tabs::-webkit-scrollbar {
    display: none;
}
.category-tabs,
.main-category-tabs {
    -ms-overflow-style: none;
    scrollbar-width: none;
}



/* ホバー時のみ少し目立たせる */
.tab-btn:hover {
    background-color: #f1f5f9;
    color: var(--primary-color);
}

.action-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    /* 縮小 */
    color: #94a3b8;
    transition: all 0.2s ease;
    padding: 0.1rem 0.2rem;
    /* 最小限 */
    border-radius: 4px;
}

.delete-btn:hover {
    color: #ef4444;
    background-color: #fee2e2;
}

.action-col {
    width: 60px;
    text-align: center;
}

.date-col {
    width: 60px;
    font-size: 0.65rem;
    color: var(--text-muted);
    text-align: center;
    white-space: nowrap;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.3rem;
    /* さらに縮小 */
    border-radius: 3px;
    font-size: 0.6rem;
    /* 極小 */
    font-weight: 700;
}

.badge.in-stock {
    background-color: var(--success-bg);
    color: var(--success-text);
}

.badge.low-stock {
    background-color: var(--warning-bg);
    color: var(--warning-text);
}

.badge.out-of-stock {
    background-color: var(--danger-bg);
    color: var(--danger-text);
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* --- 追加セルの基本スタイルと在庫状況に応じた強調表示 --- */

.cell-code {
    font-family: monospace;
    color: var(--text-main);
    font-size: 0.8rem;
}

.cell-name {
    font-weight: 500;
    font-size: 0.85rem;
    white-space: nowrap; /* 一行で表示 */
}

.product-name-with-badges {
    display: flex;
    align-items: baseline;
    flex-wrap: nowrap;
    line-height: 1.3;
    gap: 0.4rem;
}

.p-name-main {
    font-weight: 500;
    display: inline;
    flex-shrink: 1;
    min-width: 0;
    white-space: nowrap; /* 改行を禁止 */
    overflow: hidden;
    text-overflow: ellipsis; /* 溢れる場合は...で表示 */
}

.p-color-sub {
    font-size: 0.85rem;
    color: var(--text-main) !important;
    font-weight: 600;
    display: inline-block;
    flex-shrink: 0;
    white-space: nowrap;
}



.cell-color {
    color: var(--text-main);
    font-size: 0.8rem;
}

.cell-stock {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    font-size: 0.85rem;
}

/* --- ダブルクリックのインライン編集スタイル --- */
.inline-edit-input {
    width: 100%;
    padding: 0.2rem 0.4rem;
    border: 2px solid var(--primary-color);
    border-radius: 4px;
    font-size: inherit;
    font-family: inherit;
    color: var(--text-main);
    background-color: var(--input-bg);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
    outline: none;
}

/* インライン編集可能なセルにホバーした時の視覚的ヒント */
.editable-cell {
    cursor: text;
    position: relative;
    border: 1px solid transparent;
    border-radius: 4px;
    transition: all 0.2s;
}

.editable-cell:hover {
    background-color: #f1f5f9;
    border-color: #cbd5e1;
}

.editable-cell::after {
    content: '🖊️';
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.editable-cell:hover::after {
    opacity: 0.5;
}

.editing {
    padding: 0 !important;
}

.editing::after {
    display: none;
}

/* --- 棚卸在庫の直接入力フィールド --- */
.shelf-stock-input {
    width: 50px;
    text-align: right;
    padding: 0.05rem 0.25rem;
    /* 最小 */
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--text-main);
}

.shelf-stock-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
}

/* スピンボタンを除く */
.shelf-stock-input::-webkit-outer-spin-button,
.shelf-stock-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

.shelf-stock-input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* --- インポート設定モーダル専用 --- */
.import-modal-content {
    max-width: 450px !important;
}

.import-setup-section {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e2f0;
}

.import-setup-section h3 {
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    color: #334155;
    font-weight: 700;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.95rem;
    color: #475569;
}

.radio-label input[type="radio"] {
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid #cbd5e1;
    border-radius: 50%;
    outline: none;
    transition: all 0.2s;
    position: relative;
    cursor: pointer;
}

.radio-label input[type="radio"]:checked {
    border-color: var(--primary-color);
}

.radio-label input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    background-color: var(--primary-color);
    border-radius: 50%;
}

.radio-label:hover input[type="radio"] {
    border-color: var(--primary-color);
}

.status-btn-group {
    display: flex;
    gap: 2px;
    justify-content: center;
}

.status-btn {
    width: 24px;
    /* 縮小 */
    height: 24px;
    /* 縮小 */
    border-radius: 3px;
    border: 1px solid var(--border-color);
    background-color: #f8fafc;
    color: #94a3b8;
    font-size: 0.75rem;
    /* 縮小 */
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.status-btn:hover {
    background-color: #e2e8f0;
}

/* ◎ (あり) */
.status-btn.circle.active {
    background-color: #ecfdf5;
    color: #10b981;
    border-color: #10b981;
    box-shadow: inset 0 0 0 1px #10b981;
}

/* △ (わずか) */
.status-btn.triangle.active {
    background-color: #fffbeb;
    color: #f59e0b;
    border-color: #f59e0b;
    box-shadow: inset 0 0 0 1px #f59e0b;
}

/* × (なし) */
.status-btn.cross.active {
    background-color: #fef2f2;
    color: #ef4444;
    border-color: #ef4444;
    box-shadow: inset 0 0 0 1px #ef4444;
}

/* --- 一括操作コンテナ --- */
.batch-ops-container {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    position: relative;
    z-index: 1002;
    flex-wrap: wrap; /* 必要に応じて折り返し */
}

.batch-ops-main {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

@media (max-width: 850px) {
    .batch-ops-container {
        padding: 0.5rem;
        flex-direction: column;
        align-items: stretch;
        gap: 0.3rem; /* 隙間を詰める */
    }
    .batch-ops-main {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        gap: 0.3rem;
    }
    .batch-ops-container span {
        font-size: 0.75rem; /* 縮小 */
        margin-bottom: 0.2rem;
        font-weight: bold;
    }
    .batch-btn, #save-all-btn.save-btn {
        width: 100% !important;
        margin: 0 !important;
        padding: 0.5rem !important; /* 約70%に縮小 */
        font-size: 0.8rem !important; /* 縮小 */
        text-align: center !important;
        justify-content: center !important;
        display: flex !important;
        box-sizing: border-box !important;
    }
    .batch-ops-container .batch-divider {
        display: none !important;
    }

    /* フィルタボタンの折り返し対応 */
    .filter-container {
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 0.3rem !important;
        padding: 0 0.5rem !important;
    }
    .filter-btn {
        flex: 1 1 auto !important; /* 幅を自動調整 */
        min-width: calc(33% - 0.5rem) !important; /* 3列程度を想定 */
        padding: 0.4rem 0.5rem !important;
        font-size: 0.7rem !important;
        margin: 0 !important;
        white-space: nowrap !important;
    }
}

.batch-ops-container span {
    font-size: 0.9rem;
    font-weight: 500;
    color: #475569;
}

.batch-btn {
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    border: 1px solid;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: white;
}

.batch-btn.batch-circle {
    color: #10b981;
    border-color: #10b981;
}

.batch-btn.batch-circle:hover {
    background-color: #ecfdf5;
}

.batch-btn.batch-triangle {
    color: #f59e0b;
    border-color: #f59e0b;
}

.batch-btn.batch-triangle:hover {
    background-color: #fffbeb;
}

.batch-btn.batch-cross {
    color: #ef4444;
    border-color: #ef4444;
}

.batch-btn.batch-cross:hover {
    background-color: #fef2f2;
}

.batch-divider {
    color: #cbd5e1;
    margin: 0 0.25rem;
}

.batch-btn.batch-delete {
    color: #b91c1c;
    border-color: #b91c1c;
    background-color: #fef2f2;
}

.batch-btn.batch-delete:hover {
    background-color: #fee2e2;
}

.batch-btn.batch-new {
    color: #eab308;
    border-color: #eab308;
}

.batch-btn.batch-new:hover {
    background-color: #fefce8;
}

.batch-btn.batch-char-new {
    color: #a855f7;
    border-color: #a855f7;
}

.batch-btn.batch-char-new:hover {
    background-color: #faf5ff;
}

.save-btn {
    margin-left: auto;
    background-color: #10b981;
    color: white;
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
    font-weight: 700;
    animation: none;
    transition: all 0.2s ease;
    position: relative;
    z-index: 10;
    /* モーダル(5000)より低く、通常の設定要素より高く */
    touch-action: manipulation;
    /* タップの反応を速める */
}

.save-btn:active:not(:disabled) {
    transform: scale(0.95);
    /* 押した時の凹み効果 */
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.save-btn:not(:disabled) {
    background-color: #059669;
    box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.4);
    animation: pulseSave 2s infinite;
}

.save-btn:disabled {
    background-color: #94a3b8;
    opacity: 0.5;
    cursor: not-allowed;
}

@keyframes pulseSave {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

/* 未確定の行 */
tbody tr.row-dirty {
    border-left: 4px solid #3b82f6 !important;
    background-color: #eff6ff !important;
}

/* --- チェックボックス列 --- */
.checkbox-col {
    width: 40px;
    text-align: center;
}

.row-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* 検索・機能コンテナのスタイル */
.search-container {
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: center;
}

.search-input-wrapper {
    position: relative;
    width: 100%;
    max-width: 400px;
}

#search-input {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 1.25rem;
    /* 右側の余白をクリアボタン用に広くする */
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    font-size: 1rem;
    outline: none;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.clear-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 2px 6px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.clear-btn:hover {
    color: #ef4444;
    background-color: #fee2e2;
}

#search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

/* フィルタコンテナのスタイル */
.filter-container {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    justify-content: center;
}

.filter-btn {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1.25rem;
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.filter-btn:hover {
    background: var(--hover-bg);
    color: var(--text-main);
}

.filter-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.4);
}

/* --- モーダル (ポップアップウィンドウ) --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--modal-overlay);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 5000;
    /* 完全に最前面へ */
    animation: fadeInModal 0.2s ease-out;
}

@keyframes fadeInModal {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background-color: var(--card-bg);
    border-radius: 12px;
    width: 90%;
    max-width: 480px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    animation: slideUpModal 0.3s ease-out;
    overflow: hidden;
}

@keyframes slideUpModal {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    background-color: var(--zebra-bg);
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.2rem;
    color: var(--text-main);
    margin: 0;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #94a3b8;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close-btn:hover {
    color: #ef4444;
}

.modal-body {
    padding: 1.5rem;
}

.form-group {
    margin-bottom: 1.2rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #475569;
    font-size: 0.95rem;
}

.form-group .required {
    color: #ef4444;
    margin-left: 0.2rem;
}

.form-help-text {
    font-size: 0.85rem;
    color: #64748b;
    margin-top: 0;
    margin-bottom: 1.2rem;
    line-height: 1.5;
    background-color: #f1f5f9;
    padding: 0.75rem;
    border-radius: 6px;
    border-left: 3px solid var(--primary-color);
}

.form-help-text code {
    background-color: #e2e8f0;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-family: monospace;
    color: #334155;
    font-weight: bold;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s;
    resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 2rem;
}

.cancel-btn {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.cancel-btn:hover {
    background-color: var(--hover-bg);
}

.submit-btn {
    background-color: var(--primary-color);
    border: none;
    color: white;
    padding: 0.6rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.submit-btn:hover {
    background-color: #4338ca;
}

/* 在庫わずかの行を強調表示 - 静的な強調に変更 */
tbody tr.row-low-stock {
    background-color: var(--warning-bg) !important;
    border-left: 4px solid var(--warning-text);
}

tbody tr.row-low-stock:hover {
    box-shadow: inset 4px 0 0 #dc2626;
}

tbody tr.row-low-stock .cell-code,
tbody tr.row-low-stock .cell-name {
    color: var(--warning-text);
}

/* 数字入力を強調 */
tbody tr.row-low-stock .stock-input {
    color: #92400e;
    font-weight: 800;
    border-color: #f59e0b;
    background-color: #fff7ed;
}


/* 在庫なしの行を強調表示（赤色のハイライトと取り消し線） */
tbody tr.row-out-of-stock {
    background-color: var(--danger-bg) !important;
    opacity: 0.6;
}

tbody tr.row-out-of-stock:hover {
    background-color: #fee2e2 !important;
    box-shadow: inset 4px 0 0 #ef4444;
}

tbody tr.row-out-of-stock .cell-code,
tbody tr.row-out-of-stock .cell-name,
tbody tr.row-out-of-stock .cell-stock {
    color: var(--danger-text);
    text-decoration: line-through;
    text-decoration-color: var(--danger-text);
    opacity: 0.8;
    /* 全体的に暗くして死んでる感じにする */
}

tbody tr.row-out-of-stock .stock-input {
    color: #991b1b;
    background-color: transparent;
    border-color: #fca5a5;
    text-decoration: line-through;
}

tbody tr.row-out-of-stock .badge {
    text-decoration: none;
    opacity: 1;
    /* バッジだけは強調 */
    font-size: 0.85rem;
}

/* バッジを強調 */
.badge.low-stock {
    background-color: #d97706;
    color: white;
    font-weight: bold;
    border: 1px solid #92400e;
}


/* 検索結果なし（クスっと笑えるアニメーション） */
.no-data-content {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
    position: relative;
    overflow: hidden;
    background: var(--zebra-bg);
    border-radius: 8px;
}

.no-data-msg {
    position: relative;
    z-index: 10;
}

.ghost {
    font-size: 4rem;
    display: inline-block;
    animation: floatGhost 3s ease-in-out infinite;
    position: relative;
    z-index: 10;
}

.tumbleweed {
    font-size: 3rem;
    position: absolute;
    bottom: 2rem;
    left: -100px;
    animation: rollTumbleweed 6s linear infinite;
    z-index: 5;
}

@keyframes floatGhost {

    0%,
    100% {
        transform: translate3d(0, 0, 0) rotate(0deg);
        opacity: 0.8;
    }

    50% {
        transform: translate3d(0, -20px, 0) rotate(5deg);
        opacity: 1;
    }
}

@keyframes rollTumbleweed {
    0% {
        transform: translate3d(-100px, 0, 0) rotate(0deg);
    }

    100% {
        transform: translate3d(calc(100vw + 100px), 0, 0) rotate(1080deg);
    }
}

/* --- 時計を食べる大男（ゴリラ）アニメーション --- */
.eat-anim .ghost {
    animation: eatCharacter 1s infinite alternate ease-in-out;
}

.eat-anim .tumbleweed {
    animation: getEaten 2s infinite ease-in;
    font-size: 2rem;
    /* 食べられる時計 */
    bottom: 50%;
}

@keyframes eatCharacter {
    0% {
        transform: scale(1);
    }

    100% {
        transform: scale(1.3);
    }
}

@keyframes getEaten {
    0% {
        transform: translate3d(-50px, 0, 0) rotate(0deg);
        opacity: 1;
    }

    50% {
        transform: translate3d(80px, -50px, 0) scale(0.5) rotate(180deg);
        opacity: 1;
    }

    55% {
        transform: translate3d(100px, -60px, 0) scale(0.1) rotate(200deg);
        opacity: 0;
    }

    100% {
        transform: translate3d(100px, -60px, 0) scale(0) rotate(200deg);
        opacity: 0;
    }
}

/* --- 号泣する女とワイングラスアニメーション --- */
.crying-anim .ghost {
    animation: cryingShake 2s infinite ease-in-out;
}

.crying-anim .tumbleweed {
    animation: flyWineGlass 3s infinite cubic-bezier(.25, .46, .45, .94);
    font-size: 2.5rem;
    bottom: 2rem;
    left: 20%;
}

@keyframes cryingShake {

    0%,
    100% {
        transform: translate3d(0, 0, 0) scale(1.1);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translate3d(-5px, 0, 0) scale(1.1);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translate3d(5px, 0, 0) scale(1.1);
    }
}

@keyframes flyWineGlass {
    0% {
        transform: translate3d(100vw, -150px, 0) rotate(-720deg) scale(2);
        opacity: 1;
    }

    20% {
        transform: translate3d(50px, 50px, 0) rotate(-360deg) scale(2);
        opacity: 1;
    }

    30% {
        transform: translate3d(-100px, 150px, 0) rotate(0deg) scale(2);
        opacity: 1;
    }

    100% {
        transform: translate3d(-100px, 150px, 0) rotate(0deg) scale(2);
        opacity: 0;
    }
}

/* --- 西部風の手書きアニメーション --- */
.western-anim .no-data-msg {
    font-family: 'Times New Roman', serif;
}

.western-anim .ghost {
    animation: none;
    /* 手書きは揺れない */
    display: block;
    margin: 0 auto;
}

.western-anim .tumbleweed {
    animation: westernTumbleweed 5s linear infinite;
    font-size: 5rem;
    bottom: 1rem;
    filter: sepia(1);
    opacity: 0.8;
}

.western-anim .funny-msg {
    color: #4a2e15;
    font-weight: bold;
    font-size: 1.05rem;
    line-height: 1.6;
}

@keyframes westernTumbleweed {
    0% {
        transform: translate3d(calc(100vw + 100px), -20px, 0) rotate(0deg);
    }

    30% {
        transform: translate3d(50vw, -80px, 0) rotate(-360deg);
    }

    60% {
        transform: translate3d(0, -20px, 0) rotate(-720deg);
    }

    100% {
        transform: translate3d(-200px, -100px, 0) rotate(-1080deg);
    }
}

/* --- おみくじモーダル --- */
.omikuji-content {
    background: transparent;
    text-align: center;
    color: white;
    cursor: pointer;
}

#omikuji-box {
    width: 120px;
    height: 180px;
    background: #c0392b;
    margin: 0 auto;
    border-radius: 10px;
    position: relative;
    border: 4px solid #962d22;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    transition: transform 0.1s;
}

.omikuji-box-body {
    padding-top: 60px;
    font-weight: bold;
    font-size: 1.2rem;
    writing-mode: vertical-rl;
    text-orientation: upright;
    margin: 0 auto;
}

.omikuji-box-top {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 10px;
    background: #962d22;
    border-radius: 5px 5px 0 0;
}

#omikuji-result {
    background: white;
    color: #333;
    padding: 2rem;
    border-radius: 20px;
    box-shadow: 0 0 50px rgba(255, 215, 0, 0.5);
    max-width: 300px;
    margin: 0 auto;
    animation: resultPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes resultPop {
    from {
        transform: scale(0);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

#omikuji-text {
    font-size: 3rem;
    color: #e74c3c;
    margin-bottom: 0.5rem;
}

#omikuji-guide {
    margin-top: 1rem;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* おみくじを振るアニメーション */
.shaking {
    animation: shakeBox 0.1s infinite;
}

@keyframes shakeBox {
    0% {
        transform: translate(2px, 1px) rotate(0deg);
    }

    10% {
        transform: translate(-1px, -2px) rotate(-1deg);
    }

    20% {
        transform: translate(-3px, 0px) rotate(1deg);
    }

    30% {
        transform: translate(3px, 2px) rotate(0deg);
    }

    40% {
        transform: translate(1px, -1px) rotate(1deg);
    }

    50% {
        transform: translate(-1px, 2px) rotate(-1deg);
    }

    60% {
        transform: translate(-3px, 1px) rotate(0deg);
    }

    70% {
        transform: translate(3px, 1px) rotate(-1deg);
    }

    80% {
        transform: translate(-1px, -1px) rotate(1deg);
    }

    90% {
        transform: translate(1px, 2px) rotate(0deg);
    }

    100% {
        transform: translate(1px, -2px) rotate(-1deg);
    }
}

/* 特別演出：大吉 */
.result-daikichi {
    border: 5px solid gold !important;
    box-shadow: 0 0 100px gold !important;
    background: linear-gradient(135deg, #fff 0%, #fff9e6 100%) !important;
}

.result-daikichi h2 {
    color: #ffd700 !important;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.8);
    animation: luckyGlow 1s ease-in-out infinite alternate;
}

@keyframes luckyGlow {
    from {
        transform: scale(1);
        text-shadow: 0 0 10px gold;
    }

    to {
        transform: scale(1.1);
        text-shadow: 0 0 30px orange;
    }
}

/* 特別演出：大凶 */
.result-daikyo {
    background: #1a1a1a !important;
    color: #eee !important;
    border: 3px solid #4a0000 !important;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.9) !important;
}

.result-daikyo h2 {
    color: #ff0000 !important;
    text-shadow: 0 0 10px black;
}

.result-daikyo p {
    color: #ccc !important;
}

/* 画面揺れ演出 */
.shake-screen {
    animation: screenShake 0.5s cubic-bezier(.36, .07, .19, .97) both;
}

@keyframes screenShake {

    10%,
    90% {
        transform: translate3d(-1px, 0, 0);
    }

    20%,
    80% {
        transform: translate3d(2px, 0, 0);
    }

    30%,
    50%,
    70% {
        transform: translate3d(-4px, 0, 0);
    }

    40%,
    60% {
        transform: translate3d(4px, 0, 0);
    }
}

/* --- 棚卸在庫の直接入力フィールド フォーカス時 --- */
.shelf-stock-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

/* --- ドラッグ＆ドロップ用オーバーレイ --- */
.drop-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(79, 70, 229, 0.9);
    z-index: 9999;
    display: none;
    /* JSで制御 */
    pointer-events: none;
    /* デフォルトではクリックを妨げない */
    justify-content: center;
    align-items: center;
    color: white;
    backdrop-filter: blur(4px);
}

.drop-overlay.active {
    display: flex;
    pointer-events: auto;
    /* ドラッグ時のみイベントを受け取る */
}

.drop-message {
    text-align: center;
    border: 4px dashed rgba(255, 255, 255, 0.6);
    padding: 3rem 5rem;
    border-radius: 24px;
    background-color: rgba(255, 255, 255, 0.1);
}

.drop-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
    display: block;
    animation: bounce 1s infinite;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-20px);
    }
}

.drop-message p {
    font-size: 1.5rem;
    font-weight: 600;
}

/* --- メモの開閉スタイル --- */
.memo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px dashed #fde68a;
    margin-bottom: 0.25rem;
}

.toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    color: #92400e;
    padding: 0.2rem;
    line-height: 1;
    border-radius: 4px;
}

.toggle-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.memo-container.collapsed {
    width: auto;
    height: auto;
    padding: 0.5rem;
    transform: none;
}

.memo-container.collapsed label {
    padding-bottom: 0;
}

.memo-container.collapsed .memo-header {
    border-bottom: none;
    margin-bottom: 0;
}

.memo-container.collapsed #rules-memo {
    display: none;
}

/* メモコンテナの共通スタイル */
.memo-container.collapsed textarea {
    display: none;
}

.memo-container.collapsed {
    padding-bottom: 0;
}

.toggle-btn {
    background: #e2e8f0;
    border: none;
    padding: 2px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.toggle-btn:hover {
    background: #cbd5e1;
}

/* 改行禁止の共通設定 */
.tab-btn,
.main-tab-btn,
.filter-btn,
.batch-btn,
.badge,
.primary-btn,
.secondary-btn {
    white-space: nowrap !important;
}

/* 警告バナーのCSS */
.protocol-warning {
    background-color: #ff4d4d;
    color: white;
    padding: 1rem;
    text-align: center;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.95rem;
    line-height: 1.5;
    border: 2px solid #b30000;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    animation: fadeInDown 0.5s ease-out;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- レスポンシブ (スマホ対応: 詳細一覧形式) --- */
@media (max-width: 768px) {
    body {
        padding: 0.1rem;
    }

    .container {
        margin-top: 0.5rem;
    }

    header h1 {
        font-size: 1.25rem;
        margin-bottom: 0.25rem;
    }

    /* メモをスマホではアイコン的に右上に配置せず、タイトル下に自然に配置 */
    .memo-container {
        position: relative;
        top: auto;
        right: auto;
        margin: 0 auto 0.5rem auto;
        width: 100%;
        max-width: 260px;
        transform: none;
        box-shadow: var(--shadow);
        z-index: 1001;
    }

    /* テーブルを通常のテーブルとして表示しつつ、フォントサイズとパディングを極限まで絞る */
    .table-card {
        border-radius: 4px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        font-size: 0.75rem;
    }

    th,
    td {
        padding: 4px 2px !important;
        height: auto;
        line-height: 1.1;
        white-space: nowrap;
    }

    td::before {
        display: none !important;
    }

    /* 「色」列 (4番目) と 「ステータスバッジ」列 (8番目) をヘッダー・データ共に非表示 */
    th:nth-child(4), td:nth-child(4),
    th:nth-child(8), td:nth-child(8) {
        display: none !important;
    }

    /* 各列の幅調整 */
    .checkbox-col { width: 30px; }
    .cell-code { font-size: 0.7rem; min-width: 60px; }
    .cell-name { 
        font-size: 0.75rem; 
        font-weight: 600; 
        min-width: 100px; 
        white-space: nowrap !important; /* 折り返しを禁止して一行に固定 */
    }
    .cell-name .product-name-with-badges {
        display: flex;
        flex-wrap: nowrap;
        align-items: baseline;
        gap: 0.3rem;
    }
    .cell-name .p-name-main {
        flex-shrink: 1;
        min-width: 0;
    }
    .cell-name .p-color-sub {
        flex-shrink: 0;
        font-size: 0.7rem;
        color: var(--text-main) !important;
    }

    .status-btn {
        width: 24px;
        height: 24px;
        font-size: 0.75rem;
    }

    .status-btn-group { gap: 2px; }
    .shelf-stock-input {
        width: 40px;
        font-size: 0.8rem;
        padding: 1px;
    }

    .status-badge-cell, .status-badge-col {
        display: none;
    }

    .date-col {
        display: table-cell !important;
        width: 35px;
        min-width: 35px;
        font-size: 0.6rem;
        text-align: center;
        color: var(--text-main);
        padding: 4px 1px !important;
    }

    .action-col { width: 30px; }
    .action-btn { font-size: 0.8rem; }

    /* 検索コンテナ */
    .search-container {
        flex-direction: column;
        gap: 0.5rem;
        margin-bottom: 1rem;
        max-width: none;
    }

    #search-input {
        padding: 0.5rem 2rem 0.5rem 1rem;
        font-size: 0.9rem;
    }

    .header-actions {
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    .primary-btn,
    .secondary-btn,
    .main-tab-btn,
    .filter-btn,
    .batch-btn,
    .badge {
        white-space: nowrap !important;
    }

    .primary-btn,
    .secondary-btn,
    .main-tab-btn {
        padding: 0.4rem 0.5rem;
        font-size: 0.72rem;
        min-width: 0;
        flex: 1 0 auto; /* 折り返しを許容しつつ、極端に細くならないようにする */
        margin-left: 0;
    }

    .main-category-tab-container, .main-category-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        height: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* タブのスクロール */
    .category-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 4px;
        margin-bottom: 0.5rem;
        justify-content: flex-start;
        -webkit-overflow-scrolling: touch;
    }

    .tab-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.75rem;
        flex: 0 0 auto;
    }

    .filter-container {
        display: flex;
        overflow-x: auto;
        white-space: nowrap;
        gap: 6px;
        padding: 4px 1rem;
        margin-left: -0.5rem;
        margin-right: -0.5rem;
        justify-content: flex-start;
        -webkit-overflow-scrolling: touch;
    }

    .filter-btn {
        flex: 0 0 auto;
        padding: 0.4rem 0.8rem;
    }

    /* 一括操作バーのスマホ調整（Grid方式） */
    .batch-ops-container {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 0.8rem 0.4rem;
        padding: 0.8rem;
        align-items: center;
    }

    .batch-ops-container span:first-child {
        grid-column: 1 / 3; /* 左側50%を占有 */
        font-size: 0.82rem;
        font-weight: 700;
        white-space: nowrap;
        margin: 0;
    }

    .save-btn {
        grid-column: 3 / 5; /* 右側50%を占有 */
        justify-self: start; /* ラベルのすぐ横に配置 */
        width: auto !important;
        min-width: 140px; /* 文字切れ防止 */
        margin: 0 !important;
        font-size: 0.75rem !important;
        padding: 0.5rem 0.6rem !important;
        background-color: #10b981;
        white-space: nowrap;
    }

    .batch-btn {
        grid-row: 2; /* 明示的に2段目に配置 */
        padding: 0.5rem 0;
        font-size: 0.75rem;
        width: 100%;
        text-align: center;
    }

    /* 区切り線は全て非表示 */
    .batch-divider {
        display: none;
    }
}

/* --- 挨拶メッセージ (おみくじ風・全画面オーバーレイ) --- */
.greeting-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20000;
    backdrop-filter: blur(8px);
    animation: fadeIn 0.4s ease-out forwards;
    cursor: pointer;
}

.greeting-modal {
    background: white;
    padding: 2.5rem 2rem;
    border-radius: 24px;
    width: 85%;
    max-width: 450px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    border: 3px solid #fde68a;
    animation: modalPopIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    cursor: default; /* モーダル上はデフォルトカーソル */
}

.greeting-modal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 6px;
    background: linear-gradient(90deg, #f59e0b, #fde68a, #f59e0b);
}

.greeting-modal .toast-title {
    font-size: 1.6rem;
    font-weight: bold;
    color: #b45309;
    margin-bottom: 1.2rem;
    display: block;
}

.greeting-modal .toast-body {
    font-size: 1.1rem;
    color: #4b5563;
    line-height: 1.6;
    word-break: break-all;
}

.greeting-overlay.fade-out {
    animation: fadeOut 0.6s ease-in forwards;
}

@keyframes modalPopIn {
    from { transform: scale(0.8) translateY(20px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* ダークモードや夜の雰囲気に合わせた自動調整 */
@media (prefers-color-scheme: dark) {
    .greeting-modal {
        background: #1a1a1a;
        border-color: #f59e0b;
    }
    .greeting-modal .toast-title { color: #fde68a; }
    .greeting-modal .toast-body { color: #f3f4f6; }
}

/* スマホ用調整 */
@media (max-width: 768px) {
    .greeting-modal {
        padding: 2rem 1.5rem;
        width: 85%;
    }
    .greeting-modal .toast-title {
        font-size: 1.4rem;
    }
    .greeting-modal .toast-body {
        font-size: 1.1rem;
    }
}