/* Postfach (ui/mail.js): the tab at the left edge (#edge, .edge-tab in fortune.css) and the window - scoped to #mailbox */

/* the tab: the number of waiting letters under the envelope, the red mark (.et-dot) while one is unread */
#mail-tab .et-ic img { image-rendering: auto; }
#mail-tab .et-time { color: var(--gold); }

#mailbox { width: 262px; }
#mailbox .win-title .ml-tic { width: 10px; height: 10px; margin-right: 3px; vertical-align: -1px; image-rendering: auto; }
#mailbox .win-body { display: flex; flex-direction: column; gap: 4px; padding: 5px; }
#mailbox .ml-top { display: flex; align-items: center; gap: 6px; }
#mailbox .ml-info { flex: 1; min-width: 0; font-size: 7px; line-height: 9px; }
#mailbox .ml-tbtns { flex: none; width: 150px; }
#mailbox .ml-main { display: flex; gap: 4px; height: 186px; }
#ui #mailbox .ml-main > .fp + .fp { margin-top: 0; }
#mailbox .ml-lbox { flex: none; width: 108px; display: flex; flex-direction: column; }

/* the letters: newest on top, unread ones in gold with a dot */
#mailbox .ml-list { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; overflow-x: hidden; padding: 1px; }
#mailbox .ml-row { position: relative; flex: none; display: flex; align-items: center; gap: 3px; height: 32px; padding: 0 3px 0 3px; cursor: pointer;
  box-shadow: inset 0 -1px 0 #2a241d; }
#mailbox .ml-row:hover { background: rgba(242, 196, 90, .07); }
#mailbox .ml-row.chosen { background: linear-gradient(90deg, rgba(242, 196, 90, .2), rgba(242, 196, 90, .04)); box-shadow: inset 2px 0 0 #e2bf72, inset 0 -1px 0 #2a241d; }
#mailbox .ml-ric { flex: none; width: 16px; height: 16px; image-rendering: auto; }
#mailbox .ml-row:not(.full):not(.unread) .ml-ric { filter: grayscale(.7) brightness(.75); }
#mailbox .ml-rt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#mailbox .ml-rn { max-height: 16px; font-size: 7px; line-height: 8px; overflow: hidden; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
#mailbox .ml-row.unread .ml-rn { color: var(--gold); }
#mailbox .ml-rd { font-size: 6px; line-height: 7px; white-space: nowrap; }
/* the Kontopost (server/amail.js): a small mark in the row, a framed note in the letter */
#mailbox .ml-acc { display: inline-block; margin-right: 2px; padding: 0 3px; color: #1c1408; background: #d9b25c; box-shadow: 0 0 0 1px var(--edge); }
#mailbox .ml-accnote { padding: 3px 4px; font-size: 7px; line-height: 9px; color: #f0dca8; background: rgba(217, 178, 92, .1); box-shadow: inset 0 0 0 1px rgba(217, 178, 92, .35); }
/* how long a letter stays (game/mail.js: the game's own 48 h, the team's as set); red in the last hours */
#mailbox .ml-left { color: #c9a66b; }
#mailbox .ml-rt .ml-left { font-size: 6px; line-height: 7px; }
#mailbox .ml-left.soon { color: #e0604c; }
#mailbox .ml-rc { flex: none; min-width: 8px; padding: 0 2px; font-size: 6px; line-height: 8px; text-align: center; color: #fff6dc; background: #6a4a24;
  box-shadow: 0 0 0 1px var(--edge); }
#mailbox .ml-row.unread::after { content: ''; position: absolute; left: 2px; top: 2px; width: 3px; height: 3px; background: #d23a2c; box-shadow: 0 0 0 1px var(--edge); }
#mailbox .ml-empty { flex: 1; display: grid; place-items: center; padding: 6px 4px; font-size: 7px; line-height: 9px; text-align: center; }

/* the chosen letter */
#mailbox .ml-view { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; padding: 0 0 4px; overflow-y: auto; overflow-x: hidden; }
#mailbox .ml-view > :not(.ml-head) { margin-left: 5px; margin-right: 5px; }
#mailbox .ml-head { flex: none; display: flex; align-items: center; gap: 4px; min-height: 26px; padding: 2px 5px; background: linear-gradient(90deg, #2e261b, #18140f 70%);
  box-shadow: inset 0 0 0 1px #47423a, inset 0 -1px 0 #5c4b2f; }
#mailbox .ml-head img { flex: none; width: 18px; height: 18px; image-rendering: auto; }
#mailbox .ml-ht { flex: 1; min-width: 0; font-size: 7px; line-height: 9px; }
#mailbox .ml-title { font-size: 9px; line-height: 10px; color: var(--gold); overflow-wrap: anywhere; }
#mailbox .ml-text { font-size: 7px; line-height: 9px; white-space: pre-wrap; overflow-wrap: anywhere; }
#mailbox .ml-items { display: flex; flex-wrap: wrap; gap: 1px; }
#mailbox .ml-slot { flex: none; }
#mailbox .ml-money { display: flex; flex-wrap: wrap; gap: 3px 8px; font-size: 8px; line-height: 10px; color: var(--gold); }
#mailbox .ml-money > span { display: flex; align-items: center; gap: 3px; }
#mailbox .ml-gold i { flex: none; width: 8px; height: 8px; background: var(--ic-coin) center / 8px 8px no-repeat; }
#mailbox .ml-coins img { width: 8px; height: 8px; }
#mailbox .ml-done { font-size: 7px; line-height: 9px; }
#mailbox .ml-btns { margin-top: auto; width: calc(100% - 10px); }

/* phones and tablets: the window as wide as the screen allows, letters as finger-high rows (>= 44 CSS px) */
html.touch #ui #mailbox { width: min(300px, calc((100% - 8px) / var(--wz))); }
html.touch #ui #mailbox .ml-main { height: min(170px, calc((100vh / var(--px) - 70px) / var(--wz))); }
html.touch #ui #mailbox .ml-lbox { width: 124px; }
html.touch #ui #mailbox .ml-row { height: max(32px, calc(44px / (var(--px) * var(--wz)))); }
html.touch #ui #mailbox .btn { min-height: calc(44px / (var(--px) * var(--wz))); }
/* the badge Konto of an account letter: its 6 px letters stand 8 px high, in a 7 px line they reached over its top (uicheck) */
html.touch #ui #mailbox .ml-acc { line-height: 8px; }
