/* ============================================================
   DX3rd Session Tool — Dark Cyberpunk Theme
   ============================================================ */

:root {
  --bg:        #0c0c12;
  --bg2:       #13131e;
  --bg3:       #1a1a2a;
  --border:    #2a2a40;
  --border2:   #3a3a58;
  --text:      #d8d8e8;
  --text-dim:  #888899;
  --accent:    #4488ff;
  --accent2:   #22aaff;
  --gold:      #c8a840;
  --red:       #ff4455;
  --orange:    #ff8833;
  --yellow:    #ffd044;
  --green:     #44cc88;
  --exp-color: #aa44ff;
  --section-head: #1c1c30;
  --input-bg:  #0f0f1a;
  --radius:    4px;
  --shadow:    0 2px 12px rgba(0,0,0,0.5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', 'Yu Gothic UI', Meiryo, sans-serif;
  font-size: 13px;
  min-height: 100vh;
}

/* ---- App Header ---- */
.app-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 16px;
  background: #08080f;
  border-bottom: 1px solid var(--border2);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.logo {
  display: flex;
  flex-direction: column;
  line-height: 1;
  min-width: 160px;
}
.logo-main {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--accent2);
  text-transform: uppercase;
}
.logo-sub {
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--text-dim);
}
.logo-ver {
  font-size: 9px;
  color: #88ccee;
}

.main-tabs {
  display: flex;
  gap: 4px;
  flex: 1;
}

.main-tab {
  padding: 6px 20px;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  border-radius: var(--radius);
  font-size: 13px;
  transition: all .15s;
}
.main-tab:hover { color: var(--text); border-color: var(--border2); }
.main-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.header-actions {
  display: flex;
  gap: 6px;
}

.hdr-sep {
  width: 12px;
  flex-shrink: 0;
}

.btn-back {
  padding: 5px 14px;
  background: rgba(68,170,255,0.25);
  color: #fff;
  border: 1px solid rgba(68,170,255,0.4);
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.btn-back:hover { background: rgba(68,170,255,0.4); }

.btn-save    { color: var(--accent2) !important; border-color: var(--accent2) !important; }
.btn-signout { color: var(--red) !important; border-color: var(--red) !important; }

.btn-outline {
  padding: 5px 14px;
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--text-dim);
  cursor: pointer;
  border-radius: var(--radius);
  font-size: 12px;
  transition: all .15s;
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent2); }

/* ---- Tab Panels ---- */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---- Sheet Layout ---- */
.sheet-layout {
  display: grid;
  grid-template-columns: 1fr 470px;
  gap: 0;
  min-height: calc(100vh - 48px);
}

.sheet-left {
  padding: 12px;
  overflow-y: auto;
  border-right: 1px solid var(--border);
}

.sheet-right {
  background: var(--bg2);
  padding: 8px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ---- Section ---- */
.sheet-section {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
}

.section-title {
  background: var(--section-head);
  border-bottom: 1px solid var(--border2);
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold);
}
.section-title-flex {
  display: flex;
  align-items: center;
}
.slot-count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-dim);
}

