/* Sheets over the stage: blank picker, swap-or-pass, letters left, "pass the
   device" between two players, and the end card. */
.sc-sheet {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 16px max(24px, env(safe-area-inset-right, 0px))
    max(40px, calc(env(safe-area-inset-bottom, 0px) + 24px))
    max(24px, env(safe-area-inset-left, 0px));
  animation: sc-fade 0.25s ease;
}

.sc-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(46, 61, 57, 0.28);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.sc-handoff .sc-sheet-backdrop {
  background: rgba(228, 236, 230, 0.92);
}

.sc-sheet-card {
  position: relative;
  width: min(100%, 400px);
  max-height: 100%;
  overflow-y: auto;
  padding: 22px 18px 16px;
  border-radius: 22px;
  background: #fbfaf6;
  color: #2e3d39;
  text-align: center;
  box-shadow: 0 20px 50px rgba(46, 61, 57, 0.2);
  touch-action: pan-y;
  animation: sc-rise 0.3s ease;
}

.sc-sheet-title {
  margin: 0 0 8px;
  font-size: 1.25rem;
  font-weight: 800;
}

.sc-sheet-note {
  margin: 0 0 12px;
  color: #6c7f78;
  line-height: 1.4;
}

.sc-sheet-note:empty {
  display: none;
}

.sc-sheet-actions {
  display: grid;
  justify-items: center;
  gap: 10px;
  margin-top: 6px;
}

.sc-picks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
  gap: 6px;
  margin: 0 0 8px;
}

.sc-pick {
  min-height: 44px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(160deg, #fffaf0, #eddcb7);
  color: #b0705f;
  font: inherit;
  font-size: 1.2rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: inset 0 -3px 0 rgba(160, 130, 80, 0.28);
}

.sc-swap-tiles {
  display: grid;
  grid-template-columns: repeat(var(--rack, 7), minmax(0, 46px));
  justify-content: center;
  gap: 6px;
  margin: 0 0 14px;
  padding-top: 8px;
}

.sc-swap-tiles .sc-slot {
  cursor: pointer;
}

.sc-bag-letters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 10px;
  margin: 0 0 16px;
}

.sc-bag-item {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 16px;
}

.sc-bag-item .sc-tile {
  position: relative;
  width: 32px;
  height: 32px;
}

.sc-bag-item em {
  font-style: normal;
  font-size: 0.8rem;
  color: #6c7f78;
}

/* --- Definitions --- */
.sc-define-body {
  margin: 0 0 14px;
  text-align: left;
}

.sc-define-entry + .sc-define-entry {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #e4ebe6;
}

.sc-define-entry .sc-sheet-title {
  margin-bottom: 6px;
  letter-spacing: 0.06em;
}

.sc-define-text,
.sc-define-base {
  margin: 0 0 6px;
  line-height: 1.45;
}

.sc-define-base {
  color: #5d706a;
}

.sc-define-link {
  font-size: 0.82rem;
  color: #5f8f7a;
}

.sc-define-license {
  margin: 14px 0 0;
  font-size: 0.72rem;
  color: #8a9a94;
}

.sc-define-license a {
  color: inherit;
}

/* --- End card --- */
.sc-end-title {
  margin: 0 0 6px;
  font-size: 1.9rem;
  font-weight: 800;
  color: #3f7a60;
}

.sc-sheet[data-result="loss"] .sc-end-title {
  color: #a35b4b;
}

.sc-sheet[data-result="draw"] .sc-end-title {
  color: #6c7f78;
}

.sc-end-lines {
  margin: 0 0 14px;
}

.sc-end-lines p {
  margin: 0;
}

.sc-end-score {
  margin-top: 8px !important;
  font-weight: 700;
}

.sc-end-best {
  font-size: 0.85rem;
  color: #6c7f78;
}

@keyframes sc-fade {
  from {
    opacity: 0;
  }
}

/* Fade and grow only: a slide would scroll the page. */
@keyframes sc-rise {
  from {
    transform: scale(0.97);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sc-sheet,
  .sc-sheet-card {
    animation: none;
  }
}
