/* フォント設定 */
@font-face {
    font-family: 'Source Sans Pro';
    font-style: normal;
    font-weight: 200;
    src: url("../fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3i94_wlxdr.ttf") format('truetype');
}

@font-face {
    font-family: 'Source Sans Pro';
    font-style: normal;
    font-weight: 300;
    src: url("../fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwlxdr.ttf") format('truetype');
}

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

body {
    font-family: 'Source Sans Pro', sans-serif;
    color: white;
    background: linear-gradient(to bottom right, #8FD3F4 0%, #A1FFCE 100%);
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

body ::-webkit-input-placeholder {
    font-family: 'Source Sans Pro', sans-serif;
    color: white;
    font-weight: 300;
}

body :-moz-placeholder {
    font-family: 'Source Sans Pro', sans-serif;
    color: white;
    opacity: 1;
    font-weight: 300;
}

body ::-moz-placeholder {
    font-family: 'Source Sans Pro', sans-serif;
    color: white;
    opacity: 1;
    font-weight: 300;
}

body :-ms-input-placeholder {
    font-family: 'Source Sans Pro', sans-serif;
    color: white;
    font-weight: 300;
}

/* バブル背景 */
.bg-bubbles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    overflow: hidden;
}

.bg-bubbles li {
    position: absolute;
    list-style: none;
    display: block;
    width: 40px;
    height: 40px;
    background-color: rgba(103, 64, 241, 0.15);
    bottom: -160px;
    animation: square 25s infinite;
    transition-timing-function: linear;
    border-radius: 4px;
}

.bg-bubbles li:nth-child(1) {
    left: 10%;
}

.bg-bubbles li:nth-child(2) {
    left: 20%;
    width: 80px;
    height: 80px;
    animation-delay: 2s;
    animation-duration: 17s;
    background-color: rgba(255, 255, 255, 0.25);
}

.bg-bubbles li:nth-child(3) {
    left: 25%;
    animation-delay: 4s;
}

.bg-bubbles li:nth-child(4) {
    left: 40%;
    width: 60px;
    height: 60px;
    animation-duration: 22s;
    background-color: rgba(255, 255, 255, 0.25);
}

.bg-bubbles li:nth-child(5) {
    left: 70%;
}

.bg-bubbles li:nth-child(6) {
    left: 80%;
    width: 120px;
    height: 120px;
    animation-delay: 3s;
    background-color: rgba(255, 255, 255, 0.2);
}

.bg-bubbles li:nth-child(7) {
    left: 32%;
    width: 160px;
    height: 160px;
    animation-delay: 7s;
}

.bg-bubbles li:nth-child(8) {
    left: 55%;
    width: 20px;
    height: 20px;
    animation-delay: 15s;
    animation-duration: 40s;
    background-color: rgba(255, 255, 255, 0.3);
}

.bg-bubbles li:nth-child(9) {
    left: 25%;
    width: 10px;
    height: 10px;
    animation-delay: 2s;
    animation-duration: 40s;
    background-color: rgba(255, 255, 255, 0.3);
}

.bg-bubbles li:nth-child(10) {
    left: 90%;
    width: 160px;
    height: 160px;
    animation-delay: 11s;
}

@keyframes square {
    0% {
        transform: translateY(0) rotate(0deg);
    }

    100% {
        transform: translateY(-5700px) rotate(800deg);
    }
}

/* コンテナ */
.container {
    background: rgba(255, 255, 255, 0.95);
    padding: 10px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 600px;
    margin: 20px 0;
    z-index: 2;
    color: #333333;
    max-height: 120vh;
    overflow-y: auto;
}

.container h2 {
    text-align: center;
    color: #333333;
    font-size: 24px;
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 6px;
    color: #555555;
    font-weight: bold;
    font-size: 16px;
}

/* 生年月日セレクト */
.dob-select {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.dob-select select {
    width: 32%;
    padding: 8px;
    font-size: 1em;
    border: 1px solid #cccccc;
    border-radius: 8px;
    appearance: none;
    background-color: #f9f9f9;
    cursor: pointer;
    height: 40px;
}

.dob-select select:focus {
    border-color: #4CAF50;
    outline: none;
}

/* 身長 数値入力 + ステッパー */
#heightContainer.height-stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    width: fit-content;
    margin: 0 auto;
    padding: 14px 20px;
    background: #ffffff;
    border: 1px solid #e3ece5;
    border-radius: 999px;
    box-shadow: 0 4px 16px rgba(76, 175, 80, 0.12);
}

/* 円形の −/＋ ボタン（緑グラデ） */
.height-step-btn {
    position: relative;
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #56c271 0%, #4CAF50 55%, #3d9c43 100%);
    color: #fff;
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(76, 175, 80, 0.35);
    transition: transform 0.12s ease, box-shadow 0.2s ease, filter 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    overflow: hidden;
}

.height-step-btn:hover { filter: brightness(1.06); box-shadow: 0 6px 14px rgba(76, 175, 80, 0.45); }
.height-step-btn:active { transform: scale(0.92); box-shadow: 0 2px 6px rgba(76, 175, 80, 0.4); }
.height-step-btn:focus-visible { outline: 3px solid rgba(76, 175, 80, 0.4); outline-offset: 2px; }

/* 押下中（長押し）に軽く光らせる */
.height-step-btn.is-holding { filter: brightness(1.12); }

/* 数値 + 単位の表示ブロック */
.height-value-wrap {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 4px;
    min-width: 120px;
}

.height-input {
    width: 84px;
    text-align: center;
    font-size: 34px;
    font-weight: 800;
    color: #2e4d34;
    letter-spacing: 0.02em;
    border: none;
    background: transparent;
    padding: 0;
    -moz-appearance: textfield;
}

.height-input:focus { outline: none; }

/* number input のスピンボタンを非表示（−/＋ボタンで操作するため） */
.height-input::-webkit-outer-spin-button,
.height-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.height-unit {
    font-size: 16px;
    color: #7a927f;
    font-weight: 700;
}

/* 性別選択・アレルギー選択ボタン */
.gender-options,
.allergy-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.gender-options button,
.allergy-options button {
    padding: 14px 10px;
    font-size: 1em;
    border: 2px solid #4CAF50;
    border-radius: 8px;
    background-color: #ffffff;
    color: #4CAF50;
    cursor: pointer;
    transition: background-color 0.3s, color 0.3s;
    text-align: center;
}

.gender-options button {
    flex: 1 1 30%;
}

.allergy-options button {
    flex: 1 1 45%;
}

.gender-options button.selected,
.allergy-options button.selected {
    background-color: #4CAF50;
    color: #ffffff;
}

.gender-options button:hover,
.allergy-options button:hover {
    background-color: #45a049;
    color: #ffffff;
}

.gender-options button:focus,
.allergy-options button:focus {
    outline: 2px solid #4CAF50;
}

.gender-options button:active,
.allergy-options button:active {
    transform: scale(0.98);
}

/* アレルギー有無ボタン */
.allergy-yes-no {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.allergy-yes-no button {
    flex: 1 1 48%;
    padding: 14px 10px;
    font-size: 1em;
    border: 2px solid #FF9800;
    border-radius: 8px;
    background-color: #ffffff;
    color: #FF9800;
    cursor: pointer;
    transition: background-color 0.3s, color 0.3s;
    text-align: center;
}

.allergy-yes-no button.selected {
    background-color: #FF9800;
    color: #ffffff;
}

.allergy-yes-no button:hover {
    background-color: #FB8C00;
    color: #ffffff;
}

.allergy-yes-no button:focus {
    outline: 2px solid #FF9800;
}

.allergy-yes-no button:active {
    transform: scale(0.98);
}

/* ボタン群 */
.button-group {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.submit-button,
.sample-button {
    flex: 1;
    padding: 14px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
}

.submit-button:hover,
.sample-button:hover {
    background-color: #218838;
}

.submit-button:focus,
.sample-button:focus {
    outline: 2px solid #218838;
}

.submit-button:active,
.sample-button:active {
    transform: scale(0.98);
}

.sample-button {
    background-color: #6c757d;
}

.sample-button:hover {
    background-color: #5a6268;
}

.sample-button:focus {
    outline: 2px solid #5a6268;
}

.sample-button:active {
    transform: scale(0.98);
}

/* QRコンテナ */
.qr-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #333333;
}

#qrcode {
    margin: 20px 0;
    background-color: #ffffff;
    padding: 16px;
    border-radius: 8px;
    color-scheme: light;
}

#qrContainer img,
#qrContainer canvas {
    margin: 20px;
}

