:root {
  --ink: #151515;
  --paper: #f5f3ee;
  --card: #fffdf8;
  --line: #d8d3c7;
  --coral: #f28f78;
  --yellow: #f5cf63;
  --mint: #bad9c5;
  --lavender: #c9c2e8;
  font-family: Arial, Helvetica, sans-serif;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.4;
}
.stage {
  max-width: 1220px;
  margin: 0 auto;
  padding: 38px 42px 80px;
}
header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 30px;
}
.eyebrow {
  font-size: 11px;
  letter-spacing: 0.14em;
  font-weight: 700;
}
.stage h1 {
  font-size: clamp(32px, 8vw, 72px);
  line-height: 0.83;
  letter-spacing: -0.08em;
  margin: 16px 0 22px;
}
.stage h1 i {
  font-weight: 400;
}
.stage header p {
  font-size: 20px;
  margin: 0;
  color: #655f58;
}
.round-button {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--ink);
  background: transparent;
  font-weight: 700;
  font-size: 18px;
  cursor: pointer;
  transition:
    transform 0.2s,
    background 0.2s;
}
.round-button:hover {
  background: var(--ink);
  color: #fff;
  transform: rotate(10deg);
}
.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 32px;
  align-items: end;
  margin: 28px 0 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--ink);
}
label {
  display: block;
  font-size: 12px;
  font-weight: 700;
}
.intro input {
  display: block;
  width: 100%;
  border: 0;
  border-bottom: 2px solid var(--ink);
  background: transparent;
  padding: 10px 0;
  font-size: 24px;
  outline: 0;
}
.intro input::placeholder {
  color: #9b968d;
}
.intro-note {
  font-size: 14px;
  color: #655f58;
  max-width: 280px;
}
.shuffle-zone {
  position: relative;
}
.zone-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.counter {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.13em;
}
.status {
  color: #817b72;
  font-size: 13px;
}
.cards {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}
.factor-card {
  position: relative;
  min-height: 260px;
  padding: 18px;
  background: var(--card);
  border: 1px solid var(--ink);
  overflow: hidden;
  transition:
    transform 0.25s,
    background 0.25s,
    box-shadow 0.25s;
}
.factor-card:nth-child(1) {
  --accent: var(--coral);
}
.factor-card:nth-child(2) {
  --accent: var(--yellow);
}
.factor-card:nth-child(3) {
  --accent: var(--mint);
}
.factor-card:nth-child(4) {
  --accent: var(--lavender);
}
.factor-card:nth-child(5) {
  --accent: #d8b59b;
}
.factor-card:before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 7px;
  background: var(--accent);
}
.factor-card:hover {
  transform: translateY(-5px);
  box-shadow: 7px 7px 0 var(--accent);
}
.factor-card.is-locked {
  background: var(--accent);
}
.factor-card select:disabled {
  color: rgba(0, 0, 0, 0.25);
  opacity: 1;
  cursor: not-allowed;
  border-bottom: 2px solid rgba(0, 0, 0, 0.25);
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(135deg, rgba(0, 0, 0, 0.25) 50%, transparent 50%);
}
.factor-card.is-shuffled {
  animation: land 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.factor-card.is-shuffled:after {
  content: "changed";
  position: absolute;
  right: 14px;
  top: 15px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
}
.factor-card h2 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin: 18px 0 20px;
}
.factor-card select,
.factor-card input {
  width: 100%;
  border: 0;
  border-bottom: 2px solid var(--ink);
  background: transparent;
  padding: 7px 0;
  font: inherit;
  font-size: 18px;
  letter-spacing: -0.04em;
  outline: 0;
}
.factor-card select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position:
    calc(100% - 12px) 53%,
    calc(100% - 7px) 53%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
