:root { color-scheme: dark; font-family: system-ui, sans-serif; }
body { margin: 0; min-height: 100dvh; display: grid; place-items: center; background: #100d12; color: #fbf3e7; }
main { box-sizing: border-box; width: min(100% - 2rem, 27rem); padding: 2rem; background: #211a23; border: 1px solid #655243; border-radius: 1rem; }
h1 { margin: 0; font-size: 3rem; color: #efca89; }
.besa-brand { text-align: center; margin-bottom: 1.5rem; }
.besa-eagle { display: block; width: min(100%, 11rem); height: auto; margin: 0 auto .5rem; border-radius: .75rem; }
.besa-page:not(.signed-in) .besa-brand h1 { font-size: clamp(1.65rem, 6vw, 2.4rem); }
#register, #reset-password { background: transparent; color: #efca89; }
.entry-actions { display: grid; gap: .75rem; }
#language-picker { grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr)); }
#open-login, #change-language { background: transparent; color: #efca89; }
form, label { display: grid; gap: .5rem; }
form { gap: 1rem; }
input, textarea, select, button { font: inherit; padding: .8rem; border: 1px solid #8a7467; border-radius: .5rem; }
input, textarea, select { background: #100d12; }
.profile-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); gap: .75rem; }
.profile-fields label { grid-template-rows: 1fr auto; min-width: 0; }
.profile-fields :is(input, select) { min-width: 0; }
#profile-fields { display: grid; gap: 1rem; }
#registration-fields:empty { display: none; }
button { background: #efca89; color: #211a23; font-weight: 650; }
button:disabled { opacity: .6; }
:focus-visible { outline: 2px solid #efca89; outline-offset: 3px; }
#logout { margin-top: 1rem; }
[hidden] { display: none; }
.besa-footer { margin-top: 1.5rem; }
.besa-footer a, .privacy-page a { color: #efca89; }
.privacy-page { width: min(100% - 2rem, 46rem); overflow-wrap: anywhere; }
.privacy-page h1 { font-size: clamp(1.7rem, 5vw, 2.5rem); }
#sponsor { margin-top: 1.5rem; border-top: 1px solid #655243; padding-top: .75rem; font-size: .875rem; }
#sponsor span { display: block; opacity: .8; }
#sponsor a { color: #efca89; overflow-wrap: anywhere; }
#app-windows.chat-open ~ #sponsor { display: none; }

.choice { display: flex; align-items: flex-start; }
#profiles { list-style: none; padding: 0; }
#profiles li { margin-block: 1rem; padding-block: .7rem; border-top: 1px solid #655243; overflow-wrap: anywhere; }
#profiles button { margin: .25rem .25rem .25rem 0; }

#messages { display: grid; gap: .5rem; list-style: none; padding: 0; max-height: 40dvh; overflow-y: auto; }
#messages li { width: fit-content; max-width: 90%; padding: .5rem .75rem; background: #3a2c3b; border-radius: .75rem; overflow-wrap: anywhere; white-space: pre-wrap; }
#messages .own { justify-self: end; background: #a7e8ce; color: #172f25; }

.card-photo { display: block; border-radius: .75rem; object-fit: cover; margin-bottom: .5rem; }

.chat-heart {
  width: 7rem; aspect-ratio: 353 / 266; margin: .5rem auto;
  background: url('/besa-heart-frames.jpg') no-repeat 66.6667% 33.3333% / 400% 400%;
}
#chat:not([hidden]) .chat-heart { animation: heart-open 2.8s steps(1, end) both; }
#chat.closing .chat-heart { animation: heart-close 1.4s steps(1, end) both; }
@keyframes heart-open {
  0% { background-position: 0 0; }
  14.28% { background-position: 33.3333% 0; }
  28.57% { background-position: 66.6667% 0; }
  42.85% { background-position: 100% 0; }
  57.14% { background-position: 0 33.3333%; }
  71.42% { background-position: 33.3333% 33.3333%; }
  85.71%, 100% { background-position: 66.6667% 33.3333%; }
}
@keyframes heart-close {
  0% { background-position: 66.6667% 33.3333%; }
  14.28% { background-position: 66.6667% 66.6667%; }
  28.57% { background-position: 100% 66.6667%; }
  42.85% { background-position: 0 100%; }
  57.14% { background-position: 33.3333% 100%; }
  71.42% { background-position: 66.6667% 100%; }
  85.71%, 100% { background-position: 100% 100%; }
}
@media (prefers-reduced-motion: reduce) {
  #chat:not([hidden]) .chat-heart { animation: none; }
}


/* Signed-in windows */
.besa-page.signed-in {
  width: min(100% - 2rem, 76rem);
  margin-block: 1rem;
  padding: clamp(1rem, 3vw, 2rem);
  background: #100d12;
}
.signed-in .besa-brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1rem;
  text-align: left;
}
.signed-in .besa-eagle { width: 2rem; height: 2.5rem; object-fit: cover; margin: 0; }
.signed-in h1 { font-size: 1.75rem; }
#app-windows:not([hidden]) {
  display: grid;
  grid-template-columns: 10rem minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}
#window-navigation {
  display: grid;
  gap: .4rem;
  padding: .5rem;
  background: #1b151d;
  border: 1px solid #473544;
  border-radius: .9rem;
}
#window-navigation button {
  display: flex;
  align-items: center;
  gap: .55rem;
  min-height: 44px;
  padding: .5rem;
  background: transparent;
  color: #fbf3e7;
  border-color: transparent;
  text-align: left;
}
#window-navigation button [aria-hidden="true"] { color: #efca89; font-size: 1.35rem; line-height: 1; }
#window-navigation button[aria-current="page"] { background: #36222e; border-color: #9c645c; }
#window-navigation button:hover:not(:disabled) { background: #36222e; }
.window-content { min-width: 0; }
#discover, #profile-window, #chat {
  box-sizing: border-box;
  min-width: 0;
  padding: clamp(.85rem, 3vw, 1.5rem);
  border: 1px solid #594354;
  border-radius: 1rem;
  background: #211a23;
}
#discover[data-window="profile"], .chat-open #discover,
.chat-open #profile-window, #discover[data-window="matches"] #profiles li:not([data-matched]) { display: none; }
#discover h2, #profile h2, #photo-form h2 { margin: 0 0 .75rem; }
#profiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
  gap: .75rem;
}
#profiles li {
  margin: 0;
  padding: .85rem;
  background: #171219;
  border: 1px solid #473544;
  border-radius: .75rem;
}
#profiles li p:empty { display: none; }
#profile-window form { max-width: 38rem; }
#profile-window form + form, .account-actions { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid #594354; }
.account-actions { display: flex; flex-wrap: wrap; gap: .75rem; }
.account-actions #logout { margin: 0; }
#delete-account { background: transparent; color: #fbf3e7; }
#chat:not([hidden]) {
  display: flex;
  flex-direction: column;
  height: clamp(26rem, 72vh, 52rem);
  height: clamp(26rem, 72dvh, 52rem);
  border-inline-color: #bf9353;
}
.chat-window-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  padding-bottom: .6rem;
  border-bottom: 1px solid #594354;
}
.chat-window-header h2 { margin: 0; min-width: 0; overflow-wrap: anywhere; font-size: 1.15rem; }
.chat-window-header .chat-heart { width: 4.5rem; flex: none; margin: 0; }
.chat-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-inline-start: auto; }
.chat-actions button { padding: .5rem .65rem; }
#chat-notice:empty, #status:empty { display: none; }
.chat-heading { min-width: 0; }
#chat-presence { color: #efca89; }
#messages {
  flex: 1;
  min-height: 0;
  max-height: none;
  align-content: start;
  padding-inline: .25rem;
  overscroll-behavior: contain;
}
#message-form:not([hidden]) { display: flex; gap: .65rem; align-items: end; }
#message-form label { flex: 1; min-width: 0; }
#message-form textarea { min-width: 0; max-height: 7rem; resize: vertical; }
@media (max-width: 44rem) {
  .besa-page.signed-in { width: 100%; margin: 0; border: 0; border-radius: 0; padding: .75rem; }
  #app-windows:not([hidden]) { display: flex; flex-direction: column; gap: .55rem; }
  .window-content { width: 100%; }
  #window-navigation {
    z-index: 1;
    position: sticky;
    bottom: 0;
    order: 1;
    width: 100%;
    box-sizing: border-box;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding-bottom: max(.5rem, env(safe-area-inset-bottom));
  }
  #window-navigation button { flex-direction: column; justify-content: center; gap: .2rem; text-align: center; font-size: .75rem; }
  #chat:not([hidden]) { height: clamp(23rem, 65dvh, 45rem); }
  .chat-actions { margin-inline-start: 0; }
  #message-form textarea { font-size: 1rem; }
}