#qrcode img,
#qrcode canvas {
    width: 60vw;
    max-width: 256px;
    height: auto;
    display: block;
    margin: 0 auto;
    color-scheme: light;
}

/* その他のアレルギー入力 */
#otherAllergyGroup {
    margin-top: 10px;
}

#otherAllergy {
    width: 100%;
    padding: 10px 12px;
    font-size: 1em;
    border: 1px solid #cccccc;
    border-radius: 8px;
    background-color: #f9f9f9;
    color: #333333;
    transition: background-color 0.25s, border-color 0.25s;
}

#otherAllergy:hover {
    background-color: rgba(255, 255, 255, 0.4);
}

#otherAllergy:focus {
    background-color: white;
    border-color: #4CAF50;
    outline: none;
}

/* 表示用テーブル風レイアウト */
.sample-info {
    display: table;
    border-collapse: collapse;
}

.sample-info p {
    display: table-row;
    margin: 0;
}

.label,
.value {
    display: table-cell;
    padding: 0em;
    vertical-align: middle;
}

.label {
    width: 8em;
}

/* ローディング画面 */
#loading-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.6);
    z-index: 9999;
    display: none;
    margin: 0 !important;
    padding: 0;
}

.loader {
    width: 240px;
    height: 240px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.loader div {
    width: 80px;
    height: 80px;
    float: left;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.loader div span {
    position: absolute;
    display: block;
    border-radius: 3px;
    animation: anim 1.2s infinite linear;
}

@keyframes anim {
    0% {
        width: 0;
        height: 0;
        background: #18FFFF;
    }

    40% {
        width: 60px;
        height: 60px;
        background: #D500F9;
    }

    80% {
        width: 0;
        height: 0;
        background: #18FFFF;
    }

    100% {
        width: 0;
        height: 0;
        background: #18FFFF;
    }
}

.loader div:nth-child(2) span,
.loader div:nth-child(4) span {
    animation-delay: 0.15s;
}

.loader div:nth-child(3) span,
.loader div:nth-child(5) span,
.loader div:nth-child(7) span {
    animation-delay: 0.30s;
}

.loader div:nth-child(6) span,
.loader div:nth-child(8) span {
    animation-delay: 0.45s;
}

.loader div:nth-child(9) span {
    animation-delay: 0.60s;
}

/* 計測結果 */
.chart-block {
    margin: 16px 0 24px;
}

.chart-block h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: #333;
}

.chart-wrap {
    width: 100%;
    max-width: 600px;
    margin: 0 auto 12px;
}

.chart-wrap canvas {
    width: 100% !important;
    height: 260px !important;
}

.results-meta,
.stats {
    color: #555;
    font-size: 14px;
    margin: 4px 0 0;
}

/* タブ */
.tabs {
    display: grid;
    grid-auto-flow: column;
    gap: 8px;
    position: sticky;
    top: 0;
    padding: 8px 8px 0;
    background: inherit;
    z-index: 2;
}

.tab {
    appearance: none;
    border: 1px solid #ddd;
    border-bottom: 2px solid transparent;
    padding: 10px 12px;
    border-radius: 10px 10px 0 0;
    font-weight: 600;
    background: #fafafa;
}

.tab.is-active {
    background: #fff;
    border-bottom-color: #4a90e2;
}

.tab-panels {
    padding: 8px;
}

.tab-panel {
    display: block;
}

.tab-panel[hidden] {
    display: none !important;
}

.panel-inner {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.panel-title {
    margin: 0 0 8px;
    font-size: 16px;
}

.tab-panel canvas {
    width: 100% !important;
    height: auto !important;
    max-height: 48vh;
}

/* 結果画面フルスクリーン化 */
#resultsContainer.container {
    position: fixed;
    inset: 0;
    z-index: 1000;
    max-width: none;
    width: 100%;
    height: 100dvh;
    padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
    overflow-y: auto;
    border-radius: 0;
}

#resultsContainer .tabs {
    position: sticky;
    top: 0;
    padding-top: 4px;
}