.card-bottom {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.card-bottom small {
  font-size: 11px;
  color: #726c63;
}
.lock {
  border: 1px solid var(--ink);
  border-radius: 20px;
  background: transparent;
  padding: 5px 10px;
  font-size: 11px;
  cursor: pointer;
}
.lock.active {
  background: var(--ink);
  color: #fff;
}
.actions {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 25px 0 18px;
}
.shuffle-button {
  display: flex;
  align-items: center;
  gap: 18px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
  padding: 14px 18px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition:
    transform 0.2s,
    background 0.2s;
}
.shuffle-button b {
  font-size: 22px;
  line-height: 1;
}
.shuffle-button:hover {
  background: #3d3a35;
  transform: translateY(-2px);
}
.small-button {
  border: 1px solid var(--ink);
  background: transparent;
  padding: 11px 13px;
  font-size: 12px;
  cursor: pointer;
}
.small-button:hover {
  background: #fff;
}
.prompt {
  padding: 16px 18px;
  background: var(--ink);
  color: #fff;
  font-size: 17px;
  letter-spacing: -0.02em;
}
.history {
  margin-top: 48px;
  border-top: 1px solid var(--ink);
}
.history-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 17px 0;
  font-size: 16px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
.history-toggle span:nth-child(2) {
  font-size: 11px;
  background: var(--ink);
  color: #fff;
  border-radius: 20px;
  padding: 3px 8px;
}
.history-toggle b {
  margin-left: auto;
  font-size: 20px;
  transition: transform 0.2s;
}
.history.open .history-toggle b {
  transform: rotate(180deg);
}
.history-list {
  display: none;
}
.history.open .history-list {
  display: block;
}
.history-entry {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 18px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  align-items: center;
}
.history-entry p {
  margin: 0;
  font-size: 15px;
}
.history-entry small {
  color: #817b72;
}
.history-entry button {
  border: 1px solid var(--line);
  background: transparent;
  padding: 6px 9px;
  cursor: pointer;
}
.history-entry button:hover {
  border-color: var(--ink);
  background: #fff;
}
.dialog-top {
  display: flex;
  justify-content: space-between;
  background: var(--ink);
  color: #fff;
  padding: 16px 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
}
.dialog-top button {
  border: 1px solid #fff;
  background: transparent;
  color: #fff;
  font-size: 20px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  border-radius: 50%;
}
.dialog-top button:hover {
  background: #fff;
  color: var(--ink);
  transition:
    transform 0.2s,
    background 0.2s;
}
.dialog-body {
  padding: 22px;
  max-width: 520px;
}
.dialog-body h2 {
  font-size: 28px;
  line-height: 1.05;
  letter-spacing: -0.04em;
}
.dialog-body p {
  color: #655f58;
}
dialog {
  border: 1px solid var(--ink);
  padding: 0;
}
dialog::backdrop {
  background: rgba(21, 21, 21, 0.35);
}
@keyframes land {
  0% {
    transform: translateY(-14px) rotate(1.5deg);
    opacity: 0.5;
  }
  65% {
    transform: translateY(3px) rotate(-0.5deg);
  }
  100% {
    transform: translateY(0) rotate(0);
    opacity: 1;
  }
}
@keyframes spin {
  0% {
    transform: rotate(0);
  }
  100% {
    transform: rotate(360deg);
  }
}
.shuffle-button.spinning b {
  animation: spin 0.5s linear infinite;
}
@media (max-width: 850px) {
  .cards {
    grid-template-columns: repeat(3, 1fr);
  }
  .intro {
    grid-template-columns: 1fr;
  }
  .intro-note {
    max-width: none;
  }
}
@media (max-width: 600px) {
  .stage {
    padding: 24px 18px 60px;
  }
  .stage h1 {
    font-size: 58px;
  }
  .cards {
    grid-template-columns: 1fr 1fr;
  }
  .factor-card {
    min-height: 220px;
  }
  .factor-card h2 {
    margin-bottom: 24px;
  }
  .actions {
    flex-wrap: wrap;
  }
  .shuffle-button {
    width: 100%;
    justify-content: space-between;
  }
  .prompt {
    font-size: 15px;
  }
  .history-entry {
    grid-template-columns: 1fr;
  }
  .history-entry div:last-child {
    display: flex;
    gap: 6px;
  }
}
