/* ===== Variables & Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:        #7c3aed;
  --primary-dark:   #5b21b6;
  --primary-light:  #ede9fe;
  --danger:         #dc2626;
  --bg:             #0f0f1a;
  --bg2:            #1a1a2e;
  --bg3:            #16213e;
  --card-bg:        #1e1e3a;
  --border:         #2d2d5e;
  --text:           #e2e8f0;
  --text-muted:     #94a3b8;
  --radius:         8px;
  --shadow:         0 4px 16px rgba(0,0,0,0.4);

  --rarity-n:   #94a3b8;
  --rarity-r:   #22d3ee;
  --rarity-sr:  #a78bfa;
  --rarity-ssr: #fbbf24;

  --attr-ai:  #f472b6;
  --attr-ch:  #fb923c;
  --attr-ju:  #34d399;
}

html { font-size: 16px; }
body {
  font-family: 'Hiragino Kaku Gothic ProN', 'Meiryo', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ===== Header ===== */
.header {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  display: flex;
  align-items: center;
  height: 56px;
  padding: 0 1rem;
  gap: 1rem;
}
.site-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary-light);
  white-space: nowrap;
  flex-shrink: 0;
}
.nav {
  display: flex;
  gap: 0.25rem;
  flex: 1;
}
.nav-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.nav-btn:hover  { background: var(--bg3); color: var(--text); }
.nav-btn.active { background: var(--primary); color: #fff; }

.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  margin-left: auto;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: 0.2s;
}

.nav-mobile {
  display: none;
  flex-direction: column;
  padding: 0.5rem 1rem 0.75rem;
  gap: 0.25rem;
  border-top: 1px solid var(--border);
}
.nav-mobile.open { display: flex; }
.nav-mobile .nav-btn { text-align: left; }

/* ===== Main & Pages ===== */
.main { padding: 1.5rem 1rem; max-width: 1200px; margin: 0 auto; }
.page { display: none; }
.page.active { display: block; }
.page-title { font-size: 1.25rem; font-weight: 700; margin-bottom: 1.25rem; color: var(--primary-light); }

/* ===== Layouts ===== */
.deck-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.25rem;
  align-items: start;
}
.split-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 1.25rem;
  align-items: start;
}
.skills-forms-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  align-items: start;
  margin-bottom: 2rem;
}
.sub-section { margin-bottom: 2rem; }
.sub-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary-light);
  border-left: 3px solid var(--primary);
  padding-left: 0.6rem;
  margin-bottom: 1rem;
}

/* ===== Panels ===== */
.deck-panel,
.card-pool-panel,
.form-panel,
.list-panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}
.panel-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.panel-actions { margin-top: 0.75rem; }

