/* Stat Cards (294-302) */
.bt-stat-card {
    background: linear-gradient(135deg, rgba(52, 120, 255, 0.1), rgba(0, 0, 0, 0.3));
    border: 1px solid rgba(52, 120, 255, 0.2);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Tag (344-353) */
.active-chart-tag {
    background: var(--surface);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 11px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
}

/* Stat Rows (455-475) */
.bt-stat-card {
    background: var(--surface);
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--border);
    margin-bottom: 16px;
}

.bt-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.bt-stat-row:last-child {
    margin-bottom: 0;
}

/* Chart Control (485-592) */
#chart-container {
    flex-grow: 1;
    display: grid;
    gap: 1.5px;
    background: var(--border);
}

.chart-wrapper {
    position: relative;
    background: var(--bg);
}

.chart-wrapper.active {
    box-shadow: inset 0 0 0 2px var(--accent);
}

.chart-overlay {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 50;
    pointer-events: none;
    font-family: 'Outfit', sans-serif;
}

.chart-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.chart-info {
    font-size: 11px;
    color: var(--accent);
    margin-top: 2px;
    font-weight: 600;
}

.bt-player {
    height: auto;
    background: var(--sidebar-nav);
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 8px 16px 0;
    /* iPhoneホームバー分の余白をbottom段に持たせる */
    z-index: 100;
}

/* 上段: ボタン中央 + 速度右端 */
.bt-player-top {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 100%;
    min-height: 44px;
}

/* 下段: 時刻 — ホームバーより上に余白 */
.bt-player-bottom {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 4px 8px;
    padding-bottom: calc(4px + env(safe-area-inset-bottom));
    min-height: 24px;
}

.bt-player-perf {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-dim);
}

.bt-player-perf b {
    font-family: 'Outfit', monospace;
    font-weight: 700;
}

.perf-sep {
    opacity: 0.3;
    font-size: 10px;
}

.perf-item {
    white-space: nowrap;
}

/* 期間プリセットボタングループ */
.bt-period-preset-group {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
}

.bt-preset-btn {
    padding: 6px 4px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: 'Outfit', sans-serif;
    text-align: center;
}

.bt-preset-btn:hover {
    background: rgba(255,255,255,0.08);
    color: var(--text);
}

.bt-preset-btn.active {
    background: rgba(52, 120, 255, 0.15);
    border-color: var(--accent);
    color: var(--accent);
    font-weight: 700;
}

.bt-group {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.player-speed-ctrl {
    position: absolute;
    right: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

.player-speed-ctrl select {
    width: 52px !important;
    padding: 4px 2px !important;
    font-size: 11px;
}

.player-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Outfit', sans-serif;
}

.player-btn:hover {
    border-color: var(--accent) !important;
    color: var(--accent);
}

.player-btn.action-sell {
    width: 64px;
    background: rgba(239, 83, 80, 0.1);
    border-color: rgba(239, 83, 80, 0.3);
    color: #ef5350;
    font-weight: 800;
}
.player-btn.action-sell:hover {
    background: rgba(239, 83, 80, 0.8) !important;
    color: #fff !important;
}

.player-btn.action-buy {
    width: 64px;
    background: rgba(33, 150, 243, 0.1);
    border-color: rgba(33, 150, 243, 0.3);
    color: #2196f3;
    font-weight: 800;
}
.player-btn.action-buy:hover {
    background: rgba(33, 150, 243, 0.8) !important;
    color: #fff !important;
}

.player-btn.action-close {
    width: 64px;
    background: rgba(255, 193, 7, 0.1);
    border-color: rgba(255, 193, 7, 0.3);
    color: #ffc107;
    font-weight: 800;
}
.player-btn.action-close:hover {
    background: rgba(255, 193, 7, 0.8) !important;
    color: #000 !important;
}

/* 右クイックパネル */
.right-quick-panel {
    width: 160px;
    min-width: 160px;
    background: var(--sidebar-nav);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 16px 12px;
    gap: 0;
    z-index: 200;
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                min-width 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.2s ease;
    overflow: hidden;
}

.right-quick-panel.collapsed {
    width: 0;
    min-width: 0;
    opacity: 0;
    pointer-events: none;
    border-left: none;
    padding: 0;
}

.rqp-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rqp-label {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-dim);
    opacity: 0.7;
}

.rqp-select {
    width: 100% !important;
    font-size: 12px;
    padding: 6px 8px !important;
}

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

.rqp-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.rqp-row-label {
    font-size: 11px;
    color: var(--text-dim);
}

#ohlc-bar {
    font-family: 'Roboto Mono', monospace;
    font-size: 11px;
    color: var(--text-dim);
    transition: all 0.3s ease;
    z-index: 100;
}

/* 下部表示 (デフォルト) */
#ohlc-bar.ohlc-bottom {
    position: absolute;
    bottom: 25px; /* bt-player の上あたり */
    left: 200px;
    display: flex;
    gap: 12px;
    pointer-events: none;
}

