/* ============================================================
   ライブタンク プレビュー設定ページ 専用スタイル
   ============================================================ */

/* ── body のリセット ── */
.preview-body {
  background: #1a1a2e !important;
  overflow: auto !important;
  width: 100%;
  height: 100%;
  font-family: 'Segoe UI', 'Hiragino Sans', 'Noto Sans JP', sans-serif;
  color: #fff;
}

/* style.css の html,body ルールがプレビュー全体に影響しないよう上書き */
.preview-body,
.preview-body * {
  box-sizing: border-box;
}

/* ===== ヘッダー ===== */
.pv-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: rgba(0,0,0,0.4);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
  gap: 12px;
  flex-wrap: wrap;
}
.pv-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #fff;
  margin: 0;
  white-space: nowrap;
}
.pv-header-right {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ===== ボタン ===== */
.pv-btn {
  padding: 7px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.15);
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.8);
  white-space: nowrap;
}
.pv-btn:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
}
.pv-btn-primary {
  background: rgba(102,126,234,0.25);
  border-color: rgba(102,126,234,0.4);
  color: #8ea4f0;
}
.pv-btn-primary:hover {
  background: rgba(102,126,234,0.4);
  color: #fff;
}
.pv-btn-accent {
  background: rgba(56,239,125,0.2);
  border-color: rgba(56,239,125,0.35);
  color: #38ef7d;
}
.pv-btn-accent:hover {
  background: rgba(56,239,125,0.35);
  color: #fff;
}
.pv-btn-sub {
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.6);
}
.pv-btn-help {
  background: rgba(255,200,50,0.15);
  border-color: rgba(255,200,50,0.35);
  color: #ffd044;
}
.pv-btn-help:hover {
  background: rgba(255,200,50,0.3);
  color: #fff;
}
.pv-btn-small {
  padding: 4px 12px;
  font-size: 12px;
}

/* ===== メインレイアウト ===== */
.pv-main {
  display: flex;
  height: calc(100vh - 56px);
  overflow: hidden;
}

/* ===== サイドバー（設定パネル） ===== */
.pv-sidebar {
  width: 380px;
  min-width: 320px;
  max-width: 420px;
  background: rgba(0,0,0,0.3);
  border-right: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}

/* タブ */
.pv-tabs {
  display: flex;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding: 0 10px;
  flex-shrink: 0;
  overflow-x: auto;
}
.pv-tab {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  color: rgba(255,255,255,0.45);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
  user-select: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.pv-tab:hover { color: rgba(255,255,255,0.75); }
.pv-tab.active { color: #fff; border-bottom-color: #c44dff; }

/* 設定ボディ */
.pv-settings-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 16px;
}
.pv-settings-body::-webkit-scrollbar { width: 10px; }
.pv-settings-body::-webkit-scrollbar-track { background: rgba(255,255,255,0.02); }
.pv-settings-body::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.18);
  border-radius: 5px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.pv-settings-body::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.3);
  border: 2px solid transparent;
  background-clip: padding-box;
}

/* ===== フォーム要素（settings.css の流用避け・自前定義） ===== */
.pv-group { margin-bottom: 16px; }
.pv-label {
  font-size: 13px; font-weight: 700;
  color: rgba(255,255,255,0.65); letter-spacing: 0.04em;
  margin-bottom: 5px; display: block;
}
.pv-desc {
  font-size: 12px; color: rgba(255,255,255,0.35);
  margin-bottom: 6px; line-height: 1.5;
}

