.lineup-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 52px;
}

.lineup-hero,
.lineup-board-panel,
.lineup-panel,
.lineup-picker-card {
  border: 3px solid #ffffff;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 0 5px #6f86c8, 7px 7px 0 rgba(111, 134, 200, 0.25);
}

.lineup-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding: 24px;
  background:
    radial-gradient(circle at 88% 20%, rgba(255, 244, 189, 0.88) 0 28px, transparent 29px),
    radial-gradient(circle at 12% 22%, rgba(255, 173, 200, 0.42) 0 18px, transparent 19px),
    linear-gradient(135deg, #fffefe, #f0f6ff 70%);
}

.lineup-hero h1 {
  margin: 0;
  font-size: clamp(2.1rem, 6vw, 4.45rem);
}

.lineup-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 0.28fr);
  gap: 18px;
  align-items: start;
}

.lineup-board-panel,
.lineup-panel,
.lineup-picker-card {
  padding: 16px;
}

.lineup-board-header,
.roster-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.lineup-board-header h2,
.roster-header h2 {
  margin: 0;
}

.lineup-status,
.roster-count {
  min-width: 150px;
  margin: 0;
  color: var(--muted);
  font-weight: 900;
  text-align: right;
}

.lineup-omen {
  position: relative;
  display: grid;
  gap: 8px;
  margin: -2px 0 14px;
  padding: 10px 12px;
  border: 2px dashed rgba(111, 134, 200, 0.55);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 96% 12%, rgba(255, 244, 189, 0.8) 0 18px, transparent 19px),
    linear-gradient(135deg, rgba(255, 253, 248, 0.92), rgba(240, 246, 255, 0.88));
  box-shadow: inset 2px 2px 0 rgba(255, 173, 200, 0.2), 0 0 18px rgba(111, 134, 200, 0.14);
}

.lineup-omen.is-open {
  padding: 12px 13px;
}

.lineup-omen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.lineup-omen-label {
  justify-self: start;
  padding: 3px 8px;
  border: 2px solid #ffffff;
  border-radius: 999px;
  background: #8fa8e6;
  color: #fffdf8;
  box-shadow: 2px 2px 0 rgba(58, 44, 53, 0.16);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0;
}

.lineup-omen-toggle {
  min-height: 34px;
  padding: 6px 12px;
  border: 2px solid #ffffff;
  border-radius: 999px;
  color: #52649d;
  background: #fff4bd;
  box-shadow: 2px 2px 0 rgba(58, 44, 53, 0.16);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 900;
  cursor: pointer;
}

.lineup-omen-toggle:hover,
.lineup-omen-toggle:focus-visible {
  outline: none;
  transform: translateY(-1px);
  background: #ffd6df;
}

.lineup-omen p {
  margin: 0;
  color: #52649d;
  font-weight: 900;
  line-height: 1.45;
}

.lineup-omen-closed {
  opacity: 0.72;
  font-size: 0.88rem;
}

.lineup-omen-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.lineup-omen-chip {
  padding: 5px 8px;
  border: 2px solid #ffffff;
  border-radius: 999px;
  box-shadow: 2px 2px 0 rgba(58, 44, 53, 0.12);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 900;
}

.lineup-omen-chip.is-type {
  background: #d7f5ff;
}

.lineup-omen-chip.is-color {
  background: #fff1be;
}

.lineup-hint-taunt {
  position: absolute;
  right: 18px;
  top: 24px;
  z-index: 2;
  pointer-events: none;
  color: #ff6f9f;
  text-shadow: 2px 2px 0 #ffffff, 0 0 14px rgba(255, 173, 200, 0.65);
  font-size: clamp(1.2rem, 3vw, 1.8rem);
  font-weight: 900;
  animation: lineupHintTaunt 980ms ease-out forwards;
}

@keyframes lineupHintTaunt {
  0% {
    opacity: 0;
    transform: translateY(8px) rotate(-4deg) scale(0.84);
  }
  18% {
    opacity: 1;
    transform: translateY(-2px) rotate(-4deg) scale(1.06);
  }
  100% {
    opacity: 0;
    transform: translateY(-34px) rotate(5deg) scale(1);
  }
}

.current-lineup {
  position: relative;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 14px;
}

.lineup-placement-feedback {
  position: absolute;
  left: var(--lineup-feedback-x, 50%);
  bottom: calc(100% + 6px);
  z-index: 8;
  width: max-content;
  max-width: min(310px, calc(100vw - 52px));
  padding: 7px 11px;
  border: 2px solid #ffffff;
  border-radius: 8px;
  pointer-events: none;
  color: #52649d;
  background: #fffdf8;
  box-shadow: 3px 3px 0 rgba(58, 44, 53, 0.16), 0 0 18px rgba(111, 134, 200, 0.22);
  font-size: clamp(0.78rem, 2vw, 0.92rem);
  font-weight: 900;
  line-height: 1.25;
  text-align: center;
  animation: lineupPlacementFeedback 1700ms ease-out forwards;
}

