:root {
  --bg: #f8f6f2;
  --panel: #ffffff;
  --panel-strong: #fff0e9;
  --text: #211f23;
  --muted: #716a70;
  --line: #eadfdc;
  --green: #2d8a67;
  --teal: #1f7d8f;
  --coral: #ff6b5f;
  --gold: #c78a2c;
  --rose: #ff4f7b;
  --lavender: #6d5dfc;
  --ink-soft: #423b41;
  --shadow: 0 18px 48px rgba(45, 31, 36, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(120deg, rgba(255, 107, 95, 0.12), transparent 38%),
    linear-gradient(210deg, rgba(109, 93, 252, 0.1), transparent 35%),
    var(--bg);
  color: var(--text);
  font-family: Inter, Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  padding: 18px;
}

body.auth-locked {
  overflow: hidden;
}

body.auth-locked .app-shell {
  display: none;
}

body:not(.auth-locked) .auth-gate {
  display: none;
}

.auth-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 22px;
}

.auth-gate-card {
  width: min(440px, 100%);
  padding: 24px;
  border: 1px solid rgba(216, 224, 219, 0.9);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.auth-brand {
  margin-bottom: 14px;
}

.auth-gate-copy {
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.55;
}

.auth-gate .auth-panel {
  margin-bottom: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.auth-gate .auth-copy span {
  display: none;
}

.auth-gate .auth-copy strong {
  font-size: 20px;
}

.auth-gate .auth-copy small {
  font-size: 13px;
}

.auth-gate .auth-form input {
  height: 48px;
}

.auth-gate .auth-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.auth-gate .auth-submit-button,
.auth-gate .auth-signup-button {
  min-height: 48px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 320px) minmax(0, 1fr);
  gap: 16px;
  max-width: 1640px;
  margin: 0 auto;
}

.workspace.profile-saved {
  grid-template-columns: minmax(0, 1fr);
}

.workspace.profile-saved .input-panel {
  display: none;
}

.workspace.settings-active {
  grid-template-columns: minmax(0, 1fr);
}

.workspace.settings-active .input-panel {
  display: block;
}

.settings-view .input-panel {
  position: static;
  max-height: none;
  width: min(720px, 100%);
  margin: 0 auto;
}

.input-panel,
.result-panel {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(216, 224, 219, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.input-panel {
  position: sticky;
  top: 18px;
  align-self: start;
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 20px;
  border-radius: 16px;
}

.result-panel {
  min-height: calc(100vh - 36px);
  padding: 14px;
  border-radius: 16px;
}

.language-toggle {
  min-width: 54px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  border: 1px solid var(--line);
}

.brand-mark span:first-child {
  background: var(--rose);
}

.brand-mark span:last-child {
  background: var(--lavender);
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--rose);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 30px;
  line-height: 1.15;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
}

h3 {
  margin-bottom: 16px;
  font-size: 18px;
}

.notice {
  margin-bottom: 20px;
  padding: 14px;
  border: 1px solid #ffe0d7;
  border-left: 4px solid var(--coral);
  border-radius: 12px;
  background: #fff7f4;
  color: #6a514b;
  font-size: 13px;
  line-height: 1.55;
}

.auth-panel {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.auth-copy {
  display: grid;
  gap: 4px;
}

.auth-copy span {
  color: var(--rose);
  font-size: 12px;
  font-weight: 900;
}

.auth-copy strong {
  font-size: 17px;
  line-height: 1.2;
}

.auth-copy small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

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

.auth-form {
  display: grid;
  gap: 9px;
}

.auth-form input {
  height: 42px;
  border-radius: 12px;
}

.auth-submit-button,
.auth-signup-button {
  gap: 8px;
  min-height: 42px;
  font-size: 13px;
}

.auth-message {
  min-height: 16px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.auth-message.error {
  color: var(--coral);
}

.auth-logout-button {
  min-width: 92px;
}

.settings-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 18px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.couple-form {
  display: grid;
  gap: 18px;
}

.person-group {
  display: grid;
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.person-group:last-of-type {
  border-bottom: 0;
}

.legacy-hidden {
  display: none;
}

.group-heading {
  display: flex;
  align-items: center;
  gap: 9px;
}

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

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

.dot.female {
  background: var(--coral);
}

.dot.recommend {
  background: var(--gold);
}

label {
  display: grid;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  outline: none;
}

input,
select {
  height: 46px;
  padding: 0 11px;
}

textarea {
  min-height: 88px;
  padding: 11px;
  resize: vertical;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--rose);
  box-shadow: 0 0 0 3px rgba(255, 79, 123, 0.13);
}

.optional-profile {
  display: grid;
  gap: 12px;
  padding-top: 4px;
}

.primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--rose), var(--coral));
  color: #fff;
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(255, 79, 123, 0.22);
}

.secondary-action {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 13px;
  background: #fff;
  color: var(--text);
  font-weight: 900;
}

.cta-wide {
  width: 100%;
}

.summary-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 22px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(47, 125, 92, 0.14), rgba(25, 116, 135, 0.08)),
    var(--panel-strong);
  border: 1px solid var(--line);
}

