:root {
  --ink: #121417;
  --muted: #6d7482;
  --line: #e6e8ee;
  --field: #f4f5f7;
  --card: #ffffff;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 18px 40px rgba(16, 24, 40, 0.06);
  --radius: 20px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(180deg, #ffffff 0%, #f5f6f8 280px),
    #f5f6f8;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

.wrap {
  width: min(880px, calc(100% - 40px));
  margin: 36px auto 64px;
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.brand {
  display: flex;
  flex-direction: column;
}

.eyebrow {
  margin: 0 0 2px;
  color: #8b919e;
  font-family: Outfit, Pretendard, sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(32px, 4vw, 42px);
  line-height: 1.05;
  letter-spacing: -0.05em;
  font-weight: 800;
}

.lede {
  max-width: 240px;
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
  text-align: right;
}

.board,
.summary {
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.board {
  border-radius: var(--radius);
  overflow: hidden;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border-bottom: 1px solid #eef0f3;
}

.stepper {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border-radius: 12px;
  background: var(--field);
}

.stepper button {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  font-size: 20px;
  line-height: 1;
}

.stepper button:hover:not(:disabled) {
  background: white;
}

.stepper button:disabled {
  opacity: 0.28;
  cursor: not-allowed;
}

.stepper-value {
  min-width: 64px;
  text-align: center;
}

.stepper-value strong {
  font-size: 18px;
  letter-spacing: -0.04em;
}

.stepper-value span {
  margin-left: 2px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn {
  border: 0;
  border-radius: 11px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.16s ease, transform 0.16s ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-ghost {
  background: white;
  color: #3c4250;
  box-shadow: inset 0 0 0 1px #e4e7ee;
}

.btn-ghost:hover:not(:disabled) {
  background: #fafbfc;
}

.btn-primary {
  color: white;
  background: var(--ink);
}

.btn-primary:hover:not(:disabled) {
  background: #000;
}

.stage {
  padding: 22px 20px 20px;
}

.stage-scroll {
  overflow-x: auto;
}

.stage-inner {
  width: max(100%, calc(var(--cols) * 112px));
}

.slot-row {
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  gap: 12px;
}

.slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.ride {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.5px solid #e4e7ee;
  background: white;
  color: #98a0ad;
  font-weight: 700;
  letter-spacing: -0.04em;
  transition: transform 0.16s ease, background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.ride:hover:not(:disabled) {
  transform: translateY(-2px);
}

.ride,
.ride:disabled,
.ride.ready,
.ride.done,
.ride.active {
  background: var(--c);
  color: white;
  border-color: transparent;
  cursor: default;
}

.ride.ready,
.ride.done,
.ride.active {
  cursor: pointer;
}

.ride.ready {
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 18%, white);
}

.ride-label {
  margin-top: -2px;
  min-height: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--c);
}

.ride-label:empty {
  display: none;
}

.slot-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 8px;
  text-align: center;
  font-weight: 700;
  background: white;
  outline: none;
}

#names .slot-input {
  border-top: 2px solid var(--c);
}

.slot-input:focus {
  border-color: #b7beca;
}

.slot-input.matched {
  border-color: var(--c);
  box-shadow: inset 0 -2px 0 var(--c);
}

.ladder-frame {
  position: relative;
  margin: 14px 0 16px;
  min-height: 168px;
  border-radius: 16px;
  background: var(--field);
}

.ladder-frame.ready {
  min-height: 0;
  background: transparent;
}

.ladder-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0;
  padding: 0 24px;
  text-align: center;
  color: #8b919e;
  font-size: 14px;
  font-weight: 600;
}

.ladder-frame.ready .ladder-empty {
  display: none;
}

#ladder {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

.summary {
  margin-top: 14px;
  border-radius: 18px;
  padding: 6px 18px 4px;
}

.summary-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding-top: 12px;
}

.summary h2 {
  margin: 0;
  font-size: 15px;
  letter-spacing: -0.03em;
}

.summary-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.summary ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.summary li {
  display: grid;
  grid-template-columns: 8px 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 13px 0;
  border-top: 1px solid #f0f1f4;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c);
}

.summary .name,
.summary .prize {
  font-weight: 700;
}

.summary .arrow {
  color: #b0b6c2;
  font-size: 12px;
  font-weight: 600;
}

.summary .prize {
  text-align: right;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translate(-50%, 12px);
  z-index: 5;
  max-width: min(480px, calc(100% - 32px));
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--ink);
  color: white;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 12px 30px rgba(18, 20, 23, 0.22);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.confetti {
  position: fixed;
  width: 7px;
  height: 7px;
  border-radius: 1px;
  z-index: 6;
  pointer-events: none;
  animation: pop 800ms ease-out forwards;
}

@keyframes pop {
  to {
    transform: translate(var(--dx), var(--dy)) rotate(160deg);
    opacity: 0;
  }
}

@media (max-width: 720px) {
  .wrap {
    width: min(100% - 24px, 880px);
    margin-top: 20px;
  }

  .hero {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .lede {
    max-width: none;
    text-align: left;
  }

  .toolbar {
    align-items: stretch;
  }

  .toolbar-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .btn-primary {
    grid-column: 1 / -1;
  }

  .stage {
    padding: 16px 12px 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
