:root {
  --slate-ink: #2C3E50;
  --slate-mid: #3D5166;
  --deep-teal: #1A6B5C;
  --forest: #2E5F54;
  --amber: #D97706;
  --teal-stone: #F0F4F2;
  --off-white: #FDFCFB;
  --panel: #FFFFFF;
  --line: #D9E2DE;
  --muted: #718073;
  --error: #A84A3E;
  --shadow: 0 18px 42px rgba(44, 62, 80, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--off-white);
}

body {
  margin: 0;
  min-height: 100%;
  background:
    linear-gradient(90deg, rgba(240, 244, 242, 0.72) 0 1px, transparent 1px 100%),
    var(--off-white);
  background-size: 96px 100%;
  color: var(--slate-ink);
  font-family: Calibri, "Segoe UI", system-ui, sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.hidden {
  display: none !important;
}

.app,
.center {
  min-height: 100vh;
  padding: 28px 20px;
}

.center {
  display: grid;
  place-items: center;
}

.logo {
  display: block;
  width: auto;
  height: 52px;
}

.logo.small {
  height: 42px;
}

.introCard,
.contactCard {
  width: min(960px, 94vw);
  padding: 56px 64px 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
  text-align: left;
}

.contactCard {
  width: min(760px, 94vw);
}

.introCard .logo,
.contactCard .logo {
  margin-bottom: 44px;
}

.introKicker {
  margin-bottom: 14px;
  color: var(--deep-teal);
  font-family: "Courier New", Courier, monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.title,
.instructionTitle,
.instructionCopy h2,
.resultPanel h3 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  letter-spacing: 0;
}

.title {
  max-width: 760px;
  margin: 0;
  color: var(--slate-ink);
  font-size: clamp(42px, 7vw, 76px);
  line-height: 0.98;
}

.subtitle {
  max-width: 580px;
  margin: 22px 0 32px;
  color: var(--slate-mid);
  font-size: 18px;
  line-height: 1.45;
}

.introSteps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  max-width: 800px;
  margin: 34px 0 36px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
  color: var(--slate-mid);
  font-size: 15px;
  line-height: 1.35;
}

.introSteps span {
  display: block;
  margin-bottom: 8px;
  color: var(--amber);
  font-family: "Courier New", Courier, monospace;
  font-size: 12px;
  font-weight: 700;
}

.field {
  width: 100%;
  min-height: 48px;
  margin-top: 8px;
  padding: 12px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  outline: 0;
  background: transparent;
  color: var(--slate-ink);
  font-size: 16px;
}

.field::placeholder {
  color: var(--muted);
}

.field:focus {
  border-color: var(--deep-teal);
}

.startBtn,
.goBtn,
.continueBtn,
.reshuffleBtn,
.shareBtn,
.chooseBtn,
.flipBtn,
.accuracyBtn {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 700;
}

.startBtn,
.goBtn,
.continueBtn {
  min-width: 132px;
  background: var(--slate-ink);
  color: var(--off-white);
}

.startBtn {
  margin-top: 22px;
}

.startBtn:disabled,
.continueBtn:disabled {
  cursor: not-allowed;
  border-color: var(--line);
  background: var(--teal-stone);
  color: var(--muted);
}

.startBtn.enabled {
  border-color: var(--slate-ink);
  background: var(--slate-ink);
  color: var(--off-white);
}

.screen,
.instructionScreen,
.resultScreen {
  width: min(1320px, 100%);
  margin: 0 auto;
}

.instructionScreen {
  padding-top: 52px;
}

.topLogo {
  margin-bottom: 28px;
}

.instructionTitle {
  max-width: 800px;
  margin: 36px 0 56px;
  color: var(--slate-ink);
  font-size: clamp(36px, 5vw, 58px);
  line-height: 1.02;
}

.instructionGrid {
  display: grid;
  grid-template-columns: minmax(250px, 340px) 1fr;
  gap: 56px;
  align-items: start;
}

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

.miniCard,
.resultMini {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--teal-stone);
  aspect-ratio: 1140 / 1952;
}

.miniCard img,
.resultMini img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.instructionCopy {
  max-width: 520px;
}

.instructionCopy h2 {
  margin: 0 0 18px;
  color: var(--slate-ink);
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.08;
}

.instructionCopy p {
  margin: 0 0 16px;
  color: var(--slate-mid);
  font-size: 18px;
  line-height: 1.5;
}

.goBtn {
  margin-top: 24px;
}

.cardHeader {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 24px;
  align-items: center;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.cardHeader .instruction {
  color: var(--slate-mid);
  font-size: 19px;
  line-height: 1.4;
  text-align: right;
}

.selectionProgress {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin: 18px 0 22px;
}

.selectionCount,
.cardNum,
.selectionReasonLabel,
.accuracyTitle,
.selectedOpposite {
  font-family: "Courier New", Courier, monospace;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.selectionCount {
  color: var(--muted);
  font-size: 12px;
}

.selectionDots {
  display: flex;
  gap: 7px;
}

.selectionDot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.selectionDot.done {
  border-color: var(--amber);
  background: var(--amber);
}

.cardGrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px;
}

.cardBox {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.cardBox.chosen {
  border-color: var(--amber);
  box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.18), var(--shadow);
}

.cardBox.chosen::before {
  content: "Selected";
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  border-radius: 999px;
  background: var(--amber);
  color: var(--off-white);
  font-family: "Courier New", Courier, monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 5px 8px;
  text-transform: uppercase;
}

.cardImageWrap {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--teal-stone);
  aspect-ratio: 1140 / 1952;
  cursor: pointer;
}

