.mask-color-simulator {
max-width: 1100px;
margin: auto;
background: #ffffff;
border-radius: 12px;
padding: 20px;
}

/* ===== メイン構造 ===== */
.mask-simulator-container {
display: flex;
justify-content: space-between;
gap: 10px;
}

/* === 左カラム === */
.mask-left-column {
display: flex;
width: 100%;
border: 1px solid #ccc;
padding: 10px;
justify-content: space-evenly;
box-sizing: border-box;
}

.mask-thumbnail-area {
flex: 1;
display: flex;
flex-direction: column;
}

.mask-thumbnail-list {
display: flex;
flex-direction: row;
flex-wrap: wrap;
gap: 10px;
border: 1px solid #ccc;
padding: 5px;
overflow-y: visible;
margin-top: 10px;
min-height: 100px;
}

.mask-thumbnail-title {
flex-basis: 100%;
margin: 0;
padding-bottom: 5px;
border-bottom: 1px solid #ddd;
font-size: 14px;
color: #555;
font-weight: 600;
}

.mask-sub-preview-title {
margin: 5px 0;
padding-bottom: 5px;
border-bottom: 1px solid #ddd;
font-size: 12px;
color: #555;
font-weight: 600;
}

.mask-thumbnail-wrapper {
position: relative;
width: 90px;
height: 90px;
}

.mask-thumbnail-list img {
width: 90px;
height: 90px;
object-fit: cover;
border: 1px solid #ccc;
border-radius: 6px;
cursor: pointer;
transition: transform 0.2s ease, border-color 0.2s ease;
}

.mask-thumbnail-list img:hover {
transform: scale(1.05);
border-color: #007bff;
}

.mask-thumbnail-delete-btn {
position: absolute;
top: -4px;
right: -8px;
width: 24px;
height: 24px;
background: #ff4444;
color: white;
border: 1px solid white;
border-radius: 50%;
cursor: pointer;
font-size: 16px;
font-weight: bold;
line-height: 1;
padding: 0;
display: flex;
align-items: center;
justify-content: center;
transition: background 0.2s ease, transform 0.2s ease;
z-index: 100;
}

.mask-thumbnail-delete-btn:hover {
background: #cc0000;
transform: scale(1.1);
}

/* メイン領域 */
.mask-main-area {
width: 100%;
display: flex;
flex-direction: column;
gap: 10px;
}

/* コントロール行 */
.mask-controls-row {
display: flex;
flex-direction: column;
gap: 10px;
width: 100%;
}

.mask-preview-wrapper {
display: flex;
gap: 10px;
width: 100%;
position: relative;
min-height: 120px;
}

/* メインプレビュー */
.mask-main-preview {
position: relative;
border: 1px solid #ccc;
width: 500px;
height: 360px;
min-height: 360px;
display: flex;
justify-content: center;
align-items: center;
background: #f9f9f9;
cursor: pointer;
width: 100%;
}

.mask-main-preview-placeholder {
font-size: 18px;
color: #999;
font-weight: 500;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}

.mask-main-preview img {
max-width: 100%;
max-height: 100%;
object-fit: contain;
}

/* アップロードボタン */
.mask-upload-button-container {
display: flex;
justify-content: center;
gap: 10px;
}

.mask-upload-button {
padding: 10px 20px;
background: #4caf50;
color: white;
border: none;
border-radius: 6px;
cursor: pointer;
font-size: 14px;
font-weight: bold;
transition: background 0.3s;
}

.mask-upload-button:hover {
background: #45a049;
}

.mask-retry-button {
padding: 10px 20px;
background: #ff9800;
color: white;
border: none;
border-radius: 6px;
cursor: pointer;
font-size: 14px;
font-weight: bold;
transition: background 0.3s;
}

.mask-retry-button:hover {
background: #f57c00;
}

.mask-retry-button:disabled {
background: #ccc;
cursor: not-allowed;
opacity: 0.6;
}

/* サブプレビュー */
.mask-sub-preview-list {
display: none;
flex-direction: column;
gap: 10px;
border: 1px solid #ccc;
padding: 10px;
flex: 1;
}

