/* ==========================================================================
   Duolingo Learning Path — Unit Banners, Winding Sine Path, 3D Pebble Nodes
   ========================================================================== */

.path-view {
  padding: 12px 14px 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow-x: clip;
}

/* Sticky Active Unit Header Pill (Split Card with Flush Guidebook Button) */
.unit-banner {
  border-radius: 18px;
  padding: 0;
  color: #FFFFFF;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  position: sticky;
  top: calc(var(--top-bar-height) + var(--safe-top) + 6px);
  z-index: 25;
  box-shadow: 0 5px 0 var(--unit-dark, var(--duo-green-dark)), 0 8px 18px rgba(0, 0, 0, 0.12);
  background: var(--unit-color, var(--duo-green));
  overflow: hidden;
  transition: transform 150ms ease;
}

.unit-banner-text {
  flex: 1;
  min-width: 0;
  padding: 14px 16px;
}

.unit-banner-section {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  opacity: 0.88;
  margin-bottom: 2px;
}

.unit-banner-title {
  font-size: 18px;
  font-weight: 900;
  line-height: 1.25;
}

.unit-guidebook-btn {
  width: 60px;
  flex-shrink: 0;
  border-left: 2px solid rgba(0, 0, 0, 0.16);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  transition: background-color 100ms ease;
}

.unit-guidebook-btn:active {
  background: rgba(0, 0, 0, 0.14);
}

/* Unit Divider between units */
.unit-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 800;
  margin: 6px 4px;
}

.unit-divider::before,
.unit-divider::after {
  content: '';
  flex: 1;
  height: 2px;
  background: var(--border-default);
  border-radius: 2px;
}

/* Winding Path Stage */
.unit-stage {
  position: relative;
  padding: 24px 0 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
}

.path-node-row {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 80px;
  z-index: 1;
}

/* Reserve clean Y-space above any node with a floating START / OPEN CHEST tooltip so it NEVER overlaps the node above */
.path-node-row.has-tooltip {
  margin-top: 48px;
}

.path-node-row.has-popover {
  z-index: 38;
}

/* Decorative Path Character standing in negative space */
.path-character-spot {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 112px;
  height: 112px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  cursor: pointer;
}

.path-character-spot.locked-char .path-character-inner {
  filter: grayscale(0.85) opacity(0.38);
}

[data-theme="dark"] .path-character-spot.locked-char .path-character-inner {
  filter: grayscale(0.95) brightness(0.55) opacity(0.45);
}

.path-character-spot.side-right {
  right: 8px;
}

.path-character-spot.side-left {
  left: 8px;
}

.path-character-inner {
  animation: duo-char-bob 3.4s ease-in-out infinite;
  transition: transform 140ms var(--ease-bounce);
}

.path-character-spot:active .path-character-inner {
  transform: scale(1.12) rotate(-4deg);
}

.path-char-bubble {
  position: absolute;
  top: -22px;
  background: var(--bg-surface);
  border: 2px solid var(--border-default);
  border-radius: 12px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 800;
  color: var(--text-primary);
  white-space: nowrap;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.path-character-spot.side-right .path-char-bubble {
  right: 0;
}

.path-character-spot.side-left .path-char-bubble {
  left: 0;
}

.path-character-spot.tapped .path-char-bubble {
  opacity: 1;
  transform: translateY(-4px);
}

/* Winding Node Wrapper */
.path-node-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 5;
  /* Account for the 8px 3D bottom lip so vertical centering is mathematically exact */
  padding-bottom: 8px;
}

/* Active Progress Ring centered exactly around 72x73 visual pebble (65px height + 8px bottom lip) */
.node-ring-svg {
  position: absolute;
  top: -11.5px;
  left: -14px;
  width: 100px;
  height: 96px;
  pointer-events: none;
}

