:root {
  color-scheme: light;
  --ink: #20252a;
  --muted: #68717a;
  --line: #dfe3e7;
  --panel: #ffffff;
  --page: #f5f1e9;
  --accent: #2f5f7f;
  --accent-dark: #244e69;
  --warm: #b96f45;
  --green: #4e8c67;
  --blue: #537fa6;
  --gold: #a88436;
  --soft: #fbfaf7;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 12% 8%, rgb(255 244 214 / 0.95), transparent 26rem),
    radial-gradient(circle at 86% 10%, rgb(226 239 246 / 0.9), transparent 27rem),
    linear-gradient(180deg, #fbfaf7 0%, var(--page) 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
}

.app-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.intro-hero {
  display: grid;
  align-content: center;
  min-height: min(560px, calc(100vh - 40px));
  padding: 42px 0 34px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  max-width: 820px;
  margin-bottom: 0;
  font-family: Fraunces, Georgia, serif;
  font-size: clamp(2.6rem, 5.5vw, 5.15rem);
  font-weight: 650;
  line-height: 0.99;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 8px;
  font-size: 1.25rem;
  line-height: 1.15;
}

h3 {
  margin-bottom: 6px;
  font-size: 0.84rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.intro-lede {
  max-width: 660px;
  margin: 22px 0 0;
  color: #3f4851;
  font-size: clamp(1.08rem, 1.6vw, 1.28rem);
  line-height: 1.55;
}

.intro-actions,
.form-actions,
.screen-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.intro-actions {
  margin-top: 28px;
}

.intro-actions span {
  color: var(--muted);
  font-size: 0.94rem;
}

.intro-cues {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  max-width: 820px;
  margin: 30px 0 0;
  padding: 18px 0 0;
  border-top: 1px solid #ded7cd;
  color: #5f6871;
  font-size: 0.94rem;
  font-weight: 750;
  list-style: none;
}

.intro-cues li {
  display: flex;
  align-items: center;
  gap: 9px;
}

.intro-cues li::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.app-header,
.results-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 18px;
  padding-top: 22px;
  border-top: 1px solid #ded7cd;
}

.app-header h1,
.results-header h1 {
  max-width: 760px;
  font-size: clamp(2.2rem, 4.8vw, 4rem);
}

.header-note,
.results-header p {
  max-width: 380px;
  margin-bottom: 0;
  color: var(--muted);
}

.progress-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  padding: 12px;
  border: 1px solid #e6e0d7;
  border-radius: 8px;
  background: rgb(255 255 255 / 0.72);
}

.person-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
  padding: 12px;
  background: rgb(255 255 255 / 0.72);
  border: 1px solid #e6e0d7;
  border-radius: 8px;
  box-shadow: 0 12px 34px rgb(31 35 40 / 0.06);
}

.name-field {
  display: grid;
  gap: 8px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid #e7eaee;
  border-radius: 8px;
}

.name-field span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-weight: 750;
}

.name-field em {
  padding: 2px 7px;
  border-radius: 999px;
  background: #eff6ff;
  color: #235a7c;
  font-size: 0.67rem;
  font-style: normal;
  text-transform: uppercase;
}

.name-field input {
  width: 100%;
  height: 44px;
  padding: 8px 12px;
  border: 1px solid #cbd2d9;
  border-radius: 6px;
  background: #fff;
}

.name-field input:focus {
  border-color: var(--accent);
  outline: 3px solid rgb(47 95 127 / 0.16);
}

.name-field small {
  color: var(--muted);
  font-size: 0.78rem;
}

.progress-meter {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e0d8;
}

.progress-meter span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--green));
  transition: width 180ms ease;
}

.progress-panel p {
  min-width: 118px;
  margin-bottom: 0;
  color: #49515a;
  font-size: 0.86rem;
  font-weight: 800;
  text-align: right;
}

.step-panel {
  display: grid;
  gap: 16px;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 16px;
  border: 1px solid #e6e0d7;
  border-radius: 8px;
  background: rgb(255 255 255 / 0.72);
}

.toolbar p {
  max-width: 700px;
  margin-bottom: 0;
  color: var(--muted);
}

.toolbar-note {
  color: #4b5660;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.value-browser {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
  align-items: start;
}

.value-list {
  display: grid;
  gap: 8px;
}

