:root {
  --bg: #ffffff;
  --card: #ffffff;
  --ink: #17181c;
  --soft: rgba(23, 24, 28, 0.56);
  --line: rgba(23, 24, 28, 0.09);
  --accent: #d2374c;
  --pine: #1c7a55;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Mona Sans Variable", "Mona Sans", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.stage {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: 8px 16px;
}

.ss {
  width: min(312px, 100%);
  padding: 13px 14px 14px;
  border-radius: 26px;
  background: var(--card);
  box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(23, 24, 28, 0.05), 0 34px 60px -36px color-mix(in srgb, var(--accent) 60%, transparent);
}
.ss__roll { display: block; overflow: hidden; }
.ss__roll > span { display: block; white-space: nowrap; }

.ss__head { display: flex; align-items: center; gap: 10px; }
.ss__tile { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 11px; background: color-mix(in srgb, var(--accent) 11%, #ffffff); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent); }
.ss__tile svg { width: 21px; height: 21px; overflow: visible; fill: none; stroke: var(--accent); stroke-width: 1.700; stroke-linecap: round; stroke-linejoin: round; }
.ss__who { display: flex; flex-direction: column; min-width: 0; }
.ss__who b { font-size: 14.5px; line-height: 18px; font-weight: 680; font-stretch: 104%; }
.ss__who span { font-size: 11.5px; line-height: 16px; font-weight: 540; color: var(--soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ss__pill { margin-left: auto; flex: none; height: 24px; padding: 0 9px; border-radius: 12px; background: rgba(23, 24, 28, 0.05); font-size: 11.5px; line-height: 24px; font-weight: 660; color: var(--soft); white-space: nowrap; }

/* five rows: who gives on the left, a thin line, and on the right the tile of who receives */
.ss__list { position: relative; list-style: none; margin-top: clamp(6px, 2vh, 11px); }
.ss__row { display: flex; align-items: center; gap: 8px; height: clamp(27px, 8.200vh, 33px); }
.ss__face { display: grid; place-items: center; flex: none; width: 24px; height: 24px; border-radius: 8px; background: rgba(23, 24, 28, 0.06); font-size: 9.500px; font-weight: 720; letter-spacing: 0.02em; }
.ss__name { font-size: 13px; font-weight: 640; white-space: nowrap; }
.ss__row.is-you .ss__face { background: var(--ink); color: #ffffff; }
.ss__wire { flex: 1; height: 1px; margin: 0 2px; background: linear-gradient(90deg, var(--line), rgba(23, 24, 28, 0.2)); transform: scaleX(0); transform-origin: 0 50%; }
.ss__slot { flex: none; width: 30px; height: 26px; }

/* the receivers' tiles live in a column of their own, so they can change rows; each has two faces */
.ss__tiles { position: absolute; right: 0; top: 0; width: 30px; height: 100%; perspective: 300px; pointer-events: none; }
.ss__t { position: absolute; left: 0; top: 0; width: 30px; height: 26px; padding: 0; border: 0; background: none; font: inherit; outline: none; pointer-events: auto; cursor: default; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.ss__flip { position: absolute; inset: 0; transform-style: preserve-3d; }
.ss__front, .ss__back { position: absolute; inset: 0; display: grid; place-items: center; border-radius: 9px; -webkit-backface-visibility: hidden; backface-visibility: hidden; }
.ss__front { background: #ffffff; box-shadow: 0 0 0 1px rgba(23, 24, 28, 0.12), 0 3px 7px -3px rgba(23, 24, 28, 0.3); font-size: 9.500px; font-weight: 720; letter-spacing: 0.02em; }
/* the sealed side: wrapping paper with a ribbon, two plain lines */
.ss__back { background: var(--accent); box-shadow: 0 3px 8px -3px color-mix(in srgb, var(--accent) 80%, #000000); transform: rotateY(180deg); overflow: hidden; }
.ss__back::before, .ss__back::after { content: ""; position: absolute; background: rgba(255, 255, 255, 0.82); }
.ss__back::before { left: 50%; top: 0; bottom: 0; width: 3px; margin-left: -1.500px; }
.ss__back::after { top: 50%; left: 0; right: 0; height: 3px; margin-top: -1.500px; }
.ss__t.is-mine { cursor: pointer; }
.ss__t.is-mine .ss__back { background: var(--pine); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pine) 22%, transparent), 0 3px 8px -3px color-mix(in srgb, var(--pine) 80%, #000000); }
.ss__t.is-mine .ss__front { box-shadow: 0 0 0 1.500px var(--pine), 0 0 0 4px color-mix(in srgb, var(--pine) 18%, transparent); color: var(--pine); }
.ss__t:focus-visible .ss__front, .ss__t:focus-visible .ss__back { outline: 2px solid var(--ink); outline-offset: 2px; }

.ss__note { margin-top: clamp(4px, 1.600vh, 8px); font-size: 12px; font-weight: 600; color: var(--soft); text-align: center; }
.ss__note .ss__roll { height: 17px; line-height: 17px; }
.ss__note.is-open { color: var(--pine); }

.ss__btn { display: grid; place-items: center; width: 100%; height: 42px; margin-top: clamp(6px, 2vh, 10px); border: 0; border-radius: 21px; background: var(--ink); color: #ffffff; font: inherit; cursor: pointer; outline: none; -webkit-tap-highlight-color: transparent; touch-action: manipulation; transition: background-color 0.3s ease; }
.ss__btn .ss__roll { height: 20px; font-size: 14px; line-height: 20px; font-weight: 680; font-stretch: 104%; }
.ss__btn[aria-busy="true"] { cursor: default; background: #3a3c44; }
.ss__btn:focus-visible { box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px var(--accent); }

.ghost {
  position: fixed;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  pointer-events: none;
  fill: #17181c;
  stroke: #ffffff;
  stroke-width: 1.4;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 4px rgba(23, 24, 28, 0.3));
  opacity: 0;
  visibility: hidden;
  z-index: 5;
}

@media (hover: hover) {
  .ss__btn:not([aria-busy="true"]):hover { background: #2c2e36; }
}
