/* ==========================================
   ✨ 1. 共通ベース・フォントシステム
   ========================================== */
html, body {
    /* どの端末でも、日本語と英語が最も美しく調和する最先端のシステムゴシックに統一 */
    font-family: "SF Pro Text", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Meiryo", sans-serif;
    background-color: #000000;
    color: #ffffff;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.01em;
}

.app-container {
    max-width: 480px;
    margin: 0 auto;
    padding: 2rem 1.2rem;
    box-sizing: border-box;
}

/* タイトルグラデーション */
h1 {
    text-align: center;
    font-weight: 900;
    font-size: 2.2rem;
    margin-top: 0;
    margin-bottom: 0.2rem;
    letter-spacing: -0.04em;
    background: linear-gradient(135deg, #ffffff 30%, #a2a2a6 100%);
    -webkit-background-clip: text;
    -webkit-text-color: transparent;
    -webkit-background-clip: text;
    background-clip: text;
}

h2 {
    text-align: center;
    font-weight: 500;
    font-size: 0.95rem;
    color: #8e8e93;
    margin-top: 0;
    margin-bottom: 1.5rem;
}

h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-left: 4px;
    margin-bottom: 0.6rem;
    margin-top: 1.8rem;
    color: #007AFF;
    letter-spacing: -0.01em;
}

.update-time {
    text-align: center;
    color: #636366;
    font-size: 0.78rem;
    font-weight: 500;
    margin-bottom: 1.8rem;
    font-variant-numeric: tabular-nums;
}

/* ==========================================
   📦 2. 高級感のあるコンポーネント・カード
   ========================================== */
.ios-card {
    background: rgba(28, 28, 30, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 16px 20px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: 16px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================
   🎛️ 3. ミニマル・セグメントコントロール
   ========================================== */
.segmented-control {
    display: flex;
    background-color: rgba(116, 116, 128, 0.18);
    border-radius: 16px;
    padding: 3px;
    margin-bottom: 16px;
    gap: 2px;
    border: 1px solid rgba(255, 255, 255, 0.02);
}

.segmented-control button {
    flex: 1;
    background: none;
    border: none;
    color: #98989d;
    padding: 10px 4px;
    font-size: 14px;
    font-weight: 700;
    border-radius: 13px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.2, 0, 0, 1);
    outline: none;
}

.segmented-control button.active {
    background-color: #3a3a3c;
    color: #ffffff;
    box-shadow: 0px 3px 12px rgba(0, 0, 0, 0.4);
}

/* ==========================================
   ⌨️ 4. iOS風ステップコントロール（入力欄）
   ========================================== */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 16px;
}

.form-group {
    background-color: rgba(28, 28, 30, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 10px 14px;
    border-radius: 18px;
    position: relative;
    transition: border-color 0.2s, background-color 0.2s;
}

.form-group:focus-within {
    border-color: rgba(0, 122, 255, 0.5);
    background-color: rgba(28, 28, 30, 0.9);
}

.form-group label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: #8e8e93;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

/* ブラウザ標準の不要なスピン矢印を完全に抹殺 */
.form-group input[type="number"]::-webkit-outer-spin-button,
.form-group input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
    display: none !important;
}
.form-group input[type="number"] {
    -moz-appearance: textfield;
}

.stepper-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-top: 4px;
}

.stepper-wrapper input {
    text-align: center;
    flex: 1;
    font-size: 24px;
    font-weight: 800;
    background: none;
    border: none;
    color: #ffffff;
    width: 100%;
    outline: none;
    font-variant-numeric: tabular-nums;
    padding: 0 4px;
}

/* 押しやすい増減物理ボタン */
.step-btn {
    background-color: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: #ffffff;
    font-size: 20px;
    font-weight: 600;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
    -webkit-user-select: none;
}

.step-btn:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

.step-btn:active {
    transform: scale(0.92);
    background-color: rgba(255, 255, 255, 0.25);
}

/* ==========================================
   ☑️ 5. 買い歩トグルスイッチ
   ========================================== */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
    padding: 14px 20px;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    position: relative;
    width: 44px;
    height: 24px;
    -webkit-appearance: none;
    appearance: none;
    background: #3a3a3c;
    border-radius: 12px;
    outline: none;
    transition: background 0.25s cubic-bezier(0.2, 0, 0, 1);
    cursor: pointer;
}

.checkbox-group input[type="checkbox"]:checked {
    background: #34c759;
}

.checkbox-group input[type="checkbox"]::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 10px;
    top: 2px;
    left: 2px;
    background: #ffffff;
    box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.3);
    transition: transform 0.25s cubic-bezier(0.2, 0, 0, 1);
}

.checkbox-group input[type="checkbox"]:checked::before {
    transform: translateX(20px);
}

/* ==========================================
   📊 6. インフォメーション・ダッシュボード
   ========================================== */
.market-info-grid {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: center;
    background: linear-gradient(145deg, rgba(0, 122, 255, 0.03) 0%, rgba(0, 122, 255, 0.08) 100%);
    border: 1px solid rgba(0, 122, 255, 0.2) !important;
}

.market-info-item {
    flex: 1;
}