.score-line {
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.score-line strong {
  font-size: clamp(48px, 8vw, 88px);
  line-height: 0.95;
}

.score-line span {
  color: var(--muted);
  font-size: 22px;
  font-weight: 700;
}

.score-label {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--ink-soft);
  line-height: 1.6;
}

.gauge {
  position: relative;
  width: 132px;
  height: 132px;
}

.gauge svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.gauge-track,
.gauge-fill {
  fill: none;
  stroke-width: 12;
}

.gauge-track {
  stroke: rgba(29, 37, 34, 0.12);
}

.gauge-fill {
  stroke: var(--green);
  stroke-linecap: round;
  stroke-dasharray: 302;
  stroke-dashoffset: 302;
  transition: stroke-dashoffset 0.45s ease;
}

.gauge span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-weight: 900;
  color: var(--green);
}

.tabs {
  display: flex;
  gap: 8px;
  margin: 22px 0;
  border-bottom: 1px solid var(--line);
}

.service-tabs {
  position: sticky;
  top: 14px;
  z-index: 5;
  margin: 0 0 12px;
  padding-top: 2px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
}

.tab {
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 12px 14px 11px;
  font-weight: 800;
}

.tab.active {
  border-color: var(--teal);
  color: var(--text);
}

.tab-view {
  display: none;
}

.tab-view.active {
  display: block;
}

.service-tab-view.active {
  display: grid;
  gap: 12px;
}

.chat-tab-view.active {
  display: block;
}

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

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

.result-card,
.wide-panel,
.person-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 20px;
}

.wide-panel {
  margin-top: 16px;
}

ul {
  margin: 0;
  padding-left: 18px;
}

li {
  margin: 10px 0;
  color: var(--ink-soft);
  line-height: 1.55;
}

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

.promise-item {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafcfb;
}

.promise-item strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
}

.promise-item p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.person-card {
  display: grid;
  gap: 14px;
}

.rank-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 0;
}

.rank-intro h3,
.rank-intro p {
  margin-bottom: 0;
}

.rank-controls {
  display: grid;
  justify-items: end;
  gap: 10px;
}

.recommendation-toggle {
  display: inline-flex;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff8f6;
}

.recommendation-mode {
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.recommendation-mode.active {
  background: var(--text);
  color: #fff;
}

.rank-controls > p {
  max-width: 560px;
  color: var(--muted);
  line-height: 1.55;
  text-align: right;
}

.ranking-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.rank-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.rank-number {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #edf7f3;
  color: var(--green);
  font-weight: 900;
}

.rank-main {
  display: grid;
  gap: 10px;
}

.rank-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.rank-title h3 {
  margin: 0;
}

.rank-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rank-score {
  min-width: 82px;
  text-align: right;
}

.rank-score strong {
  display: block;
  font-size: 28px;
  line-height: 1;
}

.rank-score span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.rank-reason {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.55;
}

.service-layout {
  display: block;
}

.match-column {
  display: grid;
  gap: 16px;
}

.service-hero,
.chat-start-strip,
.match-detail,
.messenger-shell {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
}

.service-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  background:
    linear-gradient(135deg, rgba(255, 79, 123, 0.1), rgba(109, 93, 252, 0.08)),
    #fff;
}

.service-hero h2,
.chat-start-strip h2,
.match-detail h3,
.room-list-header h3 {
  margin-bottom: 0;
}

.chat-start-strip {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  background:
    linear-gradient(135deg, rgba(255, 79, 123, 0.08), rgba(31, 125, 143, 0.08)),
    #fff;
}

.quick-match-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px;
}

.quick-match-card {
  display: grid;
  gap: 2px;
  min-width: 132px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px 12px;
  background: #fff;
  color: var(--text);
  text-align: left;
}

