body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
    background: #f3f3f7;
    margin: 0;
    padding: 0;
}

#app {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px;
}

h1,
h2,
h3 {
    margin-top: 0;
}

section {
    margin-bottom: 24px;
    background: #fff;
    border-radius: 8px;
    padding: 16px 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.field {
    margin-bottom: 12px;
}

label {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 4px;
}

input[type="text"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 6px 8px;
    border-radius: 4px;
    border: 1px solid #ccc;
    box-sizing: border-box;
    font-size: 0.9rem;
}

textarea {
    resize: vertical;
}

.choice-block {
    border-top: 1px solid #eee;
    padding-top: 12px;
    margin-top: 12px;
}

.choice-block.hidden {
    display: none;
}

.actions-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

button {
    padding: 8px 14px;
    border-radius: 4px;
    border: none;
    background: #0070f3;
    color: #fff;
    font-size: 0.95rem;
    cursor: pointer;
}

button:disabled {
    background: #999;
    cursor: not-allowed;
}

#status {
    font-size: 0.9rem;
}

.error-message {
    color: #d00;
    font-size: 0.85rem;
}

.hidden {
    display: none;
}

/* パスワード欄 */
.password-box {
    margin-bottom: 12px;
}

.password-box label {
    display: inline-block;
    margin-right: 6px;
}

.password-box input[type="password"] {
    width: 220px;
    display: inline-block;
}

.password-status {
    margin-left: 10px;
    color: #d00;
    font-size: 0.9rem;
}

/* 結果表示カード */
.result-card {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
    background: #fff;
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.result-card img {
    max-width: 384px;
    height: auto;
    border-radius: 4px;
    border: 1px solid #ddd;
    background: #eee;
}

.result-info {
    flex: 1;
}

.result-filename {
    font-weight: bold;
    margin-bottom: 8px;
}

.result-buttons {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.result-scene {
    font-size: 0.85rem;
    color: #555;
    margin-top: 6px;
}

/* 全体用プログレスバー（インジケータ） */
.progress {
    position: relative;
    width: 100%;
    height: 4px;
    background: #ddd;
    overflow: hidden;
    border-radius: 999px;
    margin-bottom: 12px;
}

.progress-bar {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 30%;
    background: #0070f3;
    animation: progress-indeterminate 1s linear infinite;
}

@keyframes progress-indeterminate {
    0% {
        left: -30%;
    }
    100% {
        left: 100%;
    }
}

/* カードごとのプログレスバー（再生成中だけ表示） */
.card-progress {
    position: relative;
    width: 100%;
    height: 3px;
    background: #eee;
    overflow: hidden;
    border-radius: 999px;
    margin-top: 6px;
    display: none; /* 通常は非表示 */
}

.card-progress-bar {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40%;
    background: #0070f3;
    animation: progress-indeterminate 1s linear infinite;
}

/* 再生成中はうっすらオーバーレイ＋プログレスバー表示 */
.result-card.loading::after {
    content: "再生成中...";
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    color: #333;
}

.result-card.loading .card-progress {
    display: block;
}