/* チャート内表示 */
#ohlc-bar.ohlc-in-chart {
    position: absolute;
    top: 60px;   /* シンボル名の下 */
    left: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: fit-content;
    pointer-events: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.ohlc-item {
    white-space: nowrap;
}

.ohlc-val {
    color: var(--text);
    margin-left: 2px;
}

/* Indicators & Orders (749-992) */
.ind-category-section {
    margin-bottom: 8px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.ind-category-header {
    background: rgba(255, 255, 255, 0.03);
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background 0.2s;
}

.ind-category-header:hover {
    background: rgba(255, 255, 255, 0.06);
}

.ind-category-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text);
}

.ind-category-body {
    background: rgba(0, 0, 0, 0.2);
    padding: 8px;
    transition: all 0.3s ease;
}

.ind-category-body.collapsed {
    display: none;
}

.ind-type-block {
    margin-bottom: 8px;
    background: var(--surface);
    border-radius: 8px;
    padding: 10px;
}

.ind-type-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.ind-type-name {
    font-size: 12px;
    font-weight: 600;
}

.add-ind-btn {
    background: rgba(52, 120, 255, 0.15) !important;
    color: white;
    border: none;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.ind-instance-row {
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed var(--border);
    border-radius: 6px;
    padding: 8px;
    margin-top: 6px;
    transition: opacity 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.ind-instance-row.is-hidden {
    opacity: 0.52;
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.12);
}

.ind-instance-main {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ind-color-picker {
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
}

.ind-instance-params {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    gap: 4px;
}

.ind-instance-params input {
    height: 24px;
    font-size: 10px;
    padding: 0 4px;
}

.ind-toggle-btn {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-dim);
    border: 1px solid var(--border);
    border-radius: 4px;
    width: 28px;
    height: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.ind-toggle-btn:hover {
    background: rgba(52, 120, 255, 0.12);
    color: var(--text);
    border-color: rgba(52, 120, 255, 0.35);
}

.ind-toggle-btn.is-off {
    color: var(--text-dim);
    background: rgba(255, 255, 255, 0.02);
}

[data-theme="light"] .ind-toggle-btn {
    background: rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .ind-toggle-btn.is-off {
    background: rgba(0, 0, 0, 0.015);
}

.del-ind-btn {
    background: rgba(239, 83, 80, 0.1);
    color: var(--danger);
    border: none;
    border-radius: 4px;
    width: 28px;
    height: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.order-panel-v2 {
    padding: 12px;
}

.order-settings-grid,
.order-risk-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 12px;
}

.order-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.order-field label {
    font-size: 10px;
    color: var(--text-dim);
}

.order-actions-main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 20px;
}

.order-btn-buy,
.order-btn-sell {
    height: 60px;
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s, opacity 0.2s;
    position: relative;
    overflow: hidden;
}

.order-btn-buy {
    background: linear-gradient(135deg, #2196f3, #1565c0);
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.3);
}

.order-btn-sell {
    background: linear-gradient(135deg, #f44336, #c62828);
    box-shadow: 0 4px 15px rgba(244, 67, 54, 0.3);
}

.close-btn-v2 {
    width: 100%;
    margin-top: 12px;
    height: 38px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Indicator Tabs (1054-1088) */
.ind-tabs {
    display: flex;
    gap: 2px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 4px;
    margin-bottom: 16px;
}

.ind-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 0;
    font-size: 11px;
    color: var(--text-dim);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

.ind-tab.active {
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.ind-tab .material-symbols-rounded {
    font-size: 16px;
}

/* Sym/TF Grid (1401-1453) */
.sym-grid,
.tf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 8px;
}

.sym-btn,
.tf-btn {
    padding: 12px 4px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-dim);
    font-family: 'Outfit', sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sym-btn:hover,
.tf-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--text-dim);
    transform: translateY(-1px);
    color: var(--text);
}

.sym-btn.active,
.tf-btn.active {
    background: rgba(52, 120, 255, 0.15) !important;
    border-color: var(--accent) !important;
    color: white !important;
    box-shadow: 0 0 15px rgba(52, 120, 255, 0.3), inset 0 0 10px rgba(52, 120, 255, 0.1);
    transform: translateY(0);
}/* --- Currency/TF Select Buttons Light Mode Optimization --- */
[data-theme="light"] .sym-btn.active,
[data-theme="light"] .tf-btn.active {
    background: rgba(47, 129, 247, 0.1) !important;
    color: var(--accent) !important;
    /* 青文字化 */
    border-color: var(--accent) !important;
    font-weight: 800;
}

[data-theme="light"] .sym-btn.active::after,
[data-theme="light"] .tf-btn.active::after {
    color: var(--accent) !important;
}

/* OHLC 値などもライトモードでは少し濃く (視認性向上) */
[data-theme="light"] .ohlc-val {
    color: #000;
    font-weight: 700;
}

[data-theme="light"] .chart-title {
    color: #000;
    text-shadow: none;
}