#resultsContainer .tab-panels {
    padding: 8px 0;
}

#resultsContainer .tab-panel .chart-wrap {
    height: 58dvh;
    max-width: none;
    margin: 8px 0 16px;
}

#resultsContainer .tab-panel .chart-wrap.half {
    height: 42dvh;
}

#resultsContainer .tab-panel canvas {
    width: 100% !important;
    height: 100% !important;
}

#resultsContainer .chart-wrap canvas {
    height: 100% !important;
}

#resultsContainer .results-header {
    position: sticky;
    top: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 10px 8px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: saturate(150%) blur(6px);
    border-bottom: 1px solid #eee;
}

#resultsContainer .tabs {
    margin-top: 6px;
}

#resultsContainer .back-btn {
    appearance: none;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 8px 12px;
    font-weight: 600;
    background: #f8f8f8;
}

#sqkContainer .back-btn {
    appearance: none;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 8px 12px;
    font-weight: 600;
    background: #f8f8f8;
}

#resultsContainer {
    scroll-padding-top: 56px;
}

#resultsContainer .range-controls {
    display: flex;
    gap: 8px;
    padding: 8px;
    position: sticky;
    top: 48px;
    z-index: 10;
    background: rgba(255, 255, 255, .96);
    backdrop-filter: blur(6px);
}

#resultsContainer .range-btn {
    appearance: none;
    border: 1px solid #ddd;
    padding: 8px 10px;
    border-radius: 10px;
    font-weight: 600;
    background: #fafafa;
}

#resultsContainer .range-btn.is-active {
    background: #fff;
    border-color: #4a90e2;
}

.chart-wrap canvas {
    touch-action: none;
}