/* ---- Personal Grid ---- */
.personal-grid {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  padding: 10px;
  align-items: stretch;
}
.pd-fields { display: flex; flex-direction: column; gap: 6px; }
.pd-hp-erosion {
  min-width: 260px;
  display: flex;
  flex-direction: column;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.pdhe-body {
  display: flex;
  flex: 1;
  min-height: 0;
}
.pdhe-left {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  min-width: 0;
}
.pdhe-hp-block { display: flex; flex-direction: column; gap: 4px; }
.pdhe-block-lbl { font-size: 14px; font-weight: 700; color: #ffffff; letter-spacing: 0.03em; }
.pdhe-action-block { display: flex; flex-direction: column; gap: 2px; }
.erosion-row-current label { font-size: 14px !important; font-weight: 700; color: #ffffff !important; }
.erosion-row-current .erosion-input { font-size: 20px !important; width: 70px !important; }
.erosion-row-current .hp-current { font-size: 20px !important; }
input.pdhe-readonly { background: var(--bg) !important; color: #ffffff !important; pointer-events: none; cursor: default; opacity: 0.85; }
.pdhe-gauge {
  width: 120px;
  flex-shrink: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 8px 4px 8px 24px;
  border-left: 1px solid var(--border);
  box-sizing: border-box;
}
.pdhe-gauge-title {
  font-size: 9px;
  color: var(--text-dim);
  white-space: nowrap;
  margin-bottom: 4px;
  letter-spacing: 0.03em;
}
.pdhe-gauge .erosion-gauge {
  flex: 1;
  height: auto !important;
  min-height: 60px;
}
/* ドラッグインジケーター */
.erosion-indicator {
  position: absolute;
  left: -20px;
  right: 0;
  bottom: 0;
  height: 2px;
  display: flex;
  align-items: center;
  pointer-events: none;
}
.erosion-ind-arrow {
  width: 20px;
  text-align: center;
  font-size: 11px;
  color: #ffffff;
  cursor: ns-resize;
  pointer-events: all;
  user-select: none;
  line-height: 1;
  flex-shrink: 0;
}
.erosion-ind-line {
  flex: 1;
  height: 2px;
  background: rgba(255,255,255,0.85);
  border-radius: 1px;
  pointer-events: none;
}

/* パーソナルデータ ヘッダー内プレイヤー名 */
.personal-header { display: flex; align-items: center; justify-content: space-between; }
.player-inline { display: flex; align-items: center; gap: 5px; }
.player-inline-label { font-size: 11px; font-weight: normal; color: var(--text-dim); white-space: nowrap; }
.player-inline-input { width: 130px; font-size: 12px; padding: 3px 6px; }

/* 肖像エリア */
.portrait-wrap { display: flex; align-items: flex-start; }
.portrait-area {
  width: 130px;
  height: 130px;
  aspect-ratio: 1 / 1;
  border: 1px dashed var(--border2);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  background: var(--bg3);
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.portrait-area:hover { border-color: var(--accent); }
.portrait-area img { width: 100%; height: 100%; object-fit: cover; }
.portrait-hint { font-size: 10px; text-align: center; color: var(--text-dim); line-height: 1.6; pointer-events: none; }

.field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.field label {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 1px;
}
.field label.lbl-primary {
  font-size: 13px;
  color: #ffffff;
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* ---- Syndrome Grid ---- */
.syndrome-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 8px;
  padding: 10px;
}

.badge-optional {
  background: var(--gold);
  color: #000;
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 3px;
  vertical-align: middle;
}

/* ---- Input Styles ---- */
input[type="text"],
input[type="number"],
select,
textarea {
  background: var(--input-bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 8px;
  border-radius: var(--radius);
  font-size: 12px;
  font-family: inherit;
  width: 100%;
  transition: border-color .15s;
}
input[type="text"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
}
input[readonly] { opacity: 0.6; cursor: default; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23666'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 6px center; padding-right: 20px; }

/* ---- Stats Table ---- */
.stats-area { padding: 10px; }

.stats-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 8px;
}
.stats-table th {
  background: var(--section-head);
  color: var(--text-dim);
  font-size: 10px;
  letter-spacing: 1px;
  padding: 4px 8px;
  text-align: center;
  border: 1px solid var(--border);
}
.stats-table td {
  border: 1px solid var(--border);
  padding: 4px 8px;
  text-align: center;
}
.stat-name { color: var(--accent2); font-weight: 600; font-size: 12px; }
.stat-base { color: var(--text-dim); }
.stat-total { color: var(--gold); font-weight: 700; font-size: 14px; }
.stats-table input[type="number"] { text-align: center; width: 60px; }

.free-points-info {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.adjust-skill-row {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 4px;
}

.derived-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  padding: 6px 10px 8px;
}
.derived-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: rgba(50, 50, 75, 0.55);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 6px 8px;
}
.derived-label { font-size: 11px; font-weight: 600; color: var(--text-dim); }
.derived-value { font-size: 26px; font-weight: 700; color: var(--green); line-height: 1.1; }
.derived-formula { font-size: 9px; color: var(--text-dim); text-align: center; }

.highlight { color: var(--gold); font-weight: 700; }
.highlight.error { color: var(--red); }

/* ---- Skills Table ---- */
.skills-area { padding: 10px; }
.skills-info { font-size: 11px; color: var(--text-dim); margin-bottom: 6px; }

.r-emotion-cell { padding: 2px 4px !important; }
.r-emotion-cell > div { display: flex; align-items: center; gap: 3px; }
.r-emotion-cell input { flex: 1; min-width: 0; }
.r-emotion-cell .btn-roll-small { flex-shrink: 0; padding: 1px 5px; font-size: 11px; }
.r-roll-badge {
  font-size: 10px;
  color: var(--gold);
  min-width: 22px;
  text-align: right;
  flex-shrink: 0;
}
.r-range-badge {
  font-size: 9px;
  color: var(--text-dim);
  white-space: nowrap;
  flex-shrink: 0;
}
.roi-num {
  text-align: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  width: 24px;
}
.roi-initial td { background: rgba(50, 50, 75, 0.55) !important; }
.r-pos-roll { color: #ff4455 !important; }
.r-neg-roll { color: #4488ff !important; }
.r-both-roll { color: inherit; }

.skills-table,
.items-table,
.rois-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.skills-table th,
.items-table th,
.rois-table th {
  background: var(--section-head);
  color: var(--text-dim);
  font-size: 10px;
  letter-spacing: 1px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  white-space: nowrap;
}
.skills-table td,
.items-table td,
.rois-table td {
  border: 1px solid var(--border);
  padding: 3px 5px;
  vertical-align: middle;
}
.items-note { font-size: 10px; color: var(--text-dim); margin: 4px 0; padding-left: 10px; }

/* ---- Effects Card Grid ---- */
.effects-area { padding: 10px; }

.erosion-bonus-indicator {
  font-size: 11px; color: var(--text-dim); margin-bottom: 6px;
  display: flex; align-items: center; gap: 6px;
}
.erosion-bonus-indicator > #effect-erosion-display,
.erosion-bonus-indicator > #effect-lv-bonus { color: var(--gold); font-weight: 700; }

.dx-rule-tip {
  margin-left: auto;
  font-size: 10px; color: var(--text-dim); font-weight: normal;
  cursor: help; white-space: nowrap;
}
.dx-rule-tip:hover { color: var(--text); }

#dx-rule-popup {
  display: none;
  position: fixed;
  width: 280px;
  background: var(--card-bg, #1e2233);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 11px; color: var(--text); font-weight: normal;
  line-height: 1.6;
  white-space: normal;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  z-index: 9999;
  pointer-events: none;
}

/* Exp バー */
.eff-exp-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 5px 10px; background: var(--bg3); border-radius: 4px;
  margin-bottom: 6px; font-size: 11px;
}
.eff-exp-title { font-weight: 700; color: var(--exp-color); }
.eff-exp-bar .negative { color: var(--red); font-weight: 700; }
.eff-exp-warn  { color: var(--red); font-weight: 700; }

/* カードグリッド */
.eff-card-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 6px;
}

/* カード（タブ2の .ef-card スタイルを継承・拡張） */
.ec-card {
  background: var(--bg3); border: 1px solid var(--border2);
  border-radius: var(--radius); padding: 6px 16px;
  display: flex; flex-direction: column; gap: 3px;
  cursor: pointer; min-height: 90px; position: relative;
  transition: border-color 0.15s, background 0.15s;
}
.ec-card:hover   { border-color: var(--accent2); }
.ec-card.ec-selected {
  border-color: var(--accent2);
  box-shadow: 0 0 0 1px var(--accent2), inset 0 0 8px rgba(34,170,255,0.08);
  background: rgba(34,170,255,0.06);
}
.ec-card.ec-fixed  { background: rgba(255,255,255,0.07); border-color: rgba(255,255,255,0.18); }
.ec-card.ec-add-btn {
  justify-content: center; align-items: center;
  color: var(--text-dim); font-size: 22px; min-height: 60px;
  border-style: dashed;
}
.ec-card.ec-add-btn:hover { color: var(--accent2); border-color: var(--accent2); }
.ec-card.ec-empty { border-style: dashed; opacity: 0.12; pointer-events: none; min-height: 60px; }

.ef-top-right {
  display: flex; align-items: flex-start; gap: 4px; flex-shrink: 0;
}
.ec-del-btn {
  width: 14px; height: 14px; border-radius: 50%;
  background: rgba(255,68,85,0.10); border: 1px solid rgba(255,68,85,0.35);
  color: rgba(255,68,85,0.50); font-size: 9px; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  padding: 0; line-height: 1; flex-shrink: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.ec-del-btn:hover {
  background: rgba(255,68,85,0.28); color: var(--red); border-color: rgba(255,68,85,0.7);
}

/* ── エフェクト生成ボタン ── */
.ec-gen-btn {
  margin-left: auto;
  padding: 2px 7px; border-radius: 4px; font-size: 9px; font-weight: bold;
  cursor: pointer; white-space: nowrap; border: 1px solid;
  transition: background 0.15s, color 0.15s;
}
.ec-gen-weapon {
  background: rgba(255,200,60,0.12); border-color: rgba(255,200,60,0.45); color: rgba(255,200,60,0.9);
}
.ec-gen-weapon:hover {
  background: rgba(255,200,60,0.28); border-color: rgba(255,200,60,0.8); color: #ffd060;
}
.ec-gen-armor {
  background: rgba(80,180,255,0.12); border-color: rgba(80,180,255,0.45); color: rgba(80,180,255,0.9);
}
.ec-gen-armor:hover {
  background: rgba(80,180,255,0.28); border-color: rgba(80,180,255,0.8); color: #50c8ff;
}

/* ── エフェクト生成アイテム バッジ ── */
.item-card-ef {
  border-color: rgba(255,200,60,0.45) !important;
  background: rgba(255,200,60,0.05);
}
.ic-ef-badge {
  font-size: 9px; font-weight: bold; padding: 1px 5px; border-radius: 3px;
  background: rgba(255,200,60,0.18); border: 1px solid rgba(255,200,60,0.5);
  color: rgba(255,200,60,0.95); white-space: nowrap; flex-shrink: 0; margin-right: 4px;
}
/* 防具エフェクトバッジ（水色） */
.ic-ef-badge-armor {
  background: rgba(80,180,255,0.18) !important;
  border-color: rgba(80,180,255,0.5) !important;
  color: rgba(80,180,255,0.95) !important;
}
/* 消費HP: Max表示ラベル */
.ic-hpmax-label {
  font-size: 10px; color: var(--text-dim); white-space: nowrap; flex-shrink: 0;
}
/* HP消費型の自動計算フィールド（readonly）*/
.ic-row1 input[readonly] {
  color: var(--text-dim);
  background: var(--bg2);
  cursor: default;
}

.ec-syn-badge { font-size: 8px; padding: 1px 5px; border-radius: 3px; }
.ec-stats { color: var(--accent2) !important; }
.ec-card-bottom {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: auto; padding-top: 3px; gap: 4px;
}
.ef-restriction { display: flex; align-items: center; gap: 3px; flex-wrap: wrap; }
.ef-rest-label  { font-size: 8px; color: var(--text-dim); white-space: nowrap; }
.ef-erosion-row { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.ef-erosion     { font-size: 8px; color: var(--text-dim); white-space: nowrap; }
.ef-src         { font-size: 8px; color: var(--accent2); white-space: nowrap; opacity: 0.75; }
/* タブ2カード：上限Lv＋収録を縦並びにする右カラム */
.ef-top-right-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  flex-shrink: 0;
}
/* 収録ラベル（目立たせない） */
.ef-src-label {
  font-size: 9px;
  color: var(--text-dim);
  white-space: nowrap;
  font-weight: 400;
  letter-spacing: 0;
  opacity: 0.8;
}

/* カードフッター（Exp操作） */
.ec-footer {
  display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
  margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--border);
  font-size: 10px;
}
.ec-lv-wrap        { display: flex; align-items: center; gap: 3px; }
.ec-lv-wrap.lv-over{ color: var(--orange, #f80); }
.ec-lv-input       { width: 34px; font-size: 10px; text-align: center; }
.ec-maxlv          { color: var(--text-dim); font-size: 10px; }
.ec-exp-cb         { display: flex; align-items: center; gap: 2px; cursor: pointer; }
.ec-explv-wrap     { display: flex; align-items: center; gap: 2px; }
.ec-explv          { width: 30px; font-size: 10px; text-align: center; }

/* Lv上限超過警告（共通） */
.lv-over {
  outline: 2px solid var(--orange, #f80);
  background: rgba(255, 136, 0, 0.15);
  color: var(--orange, #f80);
}

/* ---- 編集パネル ---- */
.eff-edit-panel {
  background: var(--bg2); border: 1px solid var(--accent2);
  border-radius: 6px; padding: 10px; margin-top: 4px;
}
.ep-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border);
}
.ep-title       { font-size: 12px; }
.ep-title-lv     { font-size: 11px; margin-left: 4px; font-weight: normal; }
.ep-title-lv-num { font-weight: 700; color: #ffffff; }
.ep-title-lv-num.lv-high { color: var(--gold); }
.ep-title-restriction { display: inline-flex; gap: 2px; margin-left: 6px; vertical-align: middle; }
.ep-close       { background: rgba(255,68,85,0.08); border: 1px solid rgba(255,68,85,0.35); color: rgba(255,68,85,0.6); font-size: 10px; cursor: pointer; padding: 3px 8px; border-radius: 3px; white-space: nowrap; }
.ep-close:hover { background: rgba(255,68,85,0.2); color: var(--red); border-color: rgba(255,68,85,0.7); }
.ep-body        { display: flex; flex-direction: column; gap: 6px; }
.ep-row         { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; }
.ep-field       { display: flex; flex-direction: column; gap: 2px; }
.ep-field label { font-size: 9px; color: var(--text-dim); white-space: nowrap; }
.ep-field input, .ep-field select, .ep-field textarea { font-size: 11px; }
.ep-field select { min-width: 0; width: 100%; }
.ep-row .ep-field:has(select):not(.ep-field-xs) { flex: 1; min-width: 70px; }
.ep-field-sm    { min-width: 52px; }
.ep-field-xs    { min-width: 44px; max-width: 58px; }
.ep-field-xs input { width: 42px; }
.ep-field-skill { flex: 1; min-width: 60px; }
.ep-field-skill input { width: 100%; }
.ep-field-wide  { flex: 1; min-width: 150px; }
.ep-field-wide input { width: 100%; }
.ep-note { width: 100%; box-sizing: border-box; resize: none; overflow: hidden; min-height: 2.4em; font-size: 11px; font-family: inherit; line-height: 1.5; background: var(--bg2); border: 1px solid var(--border); border-radius: 3px; color: var(--text); padding: 3px 5px; }
.ep-field-restriction { min-width: 60px; }
.ep-restriction-disp { display: flex; flex-wrap: wrap; gap: 2px; padding: 2px 0; min-height: 22px; align-items: center; }
.ep-restriction-none { font-size: 11px; color: var(--text-dim); }
.ep-disp        { font-size: 12px; font-weight: 700; color: var(--gold); padding: 2px 0; display: block; line-height: 1.8; }
.ep-baselv-disp,
.ep-maxlv       { color: #ffffff; font-weight: 400; }
.ep-row-actions { margin-top: 4px; padding-top: 6px; border-top: 1px solid var(--border); }
.ep-del {
  background: rgba(204,68,68,0.15); border: 1px solid rgba(204,68,68,0.4);
  color: #cc4444; font-size: 11px; padding: 4px 10px; border-radius: 4px; cursor: pointer;
}
.ep-del:hover { background: var(--red); color: #fff; }

/* ---- Buttons ---- */
/* ---- items add row ---- */
.items-add-row {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}
.items-add-row .btn-add {
  flex: 1;
  margin-top: 0;
}

.btn-add {
  background: transparent;
  border: 1px dashed var(--border2);
  color: var(--text-dim);
  padding: 5px 12px;
  cursor: pointer;
  border-radius: var(--radius);
  font-size: 12px;
  transition: all .15s;
  width: 100%;
  margin-top: 4px;
}
.btn-add:hover { border-color: var(--accent); color: var(--accent2); }

/* ---- DB toggle button ---- */
.btn-db-toggle {
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--text-sub, #aaa);
  padding: 5px 10px;
  cursor: pointer;
  border-radius: var(--radius);
  font-size: 12px;
  transition: all .15s;
  white-space: nowrap;
}
.btn-db-toggle:hover,
.btn-db-toggle.db-open { border-color: var(--gold); color: var(--gold); background: rgba(212,175,55,.08); }

/* ---- Item DB panel ---- */
.item-db-panel {
  margin-top: 6px;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  background: var(--bg2);
  overflow: hidden;
}
.item-db-filter {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg3);
  border: none;
  border-bottom: 1px solid var(--border2);
  color: var(--text);
  padding: 6px 10px;
  font-size: 12px;
  outline: none;
}
.item-db-filter:focus { border-bottom-color: var(--accent); }
.item-db-list {
  max-height: 220px;
  overflow-y: auto;
}
.idb-entry {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 5px 10px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.idb-entry:last-child { border-bottom: none; }
.idb-entry:hover { background: rgba(212,175,55,.12); }
.idb-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  min-width: 5em;
}
.idb-meta {
  font-size: 11px;
  color: var(--text-dim);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.idb-src { color: var(--text-dim); opacity: .65; font-size: 10px; }
.idb-empty { padding: 8px 10px; color: var(--text-dim); font-size: 12px; }

/* ---- 選択済みアイテム カード ---- */
.item-cards { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }

.item-card {
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  background: var(--bg2);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

/* 段1: 全パラメータ＋削除ボタン */
.ic-row1 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
}
.ic-row1 .ic-name {
  flex: 1;
  min-width: 7em;
  font-size: 13px;
  font-weight: 700;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border2);
  color: var(--text);
  padding: 2px 4px;
  outline: none;
}
.ic-row1 .ic-name:focus { border-bottom-color: var(--accent); }
.ic-row1 .btn-del { margin-left: auto; flex-shrink: 0; }
/* row1 内の各種入力フィールド */
.ic-row1 input:not(.ic-name):not(.ic-chk-purchase):not(.ic-chk-stockpile) {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--accent2);
  font-size: 12px;
  font-weight: 600;
  padding: 2px 5px;
  width: 4.5em;
  text-align: center;
  outline: none;
}
.ic-row1 input.ic-wtype,
.ic-row1 input.ic-atype,
.ic-row1 input.ic-sk,
.ic-row1 input.ic-atk,
.ic-row1 input.ic-rng  { width: 6em; text-align: left; }
.ic-row1 input:not(.ic-name):not(.ic-chk-purchase):not(.ic-chk-stockpile):focus { border-color: var(--accent); }

/* 段2: ステータス入力群 */
.ic-row2 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}
.ic-lbl {
  font-size: 10px;
  color: var(--text-dim);
  white-space: nowrap;
}
.ic-row2 input {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--accent2);
  font-size: 12px;
  font-weight: 600;
  padding: 2px 5px;
  width: 4.5em;
  text-align: center;
  outline: none;
}
.ic-row2 input:focus { border-color: var(--accent); }
.ic-row2 input.ic-atk,
.ic-row2 input.ic-sk,
.ic-row2 input.ic-tim,
.ic-row2 input.ic-rng { width: 6em; text-align: left; }

/* 段3: 備考（全幅） */
.ic-row3 {
  display: flex;
  align-items: center;
  gap: 6px;
}
.ic-row3 .ic-note {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 1px dashed var(--border2);
  color: var(--text-sub, #bbb);
  font-size: 11px;
  padding: 2px 4px;
  outline: none;
}
.ic-row3 .ic-note:focus { border-bottom-color: var(--accent); color: var(--text); }
/* アイテムの常備化P（row1内） */
.ic-row1 .ic-cp {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--accent2);
  font-size: 12px;
  font-weight: 600;
  padding: 2px 5px;
  width: 4em;
  text-align: center;
  outline: none;
}
.ic-row1 .ic-cp:focus { border-color: var(--accent); }

/* 購入/常備化チェックボックス */
.ic-cp-checks {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-left: 4px;
  flex-shrink: 0;
}
.ic-chk-lbl {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  color: var(--gold);
  cursor: pointer;
  user-select: none;
}
.ic-chk-lbl span { color: var(--gold); }
.ic-chk-lbl input[type="checkbox"] {
  accent-color: var(--gold);
  width: 13px;
  height: 13px;
  cursor: pointer;
  margin: 0;
}

/* サイドバー CP内訳 */
.cp-row-sub {
  padding-left: 10px;
  opacity: .8;
}
.cp-row-sub label { font-size: 11px !important; }
.cp-row-wealth {
  margin-top: 4px;
  border-top: 1px solid var(--border2);
  padding-top: 4px;
}
.cp-row-wealth label { color: var(--gold) !important; font-weight: 600; }
.cp-row-wealth span  { color: var(--gold) !important; font-weight: 700; }
.cp-row-wealth.cp-wealth-over label,
.cp-row-wealth.cp-wealth-over span { color: var(--red) !important; }
.cp-row-wealth.cp-wealth-over::after {
  content: '⚠ 超過！';
  font-size: 11px;
  color: var(--red);
  font-weight: 700;
  margin-left: 6px;
}

.btn-del {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--red);
  padding: 1px 6px;
  cursor: pointer;
  border-radius: var(--radius);
  font-size: 11px;
}
.btn-del:hover { background: var(--red); color: #fff; }

.btn-sm {
  background: var(--bg3);
  border: 1px solid var(--border2);
  color: var(--text);
  padding: 3px 10px;
  cursor: pointer;
  border-radius: var(--radius);
  font-size: 11px;
}
.btn-sm:hover { border-color: var(--accent); color: var(--accent2); }

/* ---- Right Column Cards ---- */
.right-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.right-card-title {
  background: var(--section-head);
  border-bottom: 1px solid var(--border2);
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--gold);
  text-transform: uppercase;
}

/* ---- HP ---- */
.hp-area { padding: 10px; }
.hp-display {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 8px;
}
.hp-current {
  width: 70px !important;
  font-size: 20px !important;
  font-weight: 700;
  text-align: center;
  color: var(--green) !important;
}
.hp-sep { font-size: 16px; color: var(--text-dim); }
.hp-max { font-size: 20px; font-weight: 700; color: var(--text-dim); }

.hp-bar-wrap {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 2px;
  height: 8px;
  overflow: hidden;
}
.hp-bar {
  height: 100%;
  transition: width .3s, background-color .3s;
  border-radius: 2px;
}
.hp-bar.hp-high  { background: var(--green); }
.hp-bar.hp-mid   { background: var(--yellow); }
.hp-bar.hp-low   { background: var(--red); }

/* ---- Erosion ---- */
.erosion-card { display: flex; flex-direction: column; }
.erosion-controls { padding: 0; }
.pdhe-left .erosion-controls { padding: 0; }
.erosion-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
  font-size: 11px;
}
.erosion-row label { width: 80px; color: var(--text-dim); flex-shrink: 0; }
.erosion-row-sub { padding-left: 2em; white-space: nowrap; overflow: hidden; }
.erosion-row-sub label { width: 76px; flex-shrink: 0; white-space: nowrap; overflow: hidden; color: #cc6677; }
.erosion-value { font-size: 14px; font-weight: 700; color: var(--accent2); }
.erosion-input { width: 60px !important; font-size: 14px !important; text-align: center; }
.erosion-bonus { font-size: 13px; font-weight: 700; color: var(--gold); }
.erosion-row-sub .erosion-bonus { color: #ff4455; }
.erosion-range { font-size: 9px; color: var(--text-dim); margin-left: 4px; white-space: nowrap; }

/* Erosion gauge */
.erosion-gauge-wrap {
  padding: 8px 10px 8px 40px;
  display: flex;
  justify-content: center;
  position: relative;
  min-height: 220px;
}
.erosion-gauge {
  position: relative;
  width: 32px;
  height: 200px;
  background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: 2px;
  overflow: visible;
}
.erosion-gauge-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  transition: height .4s, background .4s;
  border-radius: 1px;
}
.erosion-gauge-fill.safe    { background: linear-gradient(to top, #33bb77, #44ee99); }
.erosion-gauge-fill.caution { background: linear-gradient(to top, #cc9922, #ffcc44); }
.erosion-gauge-fill.warning { background: linear-gradient(to top, #cc6611, #ff8833); }
.erosion-gauge-fill.danger  { background: linear-gradient(to top, #aa1122, #ff3344); }
.erosion-gauge-fill.critical { background: linear-gradient(to top, #6600aa, #cc44ff); }

.erosion-markers {
  position: absolute;
  left: 100%;
  top: 0;
  width: 60px;
  height: 100%;
  pointer-events: none;
}
.erosion-marker {
  position: absolute;
  left: 4px;
  font-size: 9px;
  color: var(--text-dim);
  transform: translateY(50%);
  white-space: nowrap;
}
.erosion-marker::before {
  content: '─';
  margin-right: 3px;
  color: var(--border2);
}

#erosion-gauge-label {
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--gold);
}

/* ---- Lifepath ---- */
.lifepath-card .right-card-title { color: var(--accent2); }
.lifepath-area { padding: 8px 10px; }
.lp-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
  flex-wrap: wrap;
}
.lp-label { font-size: 10px; color: var(--text-dim); width: 68px; flex-shrink: 0; }
.lp-label.has-popup { font-size: 12px; color: #ffffff; font-weight: 600; }
.lp-result {
  flex: 1;
  font-size: 11px;
  color: var(--text);
  min-width: 120px;
  word-break: break-all;
}
/* 説明欄スタイル */
.lp-desc {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px 8px;
  min-height: 22px;
  color: var(--text);
}
.lp-dice-info {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.lp-roll-badge {
  font-size: 10px;
  font-weight: 700;
  color: var(--gold);
}
.lp-range-badge {
  font-size: 9px;
  color: var(--text-dim);
}
.lp-erosion { font-size: 10px; color: var(--gold); flex-shrink: 0; }
.lp-exp-select { width: auto !important; font-size: 10px; padding: 2px 4px; }
.lp-auto-label { font-size: 9px; margin-left: 3px; font-weight: normal; opacity: 0.85; }

.btn-roll-small {
  background: var(--bg);
  border: 1px solid var(--border2);
  color: var(--accent);
  padding: 2px 8px;
  cursor: pointer;
  border-radius: var(--radius);
  font-size: 10px;
  white-space: nowrap;
}
.btn-roll-small:hover { background: var(--accent); color: #fff; }

/* ---- 経験点カード (右サイドバー) ---- */
.exp-card .right-card-title { color: var(--exp-color); text-transform: none; display: flex; align-items: center; justify-content: space-between; }
.exp-card-body { padding: 8px 10px; display: flex; flex-direction: column; gap: 5px; }

.exp-input-row {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  font-size: 10px; color: var(--text-dim);
}
.exp-input-label { white-space: nowrap; }
.exp-base-val { font-weight: 700; color: var(--exp-color); font-size: 12px; }
.exp-input-sep { color: var(--text-dim); }
.exp-extra-input {
  width: 52px !important; font-size: 11px !important;
  border-color: var(--exp-color) !important; text-align: center;
}
.exp-unit { font-size: 9px; color: var(--text-dim); }

.exp-grand-row {
  display: flex; align-items: baseline; gap: 4px;
  border-top: 1px solid var(--border); padding-top: 5px;
  font-size: 11px;
}
.exp-grand-label { color: var(--text-dim); flex: 1; }
.exp-grand-val { font-weight: 700; color: var(--exp-color); font-size: 14px; }

.exp-breakdown {
  background: rgba(0,0,0,0.15); border-radius: 3px;
  padding: 5px 7px; display: flex; flex-direction: column; gap: 3px;
}
.exp-used-row {
  display: flex; align-items: baseline; gap: 3px; font-size: 10px;
}
.exp-used-label { color: var(--text-dim); flex: 1; }
.exp-used-row span:nth-child(2) { font-weight: 600; color: var(--text); }
.exp-used-total-row { border-top: 1px solid var(--border); padding-top: 3px; margin-top: 1px; }
.exp-used-total-row .exp-used-label { color: var(--text); font-weight: 600; }
.exp-used-total-row span:nth-child(2) { color: var(--exp-color); font-weight: 700; font-size: 12px; }

.exp-remaining-row {
  display: flex; align-items: baseline; gap: 4px;
  border-top: 1px solid var(--border); padding-top: 5px; font-size: 11px;
}
.exp-rem-label { color: var(--text-dim); flex: 1; }
.exp-remaining { font-weight: 700; color: var(--exp-color); font-size: 14px; }
.exp-remaining.negative { color: var(--red) !important; }
.exp-overflow-warn {
  font-size: 10px; color: var(--red); font-weight: 700;
  white-space: nowrap; animation: blink 1s step-start infinite;
  text-align: center;
}
@keyframes blink { 50% { opacity: 0.4; } }

/* 能力値テーブル 左右端列ハイライト（2段ヘッダー対応で1行目に限定） */
.stats-table thead tr:first-child th:first-child,
.stats-table thead tr:first-child th:last-child { background: rgba(50, 50, 75, 0.55); color: #ffffff; font-size: 12px; }
.stats-table td.stat-name  { background: rgba(50, 50, 75, 0.55); font-weight: 700; font-size: 13px; }
.stats-table td.stat-total { background: rgba(50, 50, 75, 0.55); color: #ffffff !important; font-weight: 700; font-size: 18px; text-align: center; }
.stat-nm-body   { color: #ff9944 !important; background: #ff994418 !important; }
.stat-nm-sense  { color: #44ccff !important; background: #44ccff18 !important; }
.stat-nm-mind   { color: #cc88ff !important; background: #cc88ff18 !important; }
.stat-nm-social { color: #44dd88 !important; background: #44dd8818 !important; }
#stat-body-total   { background: #ff994418 !important; }
#stat-sense-total  { background: #44ccff18 !important; }
#stat-mind-total   { background: #cc88ff18 !important; }
#stat-social-total { background: #44dd8818 !important; }

/* ボーナス列（ワークス由来） */
.stat-bonus-th { text-align: center; vertical-align: middle; }
.stat-bonus { text-align: center; font-size: 14px; font-weight: 700; color: #88ccff; }

/* 素点・ボーナス・強化ヘッダー: 白 */
.stats-table thead tr:first-child th:nth-child(2),
.stats-table thead tr:first-child th:nth-child(3),
.stats-table thead tr:first-child th:nth-child(4) {
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
}

/* 技能バー：能力値セクション内サブカテゴリ */
.skill-subsection { margin-top: 0; border-top: 1px solid var(--border2); }

/* 能力値FPサブヘッダー: オレンジ */
.stats-table thead tr:nth-child(2) th:first-child {
  color: var(--gold);
}

/* 素点セル */
.stat-formula { white-space: nowrap; text-align: center; }
.sf-parts { font-size: 9px; color: var(--text-dim); letter-spacing: 0.5px; }
.sf-eq    { font-size: 9px; color: var(--text-dim); margin: 0 1px; }
.sf-val   { font-size: 13px; font-weight: 700; color: var(--text); margin-left: 2px; }

/* 能力値テーブル：0/非0の値スタイル切り替え */
.sv-nz { color: #8ab4cc !important; font-weight: 700 !important; font-size: 13px !important; }
.sv-z  { color: var(--text-dim) !important; font-weight: 400 !important; font-size: 10px !important; }
/* 入力フィールド用（stat-free / stat-exp） */
.stat-free.sv-nz, .stat-exp.sv-nz { color: #8ab4cc !important; font-weight: 700 !important; }
.stat-free.sv-z,  .stat-exp.sv-z  { color: var(--text-dim) !important; font-weight: 400 !important; }
/* 合計列：非0はgold維持、0はdim */
.stat-total.sv-z  { color: rgba(140,140,160,0.4) !important; font-size: 14px !important; font-weight: 400 !important; }

/* 能力値テーブル Exp列（紫） */
.stat-exp-td { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.stat-exp { width: 44px; flex-shrink: 0; }
.stat-exp-cost { font-size: 9px; color: var(--exp-color); white-space: nowrap; }

/* 技能テーブル Exp列（紫） */
.sk-name-td { display: flex; align-items: center; gap: 1px; }
.sk-name-td .sk-name { flex: 1; min-width: 0; }
.sk-bracket { font-size: 13px; color: var(--text-dim); font-weight: 600; flex-shrink: 0; line-height: 1; }
/* ワークス自動行の背景 */
.sk-works-row td { background: rgba(50, 50, 75, 0.55) !important; }

/* 基Lv 読み取り専用表示 */
.sk-lv-display { display: block; text-align: center; font-weight: 700; font-size: 13px; padding: 2px 4px; border-radius: var(--radius); }
.sk-lv-works  { color: #ffffff; border: 1px solid var(--border2); background: rgba(255,255,255,0.06); }
.sk-lv-manual { color: var(--text-dim); border: 1px dashed var(--border); background: transparent; }
.sk-explv { width: 36px; flex-shrink: 0; }
.sk-explv-td { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; }
.sk-explv-cost { font-size: 9px; color: var(--exp-color); white-space: nowrap; }
.sk-total-lv { text-align: center; font-weight: 700; font-size: 14px; color: #ffffff; }

.lp-base-erosion-row {
  border-top: 1px solid var(--border);
  padding-top: 5px;
  margin-top: 3px;
}
.lp-erosion-base { font-size: 16px; font-weight: 700; color: var(--red); }

/* ---- CP Area ---- */
.cp-area { padding: 8px 10px; }
.cp-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.cp-row:last-child { border-bottom: none; }
.cp-row label { color: var(--text-dim); font-size: 11px; }

/* ---- Dice Widget (sheet-right内) ---- */
.dice-widget {
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
}
.dw-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px;
  background: rgba(50,50,75,0.7);
  border-bottom: 1px solid var(--border2);
}
.dw-title { font-size: 11px; font-weight: 700; color: var(--gold); }
.dw-content { padding: 8px; }
.dw-fields { display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; }
.dw-field { display: flex; align-items: center; gap: 6px; }
.dw-field label { font-size: 9px; color: var(--text-dim); width: 72px; flex-shrink: 0; }
.dw-field input, .dw-field select { flex: 1; font-size: 12px; min-width: 0; padding: 2px 4px; }
.dw-field input { text-align: center; }
.dw-field input[type="text"], .dw-field select { text-align: left; }
.dw-auto { font-size: 12px; font-weight: 700; color: var(--green); }

/* ── 計算式テーブル ── */
.dw-calc-table {
  display: grid;
  grid-template-columns: 5em 0.6fr 1.4em 0.6fr 0px 0.6fr 8px 4.5em;
  align-items: center;
  gap: 3px 2px;
  margin-bottom: 4px;
  padding: 0 6px;
  font-size: 11px;
}
.dw-calc-formula {
  padding-top: 2px;
  padding-bottom: 2px;
}
.dw-formula-box {
  grid-column: 1 / 8;
  grid-row: 1 / 3;
  display: grid;
  grid-template-columns: subgrid;
  grid-template-rows: subgrid;
  position: relative;
}
.dw-formula-box::before {
  content: '';
  position: absolute;
  inset: -3px 6px -3px -5px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 5px;
  z-index: 0;
  pointer-events: none;
}
.dw-formula-box > * { position: relative; z-index: 1; }
.dw-target-col {
  grid-column: 8;
  grid-row: 1 / 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-around;
  gap: 3px;
}
.dw-ct-colhd { font-size: 11px; color: #ffffff; text-align: center; font-weight: 600; }
.dw-formula-box .dw-ct-colhd { font-size: 13px; align-self: end; padding-bottom: 2px; }
.dw-target-col .dw-ct-colhd { font-size: 9px; color: #ffffff; font-weight: normal; }
.dw-ct-vsep  { text-align: center; color: var(--border2); font-size: 14px; line-height: 1; }
.dw-ct-lbl   { font-size: 11px; color: var(--text-dim); white-space: nowrap; }
.dw-formula-box .dw-ct-lbl { color: #ffffff; align-self: end; padding-bottom: 2px; font-size: 12px; font-weight: 700; }
.dw-ct-op    { text-align: center; font-size: 16px; color: #ffffff; font-weight: 700; align-self: end; padding-bottom: 2px; margin-left: -2px; }
.dw-ct-total {
  display: block; text-align: center; font-size: 16px; font-weight: 700;
  color: #ffffff; background: var(--bg2); border: 1px solid var(--border2);
  border-radius: 3px; padding: 2px 2px; min-width: 2em;
}
.dw-ct-input {
  width: 100%; box-sizing: border-box; text-align: center;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 3px; color: var(--text); font-size: 11px; padding: 2px 1px;
}
.dw-ct-auto  { font-size: 12px; font-weight: 700; color: var(--green); display: block; text-align: center; }
.dw-ct-frame { background: var(--bg2); border: 1px solid var(--border2); border-radius: 3px; padding: 2px 2px; min-width: 2em; width: 100%; box-sizing: border-box; }
.dw-ct-dim   { font-size: 9px; color: var(--text-dim); }
.dw-ct-dim-zero { color: var(--text-dim); font-weight: 400; }
.dw-ct-hr    { grid-column: 1 / -1; border: none; border-top: 1px solid var(--border); margin: 1px 0; }
.dw-thick-hr { border: none; border-top: 1px solid rgba(255,255,255,0.35); margin: 5px 0; }
.dw-section-label { font-size: 9px; color: var(--text-dim); margin-bottom: 2px; }
.dw-target-col .dw-ct-input { border-color: rgba(255,255,255,0.6); }
.dw-ct-skill-in { min-width: 0; }
.dw-ct-skill-lbl  { font-size: 10px; color: var(--accent2); white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.dw-ct-erosion-cell { display: flex; align-items: center; gap: 2px; width: 100%; }
#cb-mod { min-width: 0; }
#cb-erosion-dice { color: #ff4455 !important; }
.dw-ct-erosion-cell { width: 100%; }
.dw-ct-erosion-in { width: 2.8em !important; }
.dw-ct-fixed-cell { display: flex; align-items: center; gap: 3px; }
.dw-other-in { width: 100%; box-sizing: border-box; text-align: center; background: var(--bg3); border: 1px solid var(--border); border-radius: 3px; color: var(--text); font-size: 11px; padding: 2px 1px; }

/* コピペボタン（判定式ボックス左上） */
.dw-formula-copy-btn {
  position: absolute;
  top: 3px;
  left: 3px;
  z-index: 3;
  font-size: 12px;
  line-height: 1;
  padding: 2px 4px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 3px;
  color: var(--text-dim);
  cursor: pointer;
}
.dw-formula-copy-btn:hover { background: rgba(255,255,255,0.28); color: #fff; }

/* ツールチップ */
.dw-formula-copy-btn::after {
  content: attr(data-tooltip);
  position: absolute;
  top: 50%;
  left: calc(100% + 6px);
  transform: translateY(-50%);
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 4px;
  padding: 4px 7px;
  font-size: 10px;
  color: var(--text);
  white-space: pre;
  z-index: 100;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}
.dw-formula-copy-btn:hover::after { opacity: 1; }
.dw-bcdice {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 3px 6px;
  margin-bottom: 5px;
}
.dw-bcdice code {
  flex: 1;
  font-family: 'Consolas','Courier New',monospace;
  font-size: 10px;
  color: var(--accent2);
  font-weight: 700;
  word-break: break-all;
}
/* ---- 技能グリッド ---- */
.dw-skill-grid { margin-bottom: 5px; display: flex; flex-direction: column; gap: 2px; }
.dw-skill-row  { display: flex; align-items: center; gap: 2px; }
.dw-skill-cat  {
  font-size: 11px; font-weight: 700; flex-shrink: 0; white-space: nowrap;
  text-align: left; border-radius: 2px; padding: 1px 3px; min-width: 3.8em;
}
.dw-skill-hd { flex: 1; text-align: center; min-width: 0; }
.dw-sc-body   { color: #ff9944; border: 1px solid #ff994455; }
.dw-sc-sense  { color: #44ccff; border: 1px solid #44ccff55; }
.dw-sc-mind   { color: #cc88ff; border: 1px solid #cc88ff55; }
.dw-sc-social { color: #44dd88; border: 1px solid #44dd8855; }
.dw-skill-btn {
  position: relative; flex: 1;
  font-size: 11px; padding: 3px 1px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text-dim);
  cursor: pointer; text-align: center; line-height: 1;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
}
.dw-skill-btn:hover  { background: var(--bg3); color: var(--text); border-color: var(--border2); }
.dw-skill-btn.active { background: rgba(68,136,255,0.25); border-color: var(--accent2); color: var(--accent2); font-weight: 700; }
.dw-sk-lv {
  position: absolute; top: 1px; right: 2px;
  font-size: 8px; font-weight: 700; color: var(--gold);
  display: none; line-height: 1;
}
.dw-sk-lv.visible { display: block; }
.dw-sk-lv.dw-sk-lv-zero { font-size: 7px; font-weight: 400; color: var(--text-dim); opacity: 0.5; }
.dw-skill-lv-row { margin-top: 2px; }
.dw-skill-selected { font-size: 10px; color: var(--accent2); margin-left: 4px; }
.dw-stat-val { display: inline-block; font-size: 12px; font-weight: 700; color: var(--text); margin-left: 3px; }
.dw-roll { width: 100%; padding: 7px; font-size: 12px; margin-bottom: 4px; }

/* ---- コンボプリセット ---- */
.combo-presets-section { border-top: 1px solid var(--border); padding: 4px 0 2px; margin-bottom: 4px; }
.combo-preset-hdr,
.combo-preset-row {
  display: grid;
  grid-template-columns: 16px 18px 1fr 36px 36px 34px 22px 22px 22px 26px 40px 20px 20px 16px;
  column-gap: 2px;
  align-items: center;
}
.combo-preset-hdr { padding: 2px 4px 3px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.combo-preset-row { padding: 3px 4px; border-bottom: 1px solid rgba(255,255,255,0.04); }
.combo-preset-row:hover { background: rgba(255,255,255,0.03); }
.combo-preset-active { background: rgba(68,136,255,0.08) !important; }
.combo-name-input {
  width: 100%; background: transparent; border: none;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  color: var(--text); font-size: 9px; padding: 0 1px; outline: none; min-width: 0;
}
.combo-name-input:focus { border-bottom-color: var(--accent); }
.combo-name-input::placeholder { color: var(--text-dim); }
.combo-struct-text { font-size: 8px; color: var(--text-dim); text-align: center; overflow: hidden; white-space: nowrap; }
.btn-combo-mem {
  font-size: 8px; font-weight: 700; padding: 1px 2px; cursor: pointer; border-radius: 2px;
  background: rgba(68,136,255,0.15); color: var(--accent); border: 1px solid rgba(68,136,255,0.3);
  white-space: nowrap; width: 100%;
}
.btn-combo-clr {
  font-size: 9px; padding: 1px 2px; cursor: pointer; border-radius: 2px;
  background: rgba(255,80,80,0.12); color: var(--red); border: 1px solid rgba(255,80,80,0.25);
  width: 100%;
}
.btn-combo-mem:disabled, .btn-combo-clr:disabled { opacity: 0.3; cursor: default; }

.dw-effect-section { border-top: 1px solid var(--border); padding-top: 5px; margin: 5px 0; }
.dw-effect-label { font-size: 9px; color: var(--text-dim); font-weight: 600; margin-bottom: 3px; }
.dw-effect-checks { font-size: 10px; }

/* ---- エフェクト詳細 Tab ---- */
.ed-layout { display: flex; flex-direction: column; height: calc(100vh - 60px); }
.ed-minitab-bar {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 12px 6px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border2);
  flex-shrink: 0;
}
.ed-minitab-row {
  display: flex;
  gap: 3px;
  flex-wrap: nowrap;
}
.ed-minitab-row .ed-minitab {
  flex: 1;
  text-align: center;
}
.ed-minitab {
  font-size: 11px;
  padding: 3px 10px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-dim);
  cursor: pointer;
  font-weight: 600;
}
.ed-minitab:hover { border-color: var(--accent); }
.ed-minitab.active { background: rgba(50,50,75,0.9); border-color: var(--accent2); color: #fff; }
.ed-minitab { position: relative; }
.ed-tab-num {
  position: absolute;
  top: 2px;
  left: 3px;
  font-size: 7px;
  font-weight: 400;
  opacity: 0.45;
  line-height: 1;
  color: currentColor;
  font-variant-numeric: tabular-nums;
}
.ed-minitab--enemy { background: #111111; color: #aaaaaa; border-color: #333333; }
.ed-minitab--enemy:hover { border-color: #666666; color: #cccccc; }
.ed-minitab--enemy.active { background: #1a1a1a; border-color: #888888; color: #eeeeee; }
.ed-minitab--rb { background: rgba(20,30,50,0.4); color: #8899bb; border-color: #2a3a55; }
.ed-minitab--rb:hover { border-color: #4466aa; color: #aabbdd; }
.ed-minitab--rb.active { background: rgba(30,50,80,0.5); border-color: #5577bb; color: #ccddff; }
.ed-minitab--other { background: rgba(20,30,50,0.4); color: #8899bb; border-color: #2a3a55; }
.ed-minitab--other:hover { border-color: #4466aa; color: #aabbdd; }
.ed-minitab--other.active { background: rgba(30,50,80,0.5); border-color: #5577bb; color: #ccddff; }
.ed-minitab--selected { border-color: #ff8833 !important; box-shadow: 0 0 0 1px #ff8833; }
.ed-content { flex: 1; overflow-y: auto; padding: 12px; }
.ed-panel { display: none; }
.ed-panel.active { display: block; }
.ed-placeholder { color: var(--text-dim); font-size: 13px; padding: 20px; text-align: center; }

/* ---- Dice Tab (旧・参照用スタイル残し) ---- */
.dice-layout { padding: 16px; max-width: 900px; margin: 0 auto; }

.dice-subtab-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}
.dice-subtab {
  padding: 6px 24px;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  border-radius: var(--radius) var(--radius) 0 0;
  font-size: 13px;
}
.dice-subtab:hover { color: var(--text); }
.dice-subtab.active {
  background: var(--bg2);
  color: var(--accent2);
  border-bottom-color: var(--bg2);
}

.dice-panel { display: none; }
.dice-panel.active { display: block; }

.dice-panel-inner {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.dice-panel-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 14px;
  letter-spacing: 2px;
}

.dice-input-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.dice-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.dice-field label { font-size: 10px; color: var(--text-dim); letter-spacing: 1px; }
.dice-num-input { width: 80px !important; text-align: center; font-size: 15px !important; font-weight: 700; }
.dice-text-input { width: 100% !important; }
.auto-value { font-size: 15px; font-weight: 700; color: var(--gold); }
.auto-label { font-size: 10px; color: var(--text-dim); }

/* BCDice preview */
.bcdice-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 8px 12px;
  margin-bottom: 12px;
  font-size: 12px;
  color: var(--text-dim);
}
.bcdice-code {
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 18px;
  font-weight: 700;
  color: var(--accent2);
  letter-spacing: 2px;
}
.btn-copy {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 3px 8px;
  cursor: pointer;
  border-radius: var(--radius);
  font-size: 13px;
}
.btn-copy:hover { border-color: var(--accent); color: var(--accent2); }

/* Roll Button */
.btn-roll {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, var(--accent) 0%, #2255cc 100%);
  border: none;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 3px;
  cursor: pointer;
  border-radius: var(--radius);
  transition: opacity .15s, transform .1s;
  margin-bottom: 16px;
}
.btn-roll:hover { opacity: 0.9; }
.btn-roll:active { transform: scale(0.98); }

/* Dice Result */
.dice-result {
  background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 12px;
}
.log-line {
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 2px;
}
/* 3列ロール結果 */
.roll-rounds { display: flex; flex-direction: column; gap: 3px; }
.roll-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 6px;
  align-items: baseline;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 12px;
}
.roll-label { color: var(--text-dim); white-space: nowrap; font-size: 10px; }
.roll-dice  { color: var(--text-sub); }
.roll-crit  { color: #88ccee; font-weight: 700; }
.roll-max   { color: var(--text); font-weight: 700; white-space: nowrap; text-align: right; }
.result-achievement {
  margin: 10px 0 6px;
  font-size: 14px;
}
.achievement-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent2);
}
.achievement-calc { font-size: 11px; color: var(--text-dim); }
.fumble-label { font-size: 18px; font-weight: 700; color: var(--red); }
.result-verdict { font-size: 14px; margin-bottom: 8px; }
.verdict-success { color: var(--green); font-weight: 700; font-size: 16px; }
.verdict-fail    { color: var(--red);   font-weight: 700; font-size: 16px; }
.verdict-sep     { color: var(--text-dim); font-size: 12px; margin-left: 4px; }

.result-erosion-apply {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.result-bcdice {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 8px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

/* ---- Effect Selection (Combat) ---- */
.effect-selection-area {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  margin-bottom: 12px;
}
.effect-sel-title {
  font-size: 11px;
  color: var(--gold);
  letter-spacing: 1px;
  margin-bottom: 8px;
}
.combo-info {
  margin-bottom: 6px;
  min-height: 20px;
  font-size: 11px;
}
.combo-error { color: var(--red); margin-right: 8px; }
.combo-ok    { color: var(--green); }

.effect-checkboxes { display: flex; flex-direction: column; gap: 4px; max-height: 240px; overflow-y: auto; }

/* ヘッダー行 */
.ecb-header-row {
  display: grid;
  grid-template-columns: 16px 18px 1fr 26px 40px 38px 28px 28px 28px 30px 42px 22px;
  column-gap: 2px;
  padding: 2px 8px 3px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.ecb-hd { font-size: 8px; color: var(--text-dim); text-align: center; white-space: nowrap; }
.ecb-hd-name { text-align: left; }
.effect-cb-row {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px 8px;
  cursor: pointer;
  transition: border-color .15s;
}
.effect-cb-row:hover { border-color: var(--border2); }
.effect-cb-row.selected { border-color: var(--accent); background: rgba(68,136,255,0.08); }
/* 固定グリッド: cb | No. | 名前 | Lv | タイミング | 技能 | 難度 | 対象 | 射程 | 制限 | 🎲+ | 浸蝕 */
.effect-cb-row label {
  display: grid;
  grid-template-columns: 16px 18px 1fr 26px 40px 38px 28px 28px 28px 30px 42px 22px;
  align-items: center;
  column-gap: 2px;
  cursor: pointer;
}
.effect-cb-row input[type="checkbox"] { justify-self: center; }
.ecb-num  { color: var(--text-dim); font-size: 9px; text-align: right; white-space: nowrap; }
.ecb-num-fixed { color: rgba(255,255,255,0.3); }
.ecb-name {
  font-weight: 600; font-size: 12px;
  white-space: nowrap; overflow: hidden; min-width: 0;
}
.ecb-lv   { color: var(--gold); font-size: 10px; text-align: center; white-space: nowrap; }
.ecb-erosion-bonus { color: #ff4455; font-size: 9px; font-weight: 700; margin-left: 1px; }
.dw-sk-erosion { color: #ff4455; font-size: 7px; font-weight: 700; }

/* タイミングセル */
.ecb-timing { display: flex; align-items: center; justify-content: center; gap: 1px; }

/* 技能セル */
.ecb-skill {
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; min-width: 0;
}
/* 〈〉技能: 白色テキストのみ（枠なし） */
.ecb-sk-plain { font-size: 8px; font-weight: 700; color: #ffffff; white-space: nowrap; }
/* 【肉体】: オレンジ枠 */
.ecb-sk-body  { font-size: 8px; font-weight: 700; padding: 1px 3px; border-radius: 2px;
  background: rgba(255,136,51,0.15); color: #ff8833; border: 1px solid rgba(255,136,51,0.3); white-space: nowrap; }
/* 【感覚】: 水色枠 */
.ecb-sk-sense { font-size: 8px; font-weight: 700; padding: 1px 3px; border-radius: 2px;
  background: rgba(68,204,255,0.12); color: #44ccff; border: 1px solid rgba(68,204,255,0.25); white-space: nowrap; }
/* 【精神】: 薄紫枠 */
.ecb-sk-mind  { font-size: 8px; font-weight: 700; padding: 1px 3px; border-radius: 2px;
  background: rgba(180,100,230,0.12); color: #b464e6; border: 1px solid rgba(180,100,230,0.25); white-space: nowrap; }
/* シンドロ: 金色枠 */
.ecb-sk-syn   { font-size: 8px; font-weight: 700; padding: 1px 3px; border-radius: 2px;
  background: rgba(255,208,68,0.15); color: var(--gold); border: 1px solid rgba(255,208,68,0.3); white-space: nowrap; }

/* 制限セル */
.ecb-rest     { font-size: 9px; font-weight: 700; text-align: center; white-space: nowrap; color: var(--red); }
.ecb-rest-pct { color: var(--red); }

/* 難易度・対象・射程セル */
.ecb-diff    { font-size: 8px; font-weight: 600; text-align: center; white-space: nowrap; overflow: hidden; }
.ecb-diff-duel { color: var(--red); }
.ecb-tgt     { font-size: 8px; font-weight: 600; text-align: center; white-space: nowrap; overflow: hidden; }
.ecb-rng     { font-size: 8px; font-weight: 600; text-align: center; white-space: nowrap; overflow: hidden; }

/* 🎲+ 列 */
.ecb-dice-col { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; overflow: hidden; min-width: 0; }
.ecb-cv       { font-size: 8px; font-weight: 700; color: var(--red);   white-space: nowrap; }
.ecb-db       { font-size: 8px; font-weight: 700; color: var(--green); white-space: nowrap; }
.ecb-db-neg   { font-size: 8px; font-weight: 700; color: var(--orange, #f80); white-space: nowrap; }

/* 浸蝕セル */
.ecb-erosion  { color: var(--text-dim); font-size: 10px; text-align: right; white-space: nowrap; }

.badge-crit    { font-size: 10px; padding: 1px 5px; border-radius: 3px; white-space: nowrap;
  background: rgba(255,68,85,0.2);   color: var(--red); }
.badge-dice    { font-size: 10px; padding: 1px 5px; border-radius: 3px; white-space: nowrap;
  background: rgba(68,204,136,0.2);  color: var(--green); }
.badge-dice-neg { font-size: 10px; padding: 1px 5px; border-radius: 3px; white-space: nowrap;
  background: rgba(255,136,0,0.2);   color: var(--orange, #f80); }
.badge-timing  { background: rgba(68,136,255,0.2);  color: var(--accent2); }
.badge-skill   { background: rgba(200,168,64,0.2);  color: var(--gold); }

.no-effects-msg { font-size: 11px; color: var(--text-dim); padding: 8px; text-align: center; }

/* ---- ポップアップテーブル ---- */
.has-popup {
  cursor: help;
  text-decoration: underline dotted var(--text-dim);
  text-underline-offset: 3px;
}
#popup-overlay {
  position: fixed;
  z-index: 9999;
  background: var(--bg2, #1e1e2e);
  border: 1px solid var(--border2, #444);
  border-radius: var(--radius, 4px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.6);
  padding: 5px 7px;
  display: none;
  pointer-events: none;
}
.pop-ref { padding: 2px 1px; }
.pop-ref-main { font-size: 11px; font-weight: 600; color: var(--text); }
.pop-ref-data { font-size: 9px; color: var(--text-dim); }
#popup-overlay .pop-title {
  font-size: 9px;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 3px;
  text-align: center;
}
#popup-overlay table {
  border-collapse: collapse;
  font-size: 9px;
  white-space: nowrap;
}
#popup-overlay th,
#popup-overlay td {
  padding: 1px 6px;
  border: 1px solid var(--border, #333);
  text-align: center;
}
#popup-overlay th {
  background: rgba(50,50,75,0.9);
  color: var(--gold);
  font-weight: 700;
}
#popup-overlay td:first-child { text-align: left; }
.pop-exp-wrap {
  display: flex;
  gap: 6px;
  align-items: flex-start;
}
.pop-exp-col {
  flex: 1;
}

/* Combo summary */
.combo-summary {
  background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 8px;
  margin-bottom: 12px;
}
.combo-table { font-size: 12px; }
.combo-table th { color: var(--text-dim); padding: 2px 8px 2px 0; text-align: left; width: 100px; }
.combo-table td { color: var(--text); font-weight: 600; }

/* ---- Toast ---- */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  z-index: 9999;
  box-shadow: var(--shadow);
  animation: fadeIn .2s;
}
.toast-ok    { background: var(--green); color: #000; }
.toast-error { background: var(--red);   color: #fff; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---- Checkbox ---- */
input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ---- Effect Cards (エフェクト詳細タブ) ---- */
.ef-section-hd {
  font-size: 10px; color: var(--text-dim); font-weight: 600;
  margin: 10px 0 6px; letter-spacing: .05em;
  border-bottom: 1px solid var(--border); padding-bottom: 3px;
}
.ef-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 6px; margin-bottom: 4px;
}
.ef-card {
  background: var(--bg3); border: 1px solid var(--border2);
  border-radius: var(--radius); padding: 6px 8px;
  display: flex; flex-direction: column; gap: 3px;
}
.ef-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 4px; }
.ef-name-row { display: flex; align-items: baseline; gap: 3px; flex: 1; min-width: 0; }
.ec-num { font-size: 9px; color: var(--text-dim); font-weight: 600; flex-shrink: 0; }
.ec-num-fixed { color: rgba(255,255,255,0.3); }
.ec-move-left,
.ec-move-right {
  position: absolute; top: 0; bottom: 0; width: 14px;
  background: none; border: none; padding: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 8px; cursor: pointer;
  color: transparent;
  transition: color 0.15s, background 0.15s;
  z-index: 2;
}
.ec-move-left  { left: 0;  border-radius: var(--radius) 0 0 var(--radius); }
.ec-move-right { right: 0; border-radius: 0 var(--radius) var(--radius) 0; }
.ec-card:hover .ec-move-left,
.ec-card:hover .ec-move-right { color: rgba(255,255,255,0.3); }
.ec-move-left:hover  { background: rgba(34,170,255,0.15); color: var(--accent2) !important; }
.ec-move-right:hover { background: rgba(34,170,255,0.15); color: var(--accent2) !important; }
.ef-name { font-size: 11px; font-weight: 700; color: #e8e8f8; line-height: 1.3; min-width: 0; }
.ef-card .ef-name { font-size: 14px; }
.ef-lv { font-size: 9px; color: var(--text-dim); white-space: nowrap; flex-shrink: 0; line-height: 1.4; }
.ef-lv-num  { font-weight: 400; }
.ef-lv-high { color: var(--gold); font-weight: 700; }
.ef-lv-sep  { color: var(--text-dim); margin: 0 1px; }
.ef-lv-max  { color: var(--text-dim); font-size: 8px; }
.ef-timing-sep { color: var(--text-dim); font-size: 8px; font-weight: 400; padding: 0 1px; }
.ef-card-mid { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.ef-timing {
  font-size: 8px; font-weight: 700; padding: 1px 4px;
  border-radius: 2px; white-space: nowrap;
}
/* edit table のタイミング select に色クラスが付いた時は文字色だけ変える */
select.ef-timing.ef-t-major  { color: #ff8833; }
select.ef-timing.ef-t-minor  { color: #ffd044; }
select.ef-timing.ef-t-auto   { color: #44cc88; }
select.ef-timing.ef-t-setup  { color: #4488ff; }
select.ef-timing.ef-t-react  { color: var(--red); }
select.ef-timing.ef-t-always { color: #8899aa; }
select.ef-timing.ef-t-clean  { color: #9944cc; }
select.ef-timing.ef-t-init   { color: #44cccc; }
.ef-t-major   { background: rgba(255,136,51,0.15); color: #ff8833; border: 1px solid rgba(255,136,51,0.3); }
.ef-t-minor   { background: rgba(255,208,68,0.12); color: #ffd044; border: 1px solid rgba(255,208,68,0.25); }
.ef-t-auto    { background: rgba(68,204,136,0.12); color: #44cc88; border: 1px solid rgba(68,204,136,0.25); }
.ef-t-setup   { background: rgba(68,136,255,0.12); color: #4488ff; border: 1px solid rgba(68,136,255,0.25); }
.ef-t-react   { background: rgba(255,68,85,0.12);  color: var(--red); border: 1px solid rgba(255,68,85,0.25); }
.ef-t-always  { background: rgba(136,136,153,0.12); color: #8899aa; border: 1px solid rgba(136,136,153,0.25); }
.ef-t-init    { background: rgba(68,204,204,0.12); color: #44cccc; border: 1px solid rgba(68,204,204,0.25); }
.ef-t-clean   { background: rgba(153,68,204,0.12); color: #9944cc; border: 1px solid rgba(153,68,204,0.25); }
.ef-limit {
  font-size: 8px; font-weight: 700; color: #ff4455;
  border: 1px solid rgba(255,68,85,0.4); border-radius: 2px;
  padding: 1px 3px;
}
.ef-meta {
  display: flex; gap: 8px; font-size: 9px; color: var(--text-dim);
}
.ef-meta b { color: #9999bb; margin-right: 2px; }
.ef-desc { font-size: 9px; color: #8899aa; line-height: 1.45; }

/* 所持エフェクト ハイライト */
.ef-card--owned {
  border-color: var(--accent2);
  box-shadow: 0 0 0 1px var(--accent2), inset 0 0 8px rgba(34,170,255,0.08);
  background: rgba(34,170,255,0.06);
}
.ef-card--owned .ef-name {
  color: var(--accent2);
}

/* イージーエフェクト */
.ef-easy-grid {
  display: flex; flex-direction: column; gap: 3px; margin-bottom: 8px;
}
.ef-easy-card {
  display: flex; gap: 8px; align-items: baseline;
  background: var(--bg2); border-radius: var(--radius);
  padding: 3px 8px; border: 1px solid var(--border);
}
.ef-easy-name { font-size: 10px; font-weight: 700; color: #c8b060; white-space: nowrap; flex-shrink: 0; }
.ef-easy-desc { font-size: 9px; color: var(--text-dim); }

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .sheet-layout { grid-template-columns: 1fr; }
  .sheet-right  { border-right: none; border-top: 1px solid var(--border); }
  .personal-grid { grid-template-columns: auto 1fr auto; }
  .syndrome-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
  .personal-grid { grid-template-columns: 1fr; }
  .pd-hp-erosion { flex-direction: row; flex-wrap: wrap; }
  .syndrome-grid { grid-template-columns: 1fr; }
  .main-tabs { display: none; }
}

/* ============================================================
   タブ3: アイテム一覧
   ============================================================ */

.it-card { cursor: default; }

.it-type-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--bg3);
  color: var(--text-dim);
  border: 1px solid var(--border2);
}

.it-badge-special {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 3px;
}

.it-cp {
  font-size: 10px;
  color: var(--gold);
  font-weight: 600;
}

.it-stats {
  font-size: 10px;
  color: var(--text-sub, #aaa);
  letter-spacing: 0.03em;
}

.it-card-bottom {
  display: flex;
  justify-content: flex-end;
  margin-top: auto;
  padding-top: 4px;
}

.it-minitab { /* ed-minitab と同スタイル */
  background: none; border: none; cursor: pointer;
  padding: 4px 10px; font-size: 11px; color: var(--text-dim);
  border-bottom: 2px solid transparent; transition: color 0.15s, border-color 0.15s;
}
.it-minitab:hover  { color: var(--text); }
.it-minitab.active { color: var(--accent2); border-bottom-color: var(--accent2); font-weight: 600; }

.it-own-count {
  font-size: 9px;
  color: var(--text-dim);
  white-space: nowrap;
}

.it-cp-inline {
  font-size: 9px;
  color: var(--gold);
  font-weight: 600;
  margin-left: 4px;
}

/* ============================================================
   サインイン画面 (Sign-in Screen)
   ============================================================ */

#signin-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.signin-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 48px 56px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  text-align: center;
}

.signin-logo-main {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--accent2);
}

.signin-logo-sub {
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-top: -8px;
}

.signin-desc {
  font-size: 13px;
  color: var(--text-dim);
  margin: 8px 0;
  line-height: 1.6;
}

.btn-google-signin {
  display: flex;
  align-items: center;
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 600;
  background: #fff;
  color: #333;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: box-shadow 0.15s;
  margin-top: 8px;
}
.btn-google-signin:hover {
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

.signin-user {
  font-size: 12px;
  color: var(--text-dim);
  margin-right: 4px;
}

/* ============================================================
   倉庫画面 (Warehouse Screen)
   ============================================================ */

#warehouse-screen {
  min-height: 100vh;
  background: var(--bg);
  padding: 0 0 40px;
}

.wh-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 40px;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
}

.wh-title-area {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.wh-logo-main {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--accent2);
}

.wh-logo-sub {
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}

.wh-new-btn {
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 700;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}
.wh-new-btn:hover { background: var(--accent2); }

.wh-char-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  padding: 32px 40px;
  max-width: 1200px;
  margin: 0 auto;
}

.wh-char-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  aspect-ratio: 5 / 3;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  transition: border-color 0.15s, transform 0.1s;
  cursor: default;
}
.wh-char-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.wh-card-top {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  flex: 1;
  min-height: 0;
}

.wh-card-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.wh-card-bottom {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex-shrink: 0;
}

.wh-card-portrait {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.wh-card-portrait-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 5px;
}

.wh-card-initial {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-dim);
  line-height: 1;
  user-select: none;
}

.wh-card-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  word-break: break-all;
}

.wh-card-synopsis {
  font-size: 12px;
  color: var(--accent2);
  min-height: 16px;
}

.wh-card-player {
  font-size: 11px;
  color: var(--text-dim);
  min-height: 14px;
}

.wh-card-updated {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 4px;
}

.wh-card-actions {
  display: flex;
  gap: 6px;
  width: 100%;
  margin-top: 8px;
}

.wh-btn-open {
  flex: 3;
  padding: 7px 0;
  font-size: 13px;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.15s;
}
.wh-btn-open:hover { background: var(--accent2); }

.wh-btn-delete {
  padding: 7px 12px;
  font-size: 12px;
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border2);
  border-radius: 5px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.wh-btn-delete:hover { color: var(--red); border-color: var(--red); }

.wh-loading, .wh-empty, .wh-error {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 0;
  color: var(--text-dim);
  font-size: 14px;
}
.wh-error { color: var(--red); }

/* ============================================================
   承認待ち画面 / 管理パネル
   ============================================================ */

.pending-email {
  font-size: 12px;
  color: var(--accent2);
  word-break: break-all;
}

.wh-admin-btn {
  font-size: 12px;
  padding: 6px 14px;
}

/* 管理パネル overlay */
#admin-panel {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
}

.admin-modal {
  position: relative;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 12px;
  width: 520px;
  max-width: 92vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.admin-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.admin-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}
.admin-close:hover { color: var(--text); background: var(--bg3); }

.admin-panel-body {
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.admin-section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.admin-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg3);
  border-radius: 6px;
  margin-bottom: 6px;
  gap: 12px;
}

.admin-user-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.admin-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.admin-user-email {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-user-actions { flex-shrink: 0; }

.admin-action-btn {
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: opacity 0.15s;
}
.admin-action-btn:disabled { opacity: 0.5; cursor: default; }

.admin-btn-approve { background: var(--green);  color: #000; }
.admin-btn-revoke  { background: var(--bg);     color: var(--red); border: 1px solid var(--red); }
