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

:root {
    --primary-color: #b71c1c;
    --primary-dark: #8d1515;
    --secondary-color: #8d6e63;
    --accent-color: #ffa726;
    --success-color: #2e7d32;
    --warning-color: #f57c00;
    --error-color: #d32f2f;
    --text-primary: #333;
    --text-secondary: #666;
    --border-color: #ddd;
    --background: #f0f0f0;
    --surface: #fff;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --shadow-hover: 0 4px 20px rgba(0,0,0,0.15);
    --transition: all 0.3s ease;
}

body {
    font-family: "Hiragino Kaku Gothic ProN", "Noto Sans JP", system-ui, sans-serif;
    background: var(--background);
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    min-height: 100vh;
}

/* エラーメッセージ */
.error-message {
    background: #ffebee;
    border: 1px solid var(--error-color);
    color: var(--error-color);
    padding: 12px 16px;
    border-radius: 4px;
    margin: 10px 0;
    display: none;
    animation: fadeIn 0.3s ease;
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    box-shadow: var(--shadow);
    max-width: 400px;
}

.error-message.show {
    display: block;
}

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

/* 左側ナビゲーション */
.sidebar {
    width: 320px;
    background: var(--surface);
    padding: 20px;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.sidebar-title {
    font-size: 18px;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.sidebar-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
    margin: 20px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    width: 0%;
    transition: width 0.5s ease;
}

.step-nav {
    list-style: none;
}

.step-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: var(--transition);
}

.step-item:hover {
    background: #f8f9fa;
    margin: 0 -10px;
    padding-left: 10px;
    padding-right: 10px;
    border-radius: 5px;
}

.step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #ccc;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-right: 12px;
    font-size: 14px;
    transition: var(--transition);
}

.step-number.active {
    background: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(183, 28, 28, 0.2);
}

.step-number.completed {
    background: var(--success-color);
}

.step-number.completed::after {
    content: "✓";
    font-size: 12px;
}

.step-title {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
}

.step-item.active .step-title {
    color: var(--primary-color);
    font-weight: 600;
}

.hidden {
    display: none;
}

/* メインコンテンツ */
.main-content {
    flex: 1;
    padding: 20px;
    max-width: calc(100vw - 340px);
}

.content-card {
    background: var(--surface);
    border-radius: 12px;
    padding: 0;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

/* 価格表示ヘッダー */
.price-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 20px 30px;
    position: relative;
    overflow: hidden;
    border-radius: 12px 12px 0 0;
}

.price-label {
    font-size: 16px;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.price-display-section {
    background: white;
    padding: 30px;
    border-radius: 0 0 12px 12px;
    border: 2px solid var(--primary-color);
    border-top: none;
    text-align: center;
    margin-bottom:20px;
}

.price-display {
    display: flex;
    align-items: center;
    justify-content: center;
}

.price-amount {
    font-size: 48px;
    font-weight: bold;
    font-family: 'DIN2014';
    color: var(--primary-color);
    line-height: 1;
}

.price-details {
    display: flex;
    flex-direction: column;
    font-size: 14px;
    margin-left: 8px;
}

.price-unit {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
}

.tax-label {
    font-size: 14px;
    color: var(--primary-color);
    margin-bottom: 2px;
    line-height: 1;
    text-align: left;
}

/* 選択サマリ */
.selection-summary {
    padding: 25px 30px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.funeral-type-tag {
    background: linear-gradient(135deg, var(--accent-color) 0%, #ff9800 100%);
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    display: inline-block;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(255, 167, 38, 0.3);
}

.summary-content {
    display: flex;
    align-items: center;
    gap: 20px;
}

.summary-image {
    width: 140px;
    height: 90px;
    background: linear-gradient(135deg, #e0e0e0 0%, #f5f5f5 100%);
    border-radius: 8px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 12px;
}

.summary-details {
    flex: 1;
}

.summary-list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px;
    font-size: 14px;
}

.summary-item {
    position: relative;
    padding-left: 16px;
    color: var(--text-primary);
}

.summary-item::before {
    content: "●";
    color: var(--primary-color);
    position: absolute;
    left: 0;
    font-weight: bold;
}

/* メインタイトル */
.main-title {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #795548 100%);
    color: white;
    text-align: center;
    padding: 25px;
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    position: relative;
}

.main-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: var(--accent-color);
}

.title-note {
    background: var(--secondary-color);
    color: white;
    text-align: center;
    padding: 8px 25px;
    font-size: 14px;
    font-weight: normal;
    margin: 0;
}

/* 選択エリア */
.selection-area {
    padding: 35px;
}

.selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 25px;
    margin-bottom: 35px;
}

.selection-card {
    border: 2px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
    background: var(--surface);
    position: relative;
}

.selection-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.selection-card.selected {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, #fff8f8 0%, #ffebee 100%);
    box-shadow: 0 4px 20px rgba(183, 28, 28, 0.15);
}

.selection-card.selected::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
}

