/* App card refinement. Scoped to the swipe screen; homepage demos stay intact. */
#screen-swipe {
  bottom: calc(var(--app-nav-height, 6rem) + .75rem);
  padding-top: var(--app-guest-height, 0px);
  background: var(--surface);
  overflow-y: auto;
}
#screen-swipe .swipe-header {
  padding: .5rem 1rem;
  padding-top: max(.5rem, env(safe-area-inset-top, 0px));
}
#screen-swipe .logo-sm .shemtov-logo--small { width: 64px; height: 63px; }
#screen-swipe .header-btn { min-width: 44px; min-height: 44px; }
#screen-swipe .cards-area { padding: .5rem 1rem 1rem; overflow: visible; min-height: 27.5rem; }
#screen-swipe .name-card {
  --card-accent: #a9294b;
  --card-tint: color-mix(in srgb, var(--card-accent) 6%, var(--surface-container-lowest));
  width: calc(100% - 2rem);
  max-width: 22rem;
  height: calc(100% - 1.5rem);
  max-height: 30rem;
  min-height: 26rem;
  border-radius: 1.5rem;
  box-shadow: 0 5px 20px rgba(68, 36, 46, .08), 0 1px 3px rgba(68, 36, 46, .05);
}
#screen-swipe .name-card:has(.gender-male) { --card-accent: #0b6096; }
#screen-swipe .name-card:has(.gender-both),
#screen-swipe .name-card:has(.gender-unisex) { --card-accent: #287b4a; }
#screen-swipe .card-top {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  column-gap: .75rem;
  padding: 1.15rem 1.25rem 1rem;
}
#screen-swipe .card-top::before,
#screen-swipe .card-top::after { display: none; }
#screen-swipe .card-gender-badge {
  grid-column: 2;
  grid-row: 1;
  margin: .2rem 0 0;
  padding: .25rem .5rem;
  font-size: .875rem;
  font-weight: 500;
  background: rgba(255, 255, 255, .14);
  white-space: nowrap;
}
#screen-swipe .card-main-name {
  grid-column: 1;
  grid-row: 1;
  font-family: 'Heebo', 'Segoe UI', Arial, sans-serif;
  font-size: clamp(2rem, 9vw, 2.75rem);
  line-height: 1.25;
  font-weight: 750;
  letter-spacing: 0;
  overflow-wrap: anywhere;
  text-shadow: none;
  margin: 0;
}
#screen-swipe .card-name-en {
  grid-column: 1 / -1;
  margin: .2rem 0 0;
  font-size: .875rem;
  letter-spacing: .06em;
  line-height: 1.4;
  color: rgba(255, 255, 255, .9);
  overflow-wrap: anywhere;
}
/* A fixed summary: full text lives in the detail dialog, never an inner scroll. */
#screen-swipe .card-body-wrapper {
  flex: 1 1 0;
  min-height: 0;
  flex-direction: column;
  align-items: stretch;
  overflow: hidden;
}
#screen-swipe .card-body-wrapper .card-body {
  display: grid;
  grid-template-areas: "meaning" "description" "tags" "stats";
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  padding: .75rem 1.25rem;
  gap: .5rem;
  background: var(--card-tint);
  overflow: hidden;
  overflow: clip;
  scrollbar-width: none;
}
#screen-swipe .card-body::-webkit-scrollbar { display: none; width: 0; height: 0; }

/* The shared detail dialog must also sit above the matches screen and nav. */
#card-detail-modal { z-index: 10000; }
#screen-matches .match-item { position: relative; }
#screen-matches .match-open {
  position: absolute; inset: 0; width: 100%; height: 100%;
  border: 0; border-radius: inherit; background: transparent; cursor: pointer;
}
#screen-matches .match-open:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
#screen-matches .match-item-actions { position: relative; z-index: 1; }
#screen-matches .match-detail-hint { margin-top: .35rem; font-size: .875rem; color: var(--on-surface); }
#screen-swipe .card-body > * { flex-shrink: 0; }
#screen-swipe .card-meaning-pill {
  grid-area: meaning;
  display: block;
  margin: 0;
  overflow: hidden;
  padding: .5rem .75rem;
  border-radius: .625rem;
  border-inline-start: 3px solid var(--card-accent);
  background: var(--surface-container-lowest);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  font-size: 1rem;
  line-height: 1.5;
  font-weight: 650;
  color: var(--on-surface);
  overflow-wrap: anywhere;
}
#screen-swipe .card-meaning-pill > span {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
#screen-swipe .card-description {
  grid-area: description;
  align-self: stretch;
  margin: 0;
  max-height: 4.5em;
  min-height: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--on-surface-variant);
  overflow-wrap: anywhere;
}
#screen-swipe .card-tags { grid-area: tags; gap: .375rem; flex-wrap: nowrap; overflow: hidden; align-items: center; }
#screen-swipe .tag {
  padding: .2rem .6rem;
  font-size: .875rem;
  font-weight: 500;
  background: var(--surface-container-lowest);
  overflow-wrap: anywhere;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#screen-swipe .card-stats {
  grid-area: stats;
  align-items: start;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  padding: .625rem 0;
  border: 1px solid var(--surface-container);
  border-radius: .75rem;
  background: var(--surface-container-lowest);
}
#screen-swipe .stat-item {
  min-width: 0;
  padding: 0 .4rem;
  background: none;
  border-radius: 0;
}
#screen-swipe .stat-item + .stat-item { border-inline-start: 1px solid var(--surface-container); }
#screen-swipe .stat-value {
  font-family: inherit;
  font-size: .875rem;
  line-height: 1.5;
  font-weight: 650;
  color: var(--on-surface);
  overflow-wrap: anywhere;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#screen-swipe .stat-label { font-size: .75rem; line-height: 1.5; white-space: nowrap; }
