/*
 * Natural wrapping rules shared by the whole DeokMate UI.
 * Korean copy should wrap at phrase/space boundaries instead of splitting the
 * last syllable just to fill a box. Compact controls keep their existing
 * white-space:nowrap rules; this layer only changes where wrapping is allowed.
 */
.app :where(h1,h2,h3,p,li,b,small,span,em,a,label){
  word-break:keep-all;
  overflow-wrap:break-word;
}

.app :where(
  h1,h2,h3,
  .detailTitle,.concertHero h1,.venueSummary h1,.homeIntro h1,
  .eventContext b,.eventContext span,.lockedVenue b,.lockedVenue small,.lockedVenue em,
  .homeConcertRow b,.homeConcertRow small,.homeVenueRow b,.homeVenueRow small,
  .concert b,.concert p,.rideCard h3,.companionCard h3,.partyCard h3,.partyCard p,
  .memo,.tagLine,.tipIntro,.tipCard p,.trustNote,.notice,.globalNotice,.listContext,
  .privacyHelp,.privacyLocked,.privateReveal,.formError,.fieldHelp,.directionHelp,
  .notificationText b,.notificationText p,.notificationText small,
  .notificationApplicantPerson b,.notificationApplicantPerson small,
  .applicantManagerTop b,.applicantManagerTop p,
  .onboardingV2 h1,.onboardingV2 h2,.onboardingV2 p,
  .matchInboxRow b,.matchInboxRow small,
  .matchRetentionCopy b,.matchRetentionCopy p,
  .matchEndCopy b,.matchEndCopy p,
  .placeRevealCopy b,.placeRevealCopy p,
  .stablePlaceHead b,.stablePlaceRow b,.stablePlaceRow span,
  .matchBubble,.reviewPrompt p,.matchDeleteNote
){
  white-space:normal;
  word-break:keep-all!important;
  overflow-wrap:break-word!important;
  text-wrap:pretty;
}

.app :where(h1,h2,h3,.detailTitle,.concertHero h1,.venueSummary h1,.homeIntro h1){
  text-wrap:balance;
}

/* Preserve explicit newlines in chat while still wrapping Korean naturally. */
.matchBubble{
  white-space:pre-wrap!important;
  word-break:keep-all!important;
  overflow-wrap:break-word!important;
  text-wrap:pretty;
}
.matchBubble.system{
  width:auto!important;
  max-width:calc(100% - 28px)!important;
  word-break:keep-all!important;
  overflow-wrap:break-word!important;
  text-wrap:pretty;
}

/* Grid/flex copy columns must be allowed to shrink before text is wrapped. */
.matchRetentionCopy,.matchEndCopy,.placeRevealCopy,
.stablePlaceHead,.stablePlaceRow>div,
.homeConcertRow>span:nth-child(2),.homeVenueRow>span:nth-child(2),
.authorLine>span:nth-child(2),.notificationText,.notificationApplicantPerson,
.eventContext,.lockedVenue>span:nth-child(2){min-width:0}

/* Long identifiers/links are the exception: breaking is preferable to overflow. */
.app :where(a,[data-raw-id],.publicContactMethod){overflow-wrap:anywhere!important}

@media(max-width:360px){
  .matchBubble.system{max-width:calc(100% - 12px)!important}
}

/* Flexible content rows: do not discard route, price, or translated labels. */
.app :is(.cardTop,.authorLine,.accountRow,.host){min-width:0;gap:8px}
.app :is(.cardTop,.authorLine){flex-wrap:wrap}
.app .cardTop .eventMini{flex:1 1 100px;min-width:0;white-space:normal;overflow-wrap:anywhere}
.app :is(.rideMeta span,.authorLine b,.authorLine small,.accountRow small){white-space:normal;overflow:visible;text-overflow:clip;overflow-wrap:anywhere}
.app :is(.routeStats,.infoGrid,.priceBox){grid-template-columns:repeat(2,minmax(0,1fr))}
.app :is(.routeStats,.infoGrid,.priceBox)>*{min-width:0}
.app :is(.routeStats,.infoGrid,.priceBox) :is(b,strong,small){white-space:normal;overflow-wrap:anywhere}
.app .routeStats{grid-template-columns:repeat(3,minmax(0,1fr))}
.app :is(.browseSeg,.contentTabs,.seg){height:auto;min-height:48px}
.app :is(.browseSeg,.contentTabs,.seg)>button{min-width:0;min-height:44px;white-space:normal;word-break:keep-all;overflow-wrap:anywhere;line-height:1.4}
.app :is(.primary,.outline,.sticky button){min-height:44px;height:auto;white-space:normal;overflow-wrap:anywhere;line-height:1.45}
.app :is(input,textarea,select){min-width:0;max-width:100%;box-sizing:border-box}
.app .homeSearch input{flex:1;width:0}
.app .homeSearch svg{flex-shrink:0}
.app .concertHero p{align-items:flex-start;line-height:1.5}
.app .concertHero p svg{flex-shrink:0;margin-top:3px}
.myPotsMain .compactEmpty{padding:28px 18px;margin:12px 0 28px;border:1px solid #eee9f2;border-radius:16px;background:#faf8fc;color:#81768a;line-height:1.6}
.myPotsMain>h2{margin-top:22px;margin-bottom:14px}
@media(max-width:360px){
 .app .routeStats{grid-template-columns:repeat(2,minmax(0,1fr));row-gap:12px}
 .app .routeStats>div:last-child{grid-column:1/-1}
 .app .optionalVerifyCard>div{grid-template-columns:1fr!important}
 .app .optionalVerifyCard .textButton{min-width:0!important;white-space:normal!important}
}

.app .priceBox .fareLate{white-space:normal;overflow:visible;text-overflow:clip;overflow-wrap:anywhere;line-height:1.5}