.mask-sub-preview-list.show {
display: flex;
}

.mask-sub-preview {
width: 110px;
height: 110px;
border: 1px solid #ccc;
border-radius: 6px;
display: flex;
justify-content: center;
align-items: center;
background: #fafafa;
}

.mask-sub-preview img {
width: 100%;
height: 100%;
object-fit: cover;
border-radius: 4px;
}

/* === 右カラム === */
.mask-right-column {
width: 640px;
display: flex;
flex-direction: column;
border: 1px solid #ccc;
padding: 10px;
box-sizing: border-box;
}

/* タブ */
.mask-tab-buttons {
display: flex;
justify-content: space-between;
}

.mask-tab-btn {
flex: 1;
padding: 5px 0;
border: 1px solid #ccc;
cursor: pointer;
background: #f4f4f4;
transition: 0.2s;
font-size: 14px;
}

.mask-tab-btn.active {
background: #222;
color: #fff;
}

.mask-tab-btn[disabled] {
background: #e0e0e0;
color: #999;
cursor: not-allowed;
opacity: 0.6;
}

/* === やり直しボタンセクション === */
.mask-retry-section {
margin: 10px 0;
padding: 10px;
background: #f9f9f9;
border: 1px solid #ddd;
border-radius: 6px;
box-sizing: border-box;
display: flex;
flex-direction: column;
justify-content: space-between;
}

.mask-retry-description {
margin: 0 0 8px 0;
font-size: 11px;
color: #666;
line-height: 1.4;
}

.mask-warning-note {
margin: 0 0 8px 0;
font-size: 10px;
color: #ff6b00;
line-height: 1.4;
background: #fff3e0;
padding: 6px 8px;
border-radius: 4px;
border-left: 3px solid #ff9800;
}

.mask-part-retry-button {
width: 100%;
padding: 8px 15px;
background: #ff9800;
color: white;
border: none;
border-radius: 6px;
cursor: pointer;
font-size: 14px;
font-weight: bold;
transition: background 0.3s;
}

.mask-part-retry-button:hover {
background: #f57c00;
}

.mask-part-retry-button:disabled {
background: #ccc;
cursor: not-allowed;
opacity: 0.6;
}

/* === 範囲選択確認・キャンセルボタン === */
.mask-confirm-button {
flex: 1;
padding: 8px 10px;
background: #4caf50;
color: white;
border: none;
border-radius: 6px;
cursor: pointer;
font-size: 10px;
font-weight: bold;
transition: background 0.3s;
white-space: nowrap;
}

.mask-confirm-button:hover {
background: #45a049;
}

.mask-reset-button {
flex: 1;
padding: 8px 10px;
background: #ff9800;
color: white;
border: none;
border-radius: 6px;
cursor: pointer;
font-size: 10px;
font-weight: bold;
transition: background 0.3s;
white-space: nowrap;
}

.mask-reset-button:hover {
background: #f57c00;
}

.mask-cancel-button {
flex: 1;
padding: 8px 10px;
background: #757575;
color: white;
border: none;
border-radius: 6px;
cursor: pointer;
font-size: 10px;
font-weight: bold;
transition: background 0.3s;
white-space: nowrap;
}

.mask-cancel-button:hover {
background: #616161;
}

.mask-undo-button {
flex: 1;
padding: 8px 10px;
background: #2196f3;
color: white;
border: none;
border-radius: 6px;
cursor: pointer;
font-size: 10px;
font-weight: bold;
transition: background 0.3s;
white-space: nowrap;
}

.mask-undo-button:hover {
background: #1976d2;
}

.mask-undo-button:disabled {
background: #ccc;
cursor: not-allowed;
opacity: 0.6;
}

.mask-redo-button {
flex: 1;
padding: 8px 10px;
background: #00bcd4;
color: white;
border: none;
border-radius: 6px;
cursor: pointer;
font-size: 10px;
font-weight: bold;
transition: background 0.3s;
white-space: nowrap;
}

.mask-redo-button:hover {
background: #0097a7;
}

.mask-redo-button:disabled {
background: #ccc;
cursor: not-allowed;
opacity: 0.6;
}