.chart-wrap canvas {
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* 日付範囲選択ボタン */
.range-controls {
    display: flex;
    gap: 8px;
    padding: 8px;
    overflow-x: auto;
    position: sticky;
    top: 60px;
    z-index: 99;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(6px);
    border-bottom: 1px solid #eee;
}

.range-btn {
    appearance: none;
    border: 1px solid #ddd;
    padding: 8px 12px;
    border-radius: 10px;
    font-weight: 600;
    background: #fafafa;
    white-space: nowrap;
    min-width: 60px;
}

.range-btn.is-active {
    background: #fff;
    border-color: #4a90e2;
    color: #4a90e2;
}

/* 体組成用の複数グラフ */
.body-chart-section {
    margin-bottom: 20px;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 12px;
    background: #fafafa;
}

.chart-subtitle {
    margin: 0 0 8px 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    text-align: center;
}

#bcWeightFatMuscle,
#bcBmiBmr {
    touch-action: manipulation !important;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.body-chart-section canvas {
    touch-action: manipulation !important;
}

/* ===== 肌測定タブ（部位ナビ・radar/pores・凡例） ===== */
.skin-area-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
    justify-content: center;
}
.skin-area-btn {
    padding: 6px 14px;
    border: 2px solid #f0d8df;
    border-radius: 999px;
    background: #fff;
    color: #b02d5e;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.skin-area-btn:hover { border-color: #f0648e; }
.skin-area-btn.active {
    background: #f0648e;
    color: #fff;
    border-color: #d94076;
}

.skin-empty {
    text-align: center;
    color: #666;
    padding: 24px 12px;
    font-size: 14px;
}

.skin-legend {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 8px;
    font-size: 13px;
    color: #666;
}
.skin-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.skin-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.skin-dot.current { background: rgba(99, 102, 241, 0.9); }
.skin-dot.previous { background: rgba(244, 114, 182, 0.9); }

/* タイムスライダー */
.time-slider {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: #ddd;
    border-radius: 3px;
    outline: none;
}

.time-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #4CAF50;
    cursor: pointer;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.time-slider::-webkit-slider-thumb:hover {
    background: #45a049;
    transform: scale(1.1);
}

.time-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #4CAF50;
    cursor: pointer;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.time-slider::-moz-range-thumb:hover {
    background: #45a049;
    transform: scale(1.1);
}

.time-slider::-ms-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #4CAF50;
    cursor: pointer;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.time-slider::-ms-thumb:hover {
    background: #45a049;
}

.time-slider::-webkit-slider-runnable-track {
    width: 100%;
    height: 6px;
    cursor: pointer;
    background: #ddd;
    border-radius: 3px;
}

.time-slider::-moz-range-track {
    width: 100%;
    height: 6px;
    cursor: pointer;
    background: #ddd;
    border-radius: 3px;
    border: none;
}

.time-slider::-ms-track {
    width: 100%;
    height: 6px;
    cursor: pointer;
    background: transparent;
    border-color: transparent;
    color: transparent;
}

.time-slider::-ms-fill-lower,
.time-slider::-ms-fill-upper {
    background: #ddd;
    border-radius: 3px;
}

/* スクエアキッチン */
.sub-tabs {
    margin: 12px 0;
    padding: 0;
    background: transparent;
    border-bottom: 1px solid #eee;
}

.sub-tabs .tab {
    font-size: 14px;
    padding: 8px 12px;
    background: #f8f8f8;
    border: 1px solid #ddd;
    border-bottom: none;
}

.sub-tabs .tab.is-active {
    background: #fff;
    border-bottom: 2px solid #2ecc71;
    color: #2ecc71;
}

.choice-tabs {
    display: flex;
    gap: 8px;
    margin: 16px 0;
    justify-content: center;
}

.choice-btn {
    padding: 10px 20px;
    border: 2px solid #3498db;
    border-radius: 8px;
    background: #fff;
    color: #3498db;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.choice-btn.is-active {
    background: #3498db;
    color: #fff;
}

.choice-btn:hover {
    background: #2980b9;
    color: #fff;
    border-color: #2980b9;
}

.ai-content {
    min-height: 300px;
    padding: 20px;
    background: #fafafa;
    border-radius: 8px;
    margin-top: 16px;
}

/* 1品チョイス */
.single-choice-content {
    text-align: center;
}

.menu-image {
    width: 100%;
    max-width: 300px;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.menu-name {
    font-size: 20px;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 12px;
}

.menu-concept {
    font-size: 14px;
    color: #555;
    line-height: 1.6;
    margin-bottom: 20px;
    text-align: left;
}

.nutrition-info {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 16px;
    text-align: left;
}

.nutrition-info h4 {
    margin: 0 0 12px 0;
    color: #2c3e50;
    font-size: 16px;
}

.nutrition-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    font-size: 14px;
}

.nutrition-item {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px solid #f0f0f0;
}

/* メニューチョイス */
.menu-choice-content {
    text-align: center;
}

.menu-images {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.menu-images img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.menu-list {
    text-align: left;
    margin-bottom: 20px;
}

.menu-list ol {
    padding-left: 20px;
}

.menu-list li {
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
}

.menu-description {
    font-size: 14px;
    color: #555;
    line-height: 1.6;
    margin-bottom: 20px;
    text-align: left;
}

.sub-tab-panel {
    display: block;
}

.sub-tab-panel[hidden] {
    display: none !important;
}

.ai-content.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #666;
}

.ai-content.loading::before {
    content: "🔄 ";
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

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

    100% {
        transform: rotate(360deg);
    }
}

.ai-content.error {
    background: #fee;
    border: 1px solid #fcc;
    color: #c33;
    text-align: center;
    padding: 20px;
}

/* 利用登録タブ */
.registration-description {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 24px;
    text-align: center;
}

.registration-description p {
    margin: 8px 0;
    line-height: 1.6;
}

.registration-description strong {
    color: #ffed4a;
    font-weight: bold;
}

.menu-selection-area h4,
.selected-menus-area h4 {
    color: #2c3e50;
    margin: 20px 0 12px 0;
    font-size: 18px;
    border-bottom: 2px solid #3498db;
    padding-bottom: 8px;
}

.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
    padding: 0 4px;
}

.menu-grid.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    font-size: 16px;
    color: #666;
}

.menu-item-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 12px 8px;
    border: 2px solid #ddd;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    position: relative;
    min-height: 120px;
    touch-action: manipulation;
}

.menu-item-btn:hover {
    border-color: #3498db;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.2);
}

