.game-shell {
  color-scheme: light;
  --steel: #d9e1e5;
  --steel-edge: #a8b6bd;
  --ink: #22313a;
  --shadow: rgba(23, 35, 43, 0.22);
}

.game-shell,
.game-shell * {
  box-sizing: border-box;
}

.game-shell {
  position: relative;
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 50px clamp(8px, 1.8vw, 18px) clamp(8px, 1.8vw, 18px);
  place-items: center;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.42) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.42) 1px, transparent 1px),
    #b9d2d3;
  background-size: 42px 42px;
}

.stats-panel {
  position: absolute;
  top: 10px;
  left: 50%;
  z-index: 50;
  width: min(94vw, 760px);
  padding: 8px 12px;
  transform: translateX(-50%);
  border: 1px solid rgba(64, 79, 88, 0.28);
  border-radius: 8px;
  background: rgba(247, 250, 251, 0.86);
  box-shadow: 0 10px 26px rgba(23, 35, 43, 0.16);
  color: #24343c;
  font-size: 12px;
  backdrop-filter: blur(8px);
}

.stats-title {
  display: none;
  margin-bottom: 0;
  font-size: 13px;
  font-weight: 900;
}

.stats-panel dl {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 2.2vw, 24px);
  margin: 0;
  white-space: nowrap;
}

.stats-panel dl div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.stats-panel dt,
.stats-panel dd {
  margin: 0;
}

.stats-panel dt {
  color: #5a6b73;
  font-weight: 700;
}

.stats-panel dd {
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 900;
  text-align: right;
}

.fridge {
  position: relative;
  width: min(calc((100vh - 74px) * 0.5625), calc(100vw - 24px), 620px);
  width: min(calc((100dvh - 74px) * 0.5625), calc(100vw - 24px), 620px);
  aspect-ratio: 9 / 16;
  max-height: calc(100vh - 74px);
  max-height: calc(100dvh - 74px);
  overflow: hidden;
  border: 4px solid var(--steel-edge);
  border-radius: 8px 8px 18px 18px;
  background:
    linear-gradient(105deg, rgba(255, 255, 255, 0.72) 0%, rgba(255, 255, 255, 0) 18%, rgba(72, 88, 98, 0.12) 38%, rgba(255, 255, 255, 0.46) 58%, rgba(71, 88, 100, 0.16) 78%, rgba(255, 255, 255, 0.28) 100%),
    linear-gradient(90deg, #f7fafb 0%, #c8d1d6 18%, #eef3f5 34%, #aebbc2 52%, #e5ecef 70%, #bbc7cd 100%);
  box-shadow:
    0 26px 60px rgba(34, 49, 58, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.75);
  touch-action: none;
}

.door-handle {
  position: absolute;
  right: 28px;
  z-index: 1;
  width: 22px;
  border-radius: 999px;
  background: linear-gradient(90deg, #eef3f5, #9eafb7);
  box-shadow: inset -3px 0 4px rgba(48, 66, 76, 0.18), 0 2px 5px rgba(23, 35, 43, 0.18);
}

.door-handle {
  top: 38%;
  height: 30%;
}

.fridge-shine {
  position: absolute;
  inset: 12px auto auto 20px;
  z-index: 1;
  width: 26%;
  height: 92%;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.28), transparent);
  opacity: 0.7;
}

.magnet {
  position: absolute;
  z-index: 3;
  display: grid;
  width: 26px;
  height: 29px;
  border: 0;
  padding: 0;
  place-items: center;
  background: transparent;
  color: var(--magnet-color, #e1251b);
  font-family: "Arial Black", Impact, Arial, sans-serif;
  font-size: 23px;
  font-weight: 900;
  line-height: 1;
  -webkit-text-stroke: 0.35px rgba(102, 39, 32, 0.12);
  filter:
    drop-shadow(0 2px 0 rgba(0, 0, 0, 0.25))
    drop-shadow(0 6px 5px rgba(23, 35, 43, 0.24));
  text-shadow:
    0 -2px 0 rgba(255, 255, 255, 0.32),
    0 2px 0 rgba(0, 0, 0, 0.14);
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.magnet.is-remote-moving {
  transition: left 220ms ease-out, top 220ms ease-out;
}

.magnet.card-magnet {
  width: min(24vw, 145px);
  height: auto;
  overflow: hidden;
  border-radius: 10px;
  background: transparent;
  -webkit-text-stroke: 0;
  filter:
    drop-shadow(0 2px 0 rgba(0, 0, 0, 0.18))
    drop-shadow(0 8px 8px rgba(23, 35, 43, 0.24));
  line-height: 0;
}

.card-magnet img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
}

.magnet:active,
.magnet.is-dragging {
  z-index: 20;
  cursor: grabbing;
  filter:
    drop-shadow(0 2px 0 rgba(0, 0, 0, 0.18))
    drop-shadow(0 13px 12px rgba(23, 35, 43, 0.3));
}

.magnet[data-char="I"],
.magnet[data-char="1"],
.magnet[data-char="!"],
.magnet[data-char="'"] {
  width: 19px;
}

.magnet[data-char="W"],
.magnet[data-char="M"] {
  width: 34px;
}

.magnet[data-char="."],
.magnet[data-char=","] {
  width: 17px;
}

.magnet[data-char="&"] {
  width: 31px;
}

@media (max-width: 560px) {
  .game-shell {
    padding: 44px 5px 5px;
  }

  .stats-panel {
    top: 8px;
    left: 50%;
    width: calc(100% - 16px);
    padding: 6px 8px;
    font-size: 11px;
  }

  .stats-panel dl {
    justify-content: flex-start;
    gap: 10px;
    overflow-x: auto;
  }

  .fridge {
    width: min(calc((100vh - 56px) * 0.5625), calc(100vw - 10px));
    width: min(calc((100dvh - 56px) * 0.5625), calc(100vw - 10px));
    max-height: calc(100vh - 56px);
    max-height: calc(100dvh - 56px);
  }

  .magnet {
    width: 20px;
    height: 23px;
    font-size: 18px;
  }

  .magnet[data-char="I"],
  .magnet[data-char="1"],
  .magnet[data-char="!"],
  .magnet[data-char="'"] {
    width: 15px;
  }

  .magnet[data-char="W"],
  .magnet[data-char="M"] {
    width: 27px;
  }

  .magnet[data-char="."],
  .magnet[data-char=","] {
    width: 14px;
  }

  .magnet[data-char="&"] {
    width: 24px;
  }

  .magnet.card-magnet {
    width: min(38vw, 124px);
  }

  .door-handle {
    right: 18px;
    top: 38%;
    height: 30%;
  }
}

@media (max-width: 420px) {
  .magnet {
    width: 18px;
    height: 21px;
    font-size: 16px;
  }

  .magnet[data-char="W"],
  .magnet[data-char="M"] {
    width: 24px;
  }
}