/* === カラー履歴 === */
.mask-color-history {
display: flex;
flex-wrap: wrap;
gap: 5px;
margin-bottom: 10px;
padding: 5px;
border: 1px solid #ddd;
border-radius: 4px;
min-height: 30px;
}

.mask-color-swatch {
width: 25px;
height: 25px;
border: 1px solid #ccc;
border-radius: 3px;
cursor: pointer;
transition: transform 0.2s;
}

.mask-color-swatch:hover {
transform: scale(1.1);
}

/* === カラーパネル === */
.mask-color-picker-area {
overflow-y: scroll;
border: 1px solid #ccc;
padding: 12px;
display: grid;
grid-template-columns: repeat(8, 1fr);
gap: 5px;
background: #fff;
align-content: start;
}

.mask-color-block {
width: 100%;
height: 50px;
border: 1px solid rgba(0, 0, 0, 0.15);
cursor: pointer;
transition: all 0.2s ease;
box-sizing: border-box;
border-radius: 6px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.mask-color-block:hover {
transform: translateY(-2px);
border-color: #007bff;
box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

.mask-color-block.selected {
border: 2px solid #007bff;
box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15), 0 2px 6px rgba(0, 123, 255, 0.3);
transform: translateY(-1px);
}

/* メインカラーブロック */
.mask-main-color {
grid-column: span 1;
width: 100%;
height: 35px !important;
border-radius: 6px;
font-size: 9px;
font-weight: 600;
color: rgba(0, 0, 0, 0.75);
display: flex;
align-items: center;
justify-content: center;
text-shadow:
0 1px 2px rgba(255, 255, 255, 0.95),
0 -1px 2px rgba(255, 255, 255, 0.95),
1px 0 2px rgba(255, 255, 255, 0.95),
-1px 0 2px rgba(255, 255, 255, 0.95);
border: 2px solid rgba(0, 0, 0, 0.1);
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
transition: all 0.2s ease;
}

.mask-main-color:hover {
transform: translateY(-2px);
box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
border-color: rgba(0, 0, 0, 0.2);
}

.mask-main-color.active-main-color {
border: 2px solid #007bff;
box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.2), 0 3px 10px rgba(0, 123, 255, 0.3);
transform: translateY(-1px);
}

/* サブカラーブロック */
.mask-sub-color {
grid-column: span 1;
height: 35px !important;
}

/* メインカラーとサブカラーの区切り線 */
.mask-color-divider {
grid-column: 1 / -1;
height: 1px;
background: #ddd;
margin: 5px 0;
}

/* === アップロード部分 === */
.mask-simulate-controls {
text-align: center;
}

.mask-simulate-button {
display: inline-block;
padding: 10px 20px;
background: #4b73ff;
color: white;
border: none;
border-radius: 6px;
cursor: pointer;
transition: background 0.3s;
font-size: 14px;
font-weight: bold;
}

.mask-simulate-button:hover {
background: #4b73ff;
}

.mask-simulate-button:disabled {
background: #999;
cursor: not-allowed;
opacity: 0.7;
}

.mask-simulate-button.loading {
animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.6; }
}

/* === ギャラリー === */
.mask-gallery-container {
margin-top: 20px;
background: rgb(245, 251, 234);
padding: 10px;
border: 1px solid #ccc;
}

.mask-gallery-items {
display: flex;
overflow-x: auto;
gap: 10px;
padding-bottom: 10px;
}


.mask-gallery-item {
display: flex;
flex-direction: column;
gap: 5px;
flex-shrink: 0;
cursor: pointer;
}

.mask-gallery-item-image-wrapper {
position: relative;
width: 120px;
height: 120px;
}