.lineup-placement-feedback::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  width: 10px;
  height: 10px;
  border-right: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
  background: inherit;
  transform: translate(-50%, -6px) rotate(45deg);
}

.lineup-placement-feedback.is-exact {
  color: #1d4730;
  background: #d7f5e5;
  box-shadow: 3px 3px 0 rgba(58, 44, 53, 0.14), 0 0 22px rgba(168, 230, 189, 0.72);
}

.lineup-placement-feedback.is-near {
  color: #5d4212;
  background: #fff1be;
  box-shadow: 3px 3px 0 rgba(58, 44, 53, 0.14), 0 0 22px rgba(255, 228, 154, 0.72);
}

.lineup-placement-feedback.is-miss {
  color: #743544;
  background: #ffe5ec;
  box-shadow: 3px 3px 0 rgba(58, 44, 53, 0.14), 0 0 20px rgba(255, 173, 200, 0.58);
}

@keyframes lineupPlacementFeedback {
  0% {
    opacity: 0;
    transform: translate(-50%, 8px) scale(0.9) rotate(-1deg);
  }
  14% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1.03) rotate(0deg);
  }
  72% {
    opacity: 1;
    transform: translate(-50%, -2px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -18px) scale(0.98) rotate(1deg);
  }
}

@keyframes lineupPlacementFeedbackReduced {
  0%,
  82% {
    opacity: 1;
    transform: translate(-50%, 0);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .lineup-placement-feedback {
    animation-name: lineupPlacementFeedbackReduced;
  }
}

.lineup-slot,
.lineup-tile,
.roster-card {
  position: relative;
  display: grid;
  align-content: center;
  justify-items: center;
  min-width: 0;
  border: 2px solid #ffffff;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  color: #52649d;
  box-shadow: 0 0 0 3px rgba(111, 134, 200, 0.32);
  font-weight: 900;
}

.lineup-slot,
.lineup-tile {
  aspect-ratio: 4 / 5;
  min-height: 74px;
  padding: 5px 4px;
  text-align: center;
}

.lineup-slot {
  border-style: dashed;
  background: rgba(255, 244, 189, 0.5);
  cursor: pointer;
}

.lineup-slot.is-filled {
  border-style: solid;
  background: #fff4bd;
}

.lineup-slot.is-locked {
  cursor: default;
  background: #d7f5e5;
  box-shadow: 0 0 0 3px rgba(72, 179, 112, 0.32), 0 0 18px rgba(168, 230, 189, 0.35);
}

.lineup-lock-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  padding: 2px 4px;
  border-radius: 999px;
  color: #1d4730;
  background: rgba(168, 230, 189, 0.96);
  font-size: 0.58rem;
  line-height: 1;
  box-shadow: 0 0 0 2px #ffffff;
}

.lineup-slot.is-dragover {
  transform: translateY(-2px);
  background: #d7f5ff;
  box-shadow: 0 0 0 3px rgba(157, 219, 248, 0.62), 0 0 20px rgba(157, 219, 248, 0.5);
}

.lineup-slot-number,
.lineup-entry-number {
  color: var(--muted);
  font-size: 0.66rem;
  line-height: 1;
}

.lineup-entry-sprite {
  width: min(42px, 78%);
  aspect-ratio: 1;
  object-fit: contain;
  image-rendering: auto;
}

.lineup-entry-face {
  display: grid;
  place-items: center;
  width: min(38px, 76%);
  aspect-ratio: 1;
  margin: 3px 0;
  border: 2px solid rgba(58, 44, 53, 0.7);
  border-radius: 50%;
  color: #3a2c35;
  background:
    linear-gradient(#ff8fb9 0 47%, #3a2c35 47% 53%, #fffdf8 53% 100%);
  box-shadow: 2px 2px 0 rgba(58, 44, 53, 0.78);
  font-size: 0.78rem;
}

.lineup-entry-name {
  width: 100%;
  overflow-wrap: anywhere;
  font-size: clamp(0.62rem, 1.2vw, 0.78rem);
  line-height: 1.08;
}

.lineup-board {
  display: grid;
  gap: 8px;
}

.lineup-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(84px, auto);
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 2px solid rgba(111, 134, 200, 0.22);
  border-radius: var(--radius);
  background: rgba(216, 220, 255, 0.18);
}

.lineup-marks {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 7px;
}