.market-info-item:not(:last-child) {
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.market-info-item div:first-child {
    font-size: 11px;
    font-weight: 700;
    color: #aeaeb2;
    margin-bottom: 4px;
}

.market-info-item div:last-child {
    font-size: 20px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

/* ==========================================
   ⚡ 7. エレクトリック・リザルトカード
   ========================================== */
.results-grid {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.result-card {
    flex: 1;
    text-align: center;
    padding: 14px 4px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 84px;
    margin-bottom: 0;
}

.result-card div:first-child {
    font-size: 11px;
    font-weight: 700;
    color: #8e8e93;
    margin-bottom: 6px;
}

.result-card .value {
    font-size: 22px;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.03em;
}

.result-card.highlight-red {
    border: 1px solid rgba(255, 59, 48, 0.35);
    background: linear-gradient(180deg, rgba(255, 59, 48, 0.02) 0%, rgba(255, 59, 48, 0.06) 100%);
}
.result-card.highlight-red .value {
    color: #ff453a;
}

.result-card.highlight-blue {
    border: 1px solid rgba(10, 132, 255, 0.35);
    background: linear-gradient(180deg, rgba(10, 132, 255, 0.02) 0%, rgba(10, 132, 255, 0.06) 100%);
}
.result-card.highlight-blue .value {
    color: #0a84ff;
}

/* ==========================================
   🎯 8. タッチアクションボタン
   ========================================== */
.btn-primary {
    background: linear-gradient(135deg, #007AFF 0%, #0056b3 100%);
    color: white;
    border: none;
    border-radius: 18px;
    padding: 16px;
    font-size: 17px;
    font-weight: 700;
    width: 100%;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 122, 255, 0.3);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-primary:active {
    transform: scale(0.98);
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.2);
    opacity: 0.9;
}

.btn-danger {
    background: rgba(255, 59, 48, 0.15);
    color: #ff453a;
    border: 1px solid rgba(255, 59, 48, 0.3);
    border-radius: 16px;
    padding: 12px;
    font-size: 15px;
    font-weight: 700;
    width: 100%;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 10px;
}

.btn-danger:active {
    background: rgba(255, 59, 48, 0.25);
    transform: scale(0.98);
}

/* ==========================================
   📋 9. リスト表示（履歴・最新相場）
   ========================================== */
.price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 4px;
}

.price-row:not(:last-child) {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.price-row span:first-child {
    font-weight: 600;
    font-size: 16px;
    color: #e5e5ea;
}

.price-row span:last-child {
    font-weight: 800;
    color: #0a84ff;
    font-size: 18px;
    font-variant-numeric: tabular-nums;
}

/* ❌ 履歴の個別削除ボタン（右端中央配置） */
.history-card {
    position: relative;
    overflow: hidden;
    padding-right: 44px !important; 
}

.delete-single-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #636366;
    font-size: 18px;
    font-weight: 500;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 10;
    outline: none;
    padding: 0;
}

.delete-single-btn:hover {
    color: #ff453a;
    background-color: rgba(255, 59, 48, 0.12);
}

.delete-single-btn:active {
    transform: translateY(-50%) scale(0.88);
}

/* ==========================================
   🗺️ 10. フッター固定ナビゲーションタブ
   ========================================== */
.tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background-color: rgba(18, 18, 18, 0.8);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom);
}

.tab-item {
    background: none;
    border: none;
    color: #636366;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 100%;
    transition: color 0.2s;
    outline: none;
}

.tab-item.active {
    color: #007AFF;
}

.tab-item .icon {
    font-size: 20px;
    margin-bottom: 3px;
    transition: transform 0.2s;
}

.tab-item:active .icon {
    transform: scale(1.15);
}

/* ==========================================
   ⚙️ 11. チェックボックス付き履歴カード & 合算ボード（3列同期版）
   ========================================== */

/* 履歴カードを横レイアウト化 */
.history-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px !important;
    padding-right: 44px !important; 
}

.history-checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.history-checkbox-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.custom-checkbox {
    width: 22px;
    height: 22px;
    background-color: transparent;
    border: 2px solid #3a3a3c;
    border-radius: 6px;
    position: relative;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.history-checkbox-label input[type="checkbox"]:checked ~ .custom-checkbox {
    background-color: #007AFF;
    border-color: #007AFF;
}

.custom-checkbox::after {
    content: "";
    position: absolute;
    display: none;
    left: 7px;
    top: 3px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg);
}

.history-checkbox-label input[type="checkbox"]:checked ~ .custom-checkbox::after {
    display: block;
}

.history-content {
    flex: 1;
}

.history-card.selected {
    background: rgba(0, 122, 255, 0.05);
    border-color: rgba(0, 122, 255, 0.15);
}

/* 固定表示の合算サマリーボード（3列構成） */
.total-summary-card {
    position: fixed;
    bottom: 64px; 
    left: 0;
    right: 0;
    background: rgba(18, 18, 18, 0.9);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 10px 14px 14px 14px;
    z-index: 990;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.6);
}

.summary-title {
    font-size: 11px;
    font-weight: 700;
    color: #8e8e93;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
    text-align: center;
}

.summary-grid {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.summary-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.03);
    padding: 8px 4px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.04);
    min-height: 54px;
}

.summary-item span:first-child {
    font-size: 10px;
    font-weight: 700;
    color: #8e8e93;
    margin-bottom: 4px;
}

.summary-item .value {
    font-size: 15px;
    font-weight: 800;
    color: #ffffff;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

/* 割合（赤）と歩金込（青）のデザインをカードと完全同期 */
.summary-item.highlight-red {
    border: 1px solid rgba(255, 59, 48, 0.25);
    background: linear-gradient(180deg, rgba(255, 59, 48, 0.01) 0%, rgba(255, 59, 48, 0.04) 100%);
}
.summary-item.highlight-red .value {
    color: #ff453a;
    font-size: 16px;
    font-weight: 900;
}

.summary-item.highlight-blue {
    border: 1px solid rgba(10, 132, 255, 0.25);
    background: linear-gradient(180deg, rgba(10, 132, 255, 0.01) 0%, rgba(10, 132, 255, 0.04) 100%);
}
.summary-item.highlight-blue .value {
    color: #0a84ff;
    font-size: 16px;
    font-weight: 900;
}