/* 3D Elliptical Pebble Node (Iconic Duolingo Button!) */
.path-node-btn {
  width: 72px;
  height: 65px;
  border-radius: 50%;
  background: var(--node-color, var(--duo-green));
  box-shadow: 0 8px 0 var(--node-dark, var(--duo-green-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: transform 80ms ease, box-shadow 80ms ease;
  color: #FFFFFF;
}

/* Glossy highlight arc on top-left of pebble */
.path-node-btn::before {
  content: '';
  position: absolute;
  top: 7px;
  left: 14px;
  width: 24px;
  height: 11px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
  transform: rotate(-16deg);
  pointer-events: none;
}

.path-node-btn:active {
  transform: translateY(7px);
  box-shadow: 0 1px 0 var(--node-dark, var(--duo-green-dark));
}

.path-node-btn.locked {
  background: var(--bg-locked);
  box-shadow: 0 8px 0 var(--bg-locked-dark);
  color: var(--text-muted);
}

.path-node-btn.locked::before {
  background: rgba(255, 255, 255, 0.14);
}

.path-node-btn.legendary {
  background: linear-gradient(180deg, #FFD83B 0%, #FFC800 100%);
  box-shadow: 0 8px 0 var(--duo-yellow-dark);
  color: #8A5300;
}

.path-node-btn.chest-node {
  width: 76px;
  height: 64px;
  background: transparent;
  box-shadow: none;
}
.path-node-btn.chest-node.locked {
  background: transparent;
  box-shadow: none;
  filter: grayscale(0.92) brightness(0.75) opacity(0.58);
}
.path-node-btn.chest-node::before {
  display: none;
}
.path-node-btn.chest-node:active {
  transform: scale(0.93);
  box-shadow: none;
}

/* Crown / Check badge on completed node */
.node-done-badge {
  position: absolute;
  bottom: -7px;
  right: -4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--duo-yellow);
  border: 2.5px solid var(--bg-canvas);
  color: #7A4B00;
  font-size: 12px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.16);
}

/* Floating Bouncing "スタート" Tooltip above current node */
.start-tooltip {
  position: absolute;
  bottom: calc(100% + 20px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-surface);
  color: var(--node-color, var(--duo-green));
  border: 2px solid var(--border-default);
  border-radius: 12px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  animation: duo-tooltip-bounce 1.6s ease-in-out infinite;
  z-index: 10;
  pointer-events: none;
}

.start-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 8px solid transparent;
  border-top-color: var(--border-default);
}

.start-tooltip::before {
  content: '';
  position: absolute;
  top: calc(100% - 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 7px solid transparent;
  border-top-color: var(--bg-surface);
  z-index: 1;
}

/* Floating Node Popover (Appears when tapping any node) */
.node-popover {
  position: absolute;
  top: calc(100% + 14px);
  left: 50%;
  transform: translateX(-50%);
  width: min(312px, calc(100vw - 32px));
  background: var(--pop-color, var(--duo-green));
  color: #FFFFFF;
  border-radius: 18px;
  padding: 16px;
  z-index: 40;
  box-shadow: var(--shadow-popover);
  animation: duo-pop 200ms var(--ease-bounce);
  text-align: left;
}

.node-popover::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: calc(50% + var(--arrow-shift, 0px));
  transform: translateX(-50%);
  border: 10px solid transparent;
  border-bottom-color: var(--pop-color, var(--duo-green));
}

.node-popover.locked-pop {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 2px solid var(--border-default);
}

.node-popover.locked-pop::before {
  border-bottom-color: var(--border-default);
}

.node-popover-title {
  font-size: 17px;
  font-weight: 900;
  margin-bottom: 4px;
}

.node-popover-sub {
  font-size: 14px;
  font-weight: 600;
  opacity: 0.92;
  margin-bottom: 14px;
}

.node-popover.locked-pop .node-popover-sub {
  color: var(--text-secondary);
}

.node-popover-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Floating Scroll-to-Current Button */
.jump-current-fab {
  position: fixed;
  right: max(16px, calc(50% - var(--app-max-width) / 2 + 16px));
  bottom: calc(var(--bottom-nav-height) + var(--safe-bottom) + 16px);
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--bg-surface);
  border: 2px solid var(--border-default);
  box-shadow: 0 4px 0 var(--border-default), 0 6px 14px rgba(0, 0, 0, 0.12);
  color: var(--duo-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
  transition: transform 120ms ease, opacity 180ms ease;
}

.jump-current-fab:active {
  transform: translateY(4px);
  box-shadow: none;
}

/* Guidebook Sheet */
.guidebook-phrase-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 2px solid var(--border-default);
  background: var(--bg-surface);
  margin-bottom: 10px;
}

.guidebook-audio-btn {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 12px;
  background: var(--duo-blue);
  color: #fff;
  box-shadow: 0 3px 0 var(--duo-blue-dark);
  display: flex;
  align-items: center;
  justify-content: center;
}

.guidebook-audio-btn:active {
  transform: translateY(3px);
  box-shadow: none;
}

.guidebook-target {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
}

.guidebook-ruby {
  font-size: 12px;
  font-weight: 700;
  color: var(--duo-blue-dark);
}

.guidebook-meaning {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

.guidebook-tip-box {
  background: var(--duo-blue-soft);
  border: 2px solid var(--duo-blue-border);
  border-radius: 16px;
  padding: 14px 16px;
  margin-top: 14px;
}

.guidebook-tip-title {
  font-size: 14px;
  font-weight: 900;
  color: var(--duo-blue-dark);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.guidebook-tip-body {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.55;
}
