.session-end {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  background: color-mix(in srgb, var(--bg-brown-dark) 85%, transparent);
  backdrop-filter: blur(8px);
  border-radius: 16px;
  padding: 2rem;
}

.session-end-count {
  font-size: 2rem;
  font-weight: 700;
  color: #f0f0f0;
}

.session-end-label {
  font-size: 1rem;
  color: #888;
}

.combo-summary-pips {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.combo-summary-pips .mana-pip {
  width: 28px;
  height: 28px;
}

.combo-summary-name {
  color: #ccc;
}

.next-session-button {
  font-size: 1.1rem;
  font-weight: 600;
  color: #e0e0e0;
  background: color-mix(in srgb, var(--card-back-turquoise) 20%, transparent);
  border: 2px solid var(--card-back-turquoise);
  border-radius: 12px;
  padding: 0.9rem 1.5rem;
  cursor: pointer;
  transition: background 200ms ease, border-color 200ms ease, transform 100ms ease;
  -webkit-tap-highlight-color: transparent;
}

.next-session-button:hover {
  background: color-mix(in srgb, var(--card-back-turquoise) 35%, transparent);
  border-color: var(--card-back-oval-brighter);
}

.next-session-button:active {
  transform: scale(0.97);
}

.next-session-button--primary {
  border-color: #6666aa;
  color: #f0f0f0;
}

.next-session-button--primary:hover {
  border-color: var(--card-back-oval-brighter);
  background: color-mix(in srgb, var(--card-back-turquoise) 35%, transparent);
}

/* Reel viewport: clips to one section at a time */
.level-sections-viewport {
  width: 100%;
  margin-top: 1rem;
  overflow: hidden;
  position: relative;
  transition: height 600ms cubic-bezier(0.2, 0.8, 0.3, 1.05);
  animation: reelFadeIn 300ms ease-out;
  /* Gradient mask: fade at top/bottom edges to blend peeked adjacent sections */
  mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    black 12%,
    black 88%,
    transparent 100%
  );
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    black 12%,
    black 88%,
    transparent 100%
  );
}

/* At the top: sharp top edge, faded bottom */
.level-sections-viewport.at-top {
  mask-image: linear-gradient(
    to bottom,
    black 0%,
    black 88%,
    transparent 100%
  );
  -webkit-mask-image: linear-gradient(
    to bottom,
    black 0%,
    black 88%,
    transparent 100%
  );
}

/* At the end: faded top, sharp bottom edge */
.level-sections-viewport.at-end {
  mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    black 12%,
    black 100%
  );
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    black 12%,
    black 100%
  );
}

/* At both top and end: no fading needed on either edge */
.level-sections-viewport.at-top.at-end {
  mask-image: none;
  -webkit-mask-image: none;
}

/* Reel nav buttons: top (up/Home) and bottom (down/Share) */
.reel-nav-btn {
  display: block;
  position: relative;
  width: 300px;
  height: 96px;
  margin: 0.25rem auto;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  overflow: hidden;
}

.reel-nav-btn::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 180px;
  height: 64px;
  background: color-mix(in srgb, var(--card-back-turquoise) 82%, transparent);
  transition: background 200ms ease, transform 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

.reel-nav-btn--hidden {
  pointer-events: none;
}

.reel-nav-btn--top.reel-nav-btn--hidden::after {
  transform: translate(-50%, 150%);
}

.reel-nav-btn--bottom.reel-nav-btn--hidden::after {
  transform: translate(-50%, -200%);
}

.reel-nav-btn--top::after {
  clip-path: polygon(0 100%, 50% 0, 100% 100%, 100% 60%, 50% 40%, 0 60%);
}

.reel-nav-btn--bottom::after {
  clip-path: polygon(0 0, 50% 100%, 100% 0, 100% 40%, 50% 60%, 0 40%);
}

.reel-nav-btn:hover::after {
  background: color-mix(in srgb, var(--card-back-turquoise) 100%, transparent);
}

.reel-nav-btn:active::after {
  transform: translate(-50%, -50%) scale(0.95);
}

.reel-nav-btn--has-label {
  font-family: 'GoudyMediaeval', Georgia, serif;
  font-size: 1.25rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.9);
  text-align: center;
  padding-bottom: 3rem;
  position: relative;
  z-index: 1;
}