.menu-item-btn.selected {
    border-color: #27ae60;
    background: linear-gradient(135deg, rgba(39, 174, 96, 0.1) 0%, rgba(46, 204, 113, 0.1) 100%);
    color: #27ae60;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(39, 174, 96, 0.2);
}

.menu-item-btn.selected::before {
    content: "✓";
    position: absolute;
    top: 6px;
    right: 6px;
    background: #27ae60;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.menu-item-image {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 8px;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.menu-item-btn:hover .menu-item-image {
    transform: scale(1.05);
}

.menu-item-name {
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    color: inherit;
    text-align: center;
    word-wrap: break-word;
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.selected-menus-area {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    margin-top: 24px;
}

.selected-menus-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.selected-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.selected-menu-item:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.selected-menu-image {
    width: 50px;
    height: 40px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.selected-menu-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.selected-menu-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.selected-quantity-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.selected-quantity-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #ddd;
    border-radius: 50%;
    background: #fff;
    color: #666;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    touch-action: manipulation;
    user-select: none;
}

.selected-quantity-btn:hover:not(:disabled) {
    border-color: #3498db;
    background: #3498db;
    color: white;
    transform: scale(1.05);
}

.selected-quantity-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.selected-quantity-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none;
}

.selected-quantity-display {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    min-width: 24px;
    text-align: center;
}

.selected-remove-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: #e74c3c;
    color: white;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.selected-remove-btn:hover {
    background: #c0392b;
    transform: scale(1.1);
}

.selected-remove-btn:active {
    transform: scale(0.9);
}

.registration-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.registration-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

.registration-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.3);
}

.registration-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.clear-selection-btn {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

.clear-selection-btn:hover {
    background: #c0392b;
    transform: translateY(-2px);
}

/* クーポンタブ */
.coupon-description {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 24px;
    text-align: center;
}

.coupon-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.coupon-list.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    font-size: 16px;
    color: #666;
}

.coupon-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    padding: 20px;
    color: white;
    position: relative;
    overflow: hidden;
}

.coupon-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10px;
    width: 100px;
    height: 200%;
    background: repeating-linear-gradient(90deg,
            transparent,
            transparent 5px,
            rgba(255, 255, 255, 0.1) 5px,
            rgba(255, 255, 255, 0.1) 10px);
    transform: rotate(15deg);
}

.coupon-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    gap: 12px;
}

.coupon-title-area {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1;
}

.coupon-title {
    font-size: 18px;
    font-weight: bold;
    margin: 0;
}

.coupon-value {
    font-size: 24px;
    font-weight: bold;
    color: #ffed4a;
}

.coupon-description-text {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 16px;
    line-height: 1.4;
}

.coupon-status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin-left: 8px;
}

.coupon-status-badge.available {
    background: rgba(46, 204, 113, 0.2);
    color: #27ae60;
    border: 1px solid rgba(46, 204, 113, 0.4);
}

.coupon-status-badge.used {
    background: rgba(149, 165, 166, 0.2);
    color: #7f8c8d;
    border: 1px solid rgba(149, 165, 166, 0.4);
}

.coupon-status-badge.expired {
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
    border: 1px solid rgba(231, 76, 60, 0.4);
}

.coupon-status-badge.not-yet-valid {
    background: rgba(241, 196, 15, 0.2);
    color: #f39c12;
    border: 1px solid rgba(241, 196, 15, 0.4);
}

.coupon-validity {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 10px 12px;
    margin: 12px 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.validity-label {
    font-size: 12px;
    opacity: 0.9;
    font-weight: 600;
}

.validity-dates {
    font-size: 14px;
    font-weight: bold;
    color: #ffffff;
}

.coupon-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    opacity: 0.8;
    margin-bottom: 16px;
}

.coupon-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    align-items: center;
}

.use-coupon-btn {
    background: #27ae60;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 100px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.use-coupon-btn:hover:not(:disabled) {
    background: #219a52;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
}

.use-coupon-btn:active:not(:disabled) {
    transform: scale(0.98);
    box-shadow: 0 2px 8px rgba(39, 174, 96, 0.4);
}

.use-coupon-btn:focus {
    box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.3);
}

.use-coupon-btn:disabled {
    background: #95a5a6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.6;
}

.use-coupon-btn:disabled:hover {
    background: #95a5a6;
    transform: none;
    box-shadow: none;
}

.coupon-expired .use-coupon-btn:disabled {
    background: #7f8c8d;
}

.coupon-not-yet-valid .use-coupon-btn:disabled {
    background: #e67e22;
    opacity: 0.7;
}

.coupon-info-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 60px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.coupon-info-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.coupon-info-btn:active {
    transform: scale(0.98);
}

.coupon-info-btn:focus {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5);
}

.coupon-used {
    opacity: 0.6;
    filter: grayscale(0.8);
}

.coupon-used .use-coupon-btn {
    background: #7f8c8d;
    cursor: not-allowed;
    opacity: 0.7;
}

.coupon-used .use-coupon-btn:hover {
    background: #7f8c8d;
    transform: none;
    box-shadow: none;
}

.coupon-used::after {
    content: 'USED';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-15deg);
    font-size: 48px;
    font-weight: bold;
    opacity: 0.3;
    pointer-events: none;
}

.coupon-expired {
    opacity: 0.7;
    filter: grayscale(0.5);
    background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%);
}

