@media (max-width: 1280px) and (max-height: 620px) and (orientation: landscape) {
  .right-rail {
    position: relative;
    grid-column: 2;
    grid-row: 1 / 3;
    z-index: 30;
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
    gap: 6px;
    pointer-events: none;
  }

  .right-rail > .test-setup-panel {
    display: none;
  }

  .mobile-test-setup-button {
    display: grid;
  }

  .test-setup-sheet {
    justify-self: end;
    align-self: stretch;
    width: min(430px, calc(100vw - 12px));
    height: auto;
    max-height: calc(100vh - 12px);
    grid-template-rows: auto minmax(0, 1fr);
    gap: 8px;
    padding: 10px;
  }

  .test-setup-sheet .test-setup-panel {
    display: grid;
    position: static;
    z-index: auto;
    width: auto;
    max-height: none;
    min-height: 0;
    overflow: auto;
    padding: 10px;
    gap: 8px;
    pointer-events: auto;
  }

  .test-setup-sheet .test-setup-panel .section-title {
    display: none;
  }

  .test-setup-sheet .modal-title {
    font-size: 0.84rem;
    line-height: 1.05;
  }

  .test-setup-sheet .modal-head .ghost-button {
    min-height: 30px;
    padding: 5px 8px;
    font-size: 0.66rem;
  }

  .test-field {
    font-size: 0.58rem;
  }

  .test-field select {
    min-height: 28px;
    padding: 5px 6px;
    font-size: 0.62rem;
  }

  .test-start-button {
    min-height: 34px;
    padding: 6px 8px;
    font-size: 0.62rem;
  }

  .top-actions {
    position: absolute;
    top: 76px;
    right: 4px;
    display: grid;
    justify-content: end;
    gap: 6px;
    pointer-events: auto;
  }

  .gear-button {
    width: 38px;
    height: 38px;
    font-size: 1rem;
  }

  .log-panel {
    display: none;
  }

  .mobile-log-peek {
    position: fixed;
    z-index: 36;
    left: 50%;
    top: auto;
    right: auto;
    bottom: 104px;
    width: min(220px, 30vw);
    height: 34px;
    min-width: 0;
    padding: 4px 8px;
    transform: translateX(-50%);
    border: 1px solid rgba(80, 200, 255, 0.56);
    background: linear-gradient(135deg, rgba(5, 18, 32, 0.94), rgba(3, 8, 15, 0.88));
    color: var(--text);
    box-shadow: 0 0 18px rgba(80, 200, 255, 0.2), 0 0 28px rgba(0, 0, 0, 0.45);
    clip-path: polygon(0 10px, 10px 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr) auto;
    gap: 6px;
    align-items: center;
    text-align: left;
  }

  .mobile-log-peek.bot {
    border-color: rgba(255, 75, 67, 0.62);
    box-shadow: 0 0 18px rgba(255, 75, 67, 0.2), 0 0 28px rgba(0, 0, 0, 0.45);
  }

  .mobile-log-mark {
    width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    border-left: 1px solid currentColor;
    border-right: 1px solid currentColor;
    color: var(--blue-soft);
    font-size: 0.72rem;
    font-weight: 900;
  }

  .mobile-log-peek.bot .mobile-log-mark {
    color: var(--red-soft);
  }

  .mobile-log-main {
    min-width: 0;
    display: grid;
    gap: 1px;
  }

  .mobile-log-label {
    color: var(--muted);
    font-size: 0.42rem;
    line-height: 1;
    font-weight: 900;
    text-transform: uppercase;
  }

  .mobile-log-text {
    min-width: 0;
    overflow: hidden;
    display: block;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #eff9ff;
    font-size: 0.58rem;
    line-height: 1.12;
    font-weight: 900;
  }

  .mobile-log-time {
    display: block;
    color: var(--blue-soft);
    font-size: 0.52rem;
    font-weight: 900;
    white-space: nowrap;
  }

  .controls {
    position: absolute;
    right: 6px;
    bottom: 6%;
    width: 112px;
    align-self: auto;
    pointer-events: auto;
  }

  .control-stack {
    position: relative;
  }

  .control-stack:has(.mulligan-counter) {
    align-content: end;
  }

  .mulligan-counter {
    position: absolute;
    right: 0;
    bottom: calc(100% + 28px);
    width: max-content;
    max-width: 132px;
    margin: 0;
    padding: 4px 7px;
    border: 1px solid rgba(80, 200, 255, 0.36);
    background: rgba(3, 12, 20, 0.78);
    color: #dff8ff;
    font-size: 0.62rem;
    line-height: 1.08;
    font-weight: 900;
    text-align: right;
    text-transform: uppercase;
    box-shadow: 0 0 12px rgba(0, 0, 0, 0.34);
  }

  .mulligan-counter-full {
    display: none;
  }

  .mulligan-counter-short {
    display: inline;
  }

  .primary-button {
    min-height: 58px;
    padding: 9px 12px;
    font-size: 0.92rem;
    line-height: 1.05;
  }

  .action-meter {
    padding: 5px 6px;
  }

  .action-meter {
    min-height: 34px;
    font-size: 0.52rem;
    line-height: 1.08;
    white-space: normal;
  }

  .reaction-choice {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .reaction-choice .primary-button,
  .reaction-choice .ghost-button {
    min-height: 38px;
    padding: 7px 8px;
    font-size: 0.72rem;
  }

  .hand-dock {
    grid-column: 1 / 3;
    grid-row: 2;
    height: 100%;
    padding: 5px 122px 5px 32px;
  }

  .hand-scroll {
    grid-auto-columns: 82px;
    gap: 7px;
    padding: 10px 1px 6px;
  }

  .hand-arrow {
    width: 30px;
    height: 58px;
    font-size: 2rem;
  }

  .hand-arrow.left {
    left: 2px;
  }

  .hand-arrow.right {
    right: 116px;
  }

  .card {
    height: 92px;
    gap: 3px;
    padding: 7px 6px 6px;
  }

  .card-name {
    padding-right: 20px;
    min-height: 26px;
    font-size: 0.66rem;
  }

  .card-art {
    min-height: 42px;
    font-size: 1.55rem;
  }

  .card-info {
    right: 5px;
    top: 5px;
    width: 18px;
    height: 18px;
    font-size: 0.68rem;
  }

  .card-confirm-badge {
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    padding: 4px 7px;
    font-size: 0.58rem;
  }

  .floating-card-tooltip {
    width: 220px;
    font-size: 0.72rem;
  }

  .modal-backdrop {
    place-items: stretch;
    padding: 6px 8px;
  }

  .modal-sheet {
    width: 100%;
    height: 100%;
    max-height: none;
    gap: 6px;
    padding: 10px;
  }

  .modal-sheet.post-match-sheet {
    width: min(680px, calc(100vw - 16px));
    max-height: calc(100vh - 12px);
    grid-template-columns: 1fr 1fr;
    gap: 7px 10px;
    padding: 10px;
  }

  .post-match-head,
  .post-match-sheet .post-match-rating {
    align-self: start;
  }

  .post-match-feedback {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  .post-match-actions,
  .post-match-sheet > .feedback-status {
    grid-column: 1 / -1;
  }

  .feedback-issue-options {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .modal-title {
    font-size: 0.96rem;
  }

  .modal-head .ghost-button,
  .builder-tabs .ghost-button {
    min-height: 30px;
    padding: 5px 9px;
    font-size: 0.68rem;
  }

  .builder-tabs {
    gap: 5px;
  }

  .builder-note {
    font-size: 0.68rem;
    line-height: 1.22;
  }

  .builder-difficulty {
    gap: 6px;
  }

  .builder-difficulty-label {
    font-size: 0.76rem;
  }

  .builder-stats {
    gap: 5px;
  }

  .builder-stats .mini-pill {
    padding: 2px 5px;
    font-size: 0.54rem;
  }

  .builder-list {
    gap: 5px;
    padding-right: 3px;
  }

  .builder-group-title {
    margin: 5px 0 2px;
    font-size: 0.78rem;
  }

  .builder-row {
    min-height: 48px;
    padding: 6px 8px;
  }

  .builder-card-name {
    gap: 5px;
    font-size: 0.76rem;
  }

  .builder-rarity-chip {
    min-width: 36px;
    min-height: 18px;
    padding: 2px 5px;
    font-size: 0.52rem;
  }

  .builder-card-meta {
    font-size: 0.66rem;
    line-height: 1.16;
  }

  .counter {
    grid-template-columns: 26px 32px 26px;
    gap: 4px;
  }

  .tiny-button {
    min-width: 26px;
    min-height: 26px;
    padding: 3px 6px;
  }

  .modal-foot {
    gap: 8px;
  }

  .modal-foot > .validation {
    min-width: 0;
    flex: 1 1 auto;
    font-size: 0.66rem;
  }

  .modal-foot .builder-tabs {
    flex: 0 0 auto;
  }

  .modal-foot .ghost-button,
  .modal-foot .primary-button {
    min-height: 38px;
    padding: 7px 10px;
    font-size: 0.74rem;
  }



  .card-reactor-badge {right: 0px;}
    .card-reactor-battery { width: 16px; height: 10px }
      .card-reactor-battery span {font-size: 0.42rem; font-weight: 400}
      .card-reactor-battery::after { top: 1px;width: 2px; height: 6px; right: -2px }
}