/* Reel strip: sections stacked, translated by JS.
   No CSS animation here — the reel uses transform for navigation,
   and a CSS animation on transform would conflict with JS transitions. */
.level-sections-reel {
  display: flex;
  flex-direction: column;
  width: 100%;
}

/* Reel progress dots */
.reel-progress-dots {
  position: fixed;
  left: 28px;           /* center of .home-spiral (left 12px + half of 32px) */
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  z-index: 10;
}

.reel-progress-dot {
  width: 10px;
  height: 10px;
  padding: 4px;
  background-clip: content-box;
  border-radius: 50%;
  border: none;
  background-color: rgba(255, 255, 255, 0.25);
  cursor: pointer;
  transition: background-color 200ms ease;
  box-sizing: content-box;
}

.reel-progress-dot:hover {
  background-color: rgba(255, 255, 255, 0.5);
}

.reel-progress-dot--active {
  background-color: var(--card-back-turquoise);
}

.reel-progress-dot--active:hover {
  background-color: var(--card-back-turquoise);
}

@media (max-width: 700px) {
  .reel-progress-dots {
    display: none;
  }
}

@keyframes reelFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Each guild row: summary | wheel | flavor */
.level-section {
  display: grid;
  grid-template-columns: 1fr minmax(220px, 320px) 1fr;
  gap: 1.5rem;
  align-items: center;
  padding: 1.5rem;
  background: color-mix(in srgb, var(--bg-brown-dark) 60%, transparent);
}

/* Locked row: just a centered button */
.level-section--locked {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1.5rem;
}

/* Summary panel: flex column so button pushes to bottom */
.level-section-summary {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-self: stretch;
}

/* Wheel panel: centers the SVG */
.level-section-wheel {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Flavor panel: Practice button always visible; description content appears on highlight */
.level-section-flavor {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0.75rem;
  padding: 1rem 0.5rem;
}

/* All guild descriptions stacked in the same grid cell — tallest one sets the height */
.level-section-flavor-stack {
  display: grid;
  width: 100%;
}

.level-section-flavor-stack > .level-section-flavor-entry {
  grid-row: 1;
  grid-column: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  clip-path: inset(0 100% 0 0);
  transition: none;
}

.level-section-flavor-stack > .level-section-flavor-entry.active {
  clip-path: inset(0 0 0 0);
  transition: clip-path 350ms ease-out;
}

.level-section-flavor-name {
  font-size: 1.75rem;
  font-weight: 700;
  font-family: 'GoudyMediaeval', Georgia, serif;
  color: #e8d8aa;
}

.level-section-flavor-desc {
  font-size: 1rem;
  color: #bbb;
  line-height: 1.6;
}

.level-section-scryfall-link {
  font-size: 0.875rem;
  color: var(--card-back-turquoise);
  text-decoration: none;
}

.level-section-scryfall-link:hover {
  text-decoration: underline;
}

.level-section-button {
  align-self: center;
}

.level-section-header {
  font-size: 2.5rem;
  font-weight: 700;
  font-family: 'GoudyMediaeval', Georgia, serif;
  color: #f0f0f0;
}

.level-section-explanation {
  font-size: 1rem;
  color: #aaa;
  line-height: 1.5;
}

.level-section--locked .level-section-explanation {
  color: #777;
}

.level-section-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.level-section-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem;
  font-size: 1rem;
  transition: background 0.2s ease, opacity 0.2s ease;
  border-radius: 6px;
}

