.rc { --game: #fb7185; }
.he-shell { max-width: 760px; margin: 0 auto; }
.he-shell h1 { margin: 4px 0 8px; font-size: 1.45rem; }
.he-top-controls, .he-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.he-top-controls { margin-bottom: 10px; }
.he-top-controls label { font-size: .85rem; color: var(--text-dim); }
.he-top-controls select, .he-top-controls button, .he-actions button,
.he-summary button {
  min-height: 42px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2); color: var(--text); padding: 7px 11px;
  font: inherit; cursor: pointer;
}
.he-top-controls select { flex: 1; min-width: 150px; }
.he-actions button:first-child, .he-summary button { background: var(--game); color: #191018; font-weight: 750; }
.he-actions .off { opacity: .45; }
.he-hud { line-height: 1.3; margin: 0 0 8px; font-size: .83rem; }
#totals { font-weight: 650; }
#hand-info { color: var(--text-dim); }
#message { min-height: 1.3em; color: var(--game); }
.he-board {
  position: relative; padding: 10px 7px 9px; border: 1px solid var(--border);
  border-radius: 16px; background: var(--surface); user-select: none;
  -webkit-user-select: none; -webkit-touch-callout: none;
}
.he-chip {
  position: absolute; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2); font-size: .72rem; line-height: 1.3;
  text-align: center; padding: 3px 5px; min-width: 74px; white-space: pre-line;
}
.he-chip.turn, .he-you.turn { outline: 2px solid var(--game); }
.he-chip.north { top: 7px; left: 50%; transform: translateX(-50%); white-space: normal; }
.he-chip.west { top: 80px; left: 7px; }
.he-chip.east { top: 80px; right: 7px; }
.he-trick { position: relative; height: 128px; margin: 32px auto 0; max-width: 300px; }
.he-slot { position: absolute; width: 48px; height: 62px; border: 1px dashed #4b3e47;
  border-radius: 7px; display: grid; place-items: center; }
.slot-n { left: calc(50% - 24px); top: 0; }
.slot-s { left: calc(50% - 24px); bottom: 0; }
.slot-w { left: 65px; top: 33px; }
.slot-e { right: 65px; top: 33px; }
.he-you { text-align: center; margin: 2px auto 8px; width: max-content; border-radius: 8px;
  padding: 2px 7px; font-size: .78rem; }
.he-hand { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px;
  max-width: 408px; margin: 0 auto 8px; }
.he-card { position: relative; min-width: 0; width: 100%; height: 62px; border: 0;
  border-radius: 7px; background: #f8f7f5; color: #17181e; padding: 4px;
  text-align: left; font: 700 .85rem/1.1 system-ui, sans-serif; cursor: pointer;
  touch-action: manipulation; -webkit-touch-callout: none; }
.he-card.red { color: #bd2744; }
.he-card .symbol { display: block; font-size: 1.15rem; }
.he-card .new { position: absolute; right: 2px; bottom: 2px; font-size: .56rem;
  color: #fff; background: #9e3350; border-radius: 3px; padding: 1px 2px; }
.he-card.selected, .he-card.playable { transform: translateY(-5px); }
.he-card.selected { outline: 3px solid var(--game); }
.he-card.unplayable { opacity: .53; transform: translateY(4px); }
.he-card.hint { outline: 3px solid #fbbf24; }
.he-card:focus-visible, .he-actions button:focus-visible,
.he-summary button:focus-visible { outline: 3px solid #fbbf24; outline-offset: 2px; }
.he-slot .he-card { width: 48px; height: 62px; pointer-events: none; }
.he-board[data-collect] .he-slot .he-card {
  opacity: 0; transform: translate(var(--collect-x), var(--collect-y)) scale(.5);
  transition: transform .2s ease-in, opacity .2s ease-in;
}
.he-board[data-collect="0"] { --collect-x: 0; --collect-y: 90px; }
.he-board[data-collect="1"] { --collect-x: -100px; --collect-y: 0; }
.he-board[data-collect="2"] { --collect-x: 0; --collect-y: -90px; }
.he-board[data-collect="3"] { --collect-x: 100px; --collect-y: 0; }
.he-actions { justify-content: center; padding-top: 6px; }
.he-actions button { min-width: 92px; }
.he-summary { position: absolute; inset: 16px 8px auto; z-index: 2;
  background: #202027; border: 1px solid var(--game); border-radius: 12px;
  padding: 14px; text-align: center; box-shadow: 0 12px 30px #0009; }
.he-summary[hidden] { display: none; }
.he-summary p { margin: 5px 0; }
@media (min-width: 900px) {
  .he-hand { max-width: none; grid-template-columns: repeat(13, minmax(0, 1fr)); }
  .he-card { height: 70px; }
  .he-trick { height: 190px; }
}
@media (max-width: 500px) {
  .rc-stage { padding: 0 5px; margin-top: 12px; }
  .he-board { padding-left: 5px; padding-right: 5px; }
  .he-hand { gap: 2px; }
  .he-card { min-width: 44px; }
  .he-chip { min-width: 0; max-width: 72px; padding: 3px 4px; }
  .he-chip.north { max-width: none; }
  .he-chip.west, .he-chip.east { top: 70px; }
  .he-trick { margin-top: 40px; }
  /* Left-align so the fixed Feedback button (bottom right) never covers one. */
  .he-actions { justify-content: flex-start; }
}
@media (prefers-reduced-motion: no-preference) {
  .he-card.selected, .he-card.playable { transition: transform .14s; }
}
