/* 전체 페이지 스타일 */
* {
  box-sizing: border-box;
}

body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, #f3e8ff 0%, #fce7f3 100%);
  color: #222;
  margin: 0;
  padding: 0;
}

header {
  margin-bottom: 2rem;
}

#tree-container {
  width: 100%;
  max-width: 800px;
  min-width: 320px;
  overflow-x: auto;
  padding: 0;
  margin: 0 auto 48px auto;
  min-height: 400px;
  position: relative;
  z-index: 1;
  background: none;
}
#tree-svg {
  width: 100%;
  max-width: 800px;
  min-width: 320px;
  height: auto;
  display: block;
  margin: 0 auto;
}

section {
  position: relative;
  z-index: 2;
}

#card-list-root {
  margin-top: 0;
}

.card-list-item {
  background: #fff;
  border-radius: 1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  border: 1.5px solid #e0e7ef;
  padding: 1.2rem 1.2rem 1.5rem 1.2rem;
  transition: box-shadow 0.2s, border 0.2s, transform 0.2s;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 180px;
}
.card-list-item::before{
  content:"";
  display:block;
  height:6px;
  width:100%;
  border-radius:12px 12px 0 0;
  background: linear-gradient(90deg, var(--tone,#a78bfa) 0%, rgba(0,0,0,0) 100%);
  margin:-1.2rem -1.2rem 0 -1.2rem;
}
.card-list-item[data-tone]{
  border-color: color-mix(in oklab, var(--tone,#a78bfa) 35%, #e0e7ef);
  box-shadow: 0 6px 22px rgba(0,0,0,0.08), 0 8px 30px color-mix(in oklab, var(--tone,#a78bfa) 20%, transparent);
  background: linear-gradient(180deg, #fff 0%, color-mix(in oklab, var(--tone,#a78bfa) 12%, #ffffff) 100%);
}
.card-list-item:hover {
  box-shadow: 0 8px 32px rgba(168,85,247,0.13);
  border: 1.5px solid #a78bfa;
  transform: translateY(-2px) scale(1.02);
}
.card-list-title {
  font-weight: 700;
  color: #7c3aed;
  font-size: 1.1rem;
  margin-bottom: 0.3rem;
}
.card-list-title[data-tone]{color: color-mix(in oklab, var(--tone,#7c3aed) 70%, #111)}
.card-badge{
  align-self:flex-start;
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:4px 10px;
  border-radius:999px;
  background: #f5f7fb;
  border:1px solid #e5e7eb;
  font-weight:700;
  font-size:12px;
  color:#374151;
}
.card-badge-dot{
  width:10px;height:10px;border-radius:50%;
  background: var(--tone,#7c3aed);
  box-shadow:0 0 0 2px color-mix(in oklab, var(--tone,#7c3aed) 40%, #fff) inset;
}
.card-list-easy {
  color: #444;
  font-size: 1rem;
  margin-bottom: 0.5rem;
}
.card-list-detail {
  background: linear-gradient(90deg, #a78bfa 0%, #f472b6 100%);
  color: #fff;
  border: none;
  border-radius: 0.5rem;
  padding: 0.5rem 1.2rem;
  font-weight: 600;
  font-size: 1rem;
  margin-top: auto;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
  box-shadow: 0 2px 8px rgba(168,85,247,0.08);
}
.card-list-detail:hover {
  background: linear-gradient(90deg, #c4b5fd 0%, #f9a8d4 100%);
  color: #7c3aed;
}

@media (max-width: 1024px) {
  #tree-container, #tree-svg {
    max-width: 95vw;
  }
}
@media (max-width: 700px) {
  #tree-container, #tree-svg {
    max-width: 100vw;
  }
}
@media (max-width: 480px) {
  #tree-container {
    min-width: 0;
    width: 100vw;
    max-width: 100vw;
    min-height: 400px;
    height: 400px;
    padding: 0.2rem;
  }
  #tree-svg {
    min-width: 320px;
    width: 100vw;
    height: 400px;
  }
  .card-list-item {
    min-height: 120px;
    padding: 0.7rem 0.7rem 1rem 0.7rem;
    font-size: 0.95rem;
  }
}

/* 팝업 정보 카드 스타일 - 완전히 새롭게 디자인 */
.popup-info-card {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(145deg, #ffffff 0%, #fafbff 100%);
  border-radius: 24px;
  box-shadow: 
    0 25px 50px rgba(0, 0, 0, 0.15),
    0 10px 30px rgba(147, 51, 234, 0.1);
  border: 3px solid #e9d5ff;
  padding: 32px 28px 28px 28px;
  max-width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  z-index: 1000;
  animation: popupSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes popupSlideIn {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.popup-info-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: linear-gradient(90deg, #8b5cf6, #a855f7, #c084fc);
  border-radius: 24px 24px 0 0;
}

.popup-title {
  font-size: 2rem;
  color: #7c3aed;
  font-weight: 800;
  margin-bottom: 16px;
  text-align: center;
  text-shadow: 0 2px 4px rgba(124, 58, 237, 0.1);
}

.popup-easy {
  font-size: 1.3rem;
  color: #374151;
  margin-bottom: 20px;
  line-height: 1.6;
  font-weight: 500;
  background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
  padding: 16px;
  border-radius: 12px;
  border-left: 4px solid #8b5cf6;
}

.popup-definition {
  font-size: 1.2rem;
  color: #4b5563;
  margin-bottom: 20px;
  line-height: 1.6;
  font-weight: 500;
}

.popup-symbol {
  font-size: 1.4rem;
  color: #7c3aed;
  font-weight: 700;
  margin-bottom: 16px;
  text-align: center;
  background: linear-gradient(135deg, #f3e8ff 0%, #e9d5ff 100%);
  padding: 12px;
  border-radius: 10px;
  border: 2px solid #d8b4fe;
}

.popup-examples {
  font-size: 1.1rem;
  color: #6b7280;
  font-weight: 500;
  background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
  padding: 16px;
  border-radius: 12px;
  border: 2px solid #e5e7eb;
}

.popup-wikipedia {
  margin-top: 20px;
  text-align: center;
}

.wikipedia-link {
  display: inline-block;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: white;
  text-decoration: none;
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 1.1rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
  border: 2px solid #3b82f6;
}

.wikipedia-link:hover {
  background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4);
  color: white;
  text-decoration: none;
}

.wikipedia-link:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.popup-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 1.2rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.popup-close:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4);
}

/* 트리 SVG 스타일 - 간단하고 깔끔하게 */
#tree-svg {
  background: none;
  user-select: none;
}

.tree-node {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tree-node:hover {
  transform: scale(1.05);
}

.tree-node:hover .node-bg {
  filter: brightness(1.1);
  stroke-width: 3;
}

.node-bg {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.15));
}

.node-text {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
  letter-spacing: 0.3px;
}

.node-symbol {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.tree-connection {
  transition: all 0.3s ease;
}

.tree-connection:hover {
  stroke-width: 4;
  opacity: 1;
}

/* 정보 패널 업그레이드 */
.details-panel {
  width: 480px;
  min-width: 260px;
  max-width: 100vw;
  background: linear-gradient(135deg, #fffdfa 0%, #f8fafc 100%);
  border-left: 5px solid #a78bfa;
  box-shadow: -8px 0 32px rgba(167, 139, 250, 0.10);
  min-height: 100vh;
  height: 100vh;
  overflow-y: auto;
  border-radius: 0 2.5rem 2.5rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 2.5rem;
}

#details-panel {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 0 2rem;
}

.info-card {
  background: linear-gradient(135deg, #f3e8ff 0%, #fff 100%);
  border-radius: 1.5rem;
  padding: 2.2rem 1.7rem;
  margin-bottom: 2.2rem;
  box-shadow: 0 6px 24px rgba(167, 139, 250, 0.10);
  border-left: 7px solid #a78bfa;
  font-size: 1.3rem;
  line-height: 1.7;
  color: #222;
  position: relative;
}
.info-card h3 {
  display: flex;
  align-items: center;
  font-size: 1.2rem;
  color: #7c3aed;
  margin-bottom: 0.7rem;
}
.info-card h3 span {
  margin-right: 0.7rem;
  font-size: 1.3rem;
}

#content-title {
  font-size: 2.3rem;
  margin-bottom: 2.2rem;
  color: #a78bfa;
  text-align: center;
  font-weight: bold;
  letter-spacing: -1px;
}

.example-box {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 2px solid #fbbf24;
  border-radius: 1.1rem;
  padding: 1.3rem;
  font-family: 'Courier New', monospace;
  font-size: 1.15rem;
  margin-top: 0.7rem;
}

@media (max-width: 1100px) {
  .flowchart-container { width: 98vw; min-width: 0; }
  .details-panel { max-width: 100vw; min-width: 0; width: 100vw; border-radius: 0; }
  #details-panel { max-width: 100vw; }
}
@media (max-width: 900px) {
  .flowchart-container { width: 100vw; min-width: 0; }
  .details-panel { width: 100vw; min-width: 0; border-radius: 0; }
  #tree-svg {
    min-width: 700px;
    width: 900px;
  }
  #tree-container {
    min-width: 320px;
  }
}
@media (max-width: 700px) {
  .flowchart-container { height: 900px; }
  .details-panel { min-height: 400px; height: auto; padding-top: 1rem; width: 100vw; border-radius: 0; }
  #details-panel { padding: 0 0.5rem; }
  .info-card { padding: 1.2rem 0.7rem; font-size: 1.05rem; }
  #content-title { font-size: 1.3rem; }
}
@media (max-width: 600px) {
  .flowchart-container { width: 100vw; height: 1200px; }
  .flowchart-node { font-size: 0.95rem; min-width: 70px; padding: 0.5rem 0.7rem; }
  .details-panel { padding: 1rem; }
}
@media (max-width: 480px) {
  .flowchart-container { height: 1500px; }
  .flowchart-node { font-size: 0.85rem; min-width: 60px; padding: 0.4rem 0.5rem; }
}

/* 터치 디바이스에서 호버 효과 비활성화 */
@media (hover: none) and (pointer: coarse) {
  .tree-node:hover {
    transform: none;
  }
  
  .tree-node:hover .node-bg {
    filter: none;
  }
}

#tree-container {
  width: 100%;
  min-width: 400px;
  max-width: 100vw;
  overflow-x: auto;
  padding: 0;
  margin: 0 auto 48px auto;
  min-height: 700px;
  position: relative;
  z-index: 1;
}
#tree-svg {
  min-width: 500px;
  width: 800px;
  height: 700px;
  display: block;
  margin: 0 auto;
}

section {
  position: relative;
  z-index: 2;
} 