.mask-gallery-item-count-badge {
position: absolute;
top: 5px;
right: 5px;
background: rgba(75, 115, 255, 0.9);
color: white;
padding: 3px 8px;
border-radius: 12px;
font-size: 11px;
font-weight: bold;
box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.mask-gallery-item-colors {
display: flex;
flex-direction: column;
gap: 3px;
background: #fff;
padding: 4px 6px;
border-radius: 4px;
border: 1px solid #ddd;
height: 44px;
box-sizing: border-box;
justify-content: center;
}

.mask-color-status-inline {
display: flex;
align-items: center;
gap: 4px;
font-size: 10px;
}

.mask-color-display-mini {
display: inline-block;
padding: 2px 6px;
border-radius: 3px;
font-size: 10px;
min-width: 50px;
text-align: center;
box-sizing: border-box;
}

.mask-gallery-item-image-wrapper img {
width: 100%;
height: 100%;
object-fit: cover;
border-radius: 4px;
border: 1px solid #ccc;
}

.mask-current-colors {
margin-top: 10px;
display: flex;
gap: 20px;
margin-bottom: 10px;
align-items: center;
justify-content: space-evenly;
}
.mask-color-status {
display: flex;
flex-direction: column;
align-items: center;
gap: 4px;
font-size: 14px;
}
.mask-color-display {
display: inline-block;
width: 80px;
min-width: 80px;
max-width: 80px;
height: 24px;
min-height: 24px;
max-height: 24px;
padding: 4px 8px;
border-radius: 4px;
background: lightgray;
border: 1px solid #ccc;
text-align: center;
line-height: 16px;
color: #333;
font-size: 14px;
box-sizing: border-box;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.mask-color-display.has-color {
color: white;
border: none;
}

/* === カラーリセットボタン === */
.mask-color-reset-section {
margin-top: 10px;
text-align: center;
}

.mask-color-reset-button {
width: 100%;
padding: 8px 15px;
background: #757575;
color: white;
border: none;
border-radius: 6px;
cursor: pointer;
font-size: 14px;
font-weight: bold;
transition: background 0.3s;
}

.mask-color-reset-button:hover {
background: #616161;
}

.mask-color-reset-button:disabled {
background: #ccc;
cursor: not-allowed;
opacity: 0.6;
}

/* === 画像準備状況インジケーター === */
.image-progress-indicator {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(255, 255, 255, 0.95);
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
z-index: 10;
border-radius: 8px;
}

.progress-spinner {
width: 40px;
height: 40px;
border: 4px solid #e0e0e0;
border-top: 4px solid #4b73ff;
border-radius: 50%;
animation: spin 1s linear infinite;
}

@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}

.progress-text {
margin-top: 8px;
color: #333;
font-size: 8px;
font-weight: 500;
text-align: center;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: 100%;
padding: 0 4px;
}

.progress-time {
margin-top: 4px;
color: #666;
font-size: 8px;
}

.progress-complete {
color: #4caf50;
font-weight: bold;
font-size: 14px;
}

/* === エラー通知 === */
.mask-error-notification {
position: fixed;
top: 20px;
left: 50%;
transform: translateX(-50%);
background: #ff4444;
color: white;
padding: 15px 25px;
border-radius: 8px;
box-shadow: 0 4px 12px rgba(0,0,0,0.3);
z-index: 10000;
animation: slideDown 0.3s ease-out;
display: flex;
align-items: center;
gap: 10px;
min-width: 320px;
}

.mask-error-notification::before {
content: "⚠️";
font-size: 22px;
flex-shrink: 0;
}

.mask-error-notification-content {
display: flex;
flex-direction: column;
gap: 2px;
}

.mask-error-notification-title {
font-size: 12px;
font-weight: 600;
opacity: 0.85;
text-transform: uppercase;
letter-spacing: 0.5px;
}

.mask-error-notification-message {
font-size: 14px;
font-weight: 500;
}

@keyframes slideDown {
from {
opacity: 0;
transform: translateX(-50%) translateY(-20px);
}
to {
opacity: 1;
transform: translateX(-50%) translateY(0);
}
}

/* === スマホ用スタイル === */
@media (max-width: 768px) {
.mask-color-simulator {
padding: 15px;
}

/* メイン構造を縦並びに（順序を逆転） */
.mask-simulator-container {
flex-direction: column;
gap: 15px;
}

/* 左カラムを縦並びに */
.mask-left-column {
width: 100%;
flex-direction: column;
gap: 15px;
box-sizing: border-box;
}

/* サムネイルエリアを横幅いっぱいに */
.mask-thumbnail-area {
width: 100%;
margin-right: 0;
display: flex;
flex-direction: column;
margin-right: 10px;
}

/* サムネイルリストを横並びに */
.mask-thumbnail-list {
width: 100%;
height: auto;
min-height: 100px;
overflow-x: auto;
overflow-y: hidden;
box-sizing: border-box;
display: block;
}

.mask-thumbnail-title {
text-align: left;
margin: 0 0 8px 0;
padding-bottom: 8px;
border-bottom: 1px solid #ddd;
display: block;
}

/* サムネイル画像を横並びに */
.mask-thumbnail-list {
white-space: nowrap;
}

.mask-thumbnail-wrapper {
display: inline-block;
flex-shrink: 0;
}

/* メインエリア */
.mask-main-area {
width: 100%;
}

.mask-main-preview {
width: 100%;
height: 250px;
min-height: 250px;
}

/* サブプレビュー */
.mask-sub-preview-list {
width: 100%;
flex-wrap: wrap;
}

.mask-sub-preview {
width: calc(50% - 5px);
height: 120px;
}

/* 右カラム */
.mask-right-column {
width: 100%;
box-sizing: border-box;
}

/* カラーピッカー */
.mask-color-picker-area {
grid-template-columns: repeat(8, 1fr);
}

.mask-main-color {
font-size: 8px;
height: auto !important;
aspect-ratio: 1;
}

.mask-sub-color {
height: auto !important;
aspect-ratio: 1;
}

/* 現在の色表示 */
.mask-current-colors {
justify-content: center;
}

/* ギャラリー */
.mask-gallery-item-image-wrapper {
width: 100px;
height: 100px;
}

/* エラー通知 */
.mask-error-notification {
min-width: auto;
max-width: 90%;
left: 5%;
transform: none;
}

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

/* 外壁・屋根のキャンセルボタンとやり直しボタンを非表示 */
#mask-wall-cancel-button,
#mask-wall-redo-button,
#mask-roof-cancel-button,
#mask-roof-redo-button {
display: none;
}

}
/* === 通知ポップアップ（成功・エラー共通）=== */
.mask-app-notification {
position: fixed;
top: 20px;
right: 20px;
background: white;
color: #333;
padding: 10px 15px;
border-radius: 6px;
box-shadow: 0 4px 12px rgba(0,0,0,0.2);
z-index: 10000;
animation: slideIn 0.3s ease-out;
display: flex;
align-items: flex-start;
gap: 10px;
min-width: 250px;
max-width: 400px;
font-size: 12px;
line-height: 1.4;
}

