:root {
  --paper: #f8f6ef;
  --sun: #ffd95c;
  --ink: #1f1b16;
  --chalk: #ffffff;
  --sky: #dff4ff;
  --leaf: #1f7f53;
  --card: rgba(255, 255, 255, 0.86);
  --shadow: 0 24px 60px rgba(22, 28, 45, 0.16);
  --radius-xl: 32px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  min-height: 100%;
}

body {
  min-height: 100dvh;
  overflow: hidden;
  font-family: "Avenir Next", "Trebuchet MS", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 217, 92, 0.5), transparent 28%),
    radial-gradient(circle at bottom right, rgba(126, 205, 255, 0.45), transparent 24%),
    linear-gradient(180deg, #fefcf5 0%, #f4f0df 100%);
}

button,
input,
textarea,
select {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100vw - 2rem));
  min-height: 100dvh;
  height: 100dvh;
  margin: 0 auto;
  padding: clamp(0.55rem, 1.6vh, 1.5rem) 0 clamp(0.7rem, 2vh, 2rem);
  display: flex;
}

.board-card {
  background: var(--card);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  padding: 1.4rem;
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.card-heading {
  display: flex;
  width: clamp(172px, 20vw, 238px);
  flex: 0 0 clamp(172px, 20vw, 238px);
  min-height: 0;
}

.heading-title {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
}

.eyebrow {
  margin: 0;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #905e00;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1,
h2 {
  font-size: clamp(1.16rem, 1.85vw, 1.5rem);
  line-height: 1.02;
}

h3 {
  font-size: 1.15rem;
}

.lead {
  max-width: none;
  font-size: 0.81rem;
  line-height: 1.28;
  color: rgba(31, 27, 22, 0.8);
}

.board-layout {
  display: flex;
  flex: 1;
  gap: 0.25rem;
  min-height: 0;
  width: 100%;
  align-items: stretch;
  padding: 0.35rem 0;
}

.program-panel {
  width: clamp(88px, 9vw, 102px);
  flex: 0 0 clamp(88px, 9vw, 102px);
  min-height: 0;
  align-self: stretch;
}

.mat-stage {
  position: relative;
  width: min(100%, 860px);
  aspect-ratio: 4 / 5;
  margin: 0;
  border-radius: 0;
  overflow: visible;
  background: var(--chalk);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  flex: 0 1 auto;
}

.mat-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
  user-select: none;
}

.drag-highlight {
  position: absolute;
  left: 0;
  top: 0;
  width: 25%;
  height: 20%;
  border: 4px solid rgba(14, 123, 255, 0.85);
  border-radius: 18px;
  background: rgba(14, 123, 255, 0.12);
  opacity: 0;
  pointer-events: none;
  transition:
    left 140ms ease,
    top 140ms ease,
    border-color 140ms ease,
    background 140ms ease,
    opacity 140ms ease;
}

.drag-highlight.visible {
  opacity: 1;
}

.drag-highlight.ready {
  border-color: rgba(31, 127, 83, 0.95);
  background: rgba(31, 127, 83, 0.18);
}

.beebot-token {
  --left: 37.5%;
  --top: 30%;
  --rotation: 0deg;
  position: absolute;
  left: var(--left);
  top: var(--top);
  width: clamp(108px, 19.2%, 170px);
  transform: translate(-50%, -50%);
  user-select: none;
  transition:
    left 320ms cubic-bezier(0.2, 0.8, 0.2, 1),
    top 320ms cubic-bezier(0.2, 0.8, 0.2, 1),
    filter 160ms ease;
  z-index: 3;
  overflow: visible;
}

.beebot-token:hover,
.beebot-token:focus-within {
  filter: drop-shadow(0 18px 26px rgba(20, 28, 48, 0.22));
  outline: none;
}

.beebot-token.dragging {
  transition: none;
  filter: drop-shadow(0 20px 30px rgba(20, 28, 48, 0.3));
}

.beebot-shell {
  position: relative;
  width: 100%;
  aspect-ratio: 308 / 343;
  transform: rotate(var(--rotation));
  transform-origin: center center;
  transition: transform 320ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.beebot-photo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 46% 46% 40% 40%;
  clip-path: ellipse(42% 44% at 50% 47%);
}

.mat-hotspot {
  background: transparent;
  box-shadow: none;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.button-overlay-icon {
  display: block;
  width: 84%;
  height: 84%;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 8px 14px rgba(20, 28, 48, 0.22));
}

.drag-handle {
  position: absolute;
  left: 50%;
  top: calc(100% - 0.42rem);
  transform: translateX(-50%);
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(21, 92, 153, 0.92);
  color: white;
  display: grid;
  place-items: center;
  cursor: grab;
  touch-action: none;
  box-shadow: 0 10px 18px rgba(21, 92, 153, 0.26);
}

.drag-handle svg {
  width: 19px;
  height: 19px;
}

.drag-handle path {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.drag-handle:hover,
.drag-handle:focus-visible {
  outline: none;
  transform: translateX(-50%) translateY(-1px);
}

.beebot-token.dragging .drag-handle {
  cursor: grabbing;
}

.hotspot {
  position: absolute;
  border: 0;
  background: transparent;
  cursor: pointer;
  transform: translate(-50%, -50%);
  transition:
    transform 140ms ease,
    filter 140ms ease;
}

.hotspot:hover,
.hotspot:focus-visible {
  transform: translate(-50%, -50%) scale(1.08);
  filter: brightness(1.04);
  outline: none;
}

.hotspot.forward,
.hotspot.backward,
.hotspot.go {
  width: 25%;
  aspect-ratio: 1 / 1;
}

.hotspot.left {
  width: 25%;
  aspect-ratio: 1 / 1;
  left: 29%;
  top: 46%;
}

.hotspot.right {
  width: 25%;
  aspect-ratio: 1 / 1;
  left: 71%;
  top: 46%;
}

.hotspot.forward {
  left: 50%;
  top: 24%;
}

.hotspot.backward {
  left: 50%;
  top: 66%;
}

.hotspot.go {
  left: 50%;
  top: 46%;
}

.hotspot.clear {
  width: 31%;
  aspect-ratio: 2.18 / 1;
  left: 27.5%;
  top: 66%;
}

.hotspot.pause {
  width: 31%;
  aspect-ratio: 2.18 / 1;
  left: 72%;
  top: 66%;
}

.hotspot.go .button-overlay-icon {
  width: 86%;
  height: 86%;
}

.hotspot.clear .button-overlay-icon {
  width: 86%;
  height: 86%;
}

.hotspot.pause .button-overlay-icon {
  width: 86%;
  height: 86%;
}

.sequence-card {
  width: 100%;
  height: 100%;
  padding: 0.38rem 0.34rem;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(33, 47, 77, 0.1);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.sequence-header {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.4rem;
}

.sequence-count {
  padding: 0.22rem 0.3rem;
  border-radius: 10px;
  background: rgba(255, 217, 92, 0.36);
  font-size: 0.58rem;
  font-weight: 800;
  text-align: center;
  flex-shrink: 0;
  margin-bottom: 0.3rem;
}

.sequence-list {
  display: flex;
  flex: 1;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 0.22rem;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 0.08rem;
}

.sequence-list.empty {
  display: flex;
}

.sequence-placeholder {
  min-height: 100%;
  padding: 0.55rem 0.35rem;
  border-radius: 12px;
  color: rgba(31, 27, 22, 0.72);
  background: rgba(223, 244, 255, 0.65);
  font-size: 0.63rem;
  line-height: 1.16;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sequence-item {
  width: 100%;
  min-width: 0;
  padding: 0.22rem 0.12rem 0.2rem;
  border-radius: 10px;
  background: #fff9e1;
  border: 1px solid rgba(144, 94, 0, 0.12);
  text-align: center;
  transition:
    transform 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.sequence-item.active {
  transform: translateX(-3px);
  background: #dff4ff;
  box-shadow: 0 14px 18px rgba(11, 86, 151, 0.14);
}

.sequence-item img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.step-label {
  display: block;
  margin-top: 0.14rem;
  font-size: 0.5rem;
  line-height: 1.04;
  font-weight: 700;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 700px) {
  .app-shell {
    width: min(100vw - 1rem, 100%);
    padding-top: 0.5rem;
  }

  .board-card {
    padding: 1rem;
    border-radius: 24px;
  }

  .card-heading {
    width: 150px;
    flex-basis: 150px;
  }

  .board-layout {
    gap: 0.2rem;
  }

  .program-panel {
    width: 82px;
    flex-basis: 82px;
  }

  .drag-handle {
    width: 38px;
    height: 38px;
  }
}

@media (max-height: 860px) {
  .lead {
    font-size: 0.74rem;
    line-height: 1.16;
  }

  .sequence-card {
    padding: 0.32rem 0.28rem;
  }

  .sequence-item {
    padding: 0.18rem 0.1rem 0.16rem;
  }

  .sequence-item img {
    width: 22px;
    height: 22px;
  }
}

@media (max-width: 560px) {
  .board-layout {
    flex-direction: column;
  }

  .program-panel {
    width: 100%;
    flex: 0 0 auto;
    align-self: auto;
  }

  .card-heading {
    width: 100%;
    flex: 0 0 auto;
  }

  .sequence-card {
    height: auto;
  }

  .sequence-list {
    flex-direction: row;
    flex-wrap: wrap;
    min-height: 70px;
    max-height: min(17dvh, 126px);
  }

  .sequence-list.empty {
    display: block;
  }

  .sequence-placeholder {
    min-height: auto;
  }

  .sequence-item {
    width: calc(33.333% - 0.3rem);
  }

  .sequence-count {
    margin-bottom: 0.45rem;
  }
}