.value-row,
.result-card {
  border: 1px solid #dfe4e8;
  border-radius: 8px;
  background: rgb(255 255 255 / 0.92);
  box-shadow: 0 12px 30px rgb(31 35 40 / 0.07);
}

.value-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 74px;
  padding: 12px 14px;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.value-row:hover,
.value-row:focus-visible {
  border-color: #b8c5d0;
  background: #fff;
  outline: 0;
  box-shadow: 0 16px 34px rgb(31 35 40 / 0.1);
}

.value-row.is-active {
  border-color: var(--accent);
  box-shadow: 0 12px 32px rgb(47 95 127 / 0.13);
}

.value-row.is-selected {
  border-color: var(--green);
  background: #f5fbf7;
  box-shadow: 0 14px 34px rgb(78 140 103 / 0.15);
}

.value-row.is-selected.is-active {
  border-color: #3f7b5c;
}

.value-row h3,
.result-card h3 {
  margin-bottom: 7px;
  color: var(--ink);
  font-size: 1.06rem;
  letter-spacing: 0;
  text-transform: none;
}

.value-row p,
.result-card p {
  margin-bottom: 0;
  color: #505963;
}

.value-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.value-detail {
  position: sticky;
  top: 18px;
  padding: 18px;
  border: 1px solid #dfe4e8;
  border-radius: 8px;
  background: rgb(255 255 255 / 0.92);
  box-shadow: 0 14px 34px rgb(31 35 40 / 0.08);
}

.value-detail h2 {
  margin-bottom: 10px;
  font-family: Fraunces, Georgia, serif;
  font-size: 1.85rem;
  line-height: 1.04;
}

.value-detail > p {
  color: #46515c;
}

.detail-sections {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.detail-sections section {
  padding: 13px;
  border: 1px solid #e4e7eb;
  border-radius: 8px;
  background: #fbfaf7;
}

.detail-sections p {
  margin-bottom: 0;
  color: #505963;
}

.text-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 800;
  cursor: pointer;
}

.text-button:hover {
  color: var(--accent-dark);
}

.select-button,
.primary-button,
.ghost-button {
  min-height: 42px;
  padding: 9px 14px;
  border-radius: 7px;
  cursor: pointer;
}

.select-button {
  min-width: 86px;
  border: 1px solid #cbd2d9;
  background: #fff;
  color: #303840;
  font-weight: 750;
}

.value-row.is-selected .select-button {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.select-button:disabled {
  opacity: 0.46;
  cursor: not-allowed;
}

.primary-button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 750;
}

.primary-button:hover {
  background: var(--accent-dark);
}

.primary-button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.ghost-button {
  border: 1px solid #bcc3cc;
  background: #fff;
  color: #2e3338;
}

.form-actions {
  justify-content: flex-end;
  margin-top: 18px;
}

.rank-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rank-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto 24px;
  align-items: center;
  gap: 14px;
  min-height: 72px;
  padding: 12px;
  border: 1px solid #dfe4e8;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 30px rgb(31 35 40 / 0.07);
  cursor: grab;
  touch-action: none;
  user-select: none;
  will-change: transform;
}

.rank-item.is-top-five {
  border-color: var(--green);
  background: #f7fcf8;
}

.rank-item.is-active {
  border-color: var(--accent);
  box-shadow: 0 14px 34px rgb(47 95 127 / 0.13);
}

.rank-item.is-top-five.is-active {
  border-color: #3f7b5c;
}

.rank-item.dragging {
  cursor: grabbing;
  background: #fff;
  box-shadow: 0 18px 44px rgb(31 35 40 / 0.22);
  transform: scale(1.012);
}

.rank-placeholder {
  border: 1px dashed #94a9ba;
  border-radius: 8px;
  background: rgb(47 95 127 / 0.08);
  list-style: none;
}

.is-ranking,
.is-ranking * {
  cursor: grabbing !important;
}

.rank-number {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: #eef1f4;
  color: #4f5964;
  font-weight: 850;
}

.is-top-five .rank-number {
  background: var(--green);
  color: #fff;
}

.rank-copy h3 {
  margin-bottom: 3px;
  font-size: 1.05rem;
  letter-spacing: 0;
  text-transform: none;
}

.rank-copy p {
  margin-bottom: 0;
  color: #535d66;
}

.rank-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.rank-handle {
  color: #a0a8b1;
  font-size: 1.15rem;
  text-align: center;
  line-height: 1;
}