.coupon-expired::after {
    content: 'EXPIRED';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-15deg);
    font-size: 48px;
    font-weight: bold;
    opacity: 0.2;
    pointer-events: none;
    color: #e74c3c;
}

.coupon-not-yet-valid {
    opacity: 0.75;
    filter: grayscale(0.3);
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
}

.coupon-not-yet-valid::after {
    content: 'NOT YET';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-15deg);
    font-size: 40px;
    font-weight: bold;
    opacity: 0.2;
    pointer-events: none;
    color: #f39c12;
}

@keyframes notYetPulse {

    0%,
    100% {
        opacity: 0.75;
    }

    50% {
        opacity: 0.85;
    }
}

.coupon-not-yet-valid {
    animation: notYetPulse 3s ease-in-out infinite;
}

.no-coupons-message {
    text-align: center;
    padding: 40px 20px;
    color: #7f8c8d;
    font-size: 16px;
}

.no-coupons-message p {
    margin: 8px 0;
}

/* モーダル */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 16px;
    padding: 32px;
    max-width: 400px;
    width: 100%;
    text-align: center;
    position: relative;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

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

.modal-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.modal-title {
    font-size: 24px;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 16px;
}

.modal-message {
    font-size: 16px;
    color: #555;
    line-height: 1.6;
    margin-bottom: 24px;
}

.modal-close-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-close-btn:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

#sqkContainer.container {
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

.sub-tabs .tab.unavailable {
    position: relative;
    opacity: 0.6;
    color: #999;
}

.sub-tabs .tab.unavailable::after {
    content: "📊";
    position: absolute;
    top: -2px;
    right: -2px;
    font-size: 10px;
    opacity: 0.7;
}

.sub-tabs .tab.available {
    position: relative;
    font-weight: 600;
}

.sub-tabs .tab.available::after {
    content: "✅";
    position: absolute;
    top: -2px;
    right: -2px;
    font-size: 10px;
    animation: pulse 2s infinite;
}

.sub-tabs .tab.processing {
    position: relative;
    opacity: 0.8;
    color: #f39c12;
    border-color: #f39c12;
}

.sub-tabs .tab.processing::after {
    content: "⏳";
    position: absolute;
    top: -2px;
    right: -2px;
    font-size: 10px;
    animation: pulse 2s infinite;
}

.ai-content.no-recommendation {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px dashed #dee2e6;
    color: #6c757d;
    text-align: center;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.no-recommendation-content {
    max-width: 500px;
    width: 100%;
    padding: 20px;
}

.no-recommendation-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.8;
    animation: pulse 2s ease-in-out infinite;
}

.no-recommendation-title {
    font-size: 20px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 20px;
    line-height: 1.3;
}

.no-recommendation-message {
    margin-bottom: 30px;
}

.no-recommendation-message p {
    font-size: 14px;
    line-height: 1.6;
    color: #6c757d;
    margin-bottom: 12px;
}

.requirement-badge {
    display: inline-block;
    background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
    color: #2d3436;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    margin: 10px 0;
    box-shadow: 0 2px 4px rgba(253, 203, 110, 0.3);
}

