/* ==========================================================
   base.css — 色・変数・全体レイアウト・共通部品
   デザイン全体の変更(色/ガラス効果/フォント)は主にここ
   ========================================================== */
:root {
    --bg-primary: #000000;
    --bg-card: linear-gradient(135deg, rgba(40, 40, 48, 0.55) 0%, rgba(12, 12, 16, 0.85) 100%);
    --bg-input: rgba(10, 10, 15, 0.7);
    --text-main: #f4f4f6;
    --text-sub: #9ca3af;
    --accent: #c5a059;
    --danger: #f87171;
    --success: #4ade80;
    --warning: #facc15;

    --border-subtle: rgba(255, 255, 255, 0.12);
    --border-glass: rgba(255, 255, 255, 0.22);
    --border-highlight: rgba(255, 255, 255, 0.45);

    --glass-blur: blur(28px) saturate(200%);
    --glass-shadow: 0 20px 40px rgba(0, 0, 0, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.2);

    --glow-white: 0 0 8px rgba(255, 255, 255, 0.85), 0 0 16px rgba(255, 255, 255, 0.3);
    --glow-text: 0 0 6px rgba(255, 255, 255, 0.8);
    --glow-accent: 0 0 10px rgba(197, 160, 89, 0.7);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
}
input, select, textarea {
    -webkit-user-select: text;
    user-select: text;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-primary);
    color: var(--text-main);
}

.bg-orbs {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 0; overflow: hidden;
}
.orb { position: absolute; border-radius: 50%; filter: blur(110px); opacity: 0.32; }
.orb-1 { width: 380px; height: 380px; background: rgba(255, 255, 255, 0.9); top: -100px; left: -80px; }
.orb-2 { width: 420px; height: 420px; background: rgba(120, 120, 140, 0.8); bottom: -80px; right: -100px; }
.orb-3 { width: 300px; height: 300px; background: rgba(197, 160, 89, 0.45); top: 35%; left: 15%; }

