:root {
    --primary-color: #F4A460;
    /* SandyBrown */
    --primary-dark: #D2691E;
    --accent-color: #FF7F50;
    --bg-color: #FFF8F0;
    --card-bg: #FFFFFF;
    --text-color: #4A4A4A;
    --text-light: #888888;
    --border-radius: 16px;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 8px 16px rgba(0, 0, 0, 0.1);
    --font-heading: 'Zen Maru Gothic', sans-serif;
    --font-body: 'Noto Sans JP', sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

.app-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    background-color: var(--bg-color);
    min-height: 100vh;
}

.app-header {
    text-align: center;
    margin-bottom: 30px;
}

.app-header h1 {
    font-family: var(--font-heading);
    color: var(--primary-dark);
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.app-header p {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Sections */
.step-section {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    animation: fadeIn 0.4s ease-out;
}

.step-section.hidden {
    display: none;
}

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

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

.step-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

/* URLパラメータ対応などで中央寄せクラス追加 */
.step-header.center-header {
    flex-direction: column;
    text-align: center;
    gap: 8px;
}

.step-number {
    background: #F4A460;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9rem;
    white-space: nowrap;
    /* 折り返し防止 */
}

.step-header h2 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    margin: 0;
    color: var(--primary-dark);
}

/* Form Elements */
.form-group {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    font-weight: bold;
    margin-bottom: 8px;
    color: var(--primary-dark);
}

.help-text {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: -4px;
    margin-bottom: 12px;
}

/* Breed Category Selector */
.breed-category-selector {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.category-btn {
    flex: 1;
    min-width: 80px;
    padding: 10px;
    border: 2px solid #EEE;
    border-radius: 12px;
    background: white;
    cursor: pointer;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-color);
    transition: all 0.2s;
}

.category-btn.active {
    border-color: var(--primary-color);
    background: #FFF0E0;
    color: var(--primary-dark);
    font-weight: bold;
}

/* Breed Select */
.form-select,
.form-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #EEE;
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-select:focus,
.form-input:focus {
    border-color: var(--primary-color);
    outline: none;
}

.form-input {
    text-align: right;
    padding-right: 40px;
}

.input-wrapper {
    position: relative;
}

.input-wrapper .unit {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
}

/* Grid Selections */
.selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}

.selection-btn {
    padding: 12px;
    border: 2px solid #EEE;
    border-radius: 12px;
    background: white;
    cursor: pointer;
    text-align: center;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.selection-btn:hover {
    border-color: #DDD;
}

.selection-btn.active {
    border-color: var(--primary-color);
    background: #FFF0E0;
    color: var(--primary-dark);
    font-weight: bold;
}

/* BCS Container */
.bcs-container {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    width: 100%;
}

/* Mobile responsive for BCS */
@media (max-width: 480px) {
    .bcs-container {
        grid-template-columns: repeat(3, 1fr);
        /* 2行、上3下2のような配置は難しいが、3カラムで折り返し */
        gap: 6px;
    }

    /* 5つあるので 3, 2 になるように */
    /* .bcs-btn:last-child { grid-column: span 1; } */
}

.bcs-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 4px;
    border: 2px solid #EEE;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    font-size: 0.75rem;
    text-align: center;
    transition: all 0.2s;
    min-width: 0;
    /* フレックス/グリッドアイテムの縮小を許可 */
}

.bcs-btn img {
    width: 100%;
    max-width: 60px;
    height: auto;
    margin-bottom: 6px;
    object-fit: contain;
}

.bcs-btn.active {
    border-color: var(--primary-color);
    background: #FFF0E0;
    transform: scale(1.05);
    z-index: 1;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Action Buttons */
.btn-primary {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    border: none;
    border-radius: 30px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(244, 164, 96, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(244, 164, 96, 0.5);
}

.btn-primary:disabled {
    background: #CCC;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-secondary {
    width: 100%;
    padding: 14px;
    background: white;
    border: 2px solid #EEE;
    color: var(--text-light);
    border-radius: 30px;
    font-size: 1rem;
    cursor: pointer;
    margin-top: 12px;
}

.btn-text {
    background: none;
    border: none;
    color: var(--text-light);
    text-decoration: underline;
    cursor: pointer;
    display: block;
    margin: 20px auto 0;
    font-size: 0.9rem;
}

/* Results */
.result-card {
    background: #FFFAF0;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    margin-bottom: 24px;
}

.result-card h3,
.product-selection h3 {
    font-family: var(--font-heading);
    color: var(--primary-dark);
    margin-top: 0;
}

.result-metrics {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 16px;
}

.metric-item {
    display: flex;
    flex-direction: column;
}

.metric-label {
    font-size: 0.8rem;
    color: var(--text-light);
}

.metric-value {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--text-color);
    line-height: 1.2;
}

.metric-unit {
    font-size: 0.9rem;
    color: var(--text-light);
}

.metric-item.highlight .metric-value {
    color: var(--accent-color);
    font-size: 2.2rem;
}

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
}

.product-card {
    border: 2px solid #EEE;
    border-radius: 12px;
    padding: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

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

.product-card img {
    width: 100%;
    height: 120px;
    object-fit: contain;
    margin-bottom: 8px;
    border-radius: 8px;
    background-color: #f9f9f9;
}

.product-card h4 {
    font-size: 0.9rem;
    margin: 0 0 4px 0;
    color: var(--text-color);
}

/* Final Result */
.feeding-amount-box {
    background: #FFF;
    border: 2px solid var(--primary-color);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    margin-bottom: 24px;
}

.main-amount {
    margin-bottom: 20px;
}

.main-amount .label {
    display: block;
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.main-amount .value {
    font-size: 3rem;
    font-weight: bold;
    color: var(--primary-dark);
    line-height: 1;
}

.amount-divider {
    height: 1px;
    background: #EEE;
    margin: 16px 0;
}

.schedule-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

/* Cycle List */
.cycle-list-container {
    background: #E0F7FA;
    border: 2px solid #00BCD4;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 24px;
    text-align: left;
}

.cycle-list-container h4 {
    margin: 0 0 12px 0;
    color: #00838F;
    font-size: 1rem;
    text-align: center;
}

.cycle-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.cycle-table th {
    text-align: left;
    padding: 6px;
    color: #006064;
    border-bottom: 1px solid #B2EBF2;
}

.cycle-table td {
    padding: 8px 6px;
    border-bottom: 1px solid #B2EBF2;
}

.cycle-table tr:last-child td {
    border-bottom: none;
}

.cycle-days-highlight {
    font-weight: bold;
    color: #006064;
    font-size: 1rem;
}

.hidden {
    display: none !important;
}

/* ボタン修正 V3 */
.btn-full {
    width: 100%;
    margin-bottom: 24px !important;
    /* 余白を広げる */
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 16px !important;
    /* パディング強化 */
    text-decoration: none !important;
    /* 下線なし強制 */
    box-sizing: border-box;
}

.btn-full:hover {
    text-decoration: none !important;
    opacity: 0.9;
}

#product-link-btn {
    text-decoration: none;
    /* 個別IDでも念のため */
}