/* ===== Deck Slots ===== */
.deck-slots { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.75rem; }
.deck-slot {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  min-height: 52px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.deck-slot:not(.empty):hover {
  border-color: var(--primary);
}
.deck-slot.empty {
  color: var(--text-muted);
  font-size: 0.85rem;
  justify-content: center;
  cursor: pointer;
  border-style: dashed;
}
.deck-slot.empty:hover {
  border-color: var(--primary);
  color: var(--primary-light);
}
.slot-empty-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: 0.5rem;
  opacity: 0.7;
}
.slot-rarity {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg2);
  flex-shrink: 0;
}
.slot-info { flex: 1; min-width: 0; }
.slot-card-name { font-size: 0.875rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot-char-name { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 2px 4px;
  flex-shrink: 0;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.slot-remove:hover { color: var(--danger); background: rgba(220,38,38,0.12); }

.slot-lb-wrap {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
}
.slot-lb-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.slot-lb-input {
  width: 58px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  padding: 0.2rem 0.4rem;
  font-size: 0.8rem;
  outline: none;
  text-align: center;
  transition: border-color 0.15s;
}
.slot-lb-input:focus { border-color: var(--primary); }

.slot-skill-wrap {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
}
.slot-skill-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.slot-skill-input {
  width: 52px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  padding: 0.2rem 0.4rem;
  font-size: 0.8rem;
  outline: none;
  text-align: center;
  transition: border-color 0.15s;
}
.slot-skill-input:focus { border-color: var(--primary); }

.skill-lv-badge {
  display: inline-block;
  margin-left: 0.4rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--primary-light);
  background: rgba(124,58,237,0.2);
  border: 1px solid rgba(124,58,237,0.4);
  border-radius: 4px;
  padding: 1px 5px;
  vertical-align: middle;
}

/* ===== Deck 5-Column Layout ===== */
.deck-info-box {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
}
.tokutsubo-bar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
}
.deck-columns {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.deck-col {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.deck-col-slot {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem;
  min-height: 90px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  transition: border-color 0.15s;
}
.deck-col-slot:hover { border-color: var(--primary); }
.deck-col-slot.empty {
  align-items: center;
  justify-content: center;
  border-style: dashed;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.deck-col-slot.empty:hover { color: var(--primary-light); }
.deck-col-slot-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.1rem;
}
.slot-badges {
  display: flex;
  gap: 0.3rem;
  align-items: center;
}
.slot-lb-row {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.25rem;
}
.deck-col-skill {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.3rem 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
}
.deck-col-stats {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.4rem 0.5rem;
  font-size: 0.78rem;
}
.col-stats-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}
.col-stats-row {
  display: flex;
  justify-content: space-between;
  padding: 0.1rem 0;
  color: var(--text-muted);
}
.col-stat-val { font-weight: 600; color: var(--text); }

/* ===== Deck Stats ===== */
.deck-stats {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.8rem;
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}
.stat-row { display: flex; justify-content: space-between; padding: 0.2rem 0; }
.stat-label { color: var(--text-muted); }
.stat-value { font-weight: 600; }
.stat-buff        { font-size: 0.8rem; margin-left: 0.3rem; }
.stat-buff.skill  { color: #4ade80; }
.stat-buff.lb     { color: #fbbf24; }
.stat-buff.tokubo { color: #38bdf8; }

/* ===== 特壺 ===== */
.tokutsubo-section { margin-bottom: 0.75rem; }
.tokutsubo-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
}
.tokutsubo-row { display: flex; gap: 0.5rem; }
.tokutsubo-char-sel { flex: 1; min-width: 0; }
.tokutsubo-lv-sel { width: 72px; flex-shrink: 0; }

/* ===== Deck Skill Status ===== */
.deck-skill-status { margin-bottom: 0.75rem; }
.skill-status-title { font-size: 0.8rem; font-weight: 700; color: var(--text-muted); margin-bottom: 0.4rem; text-transform: uppercase; }
.skill-status-item {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  margin-bottom: 0.4rem;
}
.skill-status-item.active { border-color: #4ade80; }
.skill-status-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.2rem; }
.skill-status-name { font-weight: 600; flex: 1; }
.status-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
}
.status-badge.on { background: rgba(74,222,128,0.2); color: #4ade80; }
.status-badge.off { background: rgba(148,163,184,0.15); color: var(--text-muted); }
.skill-status-detail { color: var(--text-muted); font-size: 0.75rem; }

/* ===== Filter Bar ===== */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.filter-input {
  flex: 1;
  min-width: 140px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.15s;
}
.filter-input:focus { border-color: var(--primary); }
.filter-select {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
  cursor: pointer;
  outline: none;
}
.filter-select:focus { border-color: var(--primary); }

/* ===== Card Grid ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.6rem;
  max-height: calc(100vh - 260px);
  overflow-y: auto;
}
.card-thumb {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  position: relative;
  overflow: hidden;
}
.card-thumb:hover { border-color: var(--primary); background: var(--bg2); }
.card-thumb.in-deck { border-color: var(--primary); background: rgba(124,58,237,0.12); }
.card-thumb-badges {
  display: flex;
  gap: 0.3rem;
  align-items: center;
  margin-bottom: 0.25rem;
}
.card-thumb-rarity {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  display: inline-block;
  flex-shrink: 0;
}
.card-thumb-name {
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-thumb-char { font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-thumb-stat { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.2rem; }
.card-thumb-attr {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  display: inline-block;
  flex-shrink: 0;
}

/* Rarity colors */
.rarity-N   { color: var(--rarity-n);   background: rgba(148,163,184,0.15); }
.rarity-R   { color: var(--rarity-r);   background: rgba(34,211,238,0.15); }
.rarity-SR  { color: var(--rarity-sr);  background: rgba(167,139,250,0.15); }
.rarity-SSR { color: var(--rarity-ssr); background: rgba(251,191,36,0.15); }

/* Attribute colors */
.attr-親愛 { color: var(--attr-ai); background: rgba(244,114,182,0.15); }
.attr-調教 { color: var(--attr-ch); background: rgba(251,146,60,0.15);  }
.attr-従順 { color: var(--attr-ju); background: rgba(52,211,153,0.15);  }

/* Inline attribute badge (for deck slots etc.) */
.slot-attr {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}

/* ===== Form ===== */
.form { display: flex; flex-direction: column; gap: 0.75rem; }
.form-row { display: flex; flex-direction: column; gap: 0.3rem; }
.form-row-inline { flex-direction: row; flex-wrap: wrap; gap: 1rem; }
.form-row-inline > div { display: flex; flex-direction: column; gap: 0.3rem; }
.form-label { font-size: 0.82rem; color: var(--text-muted); }
.form-note  { font-size: 0.78rem; color: #fbbf24; margin-bottom: 0.1rem; }
.req { color: var(--danger); }
.form-input,
.form-select,
.form-textarea {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 0.45rem 0.75rem;
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
  font-family: inherit;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus { border-color: var(--primary); }
.form-input-sm { width: 80px; }
.form-textarea { resize: vertical; }
.form-select { cursor: pointer; }

.radio-group { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.radio-label { display: flex; align-items: center; gap: 0.35rem; font-size: 0.875rem; cursor: pointer; }
.radio-label input[type="radio"] { accent-color: var(--primary); cursor: pointer; }

.checkbox-label { display: flex; align-items: center; gap: 0.45rem; font-size: 0.875rem; cursor: pointer; }
.checkbox-label input[type="checkbox"] { accent-color: var(--primary); cursor: pointer; width: 1rem; height: 1rem; flex-shrink: 0; }

.no-effect-badge {
  display: inline-block;
  margin-left: 0.4rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(148,163,184,0.12);
  border: 1px solid rgba(148,163,184,0.35);
  border-radius: 4px;
  padding: 1px 5px;
  vertical-align: middle;
}

.form-actions { display: flex; gap: 0.5rem; margin-top: 0.25rem; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.45rem 1rem;
  transition: opacity 0.15s, background 0.15s;
}
.btn:hover { opacity: 0.85; }
.btn-primary   { background: var(--primary);      color: #fff; }
.btn-secondary { background: var(--bg3);          color: var(--text); border: 1px solid var(--border); }
.btn-danger    { background: var(--danger);        color: #fff; }
.btn-sm        { padding: 0.3rem 0.65rem; font-size: 0.8rem; }

/* ===== Registered List ===== */
.registered-list { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 0.5rem; }
.list-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
}
.list-item-main { flex: 1; min-width: 0; }
.list-item-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item-sub  { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item-actions { display: flex; gap: 0.3rem; flex-shrink: 0; }
.icon-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 3px 7px;
  transition: color 0.15s, border-color 0.15s;
}
.icon-btn:hover         { color: var(--text); border-color: var(--text); }
.icon-btn.delete:hover  { color: var(--danger); border-color: var(--danger); }

/* ===== Condition Builder ===== */
.cond-add-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}
.cond-type-sel  { width: 130px; }
.cond-value-input { flex: 1; min-width: 80px; }
.cond-count-input { width: 60px; }
.sep { font-size: 0.85rem; color: var(--text-muted); white-space: nowrap; }

.cond-list { display: flex; flex-direction: column; gap: 0.3rem; }
.target-list { flex-direction: row; flex-wrap: wrap; align-items: center; }
.or-sep { font-size: 0.78rem; color: var(--text-muted); padding: 0 0.3rem; }
.cond-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(124,58,237,0.18);
  border: 1px solid rgba(124,58,237,0.4);
  border-radius: 20px;
  padding: 0.2rem 0.6rem;
  font-size: 0.8rem;
}
.cond-tag-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
  padding: 0;
}
.cond-tag-remove:hover { color: var(--danger); }
.empty-hint { font-size: 0.8rem; color: var(--text-muted); }

/* ===== Effect Grid ===== */
.effect-grid { display: flex; flex-direction: column; gap: 0.4rem; }
.effect-row  { display: flex; align-items: center; gap: 0.5rem; }
.effect-label { width: 48px; font-size: 0.85rem; color: var(--text-muted); }

/* ===== Target Value Wrap ===== */
.target-value-wrap { margin-top: 0.4rem; }

/* ===== Modals ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  max-width: 480px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
}
.modal-sm          { max-width: 340px; }
.modal-list        { max-width: 700px; }
.modal-card-picker { max-width: 900px; }
.modal-card-picker .card-grid { max-height: calc(70vh - 120px); }
.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.4rem;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.15s;
}
.modal-close:hover { color: var(--text); }
.confirm-msg { margin-bottom: 1.25rem; font-size: 0.9rem; line-height: 1.5; }

/* ===== Card Detail (modal) ===== */
.card-detail-name { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.5rem; }
.card-detail-row  { display: flex; gap: 0.5rem; font-size: 0.85rem; padding: 0.25rem 0; border-bottom: 1px solid var(--border); }
.card-detail-row:last-child { border-bottom: none; }
.card-detail-key   { color: var(--text-muted); width: 90px; flex-shrink: 0; }
.card-detail-value { font-weight: 500; }
.detail-lb-note    { font-size: 0.78rem; color: var(--text-muted); font-weight: 400; }

/* ===== Limit Break Badge (card grid) ===== */
.lb-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  background: rgba(251,191,36,0.2);
  color: #fbbf24;
  margin-left: 0.3em;
  vertical-align: middle;
}

/* ===== ゲーム内IDバッジ（カード一覧） ===== */
.internal-id-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(124,58,237,0.18);
  color: var(--primary-light);
  border: 1px solid rgba(124,58,237,0.35);
  margin-left: 0.4em;
  vertical-align: middle;
}

/* ===== 重複確認モーダル ===== */
.modal-dup { max-width: 680px; }
.dup-modal-title {
  font-size: 1rem;
  font-weight: 700;
  color: #f87171;
  margin-bottom: 0.5rem;
}
.dup-modal-msg {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  line-height: 1.5;
}
.dup-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.dup-col-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.4rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--border);
}
.dup-row {
  display: flex;
  gap: 0.4rem;
  font-size: 0.82rem;
  padding: 0.18rem 0;
}
.dup-key {
  color: var(--text-muted);
  width: 60px;
  flex-shrink: 0;
}
.dup-val {
  font-weight: 500;
  word-break: break-all;
}
@media (max-width: 560px) {
  .dup-compare { grid-template-columns: 1fr; }
}

