@layer game {
  .sheet {
    position: relative;
    z-index: 3;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: min(100%, 440px);
    max-height: 100%;
    padding: 14px;
    border: 1px solid rgb(201 162 74 / 0.6);
    border-radius: 20px;
    background: var(--laken-night);
    box-shadow: 0 10px 30px rgb(0 0 0 / 0.45);
    color: var(--felt-text);
  }

  /* The status line would only repeat the sheet's title, and the ladder needs the room. */
  .game-table:has(.sheet--active) .table-status { display: none; }
  .game-table__center:has(.sheet--active) { grid-row: 3 / 5; align-items: end; }

  .sheet--active { animation: sheet-up 240ms var(--ease-out) both; }

  @keyframes sheet-up { from { translate: 0 24px; opacity: 0; } }

  .sheet__header { display: grid; gap: 2px; }

  .sheet__title {
    color: var(--schuim);
    font-size: 1.3rem;
  }

  .sheet__subtitle { color: var(--felt-muted); font-size: 0.9rem; }

  .sheet__footer { padding-top: 2px; }

  .sheet__notice {
    padding: 8px 12px;
    border-left: 4px solid var(--messing);
    border-radius: 10px;
    background: rgb(201 162 74 / 0.16);
    color: var(--schuim);
    font-size: 0.92rem;
    font-weight: 700;
  }

  .bid-timeline {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .bid-timeline__item {
    display: inline-flex;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--felt-panel);
    font-size: 0.88rem;
  }

  .bid-timeline__who { font-weight: 700; }
  .bid-timeline__what { color: var(--messing-light); font-weight: 700; }
  .bid-timeline__item.is-pass .bid-timeline__what { color: var(--felt-muted); font-weight: 400; }
  .bid-timeline__item.is-empty { color: var(--felt-muted); }

  .bid-ladder {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 6px;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 2px;
    margin: -2px;
  }

  .bid-ladder .button_to,
  .bid-ladder .move-form { display: block; margin: 0; }

  .bid-ladder__button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    min-height: 44px;
    padding: 8px 12px;
    border: 0;
    border-radius: 12px;
    background: var(--schuim);
    color: var(--inkt);
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.2;
    text-align: left;
    box-shadow: 0 2px 0 rgb(0 0 0 / 0.25);
  }

  .bid-ladder__button:hover:not(:disabled) { background: #fff; box-shadow: 0 0 0 2px var(--messing), 0 2px 0 rgb(0 0 0 / 0.25); }

  .bid-ladder__go {
    flex: none;
    color: var(--laken);
    font-size: 1.1rem;
  }

  .bid-ladder__button.is-closed {
    background: transparent;
    box-shadow: inset 0 0 0 1px rgb(217 203 174 / 0.4);
    color: var(--felt-muted);
    font-weight: 400;
  }

  .btn--pass {
    min-height: 54px;
    border: 2px solid var(--messing);
    background: var(--eiken);
    color: var(--schuim);
    font-size: 1.15rem;
    letter-spacing: 0.04em;
  }

  .btn--pass:hover:not(:disabled) { background: var(--eiken-light); }

  .sheet .button_to:has(> .btn--block),
  .sheet .move-form:has(> .btn--block) { display: flex; width: 100%; }

  .suit-picker {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .suit-picker .move-form { display: block; margin: 0; }

  .suit-picker__button {
    display: grid;
    justify-items: center;
    gap: 2px;
    width: 100%;
    min-height: 104px;
    padding: 10px;
    border: 0;
    border-radius: 16px;
    background: linear-gradient(160deg, #fff, var(--card-face) 50%, #f3e9d6);
    box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.15), 0 3px 0 rgb(0 0 0 / 0.25);
    color: var(--inkt);
  }

  .suit-picker__button:hover:not(:disabled) { box-shadow: 0 0 0 3px var(--messing), 0 3px 0 rgb(0 0 0 / 0.25); }

  .suit-picker__symbol { color: var(--suit-ink); font-size: 2.6rem; line-height: 1; }
  .suit-picker__name { font-weight: 800; font-size: 1.05rem; }
  .suit-picker__count { color: #5e5546; font-size: 0.82rem; }
  .suit-picker__button.is-closed { opacity: 0.5; }

  .call-picker { display: grid; gap: 8px; }
  .call-picker .move-form { display: block; margin: 0; }

  .call-picker__button {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    min-height: 76px;
    padding: 8px 14px 8px 10px;
    border: 0;
    border-radius: 16px;
    background: var(--schuim);
    color: var(--inkt);
    font-size: 1.1rem;
    font-weight: 800;
    text-align: left;
    box-shadow: 0 3px 0 rgb(0 0 0 / 0.25);
  }

  .call-picker__button:hover:not(:disabled) { box-shadow: 0 0 0 3px var(--messing), 0 3px 0 rgb(0 0 0 / 0.25); }
  .call-picker__name { flex: 1; }

  .pass-game-picker { display: grid; gap: 10px; }
  .pass-game-picker .move-form { display: block; margin: 0; }

  .pass-game-picker__button {
    display: grid;
    gap: 4px;
    width: 100%;
    min-height: 76px;
    padding: 12px 16px;
    border: 0;
    border-radius: 16px;
    background: var(--schuim);
    color: var(--inkt);
    text-align: left;
    box-shadow: 0 3px 0 rgb(0 0 0 / 0.25);
  }

  .pass-game-picker__button:hover:not(:disabled) { box-shadow: 0 0 0 3px var(--messing), 0 3px 0 rgb(0 0 0 / 0.25); }

  .pass-game-picker__name {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 600;
    line-height: 1.15;
  }

  .pass-game-picker__rule { color: #3d372e; font-size: 0.92rem; line-height: 1.35; }
}

@media (min-width: 720px) {
  @layer game {
    .game-table__center:has(.sheet--active) { align-items: center; }
  }
}

@media (max-width: 719.98px) and (max-height: 760px) {
  @layer game {
    .suit-picker__button { min-height: 84px; padding-block: 6px; }
    .suit-picker__symbol { font-size: 2.1rem; }
  }
}

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