:root {
  --bg-color: #0f172a;
  --panel-bg: rgba(30, 41, 59, 0.7);
  --panel-border: rgba(255, 255, 255, 0.1);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent: #3b82f6;
  --btn-hover: #60a5fa;
  
  --hp-color: #ef4444;
  --st-color: #eab308;
  --atb-color: #10b981;
}

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

html {
  height: 100%;
}

body {
  font-family: 'Inter', sans-serif;
  color: var(--text-main);
  background-color: var(--bg-color);
  overflow: hidden;
  height: 100%;
}

/* Background Animation */
.bg-gradient {
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at center, #1e3a8a 0%, #0f172a 40%, #020617 100%);
  z-index: -1;
  animation: bg-pulse 20s infinite alternate linear;
}

@keyframes bg-pulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.1); }
}

/* Layout */
#app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: clamp(8px, 1.5vh, 20px);
  padding-bottom: calc(clamp(8px, 1.5vh, 20px) + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1.5vh, 20px);
  height: 100dvh;
  overflow: hidden;
}

header {
  text-align: center;
  padding: 20px;
  border-radius: 12px;
}

header h1 {
  font-weight: 800;
  font-size: 2rem;
  letter-spacing: 2px;
  background: linear-gradient(90deg, #60a5fa, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Components */
.glass-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.hide { display: none !important; }
.screen.hide { display: none !important; }
.screen.active { animation: fade-in 0.5s ease; }

/* Visible screen fills remaining container space */
.screen:not(.hide) {
  flex: 1;
  min-height: 0;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Selection Screen */
#screen-selection {
  padding: 30px 40px;
  text-align: center;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#screen-selection .monster-grid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  margin: 20px 0;
}

/* Battle Screen */
#screen-battle {
  display: flex;
  flex-direction: column;
  padding: clamp(8px, 1.5vh, 20px);
  overflow: hidden;
}

/* Party / Inventory screens: whole screen scrolls internally within viewport */
#screen-party {
  display: block;
  overflow-y: auto;
}

#screen-inventory {
  padding: 30px;
  display: block;
  overflow-y: auto;
}

.monster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 15px;
  margin: 30px 0;
}

.roster-card {
  padding: 20px;
  border-radius: 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--panel-border);
  cursor: pointer;
  transition: all 0.2s ease;
}

.roster-card:hover { background: rgba(255,255,255,0.1); transform: translateY(-3px); }
.roster-card.selected { border-color: var(--accent); background: rgba(59, 130, 246, 0.2); }

/* Battle Arena */
.battle-arena {
  display: grid;
  grid-template-columns: 3fr 4fr 3fr;
  grid-template-rows: 1fr auto;
  gap: clamp(8px, 1.5vh, 20px);
  flex: 1;
  min-height: 0;
}

/* Desktop grid placement: action-menu below p1-side */
.p1-side    { grid-column: 1; grid-row: 1; }
.center-panel { grid-column: 2; grid-row: 1 / span 2; }
.p2-side    { grid-column: 3; grid-row: 1 / span 2; }
#action-menu { grid-column: 1; grid-row: 2; margin-top: 0; }

.side-panel {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow: hidden;
}

.active-monster-card {
  background: rgba(0,0,0,0.3);
  padding: 20px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.05);
  position: relative;
  flex-shrink: 0;
}

.active-monster-card h4 {
  font-size: 1.5rem;
  margin: 0;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 10px;
  margin-bottom: 15px;
}

