/* Shared styles for interactive relationship tools (关系对话工具). */
:root {
  --ink: #20303d;
  --ink-mid: #536776;
  --ink-soft: #7b8d99;
  --line: #dfe9e8;
  --paper: #ffffff;
  --bg: #f3f7f6;
  --teal: #2f6f73;
  --teal-dark: #214f52;
  --teal-soft: #e8f4f1;
  --rose: #a65168;
  --rose-soft: #f9edf0;
  --amber: #a36d1d;
  --amber-soft: #fbf2df;
  --slate: #596775;
  --slate-soft: #edf1f4;
  --shadow: 0 16px 44px rgba(32, 48, 61, 0.08);
  --shadow-sm: 0 5px 18px rgba(32, 48, 61, 0.06);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 8% 0%, rgba(47, 111, 115, 0.11), transparent 28rem),
    radial-gradient(circle at 92% 16%, rgba(166, 81, 104, 0.08), transparent 25rem),
    var(--bg);
  color: var(--ink);
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
  line-height: 1.65;
  -webkit-tap-highlight-color: transparent;
}

button,
input {
  font: inherit;
}

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

.back-home {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid rgba(32, 48, 61, 0.13);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-sm);
  color: #6a7b8f;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  backdrop-filter: blur(12px);
}

.back-home:hover {
  color: #111111;
  border-color: rgba(32, 48, 61, 0.28);
}

.back-home:focus-visible {
  outline: 2px solid #1e5f65;
  outline-offset: 2px;
}

.page {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 88px 0 64px;
}

.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(32px, 6vw, 64px);
  border: 1px solid rgba(47, 111, 115, 0.14);
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.hero::after {
  content: "";
  position: absolute;
  width: 300px;
  height: 300px;
  right: -110px;
  top: -130px;
  border: 52px solid rgba(47, 111, 115, 0.07);
  border-radius: 50%;
  pointer-events: none;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.eyebrow::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal);
}

h1 {
  margin: 0;
  font-family: "Noto Serif SC", serif;
  font-size: clamp(2.2rem, 6vw, 4.5rem);
  line-height: 1.12;
  letter-spacing: -0.04em;
}

h1 em {
  color: var(--teal);
  font-style: normal;
}

.hero-lead {
  max-width: 720px;
  margin: 20px 0 0;
  color: var(--ink-mid);
  font-size: clamp(14px, 2vw, 17px);
}

.hero-notes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 30px;
}

.hero-note {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(243, 247, 246, 0.74);
}

.hero-note strong {
  display: block;
  margin-bottom: 2px;
  color: var(--ink);
  font-size: 14px;
}

.hero-note span {
  color: var(--ink-soft);
  font-size: 13px;
}

.guide {
  display: grid;
  grid-template-columns: 0.9fr 1.4fr;
  gap: 18px;
  margin: 24px 0;
}

.guide-card,
.legend-card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-sm);
}

.guide-card h2,
.legend-card h2 {
  margin: 0 0 10px;
  font-family: "Noto Serif SC", serif;
  font-size: 18px;
}

.guide-card p {
  margin: 0;
  color: var(--ink-mid);
  font-size: 14px;
}

.legend {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.legend-item {
  padding: 10px 8px;
  border-radius: 12px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
}

.legend-item small {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  font-weight: 400;
  opacity: 0.8;
}

.legend-item.need {
  background: var(--rose-soft);
  color: var(--rose);
}

.legend-item.prefer {
  background: var(--teal-soft);
  color: var(--teal-dark);
}

.legend-item.discuss {
  background: var(--amber-soft);
  color: var(--amber);
}

.legend-item.limit {
  background: var(--slate-soft);
  color: var(--slate);
}

.utility-bar {
  position: sticky;
  top: 12px;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 0 22px;
  padding: 12px 14px;
  border: 1px solid rgba(47, 111, 115, 0.16);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.91);
  box-shadow: 0 10px 30px rgba(32, 48, 61, 0.1);
  backdrop-filter: blur(16px);
}

.progress-copy {
  flex: 0 0 auto;
  min-width: 105px;
}

.progress-copy strong {
  display: block;
  font-size: 13px;
}

.progress-copy span {
  color: var(--ink-soft);
  font-size: 12px;
}

