/* The phone supplies these insets; no extra status-bar gap is invented. */
.phone{
 --safe-top:env(safe-area-inset-top,0px);
 --safe-right:env(safe-area-inset-right,0px);
 --safe-bottom:env(safe-area-inset-bottom,0px);
 --safe-left:env(safe-area-inset-left,0px);
}
.screen{
 display:flex;
 flex-direction:column;
 min-height:0;
 padding:var(--safe-top) var(--safe-right) 0 var(--safe-left);
}
.auth{padding:var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left)}
.scroll{flex:1;min-height:0;height:auto;padding-bottom:8px}

/* The top and bottom rows stay outside the clipped, scrolling content.
   The opaque screen supplies one continuous background, including its gradient. */
.screen-header{flex:none;display:flow-root;position:relative}
.page-head{margin:0 13px}
.page-head .back,.page-head .head-actions{top:50%;transform:translateY(-50%)}
.page-head .back{left:-2px;height:40px}
.page-head .back:active:not(:disabled){transform:translateY(calc(-50% + 1px))}
.page-head .back-mark{
 display:block;width:10px;height:18px;background:currentColor;
 mask:url('assets/chat/back.svg') center / contain no-repeat;
 -webkit-mask:url('assets/chat/back.svg') center / contain no-repeat;
}

/* Scale the exact 350 × 120 region of the original frame as one image. */
.banner{width:calc(100% - 25px);height:auto;aspect-ratio:350 / 120;margin:10px 13px 0 12px}
.banner img{width:107.142857%;height:auto;left:-3.428571%;top:-21.666667%}
.banner.asset{aspect-ratio:700 / 241}
.banner.asset img{position:static;display:block;width:100%;height:100%;object-fit:contain}

/* SVGs keep their complete viewBox and receive a full-size button box. */
.head-actions{gap:0;height:40px;align-items:center}
.head-actions .icon-btn{width:40px;height:40px;flex:none;padding:4px;overflow:visible}
.head-actions img{display:block;width:26px;height:26px;max-width:none;max-height:none;object-fit:contain}
.head-actions .settings-icon{width:32px;height:26px}

/* Keep every SVG square; the fifth item stays inside the narrowest screen. */
.nav{
 position:relative;
 inset:auto;
 flex:none;
 display:grid;
 grid-template-columns:repeat(5,minmax(0,1fr));
 justify-items:center;
 align-items:end;
 gap:2px;
 height:auto;
 padding:5px 12px calc(4px + var(--safe-bottom));
}
.nav button{display:block;width:100%;max-width:68px;height:auto;aspect-ratio:1;min-width:0}
.nav img{display:block;width:100%;height:100%;object-fit:contain}
.nav .badge{right:3px;top:0}

/* Metadata beside the lower-right action must not run beneath that action. */
.person-card{--details-width:100px}
.person-card .details{width:var(--details-width)}
.person-card.is-compatible .person-meta p:nth-last-child(-n+2){max-width:calc(100% - var(--details-width) + 22px)}
.person-card.is-incompatible .person-meta p{max-width:none}
.person-card.is-incompatible .mismatch{transform:none}
/* The score shares the first row with the name and the original heart. */
.person-card .match-score{
 position:absolute;right:29px;top:8px;min-width:50px;height:23px;
 padding:0 7px;display:flex;align-items:center;justify-content:center;
 border-radius:999px;background:var(--muted);color:var(--dark);
 font-size:12px;font-weight:500;line-height:1;white-space:nowrap;
}
.person-card.is-compatible .person-meta p:first-child{max-width:calc(100% - 55px)}
.chat-row>div{min-width:0;flex:1}
.chat-row p{max-width:100%}
.chat-row .avatar{flex:none}
.profile-fields{min-width:0}
.detail-photo{max-width:100%}

/* The composer and navigation occupy their own rows, below the scroll area. */
.chat-compose,.chat-blocked{position:relative;inset:auto;flex:none}
.chat-screen .scroll{padding-bottom:12px}

