:root { color-scheme: dark; --bg: #190d14; --panel: #281923; --text: #fff4ed; --muted: #c5aeb7; --rose: #ff9daa; --line: #ffffff15; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif; }
* { box-sizing: border-box; }
body { margin: 0; color: var(--text); background: var(--bg); font-size: 1rem; line-height: 1.5; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .45; }
a { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--rose); outline-offset: 3px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.login-page { min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; padding: clamp(1.5rem,5vw,4rem); background: linear-gradient(90deg, #19080dec, #19080d99), url('../../assets/fragola.webp') 70% center / cover fixed; }
.home-link { align-self: flex-start; font-size: .9375rem; text-decoration: none; padding-block: .5rem; color: #e5cbd2; }
.login-card { margin: auto; width: min(100%, 25rem); padding: 2.5rem 0; }
.login-mark { display: block; font-size: 3rem; margin-bottom: .75rem; }
.login-card h1 { font: 400 clamp(2.5rem,8vw,3.5rem)/1.12 Georgia, serif; letter-spacing: -.035em; margin: 0; }
.login-intro { color: var(--muted); margin: .9rem 0 2rem; }
.login-form { display: grid; gap: .6rem; }
.login-form label { font-size: .9375rem; color: #ecd3db; }
.login-form input, .login-form select { width: 100%; min-height: 50px; border: 1px solid #95707d; border-radius: 10px; padding: .7rem .9rem; color: var(--text); background: #2b1723; margin-bottom: .7rem; }
.primary-button { border: 0; border-radius: 10px; background: var(--rose); color: #32111d; font-weight: 600; min-height: 50px; margin-top: .65rem; }
.primary-button:hover { background: #ffbbc4; }
.form-error, .form-notice { padding: .8rem 1rem; border-radius: 9px; background: #601e38; color: #ffe6ee; font-size: .9375rem; }
.form-notice { background: #39252e; }
.settings-help { margin: 0; font-size: .875rem; color: var(--muted); }
.settings-links { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 1.4rem; color: #efd0da; }
.settings-links a { min-height: 44px; display: inline-flex; align-items: center; }
.chat-page { height: 100vh; height: 100dvh; overflow: hidden; display: grid; place-items: center; padding: 1.5rem; background: #160b11; }
.chat-app { display: flex; flex-direction: column; height: min(920px, calc(100dvh - 3rem)); width: min(100%, 960px); position: relative; border: 1px solid var(--line); border-radius: 20px; overflow: hidden; background: #1d141c; box-shadow: 0 20px 80px #0004; }
.chat-header { display: flex; flex-shrink: 0; align-items: center; gap: .8rem; padding: 1rem 1.2rem; background: var(--panel); border-bottom: 1px solid var(--line); }
.chat-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 .4rem; padding: .1rem .8rem; flex-shrink: 0; background: #281923; border-bottom: 1px solid var(--line); }
.chat-tools a, .chat-tools button { display: inline-flex; align-items: center; min-height: 44px; border: 0; padding: .35rem .25rem; font-size: .8125rem; color: #e5c1d0; background: transparent; text-decoration: none; border-radius: 6px; }
.chat-tools button[aria-pressed="true"] { color: #92dfce; }
.notification-help { margin: 0; padding: .5rem 1rem; background: #35232e; color: #ebd4dd; font-size: .8125rem; flex-shrink: 0; }
.message-notice { position: absolute; top: 9rem; left: 50%; transform: translateX(-50%); z-index: 5; width: min(90%, 26rem); padding: .65rem 1rem; border-radius: 12px; border: 1px solid #ad6f8c; background: #513044; color: var(--text); text-align: left; box-shadow: 0 6px 24px #0008; }
.message-notice strong, .message-notice span { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.message-notice strong { font-size: .875rem; }
.message-notice span { font-size: .8125rem; color: #ecd1dc; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 44px; height: 44px; border: none; border-radius: 50%; color: #f4dde6; background: transparent; font-size: 1.5rem; line-height: 1; text-decoration: none; }
.icon-button:hover { background: #ffffff0e; }
.home-button { width: 36px; }
.avatar { display: flex; align-items: center; justify-content: center; width: 46px; height: 46px; border-radius: 50%; background: #4a2334; font-size: 1.6rem; flex-shrink: 0; }
.contact-heading { min-width: 0; flex: 1; }
.contact-heading h1 { margin: 0; font-size: 1.0625rem; font-weight: 600; line-height: 1.4; }
.contact-heading p { margin: .05rem 0 0; color: var(--muted); font-size: .875rem; line-height: 1.4; }
.contact-heading p.peer-online { color: #92dfce; }
.identity { margin-right: .7rem; font-size: .875rem; color: var(--muted); }
.identity strong { font-weight: 500; color: #e3cbd5; }
.logout-button { border: 1px solid #cfa7b43d; border-radius: 9px; background: transparent; color: #e3cbd5; padding: .45rem .8rem; min-height: 44px; font-size: .875rem; }
.message-area { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 1.5rem clamp(.9rem, 3vw, 2rem); scrollbar-color: #614052 transparent; scrollbar-width: thin; overflow-anchor: none; }
.empty-state { color: var(--muted); text-align: center; font-size: .9375rem; max-width: 24rem; margin: 2rem auto; }
.history-button { display: block; margin: 0 auto 1.25rem; border: 1px solid #725466; background: #30202c; color: #edd9e2; border-radius: 999px; padding: .55rem 1rem; font-size: .875rem; min-height: 44px; }
.date-divider { text-align: center; margin: 1rem 0 1.3rem; font-size: .8125rem; color: #c7adba; }
.date-divider span { display: inline-block; border-radius: 999px; padding: .25rem .8rem; background: #382533; }
.message-row { display: flex; justify-content: flex-start; margin-bottom: .65rem; }
.message-row.own { justify-content: flex-end; }
.bubble { min-width: 5rem; max-width: min(78%, 34rem); padding: .65rem .85rem .4rem; border-radius: 2px 15px 15px 15px; background: #342630; border: 1px solid #ffffff08; overflow: hidden; }
.own .bubble { background: #643044; border-radius: 15px 2px 15px 15px; }
.message-body { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; margin: 0; font-size: 1rem; }
.message-meta { display: flex; justify-content: flex-end; align-items: center; gap: .4rem; margin-top: .25rem; color: #d0b6c1; font-size: .75rem; line-height: 1.5; }
.quote-action { margin-right: auto; min-height: 44px; min-width: 44px; border: 0; border-radius: 6px; padding: .3rem .25rem; color: #e5bacd; background: transparent; font-size: .75rem; }
.quote-action:hover { background: #ffffff0c; }
.quoted-message { margin: 0 0 .5rem; padding: .5rem .65rem; border-left: 3px solid var(--rose); border-radius: 6px; background: #160e183f; font-size: .8125rem; overflow-wrap: anywhere; }
.quoted-message strong { display: block; color: #ffbbc9; margin-bottom: .12rem; }
.quoted-message p { margin: 0; white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.reply-preview { display: flex; align-items: center; gap: .5rem; border-left: 3px solid var(--rose); background: #190f176b; border-radius: 6px; padding: .5rem .5rem .5rem .75rem; margin-bottom: .65rem; }
.reply-preview > div { min-width: 0; flex: 1; }
.reply-preview strong { display: block; color: #ffbbc9; font-size: .875rem; }
.reply-preview p { margin: .1rem 0 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: .8125rem; color: var(--muted); }
.receipt { font-size: .8125rem; letter-spacing: -.2em; padding-right: .2em; color: #d0b6c1; }
.receipt.read { color: #92dfce; }
.image-button { display: block; border: 0; padding: 0; background: transparent; color: inherit; max-width: 100%; border-radius: 9px; overflow: hidden; margin-bottom: .35rem; }
.message-image { display: block; width: auto; max-width: 100%; max-height: 360px; height: auto; object-fit: contain; }
.new-messages { position: absolute; z-index: 2; right: 1.5rem; bottom: 9rem; border: 1px solid #af718c; color: #fcecf4; background: #5c2e43; border-radius: 999px; padding: .55rem 1rem; min-height: 44px; font-size: .875rem; box-shadow: 0 5px 15px #0004; }
.error-banner { margin: 0; padding: .6rem 1rem; color: #ffe7ea; background: #692537; font-size: .875rem; flex-shrink: 0; }
.composer-area { position: relative; flex-shrink: 0; padding: .7rem 1rem .55rem; background: var(--panel); border-top: 1px solid var(--line); }
.composer { display: flex; align-items: flex-end; gap: .4rem; }
.composer textarea { resize: none; flex: 1; min-width: 0; height: 46px; min-height: 46px; max-height: 144px; border: 1px solid #94718435; background: #190f17; color: var(--text); border-radius: 15px; padding: .7rem .85rem; font-size: 1rem; line-height: 1.45; scrollbar-width: thin; }
.composer textarea::placeholder { color: #b698a7; }
.send-button { display: flex; align-items: center; justify-content: center; width: 46px; height: 46px; border-radius: 50%; flex-shrink: 0; border: none; background: var(--rose); color: #321321; }
.composer-hint { margin: .4rem 0 0; text-align: center; font-size: .75rem; color: #bd9eac; }
.attachment-preview { display: flex; align-items: center; gap: 1rem; padding: .3rem .4rem .8rem; }
.attachment-preview img { width: 66px; height: 66px; object-fit: cover; border-radius: 9px; }
.attachment-preview > div { flex: 1; font-size: .875rem; }
.attachment-preview strong { font-weight: 500; display: block; }
.attachment-preview span { color: var(--muted); }
.emoji-panel { position: absolute; z-index: 4; bottom: calc(100% + .4rem); left: .75rem; width: min(340px, calc(100% - 1.5rem)); max-height: min(310px, 48dvh); overflow-y: auto; border-radius: 16px; padding: .6rem; border: 1px solid #6f4b61; background: #30202d; box-shadow: 0 10px 45px #0008; }
.emoji-title { display: flex; align-items: center; justify-content: space-between; padding-left: .5rem; color: var(--muted); font-size: .875rem; }
.emoji-grid { display: grid; grid-template-columns: repeat(6, minmax(0,1fr)); }
.emoji-grid button { min-width: 0; min-height: 44px; border: 0; background: transparent; border-radius: 8px; font-size: 1.6rem; line-height: 1; padding: .3rem; }
.emoji-grid button:hover { background: #ffffff12; }
.image-dialog { max-width: 96vw; max-height: 94dvh; border: none; border-radius: 14px; padding: 3.3rem .7rem .7rem; background: #180e16; color: var(--text); }
.image-dialog::backdrop { background: #000d; }
.image-dialog > button { position: absolute; right: .45rem; top: .4rem; }
.image-dialog img { display: block; max-width: 90vw; max-height: calc(90dvh - 4rem); width: auto; height: auto; object-fit: contain; }
@media (max-width: 650px) {
  .chat-page { padding: 0; }
  .chat-app { height: var(--app-height, 100dvh); width: 100%; border: none; border-radius: 0; }
  .chat-header { gap: .5rem; padding: max(.6rem, env(safe-area-inset-top)) .6rem .6rem; }
  .identity { display: none; }
  .home-button { width: 32px; }
  .avatar { width: 40px; height: 40px; font-size: 1.4rem; }
  .message-area { padding: 1rem .7rem; }
  .bubble { max-width: 87%; }
  .composer-area { padding: .6rem .45rem max(.45rem, env(safe-area-inset-bottom)); }
  .composer { gap: .12rem; }
  .composer .icon-button { width: 40px; }
  .composer textarea { padding-inline: .65rem; }
  .send-button { width: 44px; height: 44px; margin-left: .2rem; }
  .composer-hint { font-size: .75rem; }
  .new-messages { right: .8rem; bottom: 8rem; }
}
@media (max-height: 500px) { .composer-hint { display: none; } .chat-header { padding-block: .35rem; } .emoji-panel { max-height: 45dvh; } }