.lineup-tile.is-exact {
  background: #a8e6bd;
  color: #1d4730;
  box-shadow: 0 0 0 3px rgba(72, 179, 112, 0.34), 0 0 18px rgba(168, 230, 189, 0.45);
}

.lineup-tile.is-near {
  background: #ffe49a;
  color: #5d4212;
  box-shadow: 0 0 0 3px rgba(242, 185, 74, 0.36), 0 0 18px rgba(255, 228, 154, 0.42);
}

.lineup-tile.is-miss {
  background: #ffd6df;
  color: #743544;
  box-shadow: 0 0 0 3px rgba(255, 111, 159, 0.26);
}

.lineup-tile.is-miss::after,
.roster-card.is-slot-blocked::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  top: 50%;
  height: 3px;
  border-radius: 999px;
  background: rgba(166, 43, 72, 0.78);
  transform: rotate(-18deg);
}

.lineup-hint {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 900;
  text-align: right;
}

.lineup-panel {
  display: grid;
  gap: 13px;
}

.lineup-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  border-radius: var(--radius);
  background: rgba(216, 220, 255, 0.28);
  color: var(--muted);
  font-weight: 900;
}

.lineup-stat-row strong {
  color: var(--ink);
}

.lineup-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.lineup-actions .button,
#lineup-share {
  width: 100%;
}

#lineup-share {
  grid-column: 1 / -1;
}

.lineup-picker[hidden] {
  display: none;
}

.lineup-picker {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(36, 26, 48, 0.42);
  backdrop-filter: blur(5px);
}

.lineup-picker-card {
  width: min(780px, 100%);
  max-height: min(760px, 88vh);
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  overflow: hidden;
}

.lineup-picker-open {
  overflow: hidden;
}

.lineup-picker-close {
  width: 34px;
  aspect-ratio: 1;
  border: 2px solid var(--ink);
  border-radius: 50%;
  color: var(--ink);
  background: #fff4bd;
  box-shadow: 2px 2px 0 rgba(58, 44, 53, 0.28);
  font-weight: 900;
  cursor: pointer;
}

.lineup-search {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 900;
}

.lineup-search input {
  min-height: 42px;
  width: 100%;
  padding: 9px 11px;
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: #fffdf8;
  box-shadow: inset 2px 2px 0 rgba(255, 173, 200, 0.38);
}

.lineup-roster {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(74px, 1fr));
  gap: 8px;
  min-height: 0;
  margin-top: 10px;
  padding: 5px;
  overflow: auto;
}

.roster-card {
  min-height: 88px;
  padding: 6px 4px;
  cursor: pointer;
}

.roster-card .lineup-entry-sprite {
  width: min(40px, 82%);
}

.roster-card .lineup-entry-name {
  font-size: 0.64rem;
}

.roster-card:hover:not(:disabled),
.roster-card:focus-visible:not(:disabled) {
  outline: none;
  transform: translateY(-1px);
  background: #fff4bd;
  box-shadow: 0 0 0 3px rgba(255, 173, 200, 0.42), 0 0 18px rgba(255, 173, 200, 0.32);
}

.roster-card.is-picked,
.roster-card.is-slot-blocked,
.roster-card:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.roster-card.is-exact {
  background: #d7f5e5;
  color: #1d4730;
}

.roster-card.is-near {
  background: #fff1be;
  color: #5d4212;
}

.roster-card.is-slot-blocked {
  background: #ffd6df;
  color: #743544;
}

@media (max-width: 900px) {
  .lineup-layout {
    grid-template-columns: 1fr;
  }

  .lineup-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lineup-actions {
    grid-column: 1 / -1;
  }
}

@media (max-width: 680px) {
  .lineup-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 18px;
  }

  .lineup-hero {
    display: grid;
    padding: 18px;
  }

  .lineup-board-header,
  .roster-header {
    display: grid;
  }

  .lineup-status,
  .roster-count {
    min-width: 0;
    text-align: left;
  }

  .current-lineup,
  .lineup-marks {
    gap: 5px;
  }

  .lineup-slot,
  .lineup-tile {
    min-height: 58px;
    padding: 4px 3px;
  }

  .lineup-entry-number {
    display: none;
  }

  .lineup-entry-sprite {
    width: min(34px, 82%);
  }

  .lineup-entry-name {
    font-size: 0.56rem;
  }

  .lineup-row {
    grid-template-columns: 1fr;
  }

  .lineup-hint {
    text-align: left;
  }

  .lineup-picker {
    align-items: end;
    padding: 10px;
  }

  .lineup-picker-card {
    max-height: 82vh;
  }

  .lineup-roster {
    grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
    gap: 7px;
  }

  .roster-card {
    min-height: 78px;
  }
}