.quick-match-card:hover,
.quick-match-card:focus-visible {
  border-color: rgba(255, 79, 123, 0.55);
  box-shadow: 0 10px 22px rgba(45, 31, 36, 0.1);
}

.quick-match-card strong {
  font-size: 18px;
  line-height: 1;
}

.quick-match-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

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

.match-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 126px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  background: #fff;
  color: var(--text);
  text-align: left;
  position: relative;
  overflow: hidden;
}

.contact-avatar {
  display: none;
}

.match-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 79, 123, 0.12), transparent 58%);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.match-card.active,
.match-card:hover {
  border-color: rgba(255, 79, 123, 0.5);
  box-shadow: 0 14px 30px rgba(45, 31, 36, 0.12);
  transform: translateY(-1px);
}

.match-card.active::before,
.match-card:hover::before {
  opacity: 1;
}

.match-rank {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: #fff2ef;
  color: var(--rose);
  font-size: 13px;
  font-weight: 900;
  z-index: 1;
}

.match-title {
  position: relative;
  display: grid;
  gap: 8px;
  z-index: 1;
}

.match-title h3 {
  margin: 0;
  font-size: 30px;
  line-height: 1;
}

.match-title span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.match-detail {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.match-detail > div:first-child p:last-child {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.guide-grid.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.messenger-shell {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr) 300px;
  gap: 0;
  overflow: hidden;
}

.room-list-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: calc(100vh - 160px);
  border-right: 1px solid var(--line);
  background: #f8faf8;
}

.room-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.room-list {
  display: grid;
  align-content: start;
  gap: 6px;
  overflow: auto;
  padding: 10px;
}

.room-item {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 16px;
  padding: 9px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.room-item.active,
.room-item:hover {
  border-color: var(--line);
  background: #fff;
  box-shadow: 0 8px 20px rgba(45, 31, 36, 0.08);
}

.room-avatar-button,
.room-copy,
.room-rename-button {
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.room-avatar-button {
  width: 58px;
  height: 58px;
  padding: 0;
  border-radius: 18px;
}

.room-avatar-button:focus-visible,
.room-copy:focus-visible,
.room-rename-button:focus-visible {
  outline: 3px solid rgba(255, 79, 123, 0.25);
  outline-offset: 2px;
}

.room-avatar {
  width: 58px;
  height: 58px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff7f4;
  object-fit: cover;
  object-position: center 32%;
}

.room-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 6px 0;
}

.room-name {
  font-weight: 900;
}

.room-rename-button {
  min-height: 34px;
  border-radius: 999px;
  padding: 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.room-rename-button:hover {
  background: #fff0f4;
  color: var(--rose);
}

.room-meta {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-last {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-empty {
  padding: 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.chat-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 16px;
}

.chat-panel,
.coach-panel {
  border: 0;
  border-radius: 0;
  background: var(--panel);
  padding: 18px;
}

.chat-panel {
  display: grid;
  grid-template-rows: auto minmax(520px, calc(100vh - 270px)) auto;
  gap: 14px;
  border-right: 1px solid var(--line);
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.chat-header-profile {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.chat-header-profile img {
  width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff7f4;
  object-fit: cover;
  object-position: center 32%;
}

.chat-header-profile span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.chat-header-profile strong {
  overflow: hidden;
  font-size: 20px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-header-profile em {
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
  font-weight: 900;
}

.leave-room-button {
  min-height: 38px;
  padding: 0 12px;
}

.rename-room-button {
  min-height: 38px;
  padding: 0 12px;
}

.affinity-meter {
  display: grid;
  grid-template-columns: auto auto auto;
  gap: 3px 7px;
  align-items: baseline;
  min-width: 128px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff7f4;
}

.affinity-meter span,
.affinity-meter small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.affinity-meter strong {
  color: var(--rose);
  font-size: 24px;
  line-height: 1;
}

.affinity-meter em {
  font-style: normal;
  font-size: 12px;
  font-weight: 900;
}

.affinity-meter em.up {
  color: var(--green);
}

.affinity-meter em.down {
  color: var(--coral);
}

.affinity-meter small {
  grid-column: 1 / -1;
}

.coach-panel h3 {
  margin-bottom: 0;
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 247, 244, 0.85), rgba(248, 250, 248, 0.95)),
    #f8faf8;
}

.message {
  max-width: min(78%, 560px);
  padding: 11px 13px;
  border-radius: 16px;
  line-height: 1.5;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
  word-break: keep-all;
}

.message.mine {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--rose), var(--coral));
  color: #fff;
  border-bottom-right-radius: 6px;
}

.message.partner {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--line);
  border-bottom-left-radius: 6px;
}

.message.system {
  align-self: center;
  max-width: 100%;
  background: #fff8ec;
  color: #65533a;
  font-size: 13px;
}

.message-meta {
  display: block;
  margin-bottom: 3px;
  font-size: 12px;
  font-weight: 900;
  opacity: 0.74;
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.chat-form .primary-action {
  min-width: 76px;
}

.mobile-coach-bar {
  display: none;
}

.mobile-bottom-tabs {
  display: none;
}

.mobile-back-button {
  display: none;
}

.coach-panel {
  display: grid;
  align-content: start;
  gap: 16px;
  background: #fbfcfb;
}

.coach-summary {
  display: grid;
  gap: 8px;
}

.coach-stat {
  padding: 12px;
  border-radius: 14px;
  background: #f8faf8;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  line-height: 1.5;
}

.coach-block h4 {
  margin: 0 0 10px;
  font-size: 14px;
}

.person-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.mbti-badge {
  padding: 6px 10px;
  border-radius: 999px;
  background: #edf7f3;
  color: var(--green);
  font-size: 13px;
  font-weight: 900;
}

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

.trait {
  display: grid;
  gap: 6px;
}

.trait-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 800;
}

.bar {
  height: 8px;
  border-radius: 99px;
  background: #e6ece8;
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--green));
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  padding: 6px 9px;
  border-radius: 999px;
  background: #f1f4f2;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 800;
}

