.mail-tree {
  --mt-ink: #382d26;
  --mt-muted: #786c60;
  --mt-red: #a7433f;
  --mt-gold: #d1a04c;
  position: relative;
  display: grid;
  grid-template-rows: minmax(330px, 1fr) auto auto;
  width: 100%;
  min-height: 440px;
  overflow: hidden;
  color: var(--mt-ink);
  border: 1px solid #c8b99f;
  border-radius: 18px;
  background: #f4ead7;
  box-shadow: 0 20px 46px #20170e24, inset 0 0 0 5px #fff9ed9c;
}
.mail-tree--snow { background: #e9edf1; border-color: #aebdca; }
.mail-tree--night { background: #e9e2dc; border-color: #b6a79c; }
.mail-tree__scene {
  position: relative;
  min-height: 0;
  overflow: hidden;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
}
.mail-tree__scene:active { cursor: grabbing; }
.mail-tree__canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.mail-tree__doors { position: absolute; inset: 0; pointer-events: none; }
.mail-tree__door {
  position: absolute;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 0;
  width: var(--door-size, 38px);
  height: var(--door-size, 38px);
  padding: 1px;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  color: #45392b;
  border: 1px solid #fff0c5;
  border-radius: 7px 7px 9px 7px;
  background: linear-gradient(145deg, #fff4d9, #dfc896);
  box-shadow: 1px 2px 0 #80633d70, 0 2px 8px #15251c4a, inset 0 0 0 2px #ffffff55;
  font: 700 11px/1.05 system-ui, sans-serif;
  cursor: pointer;
  transition: filter 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}
.mail-tree__door::before {
  position: absolute;
  top: 3px;
  right: 4px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #a4433c;
  content: "";
}
.mail-tree__door[data-filled="true"] { color: #fff8e9; border-color: #f0cc8c; background: linear-gradient(145deg, #b84d43, #823531); }
.mail-tree__door[data-filled="true"]::before { background: #f1cb75; }
.mail-tree__door[data-filled="true"][data-readable="true"] { border-color: #fff0bc; background: linear-gradient(145deg, #d4a650, #aa762c); color: #302817; }
.mail-tree__door:hover { z-index: 1000 !important; filter: brightness(1.09); transform: translate(-50%, -50%) scale(1.1); box-shadow: 0 5px 10px #17241d6e; }
.mail-tree__door:focus-visible, .mail-tree__rotate:focus-visible { outline: 3px solid #7b342d; outline-offset: 3px; z-index: 1001 !important; }
.mail-tree__door-number { font-size: 12px; letter-spacing: .02em; }
.mail-tree__door-mark { height: 11px; font-size: 9px; }
.mail-tree__hint {
  justify-self: center;
  margin: 0;
  padding: 0 18px 5px;
  color: var(--mt-muted);
  font-size: 12px;
  line-height: 1.35;
  text-align: center;
}
.mail-tree__controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 5px 16px 14px;
}
.mail-tree__rotate {
  display: grid;
  place-items: center;
  width: 42px;
  height: 36px;
  padding: 0;
  color: #493a2d;
  border: 1px solid #b6a388;
  border-radius: 999px;
  background: #fff9ed;
  box-shadow: 0 2px 0 #b6a388;
  font: 20px/1 system-ui, sans-serif;
  cursor: pointer;
  touch-action: manipulation;
}
.mail-tree__rotate:hover { background: #fff; }
.mail-tree__rotate:active { transform: translateY(1px); box-shadow: 0 1px 0 #b6a388; }
.mail-tree--snow .mail-tree__door { border-color: #e7eff0; }
.mail-tree--snow .mail-tree__door[data-filled="false"] { background: linear-gradient(145deg, #f9ffff, #cddde1); }
.mail-tree--night .mail-tree__door { box-shadow: 1px 2px 0 #5d493570, 0 2px 8px #101c2b55, inset 0 0 0 2px #ffffff55; }
@media (min-width: 740px) {
  .mail-tree { grid-template-rows: minmax(440px, 1fr) auto auto; min-height: 550px; }
}
@media (max-width: 480px) {
  .mail-tree { grid-template-rows: minmax(310px, 1fr) auto auto; min-height: 400px; border-radius: 13px; }
  .mail-tree__door { border-radius: 6px; }
  .mail-tree__controls { padding-bottom: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .mail-tree__door, .mail-tree__rotate { transition: none; }
}