.mask-notification-content {
display: flex;
align-items: center;
gap: 10px;
}

.mask-notification-icon {
font-size: 16px;
line-height: 1;
flex-shrink: 0;
}

.mask-notification-message {
font-size: 12px;
line-height: 1.4;
}

/* 成功通知のスタイル */
.mask-success-notification {
border-left: 5px solid #4caf50; /* 緑のボーダー */
}

/* エラー通知のスタイル (既存のものを上書き) */
.mask-error-notification {
background: #fff;
border-left: 5px solid #ff4444; /* 赤のボーダー */
color: #333;
}
.mask-error-notification .mask-notification-icon {
color: #ff4444;
}

@keyframes slideIn {
from {
opacity: 0;
transform: translateX(100%);
}
to {
opacity: 1;
transform: translateX(0);
}
}

/* === 左上通知ポップアップ === */
.mask-topleft-notification {
position: fixed;
top: 20px;
left: 20px;
background: white;
color: #333;
padding: 15px 25px;
border-radius: 8px;
box-shadow: 0 4px 12px rgba(0,0,0,0.2);
z-index: 10000;
animation: slideInLeft 0.3s ease-out;
display: flex;
align-items: center;
gap: 15px;
min-width: 250px;
font-size: 14px;
border-left: 5px solid #4caf50;
}

.mask-topleft-notification .mask-notification-icon {
font-size: 20px;
line-height: 1;
}

@keyframes slideInLeft {
from {
opacity: 0;
transform: translateX(-100%);
}
to {
opacity: 1;
transform: translateX(0);
}
}