.avatar-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  place-items: center;
  padding: 18px;
}

.avatar-modal.active {
  display: grid;
}

.avatar-modal-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(20, 16, 20, 0.56);
}

.avatar-modal-card {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 12px;
  width: min(430px, 94vw);
  max-height: min(760px, 94vh);
  overflow: auto;
  padding: 0 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 26px;
  background: #f4f4f6;
  box-shadow: 0 24px 80px rgba(20, 16, 20, 0.28);
}

.profile-hero {
  position: relative;
  min-height: 380px;
  overflow: hidden;
  border-radius: 26px 26px 18px 18px;
  background: #d8d8dd;
}

.profile-hero::after {
  content: "";
  position: absolute;
  inset: 45% 0 0;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.55));
  pointer-events: none;
}

.profile-hero img {
  width: 100%;
  height: 430px;
  display: block;
  background: #fff7f4;
  object-fit: cover;
  object-position: center 24%;
}

.profile-hero-copy {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 2;
  color: #fff;
}

.profile-hero-copy strong {
  display: block;
  font-size: 22px;
  line-height: 1.1;
}

.profile-hero-copy span {
  display: block;
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.86);
  font-size: 14px;
  font-weight: 800;
}

.avatar-modal-close {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.26);
  color: #fff;
  font-size: 34px;
  line-height: 1;
  backdrop-filter: blur(12px);
}

.profile-edit-button {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.28);
  color: #fff;
  font-weight: 900;
  backdrop-filter: blur(12px);
}

.profile-detail-card {
  display: grid;
  gap: 0;
  margin: 0 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}

.profile-info-row {
  display: grid;
  gap: 5px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}

.profile-info-row:last-child {
  border-bottom: 0;
}

.profile-info-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: lowercase;
}

.profile-info-row strong {
  color: var(--text);
  font-size: 15px;
  line-height: 1.35;
}