.measurement-guide {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 20px;
    text-align: left;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.measurement-guide h4 {
    color: #495057;
    font-size: 16px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.measurement-guide ul {
    list-style: none;
    padding: 0;
    margin-bottom: 16px;
}

.measurement-guide li {
    padding: 8px 0;
    border-bottom: 1px solid #f1f3f4;
    font-size: 14px;
    color: #6c757d;
    position: relative;
    padding-left: 20px;
}

.measurement-guide li:last-child {
    border-bottom: none;
}

.measurement-guide li::before {
    content: "•";
    color: #28a745;
    font-weight: bold;
    position: absolute;
    left: 0;
}

.guide-note {
    font-size: 12px;
    color: #868e96;
    font-style: italic;
    text-align: center;
    margin: 0;
    padding-top: 12px;
    border-top: 1px solid #f1f3f4;
}

.refresh-recommendation-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 24px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.refresh-recommendation-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.refresh-recommendation-btn:active:not(:disabled) {
    transform: translateY(0);
}

.refresh-recommendation-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.refresh-recommendation-btn.loading {
    animation: buttonPulse 1.5s ease-in-out infinite;
}

@keyframes buttonPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

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

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

.no-recommendation-content {
    animation: fadeInUp 0.6s ease-out;
}

.measurement-guide {
    animation: fadeInUp 0.8s ease-out;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
}

.benefits-section {
    background: #f8f9fa;
    border-left: 4px solid #3498db;
    padding: 12px 16px;
    margin: 16px 0;
    border-radius: 4px;
}

.benefits-section h5 {
    color: #2c3e50;
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 8px 0;
}

.benefits-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.benefits-section li {
    padding: 4px 0 4px 20px;
    position: relative;
    font-size: 13px;
    color: #555;
    line-height: 1.5;
}

.benefits-section li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #27ae60;
    font-weight: bold;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .tabs {
        gap: 4px;
        padding: 4px;
        position: sticky;
        top: 0;
        z-index: 100;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(8px);
    }

    .tab {
        padding: 12px 8px;
        font-size: 14px;
        min-height: 44px;
        border-radius: 8px;
    }

    #resultsContainer .tab-panel .chart-wrap {
        height: 65dvh;
        margin: 4px 0 12px;
    }

    .back-btn {
        min-height: 44px;
        padding: 12px 16px;
        font-size: 16px;
    }

    .gender-options button,
    .allergy-options button {
        flex: 1 1 45%;
    }

    .choice-tabs {
        flex-direction: column;
    }

    .choice-btn {
        width: 100%;
    }

    .nutrition-list {
        grid-template-columns: 1fr;
    }

    .menu-images {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    }

    .sub-tabs {
        gap: 2px;
    }

    .sub-tabs .tab {
        font-size: 12px;
        padding: 6px 8px;
    }

    .chart-wrap canvas {
        height: 220px !important;
    }

    .body-chart-section .chart-wrap {
        height: 45dvh;
    }

    .menu-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 10px;
        padding: 0 2px;
    }

    .menu-item-btn {
        min-height: 110px;
        padding: 10px 6px;
    }

    .menu-item-image {
        width: 70px;
        height: 50px;
    }

    .menu-item-name {
        font-size: 11px;
    }

    .selected-quantity-btn {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }

    .no-recommendation-icon {
        font-size: 48px;
        margin-bottom: 16px;
    }

    .no-recommendation-title {
        font-size: 18px;
        margin-bottom: 16px;
    }

    .no-recommendation-content {
        padding: 16px;
    }

    .measurement-guide {
        padding: 16px;
    }

    .measurement-guide h4 {
        font-size: 14px;
    }

    .measurement-guide li {
        font-size: 13px;
        padding: 6px 0 6px 16px;
    }

    .sub-tabs .tab.unavailable::after,
    .sub-tabs .tab.available::after,
    .sub-tabs .tab.processing::after {
        font-size: 8px;
        top: -1px;
        right: -1px;
    }

    .refresh-recommendation-btn {
        padding: 12px 24px;
        font-size: 15px;
        width: 100%;
        max-width: 300px;
    }

    .coupon-header {
        flex-direction: column;
        gap: 8px;
    }

    .coupon-title-area {
        width: 100%;
    }

    .coupon-value {
        align-self: flex-end;
    }

    .coupon-validity {
        padding: 8px 10px;
    }

    .validity-dates {
        font-size: 13px;
    }

    .coupon-status-badge {
        font-size: 11px;
        padding: 3px 10px;
    }

    .coupon-details {
        flex-direction: column;
        gap: 4px;
        align-items: flex-start;
    }

    .coupon-actions {
        justify-content: center;
        gap: 8px;
        flex-wrap: wrap;
    }

    .use-coupon-btn {
        flex: 1;
        min-width: auto;
        max-width: 200px;
    }

    .coupon-info-btn {
        flex: 0 0 auto;
    }

    .benefits-section {
        padding: 10px 12px;
    }

    .benefits-section h5 {
        font-size: 13px;
    }

    .benefits-section li {
        font-size: 12px;
        padding-left: 16px;
    }

    #sqkContainer.container {
        position: fixed;
        inset: 0;
        max-width: none;
        width: 100%;
        height: 100dvh;
        max-height: 100dvh;
        padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
        border-radius: 0;
        margin: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    #sqkContainer .tabs {
        position: sticky;
        top: 0;
        z-index: 100;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(8px);
        border-bottom: 1px solid #eee;
        margin-bottom: 8px;
    }

    #sqkContainer .tab-panels {
        height: auto;
        overflow: visible;
    }

    #sqkContainer .panel-inner {
        height: auto;
        overflow: visible;
        max-height: none;
    }

    #sqkContainer .sub-tabs {
        position: sticky;
        top: 60px;
        z-index: 99;
        background: rgba(255, 255, 255, 0.95);
        border-bottom: 1px solid #eee;
        margin-bottom: 8px;
    }

    #sqkContainer .ai-content {
        min-height: auto;
        max-height: none;
        overflow: visible;
    }

    #sqkContainer .menu-grid {
        height: auto;
        max-height: none;
        overflow: visible;
    }

    #sqkContainer .coupon-list {
        height: auto;
        max-height: none;
        overflow: visible;
    }
}