.level-section-item .combo-summary-pips {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.level-section-item .combo-summary-pips .mana-pip {
  width: 28px;
  height: 28px;
}

.level-section-item .combo-summary-name {
  color: #ccc;
}


.allied-color-wheel,
.enemy-color-wheel,
.wedge-color-wheel,
.shard-color-wheel {
  width: 100%;
  max-width: 360px;
  height: auto;
  margin: 0 auto;
}

/* Mobile: stack the three panels vertically */
@media (max-width: 700px) {
  .level-section {
    grid-template-columns: 1fr;
  }
}

.allied-color-wheel .ally-line,
.enemy-color-wheel .enemy-line,
.wedge-color-wheel .wedge-triangle,
.shard-color-wheel .shard-triangle {
  cursor: pointer;
}

/* Stroke colors via CSS custom properties */
.ally-line-vis {
  stroke: var(--allied-line-color);
  transition: opacity 0.2s ease, filter 0.2s ease;
}

.enemy-line-vis {
  stroke: var(--enemy-line-color);
  transition: opacity 0.2s ease, filter 0.2s ease;
}

.wedge-triangle-vis {
  fill: rgba(180, 140, 220, 0.12);
  stroke: rgba(180, 140, 220, 0.6);
  stroke-width: 2;
  transition: opacity 0.2s ease, fill 0.2s ease, filter 0.2s ease;
}

.shard-triangle-vis {
  fill: rgba(80, 200, 200, 0.12);
  stroke: rgba(80, 200, 200, 0.6);
  stroke-width: 2;
  transition: opacity 0.2s ease, fill 0.2s ease, filter 0.2s ease;
}

.allied-color-wheel .color-node,
.enemy-color-wheel .color-node {
  transition: transform 0.2s ease, opacity 0.2s ease;
  transform-box: fill-box;
  transform-origin: center;
}

/* Dimming when any element is highlighted */
.level-section--has-highlight .ally-line:not(.highlight) .ally-line-vis,
.level-section--has-highlight .enemy-line:not(.highlight) .enemy-line-vis {
  opacity: 0.2;
}

.level-section--has-highlight .wedge-triangle:not(.highlight) .wedge-triangle-vis {
  opacity: 0.15;
}

.level-section--has-highlight .shard-triangle:not(.highlight) .shard-triangle-vis {
  opacity: 0.15;
}

.level-section--has-highlight .allied-color-wheel .color-node:not(.highlight),
.level-section--has-highlight .enemy-color-wheel .color-node:not(.highlight),
.level-section--has-highlight .wedge-color-wheel .color-node:not(.highlight),
.level-section--has-highlight .shard-color-wheel .color-node:not(.highlight) {
  opacity: 0.3;
}

.level-section--has-highlight .level-section-item:not(.highlight) {
  opacity: 0.35;
}

/* Highlighted states */
.ally-line.highlight .ally-line-vis,
.enemy-line.highlight .enemy-line-vis {
  opacity: 1 !important;
  filter: drop-shadow(0 0 4px #e8d8aa);
}

.wedge-triangle.highlight .wedge-triangle-vis {
  fill: rgba(180, 140, 220, 0.35) !important;
  stroke: rgba(210, 170, 255, 0.9) !important;
  opacity: 1 !important;
  filter: drop-shadow(0 0 6px rgba(180, 140, 220, 0.7));
}

.shard-triangle.highlight .shard-triangle-vis {
  fill: rgba(80, 200, 200, 0.35) !important;
  stroke: rgba(100, 230, 230, 0.9) !important;
  opacity: 1 !important;
  filter: drop-shadow(0 0 6px rgba(80, 200, 200, 0.7));
}

.color-node.highlight {
  transform: scale(1.15);
  transform-box: fill-box;
  transform-origin: center;
  opacity: 1 !important;
}

.level-section-item.highlight {
  background: rgba(200, 160, 60, 0.18);
  opacity: 1 !important;
}

/* Guild crest in center of wheel */
#crest-image,
#crest-image-enemy,
#crest-image-wedge {
  transition: opacity 150ms ease;
}

/* Share section */
.level-section--share {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  min-height: 300px;
  padding: 3rem 1.5rem;
}

.share-prompt {
  font-size: 1.1rem;
  color: #aaa;
  text-align: center;
  line-height: 1.5;
  max-width: 400px;
}

.share-copy-btn {
  font-size: 1.1rem;
  font-weight: 600;
  color: #e0e0e0;
  background: color-mix(in srgb, var(--card-back-turquoise) 20%, transparent);
  border: 2px solid var(--card-back-turquoise);
  border-radius: 12px;
  padding: 0.9rem 2rem;
  cursor: pointer;
  transition: background 200ms ease, border-color 200ms ease, transform 100ms ease;
  -webkit-tap-highlight-color: transparent;
}

.share-copy-btn:hover {
  background: color-mix(in srgb, var(--card-back-turquoise) 35%, transparent);
  border-color: var(--card-back-oval-brighter);
}

.share-copy-btn:active {
  transform: scale(0.97);
}