@media (max-width: 980px) {
  .app-shell {
    padding: 14px;
  }

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

  .workspace.settings-active .input-panel {
    display: block;
  }

  .input-panel {
    position: static;
    max-height: none;
  }

  .result-panel {
    order: -1;
    min-height: auto;
  }

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

  .messenger-shell {
    grid-template-columns: 1fr;
  }

  .room-list-panel {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .room-list {
    display: flex;
    overflow-x: auto;
    padding-bottom: 12px;
    scroll-snap-type: x proximity;
  }

  .room-item {
    min-width: 210px;
    scroll-snap-align: start;
  }

  .chat-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 700px) {
  html,
  body {
    background: #fbf7f4;
    height: 100%;
  }

  .app-shell {
    min-height: 100dvh;
    padding: 0;
  }

  .workspace {
    min-height: 100dvh;
    gap: 0;
  }

  .input-panel,
  .result-panel {
    border-radius: 0;
  }

  .input-panel {
    display: none;
    padding: 14px;
  }

  .workspace.settings-active .input-panel {
    display: block;
  }

  .result-panel {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    height: 100dvh;
    min-height: 100dvh;
    padding: 8px;
    overflow: hidden;
  }

  .workspace.mobile-chat-detail .result-panel {
    grid-template-rows: minmax(0, 1fr);
  }

  .workspace.settings-active .result-panel {
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
  }

  .service-layout,
  .chat-tab-view.active,
  .messenger-shell {
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  .service-layout {
    overflow-y: auto;
    padding-bottom: 8px;
  }

  .service-tabs {
    display: none;
  }

  .mobile-bottom-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 8px 10px max(8px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(18px);
  }

  .workspace.mobile-chat-detail .mobile-bottom-tabs {
    display: none;
  }

  .mobile-tab {
    min-height: 48px;
    border: 0;
    border-radius: 14px;
    background: transparent;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
  }

  .mobile-tab.active {
    background: #fff0f4;
    color: var(--rose);
  }

  .chat-tab-view.active {
    display: grid;
    grid-template-rows: minmax(0, 1fr);
  }

  .messenger-shell {
    grid-template-rows: 118px minmax(0, 1fr);
  }

  .chat-tab-view.mobile-list-mode .messenger-shell,
  .chat-tab-view.mobile-detail-mode .messenger-shell {
    grid-template-rows: minmax(0, 1fr);
  }

  .field-row,
  .summary-strip,
  .insight-grid,
  .guide-grid,
  .guide-grid.compact,
  .personality-grid,
  .promise-list,
  .rank-intro,
  .rank-card,
  .chat-shell,
  .match-grid,
  .messenger-shell {
    grid-template-columns: 1fr;
  }

  .service-hero {
    display: grid;
  }

  .chat-start-strip {
    display: none;
  }

  .room-list-panel {
    min-height: auto;
    height: 118px;
    max-height: 118px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    grid-template-rows: 46px minmax(0, 1fr);
    overflow: hidden;
  }

  .chat-tab-view.mobile-list-mode .room-list-panel {
    height: 100%;
    max-height: none;
    grid-template-rows: auto minmax(0, 1fr);
    border-bottom: 0;
    background: #f7f7f7;
  }

  .chat-tab-view.mobile-detail-mode .room-list-panel {
    display: none;
  }

  .room-list-header {
    min-height: 0;
    padding: 8px 10px;
  }

  .chat-tab-view.mobile-list-mode .room-list-header {
    padding: 16px 16px 12px;
    border-bottom: 0;
  }

  .chat-tab-view.mobile-list-mode .room-list-header .eyebrow {
    display: block;
    color: var(--rose);
  }

  .chat-tab-view.mobile-list-mode .room-list-header h3 {
    font-size: 28px;
    line-height: 1.1;
  }

  .room-list-header .eyebrow {
    display: none;
  }

  .room-list-header h3 {
    font-size: 18px;
  }

  .room-list-header .secondary-action {
    min-height: 38px;
    padding: 0 14px;
  }

  .room-list {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 0;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 7px 10px 9px;
    scroll-snap-type: x proximity;
  }

  .chat-tab-view.mobile-list-mode .room-list {
    display: grid;
    align-content: start;
    gap: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 0 8px 12px;
    scroll-snap-type: none;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
  }

  .room-item {
    grid-template-columns: 46px minmax(0, 1fr) auto;
    gap: 8px;
    min-width: 172px;
    max-height: 56px;
    padding: 5px;
    scroll-snap-align: start;
  }

  .chat-tab-view.mobile-list-mode .room-item {
    grid-template-columns: 58px minmax(0, 1fr) auto;
    min-width: 0;
    max-height: none;
    width: 100%;
    gap: 12px;
    padding: 12px 10px;
    border: 0;
    border-bottom: 1px solid rgba(234, 223, 220, 0.82);
    border-radius: 0;
    scroll-snap-align: none;
  }

  .chat-tab-view.mobile-list-mode .room-item:last-child {
    border-bottom: 0;
  }

  .chat-tab-view.mobile-list-mode .room-item.active,
  .chat-tab-view.mobile-list-mode .room-item:hover {
    box-shadow: none;
    background: #fff;
  }

  .room-avatar-button,
  .room-avatar {
    width: 46px;
    height: 46px;
    border-radius: 14px;
  }

  .chat-tab-view.mobile-list-mode .room-avatar-button,
  .chat-tab-view.mobile-list-mode .room-avatar {
    width: 58px;
    height: 58px;
    border-radius: 50%;
  }

  .room-copy {
    padding: 2px 0;
  }

  .room-name {
    font-size: 13px;
  }

  .chat-tab-view.mobile-list-mode .room-name {
    font-size: 16px;
  }

  .room-meta {
    font-size: 11px;
  }

  .chat-tab-view.mobile-list-mode .room-meta {
    font-size: 13px;
  }

  .chat-tab-view.mobile-list-mode .room-last {
    font-size: 12px;
  }

  .room-empty {
    width: 100%;
    padding: 10px;
    font-size: 12px;
  }

  .chat-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 14px;
    min-height: 0;
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    gap: 10px;
  }

  .chat-tab-view.mobile-list-mode .chat-panel {
    display: none;
  }

  .chat-tab-view.mobile-detail-mode .chat-panel {
    display: grid;
    height: 100%;
    border-bottom: 0;
  }

  .chat-header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
  }

  .chat-header-profile {
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 8px;
  }

  .chat-header-profile img {
    width: 42px;
    height: 42px;
  }

  .chat-header-profile strong {
    font-size: 17px;
  }

  .chat-header-profile em {
    font-size: 12px;
  }

  .mobile-back-button {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.88);
    color: var(--text);
    font-size: 34px;
    line-height: 1;
    font-weight: 700;
  }

  .affinity-meter {
    grid-column: 1 / -1;
    grid-template-columns: auto auto auto minmax(0, 1fr);
    min-width: 0;
  }

  .affinity-meter small {
    grid-column: auto;
  }

  .leave-room-button {
    min-width: 72px;
  }

  .chat-messages {
    min-height: 0;
  }

  .coach-panel {
    display: none;
  }

  .mobile-coach-bar {
    display: grid;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fffaf7;
  }

  .mobile-coach-bar p {
    margin: 0;
    color: var(--ink-soft);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.45;
  }

  .mobile-coach-bar div {
    display: flex;
    gap: 6px;
    overflow-x: auto;
  }

  .match-grid {
    display: grid;
    gap: 0;
    overflow: visible;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fff;
  }

  .match-card {
    grid-template-columns: 48px minmax(0, 1fr) auto;
    min-height: 66px;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    padding: 9px 12px;
    background: #fff;
    box-shadow: none;
    transform: none;
  }

  .match-card:last-child {
    border-bottom: 0;
  }

  .match-card.active,
  .match-card:hover {
    box-shadow: none;
    transform: none;
  }

  .contact-avatar {
    display: block;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid var(--line);
    object-fit: cover;
    object-position: center 32%;
  }

  .match-rank {
    display: none;
  }

  .match-title h3 {
    font-size: 16px;
    line-height: 1.15;
  }

  .match-title span {
    display: block;
    overflow: hidden;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .rank-score {
    min-width: 44px;
    text-align: right;
  }

  .rank-score strong {
    font-size: 18px;
  }

  .rank-score span {
    font-size: 10px;
  }

  .match-detail,
  .service-hero {
    padding: 14px 16px;
  }

  .service-hero {
    border-radius: 18px 18px 0 0;
    border-bottom: 0;
  }

  .service-hero .eyebrow {
    display: none;
  }

  .service-hero h2 {
    font-size: 22px;
  }

  .messenger-shell {
    border-radius: 18px;
  }

  .rank-intro {
    display: grid;
  }

  .rank-controls {
    justify-items: stretch;
  }

  .rank-controls > p {
    text-align: left;
  }

  .recommendation-toggle {
    width: 100%;
  }

  .recommendation-mode {
    flex: 1;
    min-height: 42px;
  }

  .rank-score {
    text-align: left;
  }

  .gauge {
    width: 104px;
    height: 104px;
  }

  .tabs {
    overflow-x: auto;
  }

  .message {
    max-width: 88%;
  }

  .chat-form {
    grid-template-columns: minmax(0, 1fr) 64px;
    gap: 8px;
    padding-bottom: max(0px, env(safe-area-inset-bottom));
  }

  .chat-form input {
    height: 48px;
    min-width: 0;
  }

  .chat-form .primary-action {
    min-width: 0;
    width: 64px;
    min-height: 48px;
    padding: 0;
  }
}