.card-header {
    background: #f8f9fa;
    padding: 18px 20px;
    position: relative;
    border-bottom: 1px solid var(--border-color);
}

.card-header.selected {
    background: linear-gradient(135deg, #e8f5e8 0%, #f1f8e9 100%);
}

.selection-icon {
    position: absolute;
    top: 15px;
    left: 18px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: white;
    transition: var(--transition);
}

.selection-icon.selected {
    background: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(183, 28, 28, 0.2);
}

.selection-icon.selected::after {
    content: "✓";
    color: white;
    font-size: 12px;
    font-weight: bold;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.card-title {
    text-align: center;
    font-weight: 600;
    margin-left: 30px;
    font-size: 16px;
    color: var(--text-primary);
}

.card-note {
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 5px;
    margin-left: 30px;
}

.card-body {
    padding: 25px;
}

.card-image,.card-image img {
    width: 100%;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.card-description {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.5;
}

.card-price {
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-color);
    margin-top: 15px;
}

/* 修正3: 参列者人数注記の右寄せスタイル */
.participant-count-note {
    display: block;
    text-align: right;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ドロップダウン */
.dropdown-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    margin-bottom: 35px;
}

.dropdown-item {
    text-align: center;
}

.dropdown-label {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 12px;
    margin-bottom: 12px;
    border-radius: 6px;
    font-weight: 600;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.dropdown {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    background: var(--surface);
    transition: var(--transition);
    cursor: pointer;
}

.dropdown:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(183, 28, 28, 0.1);
}

.dropdown:hover {
    border-color: var(--primary-color);
}

/* 大きな選択カード */
.large-selection {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 35px;
}

.large-card {
    border: 2px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
    background: var(--surface);
    position: relative;
}

.large-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.large-card.selected {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, #fff8f8 0%, #ffebee 100%);
    box-shadow: 0 4px 20px rgba(183, 28, 28, 0.15);
}

.large-card-header {
    background: #f8f9fa;
    padding: 18px;
    position: relative;
    text-align: center;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}

.large-card-header.selected {
    background: linear-gradient(135deg, #e8f5e8 0%, #f1f8e9 100%);
}

.large-card-body {
    padding: 25px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.large-card-image, .large-card-image img {
    width: 100%;
    border-radius: 8px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

.price-details {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* 3カラム選択 */
.three-column-selection {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 35px;
}

/* 4カラム選択 */
.four-column-selection {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 35px;
}

/* オプション選択 */
.option-selection {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 35px;
}

.option-card {
    border: 2px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
    background: var(--surface);
    position: relative;
}

.option-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.option-card.selected {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, #fff8f8 0%, #ffebee 100%);
    box-shadow: 0 4px 20px rgba(183, 28, 28, 0.15);
}

/* ボタン */
.button-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 35px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-top: 1px solid var(--border-color);
}

.btn {
    padding: 14px 32px;
    border: 2px solid;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    min-width: 140px;
    position: relative;
    overflow: hidden;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn:hover:not(:disabled)::before {
    left: 100%;
}

.btn-back {
    background: var(--surface);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-back:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(183, 28, 28, 0.3);
}

.btn-next {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border-color: var(--primary-color);
}

.btn-next:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary-dark) 0%, #6d1010 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(183, 28, 28, 0.4);
}

.btn-consult {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #795548 100%);
    color: white;
    border: none;
    padding: 16px 40px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
    margin: 20px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-consult:hover {
    background: linear-gradient(135deg, #795548 0%, #5d4037 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(141, 110, 99, 0.4);
}

/* 注意書き */
.notice {
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 25px;
    padding: 12px;
    background: #fff3e0;
    border-radius: 6px;
    border: 1px solid #ffcc02;
}

.bottom-notice {
    text-align: center;
    color: var(--text-secondary);
    font-size: 12px;
    margin-top: 25px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
}

/* ステップ表示 */
.step {
    display: none;
    animation: slideIn 0.4s ease;
}

.step.active {
    display: block;
}

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

/* フォーム */
.form-container {
    padding: 40px;
}

.form-section {
    margin-bottom: 30px;
}

.form-section h3 {
    font-size: 16px;
    margin-bottom: 20px;
    color: var(--text-primary);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 8px;
}

.form-row {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 20px;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px 0;
    border-bottom: 1px solid #f0f0f0;
}

.form-label {
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.required {
    background: var(--primary-color);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 500;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    transition: var(--transition);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(183, 28, 28, 0.1);
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
}

.radio-group {
    display: flex;
    gap: 20px;
}

.radio-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.radio-item input[type="radio"] {
    transform: scale(1.2);
}

/* 結果表示 */
.result-section {
    background: var(--surface);
    border-radius: 12px;
    margin-top: 25px;
    box-shadow: var(--shadow);
    display: none;
    overflow: hidden;
}

.result-section.show {
    display: block;
    animation: fadeInUp 0.5s ease;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 25px;
    text-align: center;
    font-size: 20px;
    font-weight: 600;
    position: relative;
}

.result-content {
    padding: 35px;
}

.result-summary {
    background: var(--surface);
    border: 2px solid var(--primary-color);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.summary-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 20px;
    text-align: center;
    position: relative;
}

.summary-table {
    width: 100%;
    border-collapse: collapse;
}

.summary-table th,
.summary-table td {
    padding: 15px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.summary-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: var(--text-primary);
}

.summary-table td {
    color: var(--text-primary);
}

.summary-table .price {
    text-align: right;
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

.summary-total {
    background: var(--primary-color);
    color: white;
    font-size: 24px;
    font-weight: bold;
    text-align: center;
    padding: 20px;
}

.detail-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.detail-table th,
.detail-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.detail-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: var(--text-primary);
}

.detail-table td {
    color: var(--text-primary);
}

.result-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin: 30px 0;
}

.btn-restart {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-restart:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.simulation-details {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}

.simulation-title {
    background: var(--secondary-color);
    color: white;
    padding: 12px 20px;
    border-radius: 20px;
    display: inline-block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 15px;
}

.creation-date {
    color: var(--text-secondary);
    font-size: 12px;
    margin-top: 15px;
}

.note {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border: 1px solid #ffeaa7;
    color: #856404;
    padding: 18px;
    border-radius: 8px;
    margin-top: 25px;
    font-size: 12px;
    line-height: 1.6;
}

/* 確認画面スタイル */
.confirmation-section {
    display: none;
}

.confirmation-section.show {
    display: block;
}

/* 完了画面スタイル */
.completion-section {
    display: none;
    text-align: center;
    padding: 60px 40px;
}

.completion-section.show {
    display: block;
}

.completion-icon {
    font-size: 80px;
    color: var(--success-color);
    margin-bottom: 20px;
}

.completion-title {
    font-size: 28px;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 15px;
}

.completion-message {
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 30px;
}

/* レスポンシブデザイン */
@media (max-width: 1024px) {
    .container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        padding: 15px;
    }
    
    .step-nav {
        display: flex;
        overflow-x: auto;
        gap: 10px;
        padding: 10px 0;
    }
    
    .step-item {
        min-width: 140px;
        border-bottom: none;
        flex-direction: column;
        text-align: center;
        padding: 12px 8px;
        border-radius: 6px;
        border: 1px solid var(--border-color);
    }
    
    .step-number {
        margin-right: 0;
        margin-bottom: 8px;
    }
    
    .main-content {
        max-width: 100%;
        padding: 15px;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

@media (max-width: 768px) {
    .selection-grid, .large-selection, .three-column-selection, .four-column-selection, .option-selection {
        grid-template-columns: 1fr;
    }
    
    .dropdown-group {
        grid-template-columns: 1fr;
    }
    
    .summary-content {
        flex-direction: column;
        text-align: center;
    }
    
    .summary-list {
        grid-template-columns: 1fr;
    }
    
    .selection-area, .form-container {
        padding: 20px;
    }
    
    .price-amount {
        font-size: 24px;
    }
    
    .button-group {
        padding: 20px;
        flex-direction: column;
        gap: 15px;
    }
    
    .btn {
        width: 100%;
    }

    .result-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .content-card {
        border-radius: 8px;
    }
    
    .selection-area, .form-container {
        padding: 15px;
    }
    
    .card-body {
        padding: 15px;
    }
    
    .main-title {
        font-size: 16px;
        padding: 20px;
    }
    
    .price-header {
        padding: 15px 20px;
    }
    
    .result-content {
        padding: 20px;
    }
}

/* 印刷スタイル */
@media print {
    .sidebar, .button-group, .result-actions {
        display: none !important;
    }
    
    .main-content {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0;
    }
    
    .content-card {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .result-section {
        page-break-inside: avoid;
    }
}