.flipShell {
  width: 100%;
  height: 100%;
  overflow: hidden;
  transform: scaleX(1);
}

.flipShell.is-flipping {
  animation: cardFlip 0.55s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes cardFlip {
  0% { transform: scaleX(1); }
  49% { transform: scaleX(0.02); }
  51% { transform: scaleX(0.02); }
  100% { transform: scaleX(1); }
}

.flipShell img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--teal-stone);
}

.flipBtn,
.chooseBtn {
  width: 100%;
}

.flipBtn {
  border-color: var(--line);
  background: var(--panel);
  color: var(--slate-mid);
}

.chooseBtn {
  border-color: var(--deep-teal);
  background: var(--teal-stone);
  color: var(--deep-teal);
}

.chooseBtn.chosen {
  border-color: var(--amber);
  background: var(--amber);
  color: var(--off-white);
}

.cardNum {
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.selectionReasonWrap {
  max-width: 860px;
  margin: 24px auto 0;
}

.selectionReasonLabel {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}

.selectionReasonInput {
  width: 100%;
  min-height: 92px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  background: var(--panel);
  color: var(--slate-ink);
  padding: 12px 14px;
  line-height: 1.45;
}

.selectionReasonInput::placeholder {
  color: var(--muted);
}

.selectionReasonInput:focus {
  border-color: var(--deep-teal);
}

.continueWrap {
  display: flex;
  justify-content: center;
  margin-top: 18px;
}

.resultScreen {
  padding-top: 38px;
}

.resultGrid {
  display: grid;
  grid-template-columns: minmax(280px, 380px) 1fr;
  gap: 64px;
  align-items: start;
  margin-top: 34px;
}

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

.selectedNames {
  margin-top: 24px;
  color: var(--slate-ink);
  font-size: 18px;
  line-height: 1.45;
}

.selectedOpposite {
  display: inline-block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.resultPanel {
  min-height: 100%;
  border-left: 1px solid var(--line);
  padding-left: 48px;
}

.resultPanel h3 {
  margin: 0 0 12px;
  color: var(--slate-ink);
  font-size: 30px;
  line-height: 1.1;
}

.resultPanel .serviceHeading {
  color: var(--deep-teal);
}

.resultPanel .readback {
  max-width: 680px;
  margin: 0 0 34px;
  color: var(--slate-mid);
  font-size: clamp(24px, 2.5vw, 36px);
  line-height: 1.34;
}

.resultPanel .readback.second {
  color: var(--forest);
  font-size: clamp(20px, 2vw, 28px);
}

.accuracyCheck {
  margin: 2px 0 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.accuracyTitle {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
}

.accuracyButtons {
  display: flex;
  gap: 10px;
}

.accuracyBtn {
  min-width: 50px;
  border-color: var(--line);
  background: var(--panel);
  color: var(--slate-ink);
  font-size: 18px;
}

.accuracyBtn.active {
  border-color: var(--deep-teal);
  background: var(--teal-stone);
  color: var(--deep-teal);
}

.accuracyStatus {
  min-height: 18px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  max-width: 360px;
  margin-top: 18px;
}

.reshuffleBtn {
  border-color: var(--slate-ink);
  background: var(--slate-ink);
  color: var(--off-white);
}

.shareBtn {
  border-color: var(--slate-mid);
  background: var(--panel);
  color: var(--slate-ink);
}

.closingLine {
  max-width: 560px;
  margin-top: 28px;
  color: var(--slate-mid);
  font-size: 17px;
  line-height: 1.45;
}

.error {
  margin-top: 16px;
  color: var(--error);
  font-size: 14px;
}

@media (max-width: 900px) {
  .introCard {
    padding: 40px 28px;
  }

  .contactCard {
    padding: 40px 28px;
  }

  .introSteps {
    grid-template-columns: 1fr;
  }

  .instructionScreen {
    padding-top: 24px;
  }

  .instructionGrid,
  .resultGrid {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .cardHeader {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .cardHeader .logo {
    margin: 0 auto;
  }

  .cardHeader .instruction,
  .selectionProgress {
    justify-content: center;
    text-align: center;
  }

  .resultPanel {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 28px 0 0;
  }
}

@media (max-width: 760px) {
  .app,
  .center {
    padding: 18px 14px;
  }

  .introCard {
    width: 100%;
    min-height: calc(100vh - 36px);
    display: grid;
    align-content: center;
  }

  .title {
    font-size: 44px;
  }

  .subtitle {
    font-size: 16px;
  }

  .instructionTitle {
    margin: 24px 0 32px;
    font-size: 38px;
  }

  .instructionGrid {
    gap: 26px;
  }

  .cardGrid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .cardBox {
    width: min(100%, 430px);
    margin: 0 auto;
  }

  .resultCards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .actions {
    grid-template-columns: 1fr;
    max-width: none;
  }
}
