:root {
    --bg-color: #f2f2f7;
    --card-bg: #ffffff;
    --text-main: #000000;
    --text-sub: #8e8e93;
    --accent-blue: #007aff;
    --accent-orange: #ff9500;
    --border-color: #c6c6c8;
    --tab-bar-bg: rgba(249, 249, 249, 0.78); /* 半透明 */
    --tab-text: #8e8e93;
    --tab-active: #007aff;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #000000;
        --card-bg: #1c1c1e;
        --text-main: #ffffff;
        --text-sub: #98989e;
        --border-color: #38383a;
        --tab-bar-bg: rgba(30, 30, 30, 0.78);
    }
}

/* 手動切替用クラス */
body.dark-mode {
    --bg-color: #000000;
    --card-bg: #1c1c1e;
    --text-main: #ffffff;
    --text-sub: #98989e;
    --border-color: #38383a;
    --tab-bar-bg: rgba(30, 30, 30, 0.78);
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
    padding-bottom: 80px; /* タブバーの分空ける */
}

header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

h1 { margin: 0; font-size: 32px; font-weight: bold; }

.container { padding: 0 16px; }

/* カードスタイル */
.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-size: 13px; color: var(--text-sub); margin-bottom: 4px; }
.form-group.row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0; }

input {
    width: 100%;
    border: none;
    background: transparent;
    color: var(--text-main);
    text-align: right;
    font-family: inherit;
    outline: none;
    padding: 0;
}
.input-large { font-size: 32px; font-weight: bold; }
.input-medium { font-size: 20px; border-bottom: 1px solid var(--border-color); padding-bottom: 4px;}

.divider { height: 1px; background: var(--border-color); margin: 12px 0; }

/* ステッパー（人数） */
.stepper {
    display: flex;
    align-items: center;
    background: rgba(118, 118, 128, 0.12);
    border-radius: 8px;
    padding: 4px;
}
.stepper button {
    width: 44px; height: 32px; border: none; background: #fff; border-radius: 6px;
    font-size: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); cursor: pointer; color: var(--text-main);
}
body.dark-mode .stepper button { background: #636366; color: white; }
.stepper span { min-width: 60px; text-align: center; font-weight: bold; }

/* セレクトボックス */
.select-group { display: flex; align-items: center; gap: 8px; }
select {
    font-size: 16px; color: var(--accent-blue); border: none; background: transparent; 
    font-weight: 500; cursor: pointer; outline: none; text-align-last: right;
}

/* 結果表示 */
.result-price { 
    display: flex; justify-content: center; align-items: baseline; 
    font-size: 48px; font-weight: bold; color: var(--accent-blue); margin: 10px 0; 
}
.result-price .unit { font-size: 16px; color: var(--text-sub); margin-left: 4px; }
.label-sub { text-align: center; font-size: 13px; color: var(--text-sub); }

.detail-row { display: flex; justify-content: space-between; font-size: 15px; margin-bottom: 8px; }

/* ボタン */
.action-buttons { display: flex; gap: 12px; margin-top: 20px; }
.btn {
    flex: 1; padding: 14px; border: none; border-radius: 10px; 
    font-size: 16px; font-weight: bold; color: white; cursor: pointer;
    display: flex; justify-content: center; align-items: center; gap: 6px;
}
.btn:active { opacity: 0.8; }
.btn-orange { background: var(--accent-orange); }
.btn-blue { background: var(--accent-blue); }
.text-btn { background: none; border: none; color: var(--accent-blue); font-size: 16px; cursor: pointer; }

/* タブ切り替え */
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.2s ease; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* 下部タブバー（リキッドガラス風） */
.tab-bar {
    position: fixed; bottom: 0; left: 0; width: 100%;
    height: 83px; /* iPhoneの下部バー考慮 */
    background: var(--tab-bar-bg);
    backdrop-filter: blur(20px); /* すりガラス効果 */
    -webkit-backdrop-filter: blur(20px);
    border-top: 0.5px solid rgba(0,0,0,0.2);
    display: flex; justify-content: space-around;
    padding-top: 10px; box-sizing: border-box;
    z-index: 100;
}
.tab-item {
    background: none; border: none; cursor: pointer;
    display: flex; flex-direction: column; align-items: center;
    color: var(--tab-text);
}
.tab-item.active { color: var(--tab-active); }
.tab-icon { font-size: 24px; margin-bottom: 4px; }
.tab-label { font-size: 10px; font-weight: 500; }

/* 履歴リスト */
.history-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 0; border-bottom: 1px solid var(--border-color);
}
.h-date { font-size: 12px; color: var(--text-sub); }
.h-detail { font-size: 15px; }
.h-price { font-size: 17px; font-weight: bold; color: var(--accent-blue); text-align: right; }
.h-label { font-size: 11px; color: var(--text-sub); }
.empty-state { text-align: center; color: var(--text-sub); margin-top: 40px; }