/* 收发室（js/inbox.js）：门桥上那只铜信箱和旁边的信柜，摊开看信。2026-11-19 从 desktop.css 拆出来。 */

/* 收发室：一只老式铜信箱摊在桌面上（js/inbox.js），左边信箱，右边是取出来的信。字号由脚本按屏幕挑清楚的像素字号 */
.mbx {
  display: flex;
  align-items: flex-end;
  gap: 32px;
  max-height: 100%;
  padding: 16px;
  box-sizing: border-box;
  line-height: 1.7;
}

.mbx-box {
  all: unset;
  flex: none;
  cursor: pointer;
}

/* 信箱这一栏：信箱，底下挂一只叫猫的小铜铃（只在 3D 草原开着时有） */
.mbx-col {
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.mbx-bell {
  all: unset;
  cursor: pointer;
  transform-origin: 50% 0;
}

.mbx-bell canvas {
  display: block;
  image-rendering: pixelated;
  filter: drop-shadow(3px 3px 0 rgb(0 0 0 / 0.35));
}

.mbx-bell:focus-visible canvas {
  filter: drop-shadow(3px 3px 0 rgb(0 0 0 / 0.35)) drop-shadow(0 0 6px rgb(255 226 170 / 0.7));
}

/* 鼠标划过：轻轻晃一下（不出声） */
.mbx-bell:hover:not(.ring) {
  animation: mbx-nudge 0.45s steps(1, end);
}

/* 摇一下：左右晃三下，一下比一下小（一格一格地晃，像素画不糊） */
.mbx-bell.ring {
  animation: mbx-ring 0.9s steps(1, end);
}

.mbx-box canvas {
  display: block;
  image-rendering: pixelated;
  filter: drop-shadow(4px 4px 0 rgb(0 0 0 / 0.35));
}

/* 只有用键盘挪到信箱上才亮：一圈暖光，不画虚线框（鼠标点过就把焦点放掉，见 inbox.js） */
.mbx-box:focus-visible canvas {
  filter: drop-shadow(4px 4px 0 rgb(0 0 0 / 0.35)) drop-shadow(0 0 6px rgb(255 226 170 / 0.7));
}

.mbx-desk {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(520px, 60vw / var(--uiz, 1));
  max-height: calc(100vh / var(--uiz, 1) - 80px);
  overflow-y: auto;
  padding: 4px 8px 4px 0;
}

/* 遮罩是暗的：提示写成浅色 */
.mbx-tip {
  margin: 0;
  color: #f3ead6;
  text-shadow: 1px 1px 0 #000;
}

/* 信封：米色，背面一道 V 形的封口线；没拆的盖着一枚红火漆 */
.mbx-env {
  all: unset;
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 4px 12px;
  padding: 12px 52px 12px 16px;
  background: #efe6d2;
  box-shadow: inset 0 0 0 1px #b9a77f, 3px 3px 0 rgb(0 0 0 / 0.35);
  color: #2b2a33;
  cursor: pointer;
}

.mbx-env::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom right, transparent calc(50% - 1px), #cdbb93 50%, transparent calc(50% + 1px)) left top / 50% 70% no-repeat,
    linear-gradient(to bottom left, transparent calc(50% - 1px), #cdbb93 50%, transparent calc(50% + 1px)) right top / 50% 70% no-repeat;
  pointer-events: none;
}

.mbx-env b {
  position: relative;
  font-weight: normal;
}

.mbx-env small {
  position: relative;
  color: #7a6a4c;
  font-size: var(--small);
}

.mbx-env:hover,
.mbx-env:focus-visible {
  translate: -2px -2px;
  box-shadow: inset 0 0 0 1px #b9a77f, 5px 5px 0 rgb(0 0 0 / 0.35);
}

.mbx-env .seal {
  position: absolute;
  right: 14px;
  top: 50%;
  width: 22px;
  height: 22px;
  translate: 0 -50%;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #d6404e, #9c1426 70%);
  box-shadow: 1px 1px 0 rgb(0 0 0 / 0.35);
}

/* 摊开的信纸：横线信纸，抬头是谁寄的、哪天；底下一行小字交代这是哪件事 */
.mbx-letter {
  padding: 18px 24px 16px;
  background:
    repeating-linear-gradient(transparent 0 calc(1.7em - 1px), #e2d8c0 calc(1.7em - 1px) 1.7em) 0 calc(18px + 1.7em) / 100% calc(100% - 3.4em - 18px) no-repeat,
    #f6f1e3;
  box-shadow: 4px 4px 0 rgb(0 0 0 / 0.35);
  color: #2b2a33;
}

.mbx-letter header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 0.6em;
  color: #6a5a40;
}

.mbx-text p {
  margin: 0;
}

.mbx-ps {
  margin: 1em 0 0.6em;
  color: #8a7a5a;
  font-size: var(--small);
  line-height: 1.6;
}

.mbx-ps:empty {
  display: none;
}

/* 信柜（inbox.js 的 cabinet）：深色橡木柜子，一层层隔板。看过的信立在隔板上，一叠叠斜靠着右边的柜壁，
   像书架上没摆满的书；纸色按原本怎么送来的（电报黄、传真白、留言转写的蓝灰、短信淡绿）。
   指到哪封，哪封顺着斜的方向往上抽出一截，头上冒出一张小签条写着哪天来的 */
.mbx-cab {
  margin-top: 14px;
  padding: 0 10px 10px;
  background: #3a2416;
  box-shadow: inset 0 0 0 2px #1f130b, inset 4px 0 0 #4d3120, 4px 4px 0 rgb(0 0 0 / 0.35);
}

.mbx-plate {
  display: flex;
  align-items: baseline;
  gap: 0.6em;
  width: fit-content;
  margin: 0 auto;
  padding: 2px 14px 3px;
  background: #b98a45;
  color: #2a1a0c;
  box-shadow: inset 0 0 0 1px #6e4b20, inset 0 1px 0 #e6c27a, 0 2px 0 #1f130b;
  translate: 0 -40%;
  margin-bottom: 8px; /* 最上面一层抽出来的信，签条别顶到铜牌 */
}

.mbx-plate b {
  font-weight: normal;
  letter-spacing: 0.3em;
}

.mbx-plate small {
  color: #4a3214;
  font-size: var(--small);
}

.mbx-shelf {
  position: relative;
  display: flex;
  justify-content: flex-end;
  align-items: flex-end;
  height: 116px;
  padding: 0 22px 0 4px; /* 右边空出信顶斜过去的那一截 */
  background: #22150c;
  border-bottom: 8px solid #6b4428;
}

.mbx-shelf + .mbx-shelf {
  margin-top: 6px;
}

/* 一整叠一起斜：底边贴着隔板不动，上头往右靠 */
.mbx-stack {
  display: flex;
  align-items: flex-end;
  transform: skewX(-9deg);
  transform-origin: bottom;
}

.mbx-file {
  all: unset;
  position: relative;
  box-sizing: border-box;
  width: var(--w);
  height: var(--h);
  background: var(--c, #efe6d2);
  box-shadow: inset -1px 0 0 rgb(0 0 0 / 0.28), inset 1px 0 0 rgb(255 255 255 / 0.45);
  cursor: pointer;
  transition: translate 0.15s steps(3);
}

.mbx-file.telegram {
  --c: #e6d39a;
}

.mbx-file.fax {
  --c: #ecebe6;
}

.mbx-file.voicemail {
  --c: #cfdbe3;
}

.mbx-file.sms {
  --c: #d6e3c4;
}

/* 电报纸顶上一道红杠，传真纸上一道灰线 */
.mbx-file.telegram::before,
.mbx-file.fax::before {
  content: '';
  position: absolute;
  inset: 6px 0 auto;
  height: 3px;
  background: #b8452f;
}

.mbx-file.fax::before {
  inset: 10px 2px auto;
  height: 1px;
  background: #9a9890;
}

.mbx-file:hover,
.mbx-file:focus-visible {
  z-index: 1;
  translate: 0 -26px;
}

/* 抽出来的那封头上：哪天来的。签条自己反着斜回去，字是正的 */
.mbx-file::after {
  content: attr(data-day);
  position: absolute;
  bottom: calc(100% + 4px);
  left: -2px;
  padding: 1px 6px;
  background: #f3e9cf;
  box-shadow: 2px 2px 0 rgb(0 0 0 / 0.4);
  color: #3a2a1a;
  font-size: var(--small);
  line-height: 1.5;
  white-space: nowrap;
  transform: skewX(9deg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s steps(2);
}

.mbx-file.near::after {
  right: -2px;
  left: auto;
}

.mbx-file:hover::after,
.mbx-file:focus-visible::after {
  opacity: 1;
}

.mbx-none {
  position: absolute;
  inset: 40% 0 auto;
  margin: 0;
  color: #a88a66;
  font-size: var(--small);
  text-align: center;
}

/* 信箱底下的遮罩压暗一点：白天的草原太亮，提示字和信封会糊在桌面图标上 */
.phone-overlay.mbx-veil {
  background: rgb(20 12 8 / 0.6);
}

/* 手机上：信箱小一号摆在上面，信在底下，整块一起上下滑 */
#desktop.mobile .mbx {
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 100%;
  overflow-y: auto;
}

#desktop.mobile .mbx-desk {
  align-self: stretch;
  width: auto;
  max-height: none;
  overflow: visible;
}