/* ---------- ヘッダー ---------- */
header {
    position: fixed; top: 0; left: 0; width: 100%; z-index: 1000;
    background: rgba(12, 12, 16, 0.75); backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    padding-top: env(safe-area-inset-top); height: calc(env(safe-area-inset-top) + 48px);
    padding-left: 16px; padding-right: 16px; font-size: 0.9rem; font-weight: 700;
    border-bottom: 1px solid var(--border-glass); display: flex; justify-content: space-between; align-items: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.header-rate-box { font-size: 0.8rem; color: #ffffff; font-weight: 700; display: flex; align-items: center; gap: 6px; text-shadow: var(--glow-white); cursor: pointer; }
.header-rate-val { color: #ffffff; font-weight: bold; text-shadow: var(--glow-white); letter-spacing: 0.02em; }
.header-rate-change {
    font-size: 0.68rem; font-weight: 600; padding: 1px 5px; border-radius: 4px; text-shadow: none;
}
.header-rate-change.plus { color: #4ade80; background: rgba(74, 222, 128, 0.15); border: 1px solid rgba(74, 222, 128, 0.35); }
.header-rate-change.minus { color: #f87171; background: rgba(248, 113, 113, 0.15); border: 1px solid rgba(248, 113, 113, 0.35); }
.header-timestamp { font-size: 0.58rem; color: var(--text-sub); font-weight: normal; margin-left: 2px; }

/* ---------- コンテナ・タブ表示 ---------- */
.container {
    position: fixed; top: calc(env(safe-area-inset-top) + 48px);
    bottom: calc(56px + env(safe-area-inset-bottom));
    left: 0; right: 0; z-index: 10; max-width: 600px; margin: 0 auto; width: 100%; overflow: hidden;
}

.tab-content { display: none; width: 100%; height: 100%; overflow-y: auto; padding: 12px 16px; }
.tab-content.active { display: block; }
#tab-browser.tab-content.active { display: flex !important; flex-direction: column; padding: 6px 10px; overflow: hidden !important; }
#tab-home.tab-content.active { display: flex !important; flex-direction: column; justify-content: space-between; height: 100%; padding: 10px 14px; overflow: hidden !important; }
#tab-entry.tab-content.active { display: flex !important; flex-direction: column; height: 100%; padding: 12px 16px; overflow: hidden !important; }
#tab-data.tab-content.active { display: flex !important; flex-direction: column; height: 100%; padding: 12px 16px; overflow: hidden !important; }

.section-title { font-size: 0.75rem; font-weight: 700; color: var(--text-sub); margin-bottom: 6px; letter-spacing: 0.05em; display: flex; justify-content: space-between; align-items: center; }

/* ---------- ボタン・タップ演出 ---------- */
.btn, .trade-type-btn, .sticky-tab, .cal-nav button, .checklist-item, .settings-sub-tab, .nav-item, .header-rate-box, .clickable-card, .chart-btn {
    transition: transform 0.15s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.15s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    cursor: pointer;
    touch-action: manipulation;
}
.btn:active, .trade-type-btn:active, .sticky-tab:active, .cal-nav button:active, .checklist-item:active, .settings-sub-tab:active, .nav-item:active, .header-rate-box:active, .clickable-card:active, .chart-btn:active, .is-pressed {
    transform: scale(0.93) !important;
    opacity: 0.75 !important;
}

.btn {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0.05) 100%);
    color: var(--text-main); border: 1px solid var(--border-glass);
    border-top: 1px solid rgba(255, 255, 255, 0.4); border-radius: 14px;
    padding: 10px; font-size: 0.85rem; font-weight: 600; width: 100%; text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}
.btn-primary {
    background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 100%);
    color: #000000; border: none; font-weight: 700;
    box-shadow: 0 4px 20px rgba(255, 255, 255, 0.35);
}

/* ---------- フォーム部品 ---------- */
.form-group { margin-bottom: 10px; }
label { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--text-sub); margin-bottom: 4px; }
input, select, textarea {
    width: 100%; background: var(--bg-input); border: 1px solid var(--border-glass);
    border-radius: 12px; padding: 9px 10px; color: var(--text-main); font-size: 0.85rem; outline: none;
    backdrop-filter: blur(10px);
    transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, select:focus, textarea:focus {
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 12px rgba(255,255,255,0.2);
}

/* ---------- テーブル・損益色(複数画面で共通) ---------- */
.table-wrapper { width: 100%; overflow-x: auto; touch-action: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 0.72rem; }
th, td { padding: 8px 6px; text-align: left; border-bottom: 1px solid var(--border-subtle); white-space: nowrap; }
th { color: var(--text-sub); font-weight: 500; background: rgba(255,255,255,0.06); backdrop-filter: blur(5px); }
tbody tr:nth-child(even) { background-color: rgba(255, 255, 255, 0.04); }
tbody tr:nth-child(odd) { background-color: rgba(0, 0, 0, 0.25); }
tbody tr.trade-row-item { cursor: pointer; transition: background 0.1s; }
tbody tr.trade-row-item:active { background-color: rgba(255, 255, 255, 0.18); }

.text-right { text-align: right; }
.profit-plus { color: var(--success); text-shadow: 0 0 5px rgba(74, 222, 128, 0.4); }
.profit-minus { color: var(--danger); text-shadow: 0 0 5px rgba(248, 113, 113, 0.4); }

/* ---------- モーダル ---------- */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.85); backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 2000; display: none; justify-content: center; align-items: center; padding: 16px;
}
.modal-overlay.active { display: flex; }
.modal-content {
    background: rgba(25, 25, 35, 0.92); border: 1px solid var(--border-highlight);
    border-top: 1px solid rgba(255,255,255,0.5);
    border-radius: 20px; width: 100%; max-width: 450px; max-height: 85vh; overflow-y: auto;
    padding: 18px; box-shadow: 0 25px 50px rgba(0,0,0,0.95);
    backdrop-filter: blur(30px);
}

/* ---------- ナビゲーションバー ---------- */
nav {
    position: fixed; bottom: 0; left: 0; width: 100%;
    height: calc(56px + env(safe-area-inset-bottom));
    background: rgba(12, 12, 16, 0.85); backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-top: 1px solid var(--border-glass); display: flex; justify-content: space-around;
    padding-bottom: env(safe-area-inset-bottom); z-index: 1000;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.5);
}
.nav-item {
    flex: 1; text-align: center; padding-top: 8px; font-size: 0.68rem; color: var(--text-sub); cursor: pointer;
}
.nav-item.active {
    color: #ffffff;
    font-weight: bold;
    text-shadow: var(--glow-white);
}