@container phone (max-width:360px){
 .person-card{--details-width:80px}
 .person-card .details{width:var(--details-width)}
 .detail-hero{width:274px;max-width:calc(100% - 36px)}
 .detail-photo{width:100%;height:auto;aspect-ratio:274 / 328;max-width:100%}
}

/* Original detailed questionnaire: three columns, then a separate location row. */
.detail-info { --detail-u:calc(100cqw / 375); }
.detail-grid {
 grid-template-columns:minmax(0,.85fr) minmax(0,1.05fr) minmax(0,1.6fr);
 gap:calc(4 * var(--detail-u)) calc(10 * var(--detail-u));
 padding:0 calc(12 * var(--detail-u));
}
.detail-location {
 display:grid;
 grid-template-columns:minmax(calc(50 * var(--detail-u)),max-content) minmax(0,1fr);
 gap:calc(12 * var(--detail-u));
 padding:calc(4 * var(--detail-u)) calc(12 * var(--detail-u));
}
.detail-grid p,.detail-location p {
 min-width:0; margin:0; font-size:calc(12 * var(--detail-u));
 line-height:1.4; overflow-wrap:anywhere;
}
/* The same unmodified 16 × 13 SVG accompanies every Write button. */
.write-label { display:inline-flex; align-items:center; justify-content:center; gap:10px; vertical-align:middle; white-space:nowrap; }
.write-chat-icon { display:block; flex:none; }

.person-card .write { padding-left:10px; padding-right:10px; }

/* This exported photograph already contains its one border and rounded corners. */
.detail-photo.exported-frame { height:auto; aspect-ratio:auto; border:0; border-radius:0; object-fit:contain; }
/* Text starts on the same vertical as Name and Country in the original. */
.detail-music { padding:0 calc(12 * var(--detail-u)); }

/* Detailed compatibility: one result row, then three labelled music groups. */
.detail-match {
 display:flex;align-items:center;justify-content:space-between;
 gap:calc(8 * var(--detail-u));
 margin:calc(14 * var(--detail-u)) 0 calc(8 * var(--detail-u));
}
.detail-match .score {
 display:inline-flex;align-items:center;gap:calc(8 * var(--detail-u));
 margin:0;font-size:calc(18 * var(--detail-u));white-space:nowrap;
}
.detail-match-score {
 display:inline-flex;align-items:center;justify-content:center;flex:none;
 min-width:calc(56 * var(--detail-u));height:calc(26 * var(--detail-u));
 padding:0 calc(7 * var(--detail-u));border-radius:999px;
 background:var(--muted);color:var(--dark);
 font-size:calc(13 * var(--detail-u));font-weight:500;line-height:1;
}
.detail-match .detail-perfect {
 flex:none;min-width:calc(124 * var(--detail-u));min-height:calc(36 * var(--detail-u));
 padding:calc(5 * var(--detail-u)) calc(14 * var(--detail-u));
 font-size:calc(14 * var(--detail-u));white-space:nowrap;
 box-shadow:0 4px 5px #21151026;
}
.shared-preferences h2 {
 margin:0 0 calc(3 * var(--detail-u));font-size:calc(12 * var(--detail-u));font-weight:400;
}
.shared-group + .shared-group { margin-top:calc(6 * var(--detail-u)); }
.shared-group h3 {
 margin:0 0 calc(3 * var(--detail-u));color:var(--muted);
 font-size:calc(10 * var(--detail-u));font-weight:400;
}
.shared-tags { display:flex;flex-wrap:wrap;gap:calc(4 * var(--detail-u)); }
.shared-tags .shared {
 max-width:100%;margin:0;padding:calc(3 * var(--detail-u)) calc(7 * var(--detail-u));
 font-size:calc(11 * var(--detail-u));overflow-wrap:anywhere;
}
.detail-info .detail-actions { justify-content:flex-end;margin-top:calc(24 * var(--detail-u)); }
