* { box-sizing: border-box; }
html, body { margin: 0; min-width: 0; min-height: 100%; background: #fafbfb; color: #202326; font-family: 'Segoe UI', Arial, sans-serif; }
body { min-height: 100dvh; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible { outline: 3px solid #4789b2; outline-offset: 3px; }
.app {
  --card: min(14vw, 14.2dvh);
  --gap: clamp(7px, 1vw, 18px);
  --board: calc(4 * var(--card) + 3 * var(--gap));
  position: relative;
  width: 100%;
  min-height: 100dvh;
  margin: auto;
  background: #fafbfb;
  outline: 0;
  padding: clamp(18px, 3.2vh, 32px) clamp(18px, 11.3vw, 180px);
  display: flex;
  flex-direction: column;
}
header, footer { width: 100%; display: flex; align-items: center; justify-content: space-between; }
.turn { color: #65717b; font-size: clamp(12px, 1.2vw, 16px); }
.health { font-size: clamp(18px, 2vw, 28px); display: flex; gap: 10px; align-items: center; }
.health b { font-weight: 500; }
.board { width: var(--board); margin: clamp(8px, 1.2vh, 20px) auto 0; }
.row, .hand, .directions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); }
.row { margin-bottom: calc(var(--gap) * .75); }
.slot {
  width: 100%;
  aspect-ratio: 116 / 135;
  border: 1px dashed #bac0c4;
  background: transparent;
  border-radius: 2px;
  padding: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.slot.card { border: 1px solid #afb4b8; background: white; }
.slot.player { background: #202326; color: white; border-color: #202326; }
.slot:hover { box-shadow: 0 0 0 2px #8f9ba455; }
.slot:disabled { cursor: default; }
.slot:disabled:hover { box-shadow: none; }
.slot .out, .slot .in { position: absolute; font-size: clamp(14px, calc(var(--card) * .18), 30px); font-weight: 600; }
.out { right: 8%; top: 4%; }
.in { left: 8%; bottom: 4%; }
.slot svg { position: absolute; left: 28%; top: 20%; width: 44%; height: 44%; fill: currentColor; stroke: currentColor; stroke-width: 0; stroke-linejoin: round; stroke-linecap: round; }
.slot small { position: absolute; top: 65%; left: 0; width: 100%; font-size: clamp(8px, calc(var(--card) * .112), 19px); line-height: 1.2; }
.slot.dim { opacity: .5; }
.directions { text-align: center; color: #65717b; font-size: clamp(13px, 1.5vw, 19px); margin-top: -2px; }
.hand-area {
  width: max-content;
  display: grid;
  grid-template-columns: 48px var(--board) 48px;
  gap: clamp(16px, 2.8vw, 40px);
  align-items: start;
  margin: clamp(28px, 8vh, 96px) auto 0;
}
.pile { width: 48px; height: 66px; border: 1px solid #aeb4b8; display: flex; align-items: center; justify-content: center; font-size: 18px; }
#draw-pile { box-shadow: 4px -4px 0 -1px #fafbfb, 4px -4px 0 0 #aeb4b8; }
footer { margin-top: auto; padding-top: clamp(22px, 4vh, 48px); }
.actions { display: flex; gap: 10px; }
.actions button { border: 1px solid #aeb4b8; background: transparent; width: 46px; height: 40px; font-size: 22px; border-radius: 2px; }
.actions button:hover { background: #eef1f3; }
.status { position: absolute; bottom: clamp(18px, 4vh, 38px); left: 25%; width: 50%; text-align: center; margin: 0; color: #65717b; }
button:disabled { opacity: .5; }
@media (max-width: 600px) {
  .app { --gap: 7px; --card: calc((92vw - 96px - 21px) / 4); padding-left: 4vw; padding-right: 4vw; }
  .hand-area { grid-template-columns: 36px var(--board) 36px; gap: 12px; }
  .pile { width: 36px; height: 54px; font-size: 14px; }
  .actions { gap: 6px; }
  .actions button { width: 40px; height: 36px; font-size: 18px; }
}
@media (max-height: 500px) and (min-width: 601px) {
  .app { --card: 66px; --gap: 7px; padding-top: 12px; padding-bottom: 12px; }
  .board { margin-top: 12px; }
  .hand-area { margin-top: 18px; }
  footer { padding-top: 16px; }
}