.elem-badge {
  font-size: 0.75rem;
  font-weight: bold;
  padding: 4px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
  text-transform: uppercase;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.elem-fire { border-color: #ef4444; color: #fca5a5; background: rgba(239, 68, 68, 0.2); }
.elem-water { border-color: #3b82f6; color: #93c5fd; background: rgba(59, 130, 246, 0.2); }
.elem-wind { border-color: #10b981; color: #6ee7b7; background: rgba(16, 185, 129, 0.2); }
.elem-earth { border-color: #eab308; color: #fde047; background: rgba(234, 179, 8, 0.2); }
.elem-thunder { border-color: #f59e0b; color: #fcd34d; background: rgba(245, 158, 11, 0.2); }
.elem-ice { border-color: #06b6d4; color: #67e8f9; background: rgba(6, 182, 212, 0.2); }
.elem-light { border-color: #f8fafc; color: #ffffff; background: rgba(255, 255, 255, 0.3); }
.elem-dark { border-color: #a855f7; color: #d8b4fe; background: rgba(168, 85, 247, 0.2); }
.elem-none { border-color: #94a3b8; color: #cbd5e1; background: rgba(148, 163, 184, 0.2); }

/* Progress Bars */
.bars { display: flex; flex-direction: column; gap: 8px; }
.bars label { font-size: 0.85rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; }

.bar-container {
  width: 100%;
  height: 16px;
  background: rgba(0,0,0,0.5);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

.bar-fill {
  height: 100%;
  width: 100%;
  border-radius: 8px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.bar-fill.hp { background: linear-gradient(90deg, #b91c1c, #ef4444); }
.bar-fill.st { background: linear-gradient(90deg, #ca8a04, #eab308); }
.bar-fill.atb { background: linear-gradient(90deg, #047857, #10b981); }

/* Reserve list: takes remaining side-panel space and scrolls */
.reserve-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

/* Enemy Roster Cards */
.enemy-roster-card {
  padding: 5px 8px;
  background: rgba(0,0,0,0.3);
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.1);
  min-width: 90px;
  flex: 1;
}
.enemy-roster-active {
  border-color: #ef4444;
  background: rgba(239,68,68,0.1);
}
.enemy-roster-dead {
  opacity: 0.4;
}
.enemy-roster-dead span { text-decoration: line-through; }

/* Status Effects */
.is-broken { animation: redBlink 0.7s ease-in-out infinite !important; border-color: #ef4444 !important; }
@keyframes redBlink {
  0%, 100% { border-color: #ef4444; box-shadow: 0 0 10px rgba(239,68,68,0.7); }
  50%       { border-color: rgba(239,68,68,0.15); box-shadow: none; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-5px); }
}

/* Center Panel (Logs & Commands) */
.center-panel {
  display: flex;
  flex-direction: column;
  padding: 20px;
  gap: 15px;
}

.log-box {
  flex-grow: 1;
  background: rgba(0,0,0,0.4);
  border-radius: 12px;
  padding: 15px;
  overflow-y: auto;
  font-family: monospace;
  font-size: 0.95rem;
  line-height: 1.5;
  color: #cbd5e1;
}

.log-entry { margin-bottom: 8px; border-bottom: 1px dashed rgba(255,255,255,0.1); padding-bottom: 5px; }
.log-turn { color: var(--accent); font-weight: bold; }
.log-damage { color: #f87171; }
.log-system { color: #fbbf24; }

/* Action Menu */
.action-menu { padding: 15px; background: rgba(0,0,0,0.2); border-radius: 12px; margin-top: 15px; }
.action-menu.hide { display: none; }
.cmd-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }

/* Timeline Queue */
.timeline-queue {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
  overflow-y: auto;
  max-height: min(380px, 28dvh);
  padding-right: 5px;
}

.queue-item {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--panel-border);
  padding: 10px 15px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: bold;
  transition: all 0.3s ease;
  animation: slideIn 0.3s ease forwards;
}
.queue-item.p1 { border-left: 4px solid var(--accent); }
.queue-item.p2 { border-left: 4px solid var(--hp-color); }
.queue-item.next-up { background: rgba(255, 255, 255, 0.1); transform: translateX(10px); }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Toast Notifications */
.toast-container {
  margin-top: auto;
  min-height: 70px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 5px;
  padding: 5px;
}

.toast {
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.9rem;
  animation: fadeOut 3s forwards;
  color: #f8fafc;
}
.toast b { color: #60a5fa; }
.toast .dmg { color: #f87171; }
.toast .st-dmg { color: #fbbf24; }

@keyframes fadeOut {
  0% { opacity: 0; transform: translateY(10px); }
  10% { opacity: 1; transform: translateY(0); }
  80% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; }
}

/* Eggs UI */
.egg-container {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-bottom: 20px;
}

.egg {
  width: 100px;
  height: 140px;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  position: relative;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 10px 25px rgba(0,0,0,0.45), inset -6px -12px 18px rgba(0,0,0,0.12);
  overflow: hidden;
}

.egg:hover {
  transform: scale(1.05) translateY(-10px);
}

.egg.hatching {
  animation: eggShake 0.5s ease;
  pointer-events: none;
}

@keyframes eggShake {
  0% { transform: rotate(0deg); }
  25% { transform: rotate(15deg); }
  50% { transform: rotate(-15deg); }
  75% { transform: rotate(10deg); }
  100% { transform: rotate(0deg); opacity: 0.5; filter: grayscale(1); }
}

/* 水玉 (赤) */
.egg-red {
  background-color: #f7f0ed;
  background-image: radial-gradient(circle, #dc2626 4.5px, transparent 4.5px);
  background-size: 22px 22px;
}

/* 星 (青) */
.egg-blue {
  background-color: #eef2f8;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22'%3E%3Ctext x='3' y='16' font-size='13' fill='%232563eb'%3E%E2%98%85%3C/text%3E%3C/svg%3E");
  background-size: 22px 22px;
}

/* ひし形格子 (緑) */
.egg-green {
  background-color: #edf5ef;
  background-image:
    repeating-linear-gradient(45deg,  transparent, transparent 7px, #16a34a 7px, #16a34a 9px),
    repeating-linear-gradient(-45deg, transparent, transparent 7px, #16a34a 7px, #16a34a 9px);
}

/* 卵の光沢ハイライト */
.egg-spot {
  position: absolute;
  width: 38px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255,255,255,0.65);
  top: 20px;
  left: 14px;
  transform: rotate(-30deg);
  filter: blur(5px);
  pointer-events: none;
}

.mt-2 { margin-top: 20px; }

/* Buttons */
.btn {
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.start-btn {
  width: 220px !important;
  padding: 14px 20px !important;
  font-size: 1rem !important;
  text-align: center;
  box-sizing: border-box;
}

.primary-btn {
  background: var(--accent);
  color: white;
  margin-top: 20px;
  width: 200px;
}

.primary-btn:hover:not(:disabled) { background: var(--btn-hover); transform: scale(1.05); }
.primary-btn:disabled { background: #475569; cursor: not-allowed; opacity: 0.7; }

.skill-btn {
  background: rgba(255,255,255,0.1);
  color: var(--text-main);
  border: 1px solid var(--panel-border);
}
.skill-btn:hover { background: rgba(59, 130, 246, 0.4); border-color: var(--accent); }

.active-tab {
  background: var(--accent) !important;
  color: white !important;
  border-color: var(--btn-hover) !important;
  opacity: 1 !important;
}

.inactive-tab {
  opacity: 0.5;
}

.inv-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.inv-item-row:hover {
  background: rgba(255,255,255,0.15);
  border-color: var(--accent);
}
.inv-item-row.selected {
  background: rgba(59, 130, 246, 0.3);
  border-color: var(--accent);
}

.reward-box {
  width: 150px;
  height: 150px;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(0,0,0,0.5));
  border: 2px solid var(--accent);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 10px;
  box-shadow: 0 0 15px rgba(59,130,246,0.3);
  animation: float 2s infinite alternate ease-in-out;
}
.reward-box h4 { margin: 5px 0; font-size: 1rem; color: #fbbf24; text-align: center;}
.reward-box p { font-size: 0.75rem; color: var(--text-muted); text-align: center;}
.reward-box-selectable { cursor: pointer; transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s; }
.reward-box-selectable:hover { transform: translateY(-4px); border-color: #60a5fa; }
.reward-box-selectable.selected { border-color: #10b981; box-shadow: 0 0 20px rgba(16,185,129,0.6); transform: translateY(-6px); }
.reward-box-type { font-size: 0.68rem; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }

@keyframes float {
  from { transform: translateY(0); }
  to { transform: translateY(-10px); }
}

/* --- New Screens (Start, Story, Map) --- */
.full-center {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 0;
  height: 100%;
  text-align: center;
  overflow-y: auto;
}

.title-container { margin-bottom: 40px; }
.mega-title {
  font-size: 4rem;
  font-weight: 800;
  letter-spacing: 4px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6, #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: glow 3s ease-in-out infinite alternate;
}
.subtitle { font-size: 1.5rem; color: #94a3b8; letter-spacing: 2px; margin-top: 10px; }

@keyframes glow {
  from { text-shadow: 0 0 20px rgba(59, 130, 246, 0.2); }
  to { text-shadow: 0 0 30px rgba(236, 72, 153, 0.6); }
}

.pulse-glow { animation: pulseBtn 2s infinite; }
@keyframes pulseBtn {
  0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7); }
  70% { box-shadow: 0 0 0 15px rgba(59, 130, 246, 0); }
  100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

.story-content {
  font-size: 1.2rem;
  line-height: 2;
  margin-bottom: 30px;
  max-width: 600px;
  text-align: left;
}
.story-content p {
  opacity: 0;
  animation: fadeUp 1s forwards;
}
.story-content p:nth-child(1) { animation-delay: 0.5s; }
.story-content p:nth-child(2) { animation-delay: 2.0s; }
.story-content p:nth-child(3) { animation-delay: 3.5s; }
.story-content p:nth-child(4) { animation-delay: 5.0s; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.modern-input {
  padding: 15px 20px;
  font-size: 1.5rem;
  font-family: inherit;
  background: rgba(0,0,0,0.5);
  border: 2px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  color: #f8fafc;
  text-align: center;
  outline: none;
  transition: all 0.3s ease;
  width: 300px;
}
.modern-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
}

.party-stat-card {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  box-shadow: inset 0 0 20px rgba(255,255,255,0.02);
  transition: opacity 0.15s, border-color 0.15s;
}
.party-stat-card.dragging { opacity: 0.4; }
.party-stat-card.drag-over {
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(59,130,246,0.5);
}
.party-drag-handle {
  cursor: grab;
  color: #475569;
  font-size: 1.1rem;
  user-select: none;
  padding: 0 4px;
  transition: color 0.15s;
}
.party-drag-handle:hover { color: #94a3b8; }
.party-stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  font-size: 0.9rem;
  background: rgba(0,0,0,0.4);
  padding: 15px;
  border-radius: 8px;
}
.stat-row { display: flex; justify-content: space-between; border-bottom: 1px dashed rgba(255,255,255,0.1); padding-bottom: 3px; }
.stat-label { color: var(--text-muted); font-weight: bold; }
.stat-val { color: #f8fafc; font-weight: bold; font-family: monospace; font-size: 1rem;}
.party-skills {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
.party-skill-badge {
  background: rgba(255,255,255,0.1);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  border: 1px solid rgba(255,255,255,0.2);
}

/* ---- 技設定モーダル ---- */
.skill-edit-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
}
.skill-edit-overlay.hide { display: none; }
.skill-edit-panel {
  width: min(520px, 92vw);
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px;
  border-radius: 16px;
}
.skill-edit-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--panel-border);
}
.skill-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.skill-section-title { font-size: 0.9rem; font-weight: bold; }
.skill-battle-zone {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  border: 1px dashed rgba(251,191,36,0.3);
  border-radius: 10px;
  min-height: 40px;
}
.skill-slot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-radius: 8px;
  transition: opacity 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.skill-slot-filled {
  background: rgba(59,130,246,0.12);
  border: 1px solid rgba(59,130,246,0.35);
  cursor: grab;
}
.skill-slot-filled:hover { background: rgba(59,130,246,0.2); }
.skill-slot-empty {
  background: rgba(255,255,255,0.03);
  border: 1px dashed rgba(255,255,255,0.12);
  color: #475569;
  font-size: 0.8rem;
  justify-content: center;
  min-height: 38px;
}
.skill-slot.drag-over, .skill-slot-empty.drag-over {
  border-color: var(--accent);
  box-shadow: 0 0 8px rgba(59,130,246,0.4);
}
.skill-slot.dragging { opacity: 0.35; }
.skill-slot-name {
  font-size: 0.9rem;
  color: #f8fafc;
  display: flex;
  align-items: center;
}
.skill-known-zone {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px;
  border: 1px dashed rgba(255,255,255,0.1);
  border-radius: 10px;
  min-height: 40px;
}
.skill-known-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 10px;
  border-radius: 7px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  transition: background 0.15s, opacity 0.15s;
  cursor: grab;
}
.skill-known-row:hover { background: rgba(255,255,255,0.1); }
.skill-known-equipped {
  background: rgba(59,130,246,0.05);
  border-color: rgba(59,130,246,0.15);
  cursor: default;
}
.skill-known-row.drag-over {
  border-color: var(--accent);
  box-shadow: 0 0 6px rgba(59,130,246,0.3);
}
.skill-known-row.dragging { opacity: 0.35; }

.stage-container {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
}
.stage-card {
  background: rgba(0,0,0,0.4);
  border: 2px solid var(--panel-border);
  border-radius: 12px;
  padding: 30px 20px;
  width: 200px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}
.stage-card:hover:not(.locked) {
  transform: translateY(-5px);
  border-color: var(--accent);
  box-shadow: 0 5px 15px rgba(59,130,246,0.3);
}
.stage-card.locked {
  opacity: 0.5;
  cursor: not-allowed;
  border-color: #334155;
  background: rgba(0,0,0,0.6);
}
.lock-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2.5rem;
  opacity: 0.7;
}

.map-screen { padding: 30px; display: flex; flex-direction: column; align-items: center; overflow: hidden; }
.map-desc { color: var(--text-muted); margin-bottom: 6px; }
.map-legend {
  display: flex;
  gap: 12px;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  flex-wrap: wrap;
  justify-content: center;
}
.map-container {
  position: relative;
  width: 100%;
  max-width: 600px;
  flex: 1;
  min-height: 0;
  background: rgba(0,0,0,0.2);
  border-radius: 12px;
  overflow: visible;
  border: 1px solid var(--panel-border);
}

.map-lines { position: absolute; top:0; left:0; width: 100%; height: 100%; z-index: 1; pointer-events: none;}
.map-line { stroke: rgba(255,255,255,0.2); stroke-width: 3; stroke-dasharray: 5,5; }
.map-line.active { stroke: var(--accent); stroke-dasharray: none; animation: lineDraw 1s ease forwards; }

.map-nodes { position: absolute; top:0; left:0; width: 100%; height: 100%; z-index: 2; }
.node {
  position: absolute;
  width: 30px; height: 30px;
  margin-left: -15px; margin-top: -15px;
  border-radius: 50%;
  display: flex; justify-content: center; align-items: center;
  font-weight: bold; font-size: 0.7rem;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid #fff;
}

.node.battle { background: #3b82f6; }
.node.elite { background: #f59e0b; border-color: #ef4444; width: 36px; height: 36px; margin-left:-18px; margin-top:-18px;}
.node.boss { background: #ef4444; width: 44px; height: 44px; margin-left:-22px; margin-top:-22px; font-size: 1rem; }
.node.rest { background: #10b981; }

.node.locked { filter: grayscale(100%); opacity: 0.4; cursor: not-allowed; }
.node.cleared { opacity: 0.3; cursor: default; border-color: #10b981; }
.node.available { box-shadow: 0 0 15px currentColor; animation: pop 1s infinite alternate; }
.node.available:hover { transform: scale(1.2); }

@keyframes pop {
  from { transform: scale(1); }
  to { transform: scale(1.1); }
}

/* ---- Swap Bench Selection ---- */
.swap-select-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
  padding: 8px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
}

.swap-select-panel.hide { display: none; }

.swap-bench-btn {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  background: rgba(71, 85, 105, 0.6);
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}

.swap-bench-btn:hover {
  background: rgba(100, 116, 139, 0.8);
  border-color: rgba(255, 255, 255, 0.3);
}

.swap-bench-name { font-weight: 600; font-size: 0.88rem; }
.swap-bench-elem { font-size: 0.68rem; padding: 1px 5px; }
.swap-bench-hp { font-size: 0.75rem; color: #86efac; white-space: nowrap; }

/* ---- Encyclopedia Modal ---- */
.enc-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.enc-overlay.hide { display: none; }

.enc-panel {
  width: 680px;
  max-width: 95vw;
  max-height: 85vh;
  padding: 30px;
  display: flex;
  flex-direction: column;
}

/* ---- Roadmap Modal ---- */
.roadmap-panel {
  width: 800px;
  max-width: 95vw;
  max-height: 90vh;
  padding: 30px;
  display: flex;
  flex-direction: column;
}

.roadmap-intro {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--panel-border);
}

.roadmap-content {
  overflow-y: auto;
  flex: 1;
  padding-right: 4px;
}

.roadmap-chapter {
  margin-bottom: 28px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 20px;
}

.roadmap-chapter h3 {
  font-size: 1.05rem;
  color: var(--accent);
  margin-bottom: 6px;
  letter-spacing: 0.03em;
}

.roadmap-chapter-desc {
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-bottom: 14px;
}

.roadmap-list {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.roadmap-list li {
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--text-main);
}

.roadmap-list li strong {
  color: #e2e8f0;
}

.enc-content {
  overflow-y: auto;
  flex: 1;
  padding-right: 4px;
}

.enc-card {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 12px 15px;
  margin-bottom: 10px;
}

.enc-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.enc-stats {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 8px;
  font-size: 0.85rem;
  color: #cbd5e1;
}

.enc-skills {
  margin-top: 6px;
  font-size: 0.82rem;
  color: #94a3b8;
}

.enc-badge {
  font-size: 0.72rem;
  font-weight: bold;
  padding: 3px 9px;
  border-radius: 10px;
  color: #fff;
  white-space: nowrap;
}

/* ---- Mobile / Responsive ---- */

/* ラップトップ・低解像度画面（高さ760px以下） */
@media (max-height: 760px) {
  #app-container { padding: 8px; gap: 8px; }
  #screen-battle { padding: 8px; }
  .battle-arena { gap: 10px; }
  .side-panel { padding: 12px; gap: 10px; }
  .center-panel { padding: 12px; gap: 8px; }
  .active-monster-card { padding: 10px; }
  .active-monster-card h4 { font-size: 1.1rem; }
  .card-header { margin-bottom: 8px; padding-bottom: 8px; }
  .bars { gap: 4px; }
  .bars label { font-size: 0.75rem; }
  .bar-container { height: 12px; }
  .timeline-queue { max-height: min(180px, 20dvh); gap: 6px; }
  .queue-item { padding: 6px 10px; font-size: 0.82rem; }
  .toast-container { min-height: 50px; }
  .toast { font-size: 0.82rem; padding: 5px 8px; }
  .action-menu { padding: 10px; }
  .action-menu .btn { padding: 8px 10px; font-size: 0.85rem; }
  .cmd-grid { gap: 6px; }
  #action-phase-header { margin-bottom: 6px !important; }
  .cmd-tabs { margin-bottom: 6px !important; }
}

/* タブレット・中サイズ */
@media (max-width: 900px) {
  .mega-title { font-size: 2.8rem; }
  .battle-arena { gap: 12px; }
}

/* ポートレート スマホ */
@media (max-width: 767px) and (orientation: portrait) {
  /* ヘッダーを非表示にしてスペースを確保 */
  #main-header { display: none !important; }

  #app-container { padding: 8px; padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)); gap: 0; }
  .mega-title { font-size: 2rem; letter-spacing: 2px; }
  .subtitle { font-size: 1rem; }
  .modern-input { width: 90%; max-width: 280px; }

  /* バトル: 上段に左右ステータス / 中段にキュー / 下段にアクションメニュー */
  #screen-battle { padding: 6px; }

  .battle-arena {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto 1fr auto;
    gap: 6px;
  }

  .p1-side    { grid-column: 1; grid-row: 1; padding: 8px; gap: 4px; }
  .p2-side    { grid-column: 2; grid-row: 1; padding: 8px; gap: 4px; }
  .center-panel { grid-column: 1 / -1; grid-row: 2; order: 0; padding: 8px; gap: 6px; }
  #action-menu  { grid-column: 1 / -1; grid-row: 3; }

  /* コンパクトなモンスターカード */
  .active-monster-card { padding: 8px; }
  .active-monster-card h4 { font-size: 0.85rem; }
  .card-header { margin-bottom: 6px; padding-bottom: 6px; }
  .bars { gap: 3px; }
  .bars label { font-size: 0.62rem; }
  .bar-container { height: 8px; }

  /* 控えを横並びに */
  .reserve-list { display: flex; flex-direction: row; gap: 4px; flex-wrap: wrap; }

  /* タイムラインをコンパクトに */
  .timeline-queue { max-height: 60px; gap: 4px; }
  .queue-item { padding: 4px 8px; font-size: 0.75rem; }
  .toast-container { min-height: 50px; }
  .toast { font-size: 0.78rem; padding: 4px 8px; }

  /* アクションメニューをコンパクトに */
  #action-phase-header { font-size: 0.75rem !important; margin-bottom: 6px !important; }
  .cmd-tabs { margin-bottom: 6px !important; gap: 6px !important; }
  .action-menu { padding: 8px; }
  .btn { font-size: 0.8rem; padding: 7px 8px; }

  /* マップ */
  .map-container { max-height: 55vh; }

  /* ハブ・選抜画面 */
  .monster-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
  .stage-container { flex-direction: column; align-items: center; }
  .stage-card { width: 100%; max-width: 300px; }
}

/* ランドスケープ スマホ（横向き） */
@media (orientation: landscape) and (max-height: 500px) {
  #app-container {
    padding: env(safe-area-inset-top, 6px) env(safe-area-inset-right, 10px) env(safe-area-inset-bottom, 6px) env(safe-area-inset-left, 10px);
    gap: 0;
  }

  /* スタート・ストーリー等の全画面センター画面 */
  .full-center {
    padding: 10px 20px;
  }
  .mega-title { font-size: 2rem; letter-spacing: 2px; }
  .title-container { margin-bottom: 15px; }
  .subtitle { font-size: 1rem; }
  .story-content { font-size: 1rem; line-height: 1.8; }

  /* 名前入力 */
  .modern-input { font-size: 1.1rem; padding: 10px 15px; }

  /* ハブ画面 */
  #screen-hub { width: 100% !important; max-width: 100% !important; }
  .stage-container { flex-wrap: nowrap; gap: 12px; }
  .stage-card { width: 160px; padding: 15px 10px; }

  /* バトルアリーナ：横向きでは3列グリッドを維持 */
  #screen-battle { padding: 6px; }
  .battle-arena {
    grid-template-columns: 3fr 4fr 3fr;
    gap: 8px;
  }

  .side-panel { padding: 10px; gap: 6px; }
  .center-panel { padding: 10px; gap: 6px; }

  .active-monster-card { padding: 10px; }
  .active-monster-card h4 { font-size: 1rem; }
  .card-header { margin-bottom: 8px; padding-bottom: 8px; }

  .bars { gap: 4px; }
  .bars label { font-size: 0.7rem; }
  .bar-container { height: 10px; }

  .action-menu { padding: 8px; }
  .cmd-grid { gap: 6px; }
  .btn { padding: 8px 10px; font-size: 0.8rem; }

  .reserve-list { display: flex; flex-direction: row; flex-wrap: wrap; gap: 6px; }

  .timeline-queue { max-height: 120px; gap: 6px; }
  .queue-item { padding: 6px 10px; font-size: 0.85rem; }

  .toast-container { min-height: 60px; }
  .toast { font-size: 0.8rem; padding: 5px 8px; }

  /* マップ画面 */
  .map-screen { padding: 8px 12px; }

  /* パーティ・インベントリ画面 */
  #screen-party { padding: 15px; }
  #screen-inventory { padding: 15px; }
  .inv-container { flex-direction: row; }

  /* 図鑑モーダル */
  .enc-panel { max-height: 95dvh; padding: 15px; }

  /* モンスターグリッド */
  .monster-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin: 10px 0; }
}

/* ---- Tutorial ---- */

.tutorial-select-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 420px;
  margin-top: 8px;
}

.tutorial-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.tutorial-overlay.hide { display: none; }

.tutorial-overlay-panel {
  max-width: 480px;
  width: 100%;
  padding: 28px 32px 32px;
  text-align: center;
  border: 1px solid rgba(251, 191, 36, 0.4);
  max-height: 90vh;
  overflow-y: auto;
}

.tutorial-overlay-step-badge {
  display: inline-block;
  background: rgba(251, 191, 36, 0.2);
  border: 1px solid #fbbf24;
  color: #fbbf24;
  font-size: 0.7rem;
  font-weight: bold;
  letter-spacing: 0.1em;
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 14px;
}

.tutorial-overlay-panel h3 {
  color: #f8fafc;
  font-size: 1.25rem;
  margin-bottom: 14px;
}

.tutorial-overlay-panel p {
  color: #cbd5e1;
  font-size: 0.92rem;
  line-height: 1.75;
  white-space: pre-line;
  margin-bottom: 22px;
  text-align: left;
}

.tutorial-hint {
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.5);
  border-radius: 6px;
  padding: 7px 12px;
  margin-bottom: 8px;
  font-size: 0.8rem;
  color: #fef3c7;
  line-height: 1.5;
}

.tutorial-hint.hide { display: none; }

@keyframes tutorial-pulse {
  0%, 100% { outline: 3px solid #fbbf24; box-shadow: 0 0 0 3px rgba(251,191,36,0.3), 0 0 20px rgba(251,191,36,0.5); }
  50%       { outline: 4px solid #fffbeb; box-shadow: 0 0 0 6px rgba(251,191,36,0.2), 0 0 40px rgba(251,191,36,0.9); }
}

.tutorial-highlight {
  position: relative;
  z-index: 10000;
  border-radius: 6px;
  cursor: pointer;
  animation: tutorial-pulse 1.1s ease-in-out infinite;
}

/* ---- チュートリアル スポットライト ---- */
.tutorial-spotlight-piece {
  position: fixed;
  background: rgba(0, 0, 0, 0.75);
  z-index: 5000;
  pointer-events: none;
}

.tutorial-spotlight-label {
  position: fixed;
  z-index: 5001;
  background: rgba(251, 191, 36, 0.95);
  color: #1e293b;
  font-size: 0.78rem;
  font-weight: bold;
  padding: 5px 14px;
  border-radius: 20px;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 2px 12px rgba(0,0,0,0.5);
  animation: spotlight-label-bounce 1s ease-in-out infinite;
}

@keyframes spotlight-label-bounce {
  0%, 100% { transform: translateX(-50%) translateY(0);   }
  50%       { transform: translateX(-50%) translateY(-6px); }
}

/* ---- HELP System ---- */

.help-float-btn {
  position: fixed;
  bottom: 18px;
  right: 18px;
  z-index: 8001;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.75);
  border: 2px solid rgba(96, 165, 250, 0.9);
  color: #fff;
  font-size: 1.2rem;
  font-weight: bold;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: transform 0.18s, background 0.18s;
  box-shadow: 0 2px 14px rgba(59, 130, 246, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
}
.help-float-btn:hover {
  background: rgba(96, 165, 250, 0.92);
  transform: scale(1.12);
}
.affinity-float-btn {
  right: 72px;
  font-size: 0.7rem;
  background: rgba(16, 185, 129, 0.75);
  border-color: rgba(52, 211, 153, 0.9);
  box-shadow: 0 2px 14px rgba(16, 185, 129, 0.45);
}
.affinity-float-btn:hover {
  background: rgba(52, 211, 153, 0.92);
}
.monsters-float-btn {
  right: 126px;
  font-size: 0.7rem;
  background: rgba(168, 85, 247, 0.75);
  border-color: rgba(192, 132, 252, 0.9);
  box-shadow: 0 2px 14px rgba(168, 85, 247, 0.45);
}
.monsters-float-btn:hover {
  background: rgba(192, 132, 252, 0.92);
}

/* ---- アンケートリンク ---- */
.survey-global-link {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 8001;
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.5);
  color: #f8fafc;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  backdrop-filter: blur(4px);
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  gap: 6px;
}
.survey-global-link:hover {
  background: rgba(51, 65, 85, 0.95);
  border-color: rgba(203, 213, 225, 0.8);
  transform: translateX(-50%) scale(1.05);
}
@media (max-width: 767px) {
  .survey-global-link {
    bottom: auto;
    top: 6px;
    left: 8px;
    transform: none;
    font-size: 0.75rem;
    padding: 6px 10px;
  }
}

/* ---- モンスター図鑑 ---- */
.monster-dex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}
.monster-dex-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 12px 14px;
}
.monster-dex-name {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.monster-dex-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px 8px;
  font-size: 0.78rem;
  color: #94a3b8;
  margin: 8px 0;
}
.monster-dex-stats span { color: #f8fafc; font-weight: 600; }
.monster-dex-skills {
  font-size: 0.75rem;
  color: #94a3b8;
  border-top: 1px solid rgba(255,255,255,0.07);
  padding-top: 6px;
  margin-top: 4px;
  line-height: 1.6;
}

/* ---- ダメージポップアップ ---- */
.dmg-popup {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-weight: bold;
  pointer-events: none;
  animation: dmg-float 0.9s ease-out forwards;
  z-index: 50;
  white-space: nowrap;
  text-shadow: 0 1px 4px rgba(0,0,0,0.9);
}
.dmg-popup-hp { color: #f87171; font-size: 1.15rem; }
.dmg-popup-st { color: #fbbf24; font-size: 0.95rem; }
.dmg-badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 5px;
  vertical-align: middle;
  line-height: 1.4;
  letter-spacing: 0.02em;
}
.dmg-badge-weakness { background: rgba(239,68,68,0.85);   color: #fff; }
.dmg-badge-resist   { background: rgba(100,116,139,0.75); color: #cbd5e1; }
.dmg-badge-stab     { background: rgba(59,130,246,0.8);   color: #fff; }
.dmg-badge-overflow { background: rgba(249,115,22,0.8);   color: #fff; }
@keyframes dmg-float {
  0%   { opacity: 1; transform: translateX(-50%) translateY(0); }
  80%  { opacity: 0.7; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-45px); }
}

/* ---- コマンドツールチップ ---- */
[data-tooltip] { position: relative; }
[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.97);
  color: #e2e8f0;
  font-size: 0.7rem;
  line-height: 1.5;
  padding: 5px 9px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  white-space: normal;
  width: max-content;
  max-width: 200px;
  text-align: left;
  z-index: 200;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}

.help-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 8000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.help-overlay.hide { display: none; }

.help-panel {
  width: min(820px, 98vw);
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
  padding: 24px 28px 20px;
  gap: 14px;
}

.help-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--panel-border);
  flex-shrink: 0;
}

.help-tabs-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.help-tab-btn {
  font-size: 0.82rem !important;
  padding: 6px 12px !important;
  white-space: nowrap;
}

.help-body {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding-right: 4px;
}

.help-tab-content { display: block; }
.help-tab-content.hide { display: none; }

.help-section {
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.help-section:last-child { border-bottom: none; margin-bottom: 0; }

.help-h3 {
  font-size: 1rem;
  color: #fbbf24;
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}

.help-p {
  font-size: 0.88rem;
  color: #cbd5e1;
  line-height: 1.7;
  margin-bottom: 6px;
}

.help-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 6px;
}
.help-list li {
  font-size: 0.86rem;
  color: #cbd5e1;
  padding: 5px 10px;
  background: rgba(255,255,255,0.04);
  border-left: 3px solid rgba(255,255,255,0.1);
  border-radius: 0 5px 5px 0;
  line-height: 1.6;
}
.help-list li b { color: #f8fafc; }

.help-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
  margin-top: 8px;
}
.help-card {
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 10px 13px;
  font-size: 0.83rem;
  color: #cbd5e1;
  line-height: 1.6;
}
.help-card-title {
  font-size: 0.9rem;
  font-weight: bold;
  color: #f8fafc;
  margin-bottom: 4px;
}
.help-card-meta {
  font-size: 0.75rem;
  color: #64748b;
  margin-bottom: 4px;
}

/* 属性相性テーブル */
.affinity-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  margin-top: 10px;
}
.affinity-table th, .affinity-table td {
  text-align: center;
  padding: 5px 4px;
  border: 1px solid rgba(255,255,255,0.07);
  min-width: 30px;
}
.affinity-table thead th { color: #94a3b8; font-size: 0.75rem; }
.aff-good  { background: rgba(16,185,129,0.25); color: #6ee7b7; font-weight: bold; }
.aff-bad   { background: rgba(239,68,68,0.2);  color: #fca5a5; font-weight: bold; }
.aff-normal { color: #475569; }

/* 用語集 */
.help-glossary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px;
  margin-top: 8px;
}
.help-glossary-item {
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 7px;
  padding: 8px 12px;
}
.help-glossary-term {
  font-size: 0.88rem;
  font-weight: bold;
  color: #93c5fd;
  margin-bottom: 3px;
}
.help-glossary-def {
  font-size: 0.8rem;
  color: #94a3b8;
  line-height: 1.55;
}

@media (max-width: 767px) {
  .help-panel { padding: 14px 14px 12px; gap: 10px; }
  .help-tab-btn { font-size: 0.75rem !important; padding: 5px 8px !important; }
  .help-cards { grid-template-columns: 1fr; }
  .affinity-table { font-size: 0.7rem; }
  .affinity-table th, .affinity-table td { padding: 3px 2px; min-width: 22px; }
}