@media (max-width: 768px) and (orientation: landscape) {
    #resultsContainer .tab-panel .chart-wrap {
        height: 75dvh;
    }

    #sqkContainer .tabs {
        padding: 6px 8px;
    }

    #sqkContainer .tab {
        padding: 8px 10px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .dob-select {
        flex-direction: column;
    }

    .dob-select select {
        width: 100%;
    }

    .gender-options button,
    .allergy-options button,
    .allergy-yes-no button {
        flex: 1 1 100%;
        font-size: 0.9em;
        padding: 10px;
    }

    label {
        font-size: 14px;
    }

    .dob-select select {
        font-size: 0.9em;
        height: 35px;
    }

    #heightContainer.height-stepper {
        gap: 12px;
        padding: 10px 14px;
    }
    .height-step-btn {
        width: 46px;
        height: 46px;
        font-size: 24px;
    }
    .height-value-wrap {
        min-width: 96px;
    }
    .height-input {
        width: 66px;
        font-size: 28px;
    }
    .height-unit {
        font-size: 14px;
    }

    #otherAllergy {
        font-size: 0.9em;
        padding: 8px 10px;
    }

    .submit-button,
    .sample-button {
        font-size: 0.9em;
        padding: 10px;
    }

    .menu-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .menu-item-btn {
        min-height: 100px;
        padding: 8px 4px;
    }

    .menu-item-image {
        width: 60px;
        height: 45px;
    }

    .menu-item-name {
        font-size: 10px;
    }

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

    .registration-btn,
    .clear-selection-btn {
        width: 100%;
        min-width: auto;
    }

    .selected-menu-item {
        padding: 10px;
        gap: 10px;
    }

    .selected-menu-image {
        width: 40px;
        height: 30px;
    }

    .selected-menu-name {
        font-size: 13px;
    }

    .ai-content.no-recommendation {
        min-height: 350px;
        margin-top: 12px;
    }

    .no-recommendation-title {
        font-size: 16px;
    }

    .requirement-badge {
        font-size: 12px;
        padding: 6px 12px;
    }

    .refresh-recommendation-btn {
        padding: 12px 20px;
        font-size: 14px;
    }

    .coupon-title-area {
        flex-direction: column;
        align-items: flex-start;
    }

    .coupon-status-badge {
        margin-left: 0;
        margin-top: 4px;
    }

    .validity-dates {
        font-size: 12px;
        word-break: break-all;
    }

    .coupon-expired::after {
        font-size: 36px;
    }

    .coupon-not-yet-valid::after {
        font-size: 32px;
    }

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

    .use-coupon-btn,
    .coupon-info-btn {
        width: 100%;
        max-width: none;
    }

    #sqkContainer .tabs {
        gap: 2px;
        padding: 4px;
    }

    #sqkContainer .tab {
        padding: 10px 6px;
        font-size: 12px;
        border-radius: 6px;
    }
}

@media (pointer: coarse) {
    .time-slider::-webkit-slider-thumb {
        width: 30px;
        height: 30px;
    }

    .time-slider::-moz-range-thumb {
        width: 30px;
        height: 30px;
    }

    .time-slider::-ms-thumb {
        width: 30px;
        height: 30px;
    }

    .use-coupon-btn {
        min-height: 44px;
        padding: 14px 24px;
        font-size: 16px;
    }

    .coupon-info-btn {
        min-height: 44px;
        padding: 12px 18px;
        font-size: 14px;
    }
}

#sqkContainer * {
    overscroll-behavior: auto;
}

.menu-item-image,
.menu-image {
    will-change: auto;
    transform: translateZ(0);
}

#sqkContainer {
    scroll-padding-top: 80px;
}

@supports (-webkit-touch-callout: none) {
    #sqkContainer.container {
        -webkit-overflow-scrolling: touch;
        transform: translateZ(0);
    }
}

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

    50% {
        transform: scale(1.02);
    }

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

.coupon-card:hover {
    animation: couponPulse 2s ease-in-out infinite;
}

.use-coupon-btn:focus-visible,
.coupon-info-btn:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.6);
    outline-offset: 2px;
}

@media (prefers-contrast: high) {
    .use-coupon-btn {
        border: 2px solid #fff;
    }

    .coupon-info-btn {
        border: 1px solid rgba(255, 255, 255, 0.8);
    }
}

@media (prefers-color-scheme: dark) {
    .coupon-card {
        background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    }
}

/* QRコンテナのボタン群を改善 */
#qrContainer>div:last-of-type {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    width: 100%;
}

#qrContainer .submit-button {
    flex: 1 1 calc(33.333% - 10px);
    min-width: 100px;
    max-width: 200px;
}

/* 狭い画面での調整 */
@media (max-width: 400px) {
    #qrContainer .submit-button {
        flex: 1 1 100%;
        max-width: none;
    }
}

/* 中間サイズ（376px付近）での調整 */
@media (min-width: 350px) and (max-width: 500px) {
    #qrContainer>div:last-of-type {
        gap: 8px;
    }

    #qrContainer .submit-button {
        flex: 1 1 calc(33.333% - 8px);
        min-width: 95px;
        padding: 12px 8px;
        font-size: 0.9em;
    }
}

/* より狭い画面でのフォールバック */
@media (max-width: 349px) {
    #qrContainer .submit-button {
        flex: 1 1 100%;
        max-width: none;
    }
}

.ai-recommendation-notice {
    background: linear-gradient(135deg, #fff3cd 0%, #fff8e1 100%);
    border: 2px solid #ffc107;
    border-radius: 12px;
    padding: 16px;
    margin-top: 24px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.2);
}

.ai-recommendation-notice .notice-icon {
    font-size: 24px;
    margin: 0;
    flex-shrink: 0;
    line-height: 1;
}

.ai-recommendation-notice .notice-text {
    font-size: 13px;
    color: #856404;
    line-height: 1.6;
    margin: 0;
    text-align: left;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .ai-recommendation-notice {
        padding: 14px;
        gap: 10px;
    }

    .ai-recommendation-notice .notice-icon {
        font-size: 20px;
    }

    .ai-recommendation-notice .notice-text {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .ai-recommendation-notice {
        padding: 12px;
        flex-direction: column;
        gap: 8px;
        align-items: center;
        text-align: center;
    }

    .ai-recommendation-notice .notice-text {
        font-size: 11px;
    }
}