.icon-button {
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid #cbd2d9;
  border-radius: 7px;
  background: #f7f8fa;
  color: #34404a;
  cursor: pointer;
  font-weight: 750;
}

.icon-button:hover:not(:disabled) {
  background: #fff;
  border-color: #aeb8c2;
}

.icon-button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.screen-actions {
  justify-content: flex-end;
  margin-bottom: 14px;
}

.results-page {
  width: min(10.5in, 100%);
  margin: 0 auto;
  padding: 0.38in;
  border: 1px solid #e0ddd6;
  background: #fff;
  box-shadow: 0 18px 50px rgb(59 54 45 / 0.12);
}

.results-header {
  align-items: flex-start;
  margin-bottom: 20px;
  padding-top: 0;
  padding-bottom: 16px;
  border-top: 0;
  border-bottom: 1px solid #ebe6de;
}

.results-header h1 {
  font-size: clamp(1.75rem, 3.85vw, 3.2rem);
}

.top-values {
  display: grid;
  gap: 12px;
}

.top-values > h2 {
  margin: 0 0 10px;
  font-family: Fraunces, Georgia, serif;
  font-size: clamp(2rem, 4vw, 3.05rem);
  line-height: 1;
}

.result-card {
  padding: 16px;
}

.result-card p {
  font-size: 0.9rem;
}

.result-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.result-detail-grid section {
  padding: 12px;
  border: 1px solid #e4e7eb;
  border-radius: 8px;
  background: #fbfaf7;
}

.result-detail-grid h4 {
  margin: 0 0 6px;
  color: #3e4852;
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.reflection-panel,
.results-note {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid #ebe6de;
}

.secondary-values {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: 18px;
  margin-top: 22px;
  padding: 18px;
  border: 1px solid #e3e8ea;
  border-radius: 8px;
  background: #f8fbfa;
}

.secondary-values h2 {
  margin-bottom: 8px;
  font-family: Fraunces, Georgia, serif;
  font-size: 1.45rem;
}

.secondary-values p {
  color: #4e5961;
}

.secondary-list {
  display: grid;
  gap: 10px;
}

.secondary-card {
  padding: 13px 14px;
  border: 1px solid #dce5e3;
  border-radius: 8px;
  background: #fff;
}

.secondary-card h3 {
  margin-bottom: 5px;
  font-size: 1rem;
}

.secondary-card p {
  margin-bottom: 0;
  font-size: 0.88rem;
}

.email-status {
  min-height: 22px;
  margin: 18px 0 0;
  padding: 14px 16px;
  border: 1px solid #cfe3d8;
  border-radius: 8px;
  background: #f5fbf7;
  color: #24473b;
  font-weight: 750;
  text-align: center;
}

.email-status:empty {
  display: none;
}

.email-status[data-tone="error"] {
  color: #b64242;
  border-color: #ead0c8;
  background: #fff7f4;
}

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

.reflection-grid p,
.results-note {
  margin-bottom: 0;
  color: #4e5660;
}

@media (max-width: 920px) {
  .value-browser {
    grid-template-columns: 1fr;
  }

  .value-detail {
    position: static;
  }

  .reflection-grid,
  .result-detail-grid,
  .secondary-values {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .app-shell {
    width: min(100% - 22px, 1120px);
    padding-top: 18px;
  }

  .app-header,
  .toolbar,
  .results-header {
    display: grid;
  }

  .person-fields {
    grid-template-columns: 1fr;
  }

  .value-browser {
    grid-template-columns: 1fr;
  }

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

  .value-row-actions {
    justify-content: flex-start;
  }

  .rank-item {
    grid-template-columns: 38px minmax(0, 1fr) 22px;
  }

  .rank-controls {
    grid-column: 1 / -1;
    justify-content: flex-start;
    padding-left: 52px;
  }

  .rank-handle {
    grid-column: 3;
    grid-row: 1;
  }

  .progress-panel {
    grid-template-columns: 1fr;
  }

  .progress-panel p {
    text-align: left;
  }
}

@media print {
  body {
    background: #fff;
  }

  .screen-actions,
  .intro-view,
  .survey-view {
    display: none !important;
  }

  .app-shell {
    width: 100%;
    padding: 0;
  }

  .results-page {
    width: 100%;
    min-height: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
  }
}