#screen-swipe .card-famous { display: none; }
#screen-swipe .card-famous strong { font-size: .875rem; letter-spacing: 0; font-weight: 600; }
#screen-swipe .card-icons-group {
  flex: 0 0 auto;
  flex-direction: row;
  justify-content: space-between;
  gap: .25rem;
  padding: .375rem .75rem;
  border-top: 1px solid var(--surface-container-low);
  background: var(--surface-container-lowest);
}
#screen-swipe .card-icon-btn {
  flex: 1 1 0;
  min-width: 44px;
  min-height: 44px;
  padding: .5rem .25rem;
  gap: .35rem;
  border-radius: .75rem;
  background: transparent;
  color: var(--on-surface-variant);
  font: inherit;
  font-size: .875rem;
  white-space: nowrap;
}
#screen-swipe .card-icon-btn:hover { background: var(--surface-container-low); transform: none; }
#screen-swipe .card-icon-btn:focus-visible,
#screen-swipe .action-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: -3px; }
#screen-swipe .swipe-actions { gap: 2.75rem; padding: .75rem 1rem .5rem; background: var(--surface); }
#screen-swipe .action-btn.like { width: 4rem; height: 4rem; border-width: 2px; box-shadow: 0 4px 14px rgba(169, 41, 75, .22); }
#screen-swipe .action-btn.dislike { width: 3.5rem; height: 3.5rem; border-width: 1px; }
#screen-swipe .undo-btn { bottom: 5.5rem; }
#screen-swipe .card-speech-status {
  flex: none;
  padding: .5rem 1rem;
  background: var(--card-tint);
  color: var(--on-surface-variant);
  font-size: .875rem;
  line-height: 1.5;
  text-align: center;
}
#screen-swipe .card-speech-status[hidden] { display: none; }
#screen-swipe .card-icon-btn[aria-busy="true"] { color: var(--on-surface); background: var(--card-tint); }
/* Soft charcoal / plum, with distinct surfaces instead of flat black. */
body.dark-mode {
  color-scheme: dark;
  --surface: #28262d;
  --surface-bright: #302d35;
  --surface-container-lowest: #38343e;
  --surface-container-low: #403b46;
  --surface-container: #514a58;
  --surface-container-high: #554d5e;
  --surface-container-highest: #5d5566;
  --on-surface: #f5eff4;
  --on-surface-variant: #d0c5cf;
  --outline: #a498a8;
  --outline-variant: #766b7e;
}
body.dark-mode .bottom-nav { background: #302d35; border-color: #514a58; }
body.dark-mode .guest-banner { background: #403747; }
body.dark-mode #screen-swipe .header-btn { color: #f3adc3; }
body.dark-mode #screen-swipe .name-card { box-shadow: 0 6px 20px rgba(16, 10, 21, .22); }
body.dark-mode #screen-swipe .card-meaning-pill { border-inline-start-color: #c6aabd; }
body.dark-mode #screen-swipe .action-btn.dislike { background: #443e4d; border-color: #62576d; color: #e4d9e6; }
body.dark-mode #screen-swipe .action-btn.like { border-color: #716477; }
@media (max-width: 360px) {
  #screen-swipe .card-top { padding: 1rem; column-gap: .5rem; }
  #screen-swipe .card-body-wrapper .card-body { padding: .75rem 1rem; }
  #screen-swipe .card-icon-btn { gap: .2rem; }
}
@media (max-height: 700px) {
  #screen-swipe .logo-sm .shemtov-logo--small { width: 56px; height: 55px; }
  #screen-swipe .card-top { padding-block: .75rem; }
  #screen-swipe .card-main-name { font-size: 2.125rem; }
}
/* Landscape / enlarged text: let the screen scroll rather than crush the card. */
@media (max-height: 34rem) {
  #screen-swipe { overflow-y: auto; }
  #screen-swipe .cards-area { flex: 0 0 28rem; min-height: 28rem; }
  #screen-swipe .undo-btn { position: fixed; bottom: calc(var(--app-nav-height, 6rem) + 1rem); }
}
@media (prefers-reduced-motion: reduce) {
  #screen-swipe .card-icon-btn,
  #screen-swipe .action-btn { transition: none; }
}
