:root {
  --ink: #23201d;
  --muted: #6f6860;
  --paper: #fffaf0;
  --line: #23201d;
  --mint: #67d7c4;
  --coral: #ff7f65;
  --yellow: #ffd166;
  --blue: #7da7ff;
  --white: #ffffff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(90deg, rgba(35, 32, 29, 0.06) 1px, transparent 1px),
    linear-gradient(rgba(35, 32, 29, 0.06) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
}

button,
input {
  font: inherit;
}

.app {
  width: min(1120px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  align-items: center;
  padding: 36px 0;
}

.panel,
.share-panel {
  border: 3px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 10px 10px 0 var(--ink);
}

.panel {
  min-height: 560px;
  padding: clamp(24px, 5vw, 56px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.intro {
  background:
    linear-gradient(135deg, rgba(255, 209, 102, 0.36), transparent 45%),
    linear-gradient(315deg, rgba(103, 215, 196, 0.36), transparent 48%),
    var(--white);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-weight: 800;
}

.mark {
  width: 74px;
  height: 74px;
  transform: rotate(-4deg);
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 18px;
  font-size: clamp(48px, 8vw, 96px);
  line-height: 0.95;
  letter-spacing: 0;
}

.lead {
  max-width: 680px;
  color: var(--muted);
  font-size: 20px;
  line-height: 1.7;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

button {
  min-height: 48px;
  border: 2px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--white);
  cursor: pointer;
  font-weight: 900;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

button:hover {
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0 var(--ink);
}

.primary {
  padding: 0 24px;
  background: var(--coral);
}

.ghost {
  padding: 0 22px;
  background: var(--yellow);
}

.full {
  width: 100%;
}

.icon-btn {
  width: 46px;
  padding: 0;
  border-radius: 50%;
  background: var(--mint);
}

.hidden {
  display: none;
}

.topline,
.share-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topline {
  margin-bottom: 18px;
  font-weight: 900;
}

.progress {
  height: 14px;
  border: 2px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: var(--white);
}

.progress span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--mint), var(--blue), var(--coral));
  transition: width 220ms ease;
}

.scene {
  margin: 42px 0 12px;
  color: var(--muted);
  font-weight: 900;
}

.quiz h2 {
  max-width: 760px;
  font-size: clamp(30px, 5vw, 54px);
  line-height: 1.1;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 28px;
}

.choice {
  min-height: 150px;
  padding: 20px;
  background: var(--white);
  text-align: left;
  font-size: 20px;
  line-height: 1.45;
}

.choice:nth-child(2) {
  background: #ecf3ff;
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 1000;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.result-card {
  padding: 28px;
  border: 3px solid var(--line);
  border-radius: 8px;
  background: #fff4d6;
}

.badge {
  width: max-content;
  margin-bottom: 18px;
  padding: 8px 12px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--mint);
  font-weight: 1000;
}

.result h2 {
  margin-bottom: 14px;
  font-size: clamp(36px, 6vw, 70px);
  line-height: 1;
}

.result-card p {
  color: var(--muted);
  font-size: 19px;
  line-height: 1.7;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.tags span,
#topTypes span {
  padding: 8px 10px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  font-weight: 900;
}

.share-panel {
  align-self: stretch;
  min-height: 560px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: #e8fff9;
}

.share-panel.closed {
  display: none;
}

.share-head h2 {
  margin-bottom: 0;
  font-size: 28px;
}

#qrImage {
  width: 100%;
  aspect-ratio: 1;
  border: 3px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  object-fit: cover;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 900;
}

input {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 2px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--white);
}

.stats {
  margin-top: auto;
  padding-top: 16px;
  border-top: 2px dashed var(--line);
}

.stats strong {
  font-size: 44px;
  line-height: 1;
}

#topTypes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  max-width: min(420px, calc(100% - 32px));
  padding: 12px 16px;
  border: 2px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--white);
  box-shadow: 6px 6px 0 var(--ink);
  transform: translate(-50%, 140%);
  transition: transform 180ms ease;
  font-weight: 900;
}

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

@media (max-width: 880px) {
  .app {
    grid-template-columns: 1fr;
    align-items: start;
    padding: 18px 0 36px;
  }

  .panel,
  .share-panel {
    min-height: auto;
    box-shadow: 7px 7px 0 var(--ink);
  }

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

  .choice {
    min-height: 112px;
  }
}