/* ===== CSV Import ===== */
.csv-import-panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.csv-hint { font-size: 0.82rem; color: var(--text-muted); }
.csv-hint-sm { font-size: 0.78rem; margin-top: 0.25rem; }
.csv-format-code-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.35rem;
}
.csv-format-code {
  font-family: 'Courier New', monospace;
  font-size: 0.78rem;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.3rem 0.7rem;
  color: #a5f3fc;
  white-space: nowrap;
  overflow-x: auto;
  flex: 1;
}
.csv-input-wrap { display: flex; flex-direction: column; gap: 0.5rem; }
.csv-or-sep { text-align: center; font-size: 0.82rem; color: var(--text-muted); padding: 0.1rem 0; }
.csv-file-input { font-size: 0.85rem; color: var(--text-muted); }
.csv-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.csv-dup-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.csv-dup-sel { width: 120px; }

/* Preview summary counts */
.csv-preview-summary { font-size: 0.85rem; }
.csv-cnt        { font-weight: 700; }
.csv-cnt.ok     { color: #4ade80; }
.csv-cnt.dup    { color: #fbbf24; }
.csv-cnt.err    { color: #f87171; }

/* Preview table */
.csv-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.csv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  white-space: nowrap;
}
.csv-table th {
  background: var(--bg3);
  color: var(--text-muted);
  font-weight: 700;
  padding: 0.4rem 0.7rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.csv-table td {
  padding: 0.35rem 0.7rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.csv-table tr:last-child td { border-bottom: none; }
.csv-table .row-err { background: rgba(239,68,68,0.08); }
.csv-table .row-dup { background: rgba(251,191,36,0.08); }
.csv-table .csv-note {
  color: var(--text-muted);
  white-space: normal;
  max-width: 220px;
  word-break: break-all;
}

/* Badges */
.csv-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
}
.csv-badge.ok  { background: rgba(74,222,128,0.18); color: #4ade80; }
.csv-badge.dup { background: rgba(251,191,36,0.18); color: #fbbf24; }
.csv-badge.err { background: rgba(239,68,68,0.18);  color: #f87171; }

.csv-import-actions { margin-top: 0.25rem; }

/* Result message */
.csv-result-msg {
  padding: 0.6rem 0.9rem;
  background: rgba(74,222,128,0.1);
  border: 1px solid rgba(74,222,128,0.3);
  border-radius: var(--radius);
  font-size: 0.85rem;
  color: #4ade80;
}

/* ===== Empty States ===== */
.empty-state {
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
  padding: 1.5rem 0;
}

/* ===== Logout Button (header) ===== */
#btnLogout {
  margin-left: auto;
  flex-shrink: 0;
  white-space: nowrap;
}
@media (max-width: 640px) {
  #btnLogout { display: none; } /* モバイルではハンバーガーメニュー内に表示しない（ログアウトはPCのみ） */
}

/* ===== Admin Nav Button indicator ===== */
.nav-btn[data-admin="true"]::after {
  content: '🔒';
  font-size: 0.65em;
  margin-left: 0.3em;
  opacity: 0.6;
}
.nav-btn[data-admin="true"].admin-authed::after {
  content: '🔓';
  opacity: 0.8;
}

/* ===== Login Modal ===== */
.login-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--primary-light);
}
.login-error {
  color: #f87171;
  font-size: 0.82rem;
  margin-top: -0.25rem;
}

/* ===== Loading Overlay ===== */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.loading-overlay[hidden] { display: none; }
.loading-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-msg {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .deck-layout  { grid-template-columns: 1fr; }
  .split-layout       { grid-template-columns: 1fr; }
  .skills-forms-row   { grid-template-columns: 1fr; }
  .deck-columns       { grid-template-columns: repeat(3, 1fr); }
  .card-grid    { max-height: none; }
}

@media (max-width: 640px) {
  .nav  { display: none; }
  .hamburger { display: flex; }
  .nav-mobile { display: none; }
  .nav-mobile.open { display: flex; }
  .main { padding: 1rem 0.75rem; }
  .form-input-sm { width: 70px; }
  .deck-columns { grid-template-columns: repeat(2, 1fr); }
}

/* ===== Toast Notification ===== */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: #22c55e;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.6rem 1.4rem;
  border-radius: 999px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  z-index: 9999;
  white-space: nowrap;
  pointer-events: none;
}
.toast[hidden] { display: none; }
.toast.toast-error { background: #ef4444; }