/* ラジオグループ */
.pv-radio-group { display: flex; flex-wrap: wrap; gap: 5px; }
.pv-radio { display: none; }
.pv-radio-label {
  padding: 5px 12px; font-size: 13px; font-weight: 700;
  color: rgba(255,255,255,0.55);
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 7px; cursor: pointer;
  transition: all 0.2s; user-select: none;
}
.pv-radio-label:hover { background: rgba(255,255,255,0.1); color: #fff; }
.pv-radio:checked + .pv-radio-label {
  background: rgba(196,77,255,0.22);
  border-color: #c44dff; color: #fff;
}

/* スライダー */
.pv-slider-row { display: flex; align-items: center; gap: 6px; }
.pv-slider { flex: 1; accent-color: #c44dff; }
.pv-slider-input {
  width: 52px; padding: 3px 4px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 5px; color: #fff;
  font-size: 13px; font-weight: 700;
  text-align: center; outline: none;
  -moz-appearance: textfield;
}
.pv-slider-input::-webkit-outer-spin-button,
.pv-slider-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.pv-slider-input:focus { border-color: #c44dff; }
.pv-slider-unit {
  font-size: 12px; font-weight: 700;
  color: rgba(255,255,255,0.4); min-width: 14px;
}

/* スライダーグリッド */
.pv-slider-grid { display: grid; grid-template-columns: 1fr; gap: 7px; }
.pv-slider-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px; padding: 7px 9px;
}
.pv-slider-card .pv-label { font-size: 11px; margin-bottom: 3px; }

/* テキスト入力 */
.pv-input {
  width: 100%; padding: 7px 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 5px; color: #fff;
  font-size: 14px; outline: none;
}
.pv-input:focus { border-color: #c44dff; }
.pv-input-sm { width: 72px; }

/* トグル */
.pv-toggle {
  width: 38px; height: 20px;
  border-radius: 10px;
  background: rgba(255,255,255,0.13);
  position: relative; cursor: pointer;
  transition: background 0.2s; flex-shrink: 0;
}
.pv-toggle.on { background: #c44dff; }
.pv-toggle::after {
  content: ''; position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 50%; background: #fff;
  transition: left 0.2s;
}
.pv-toggle.on::after { left: 20px; }

/* カラーチップ */
.pv-color-grid { display: flex; flex-wrap: wrap; gap: 5px; }
.pv-color-chip {
  width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid transparent; cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
}
.pv-color-chip:hover { transform: scale(1.15); }
.pv-color-chip.selected { border-color: #fff; box-shadow: 0 0 6px rgba(255,255,255,0.4); }

/* タンクリスト */
.pv-tank-list { display: flex; flex-direction: column; gap: 6px; }
.pv-tank-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
}
.pv-tank-item.disabled { opacity: 0.35; }
.pv-tank-icon { width: 24px; text-align: center; flex-shrink: 0; }
.pv-tank-name { flex: 1; font-size: 14px; font-weight: 700; color: #fff; }
.pv-tank-color-dot {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.25); flex-shrink: 0;
}
.pv-order-btns { display: flex; flex-direction: column; gap: 1px; flex-shrink: 0; }
.pv-order-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.5);
  width: 22px; height: 16px; border-radius: 3px;
  font-size: 9px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.pv-order-btn:hover { background: rgba(255,255,255,0.15); color: #fff; }
.pv-detail-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.6);
  padding: 4px 10px; border-radius: 5px;
  font-size: 12px; font-weight: 700; cursor: pointer;
}
.pv-detail-btn:hover { background: rgba(255,255,255,0.12); color: #fff; }
.pv-tank-detail {
  display: none; padding: 10px 12px; margin-top: 4px;
  background: rgba(255,255,255,0.02); border-radius: 6px;
}
.pv-tank-detail.open { display: block; }

/* ===== プレビュー領域 ===== */
.pv-preview-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.pv-preview-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: rgba(0,0,0,0.25);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.pv-zoom-label,
.pv-size-label, .pv-bg-label {
  font-size: 12px; font-weight: 700;
  color: rgba(255,255,255,0.6);
  display: flex; align-items: center; gap: 4px;
}
.pv-zoom-select {
  padding: 3px 8px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 4px; color: #fff;
  font-size: 12px; outline: none; cursor: pointer;
}
.pv-zoom-select option { background: #222; color: #fff; }
.pv-size-input {
  width: 60px; padding: 3px 6px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 4px; color: #fff;
  font-size: 12px; text-align: center; outline: none;
  -moz-appearance: textfield;
}
.pv-size-input::-webkit-outer-spin-button,
.pv-size-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.pv-size-input:focus { border-color: #c44dff; }
.pv-bg-select {
  padding: 3px 8px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 4px; color: #fff;
  font-size: 12px; outline: none; cursor: pointer;
}
.pv-bg-select option { background: #222; color: #fff; }

.pv-preview-frame {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow: auto;
  padding: 20px;
}
.pv-preview-scaler {
  transform-origin: top center;
  flex-shrink: 0;
}
.pv-preview-canvas {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  /* 透過チェッカーボード */
  background-image:
    linear-gradient(45deg, #2a2a3e 25%, transparent 25%),
    linear-gradient(-45deg, #2a2a3e 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #2a2a3e 75%),
    linear-gradient(-45deg, transparent 75%, #2a2a3e 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}

/* canvas 内の main-layout は本番 style.css で定義されている */
.pv-preview-canvas .main-layout {
  width: 100%;
  height: 100%;
}
.pv-preview-canvas .pipe-layer {
  position: absolute;
  top: 0; left: 0;
}
.pv-preview-canvas .float-emoji-area {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  overflow: hidden;
}

/* ===== ヘルプモーダル ===== */
.pv-help-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.6);
}
.pv-help-box {
  background: rgba(22,22,45,0.97);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  padding: 0;
  max-width: 580px;
  width: 92%;
  max-height: 80vh;
  box-shadow: 0 12px 50px rgba(0,0,0,0.7);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.pv-help-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}
.pv-help-title {
  font-size: 17px;
  font-weight: 800;
  color: #fff;
}
.pv-help-close {
  background: none;
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  width: 30px; height: 30px;
  border-radius: 8px;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.pv-help-close:hover { background: rgba(255,255,255,0.1); }
.pv-help-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.pv-help-body::-webkit-scrollbar { width: 8px; }
.pv-help-body::-webkit-scrollbar-track { background: rgba(255,255,255,0.02); }
.pv-help-body::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 4px;
}
.pv-help-section {
  margin-bottom: 20px;
}
.pv-help-section:last-child { margin-bottom: 0; }
.pv-help-h2 {
  font-size: 14px;
  font-weight: 800;
  color: #ffd044;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.pv-help-h2-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(255,200,50,0.2);
  font-size: 12px;
  font-weight: 800;
  color: #ffd044;
  flex-shrink: 0;
}
.pv-help-text {
  font-size: 13px;
  color: rgba(255,255,255,0.78);
  line-height: 1.75;
}
.pv-help-text strong {
  color: #fff;
  font-weight: 700;
}
.pv-help-text code {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 12px;
  font-family: 'Consolas', 'Courier New', monospace;
  color: #c8d6e5;
}
.pv-help-note {
  margin-top: 8px;
  padding: 10px 14px;
  background: rgba(255,200,50,0.08);
  border: 1px solid rgba(255,200,50,0.15);
  border-radius: 8px;
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  line-height: 1.65;
}

/* ===== 通知トースト ===== */
.pv-toast {
  position: fixed;
  bottom: 20px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(0,0,0,0.85);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  padding: 10px 24px;
  font-size: 14px; font-weight: 700;
  color: #fff;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
}
.pv-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}