.progress-track {
  flex: 1;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7eeec;
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), #67a99a);
  transition: width 0.25s ease;
}

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

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink-mid);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.18s ease;
}

.button:hover {
  border-color: rgba(47, 111, 115, 0.38);
  color: var(--teal-dark);
  transform: translateY(-1px);
}

.button:disabled {
  cursor: wait;
  opacity: 0.68;
  transform: none;
}

.button.primary {
  border-color: var(--teal);
  background: var(--teal);
  color: #fff;
}

.button.primary:hover {
  background: var(--teal-dark);
  color: #fff;
}

.profile-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
  padding: 14px 18px;
  border: 1px dashed rgba(47, 111, 115, 0.28);
  border-radius: 16px;
  background: rgba(232, 244, 241, 0.5);
}

.profile-row label {
  color: var(--teal-dark);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.profile-row input {
  width: 100%;
  padding: 8px 2px;
  border: 0;
  border-bottom: 1px solid rgba(47, 111, 115, 0.28);
  outline: none;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
}

.profile-row input:focus {
  border-bottom-color: var(--teal);
}

.topics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  align-items: start;
}

.topic-card {
  overflow: hidden;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--paper);
  box-shadow: var(--shadow-sm);
}

.topic-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.35);
  color: #fff;
}

.topic-head.relationship {
  background: linear-gradient(120deg, #2f6f73, #568f8b);
}

.topic-head.emotion {
  background: linear-gradient(120deg, #94546a, #be7b8f);
}

.topic-head.communication {
  background: linear-gradient(120deg, #4d6480, #708aa8);
}

.topic-head.time {
  background: linear-gradient(120deg, #8b6b37, #b08d57);
}

.topic-head.social {
  background: linear-gradient(120deg, #687052, #8d9871);
}

.topic-head.autonomy {
  background: linear-gradient(120deg, #665b86, #8d80aa);
}

.topic-head.practical {
  background: linear-gradient(120deg, #5a6f73, #81969a);
}

.topic-head.intimacy {
  background: linear-gradient(120deg, #8c5360, #b57a84);
}

.topic-icon {
  display: grid;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  font-family: "Noto Serif SC", serif;
  font-size: 17px;
  font-weight: 700;
}

.topic-heading {
  flex: 1;
  min-width: 0;
}

.topic-heading h2 {
  margin: 0;
  font-family: "Noto Serif SC", serif;
  font-size: 17px;
  line-height: 1.35;
}

.topic-heading p {
  margin: 2px 0 0;
  font-size: 12px;
  opacity: 0.82;
}

.topic-count {
  margin-left: auto;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  opacity: 0.94;
}

.topic-list {
  padding: 6px 18px 10px;
}

.topic-item {
  padding: 14px 0;
  border-bottom: 1px solid #edf2f1;
}

.topic-item:last-child {
  border-bottom: 0;
}

.item-copy {
  margin-bottom: 10px;
}

.item-title {
  display: block;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.55;
}

.item-desc {
  display: block;
  margin-top: 2px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.5;
}

.status-group {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
}

.status-choice {
  min-height: 36px;
  padding: 6px 4px;
  border: 1px solid #e2e9e8;
  border-radius: 8px;
  background: #f9fbfa;
  color: #82919b;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
  cursor: pointer;
  transition: 0.15s ease;
}

.status-choice:hover {
  border-color: #b9c9c6;
  color: var(--ink-mid);
}

.status-choice.is-selected {
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(32, 48, 61, 0.13);
}

.status-choice.need.is-selected {
  border-color: var(--rose);
  background: var(--rose);
}

.status-choice.prefer.is-selected {
  border-color: var(--teal);
  background: var(--teal);
}

.status-choice.discuss.is-selected {
  border-color: var(--amber);
  background: var(--amber);
}

.status-choice.limit.is-selected {
  border-color: var(--slate);
  background: var(--slate);
}

.sensitive-note {
  margin: 14px 18px 2px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--rose-soft);
  color: #78515c;
  font-size: 13px;
}

.custom-card {
  margin-top: 20px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--paper);
  box-shadow: var(--shadow-sm);
}

.custom-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.custom-head h2 {
  margin: 0;
  font-family: "Noto Serif SC", serif;
  font-size: 20px;
}

.custom-head p {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
}

.custom-composer {
  display: flex;
  gap: 10px;
  width: min(100%, 560px);
}

.custom-composer input {
  flex: 1;
  min-width: 0;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  color: var(--ink);
  background: #fbfcfc;
}

.custom-composer input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(47, 111, 115, 0.09);
}

.custom-list:empty::before {
  content: "还没有自定义议题。可以添加只有你们才会遇到的安排、边界或期待。";
  display: block;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--ink-soft);
  font-size: 13px;
  text-align: center;
}

.custom-item {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(280px, 0.8fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #edf2f1;
}

.custom-item:last-child {
  border-bottom: 0;
}

.delete-custom {
  padding: 5px 8px;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 12px;
  cursor: pointer;
}

.delete-custom:hover {
  color: var(--rose);
}

.summary-card {
  margin-top: 28px;
  padding: clamp(22px, 4vw, 36px);
  border: 1px solid rgba(47, 111, 115, 0.18);
  border-radius: 26px;
  background: linear-gradient(145deg, #ffffff, #f0f7f5);
  box-shadow: var(--shadow);
}

.summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.summary-head h2 {
  margin: 0;
  font-family: "Noto Serif SC", serif;
  font-size: clamp(21px, 3vw, 28px);
}

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

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.summary-block {
  min-height: 132px;
  padding: 17px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--line);
}

.summary-block h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 14px;
}

.summary-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.summary-dot.need {
  background: var(--rose);
}

.summary-dot.prefer {
  background: var(--teal);
}

.summary-dot.discuss {
  background: var(--amber);
}

.summary-dot.limit {
  background: var(--slate);
}

.summary-list {
  margin: 0;
  padding-left: 1.2em;
  color: var(--ink-mid);
  font-size: 13px;
}

.summary-list li+li {
  margin-top: 5px;
}

.summary-empty {
  color: var(--ink-soft);
  font-size: 13px;
}

.summary-actions {
  display: flex;
  gap: 10px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(32, 48, 61, 0.94);
  color: #fff;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: 0.2s ease;
}

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

@media (max-width: 900px) {
  .guide {
    grid-template-columns: 1fr;
  }

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

  .custom-head {
    align-items: stretch;
    flex-direction: column;
  }

  .custom-composer {
    width: 100%;
  }

  .custom-item {
    grid-template-columns: 1fr minmax(280px, 0.8fr) auto;
  }
}

@media (max-width: 680px) {
  .back-home {
    top: 10px;
    left: 10px;
    padding: 7px 10px;
    font-size: 12px;
  }

  .page {
    width: min(100% - 20px, 1180px);
    padding-top: 62px;
  }

  .hero {
    padding: 28px 20px;
    border-radius: 22px;
  }

  .hero-notes {
    grid-template-columns: 1fr;
  }

  .legend {
    grid-template-columns: repeat(2, 1fr);
  }

  .utility-bar {
    flex-wrap: wrap;
    gap: 10px;
    top: 8px;
  }

  .progress-copy {
    min-width: 92px;
  }

  .progress-track {
    min-width: calc(100% - 118px);
  }

  .toolbar-actions {
    width: 100%;
  }

  .toolbar-actions .button {
    flex: 1;
  }

  .profile-row {
    align-items: stretch;
    flex-direction: column;
    gap: 4px;
  }

  .topic-head {
    padding: 15px 16px;
  }

  .topic-list {
    padding: 4px 14px 8px;
  }

  .custom-card {
    padding: 19px 15px;
  }

  .custom-composer {
    flex-direction: column;
  }

  .custom-item {
    grid-template-columns: 1fr auto;
  }

  .custom-item .status-group {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .summary-head {
    align-items: stretch;
    flex-direction: column;
  }

  .summary-actions {
    width: 100%;
  }

  .summary-actions .button {
    flex: 1;
  }

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

@media (max-width: 390px) {
  .status-group {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

:root[data-theme="dark"] {
  --ink: #e6eef0;
  --ink-mid: #aebcc2;
  --ink-soft: #8597a0;
  --line: #2a3a3a;
  --paper: #161d22;
  --bg: #0f1417;
  --teal: #4db3a0;
  --teal-dark: #2f6f73;
  --teal-soft: #14241f;
  --rose: #d98aa0;
  --rose-soft: #2a1820;
  --amber: #cda44e;
  --amber-soft: #241f10;
  --slate: #8597a0;
  --slate-soft: #1b232a;
}

:root[data-theme="dark"] .hero,
:root[data-theme="dark"] .utility-bar,
:root[data-theme="dark"] .guide-card,
:root[data-theme="dark"] .legend-card,
:root[data-theme="dark"] .summary-block {
  background: #161d22;
}

:root[data-theme="dark"] .summary-card {
  border-color: rgba(77, 179, 160, 0.24);
  background: linear-gradient(145deg, #12191d, #172127);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.44);
}

:root[data-theme="dark"] .status-choice,
:root[data-theme="dark"] .progress-track,
:root[data-theme="dark"] input,
:root[data-theme="dark"] textarea,
:root[data-theme="dark"] select,
:root[data-theme="dark"] .custom-composer input {
  background: #1b232a;
}

:root[data-theme="dark"] .hero-note {
  background: #11171a;
}

:root[data-theme="dark"] .profile-row {
  background: #14241f;
}

:root[data-theme="dark"] .back-home {
  background: rgba(20, 26, 34, 0.92);
  color: #c6cfdc;
  border-color: rgba(255, 255, 255, 0.14);
}

:root[data-theme="dark"] .back-home:hover {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.28);
}

:root[data-theme="dark"] .back-home:focus-visible {
  outline: 2px solid #7fd3c2;
  outline-offset: 2px;
}

/* 移动端工具页减少装饰层级，并保证每个决策行清晰可读，
   同时避免大型吸顶工具栏遮挡内容。 */
@media (max-width: 680px) {
  .page {
    width: 100%;
    padding:
      calc(4.8rem + env(safe-area-inset-top, 0px))
      12px
      calc(3rem + env(safe-area-inset-bottom, 0px));
  }

  .hero {
    padding: 22px 16px;
    border-radius: 18px;
    box-shadow: 0 6px 22px rgba(32, 48, 61, 0.06);
  }

  .hero::after {
    width: 190px;
    height: 190px;
    right: -95px;
    top: -100px;
    border-width: 34px;
  }

  .eyebrow {
    margin-bottom: 12px;
  }

  h1 {
    font-size: clamp(1.9rem, 10vw, 2.65rem);
    letter-spacing: -0.03em;
  }

  .hero-lead {
    margin-top: 14px;
    font-size: 0.94rem;
    line-height: 1.78;
  }

  .hero-notes {
    gap: 8px;
    margin-top: 18px;
  }

  .hero-note {
    padding: 11px 12px;
    border-radius: 11px;
  }

  .guide {
    gap: 10px;
    margin: 12px 0;
  }

  .guide-card,
  .legend-card {
    padding: 16px;
    border-radius: 15px;
    box-shadow: none;
  }

  .legend {
    gap: 6px;
  }

  .legend-item {
    padding: 8px 6px;
    font-size: 0.76rem;
  }

  .utility-bar {
    position: relative;
    top: auto;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 9px 12px;
    margin-bottom: 12px;
    padding: 12px;
    border-radius: 14px;
    box-shadow: none;
  }

  .progress-copy {
    min-width: 0;
  }

  .progress-copy span {
    display: none;
  }

  .progress-track {
    width: 100%;
    min-width: 0;
  }

  .toolbar-actions {
    grid-column: 1 / -1;
    width: 100%;
  }

  .toolbar-actions .button {
    min-height: 44px;
  }

  .profile-row {
    margin-bottom: 12px;
    padding: 12px 14px;
    border-radius: 13px;
  }

  .topics-grid {
    gap: 12px;
  }

  .topic-card {
    border-radius: 16px;
    box-shadow: 0 3px 14px rgba(32, 48, 61, 0.05);
  }

  .topic-head {
    padding: 13px 14px;
  }

  .topic-list {
    padding: 2px 12px 6px;
  }

  .topic-item {
    padding: 12px 0;
  }

  .item-copy {
    margin-bottom: 8px;
  }

  .status-choice {
    min-height: 42px;
  }

  .custom-card,
  .summary-card {
    margin-top: 12px;
    padding: 16px 14px;
    border-radius: 16px;
    box-shadow: none;
  }
}
