/* Viewer + shared tokens. Admin adds admin.css on top of this file. */
:root {
      --bg: #0f0f12;
      --surface: #18181d;
      --surface-hover: #222228;
      --border: #2a2a32;
      --text: #e8e6e3;
      --text-muted: #8b8685;
      --accent: #c9a227;
      --accent-dim: #8b7320;
      --success: #4a9b6e;
      --danger: #c75c5c;
    }

    * {
      box-sizing: border-box;
    }

    body {
      margin: 0;
      font-family: 'Outfit', system-ui, sans-serif;
      background: var(--bg);
      color: var(--text);
      min-height: 100vh;
      min-height: 100dvh;
      line-height: 1.5;
      overflow-x: clip;
      color-scheme: dark;
    }

    .layout {
      min-height: 100vh;
      display: flex;
      flex-direction: column;
    }

    main {
      padding: 2rem;
      max-width: 1200px;
      margin: 0 auto;
      width: 100%;
      flex: 1;
    }

    .site-footer {
      margin-top: auto;
      padding: 0.85rem 1.5rem 1.25rem;
      text-align: center;
      border-top: 1px solid var(--border);
      background: var(--surface);
    }

    .last-updated {
      margin: 0;
      font-size: 0.8rem;
      color: var(--text-muted);
      letter-spacing: 0.01em;
    }

    .last-updated time {
      color: var(--text);
      font-variant-numeric: tabular-nums;
    }

    @media (max-width: 768px) {
      main {
        padding: 1rem;
      }

      .site-footer {
        padding: 0.75rem 1rem 1rem;
      }

      h1 {
        font-size: 1.5rem;
      }

      .subtitle {
        font-size: 0.9rem;
        margin-bottom: 0.75rem;
      }

      .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
      }

      .tabs::-webkit-scrollbar {
        display: none;
      }

      .tab {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
        white-space: nowrap;
      }

      .search-bar input {
        max-width: 100%;
        font-size: 1rem;
        padding: 0.7rem 1rem;
      }

      .filter-field {
        flex: 1 1 140px;
      }

      .filter-field input[type="date"],
      .filter-field input[type="search"],
      .filter-field select {
        min-width: 0;
        width: 100%;
      }

      .card-search-field,
      .card-search-field input,
      .card-search-controls > input {
        max-width: 100%;
      }

      .tournament-header {
        flex-wrap: wrap;
        padding: 0.875rem 1rem;
      }

      .tournament-name {
        font-size: 0.95rem;
        flex: 1;
        min-width: 0;
      }

      .tournament-meta {
        font-size: 0.75rem;
        gap: 0.75rem;
        flex-wrap: wrap;
      }

      .standings {
        padding: 0.5rem 0.75rem 0.75rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
      }

      .standings-table {
        font-size: 0.85rem;
        min-width: 0;
      }

      .standings-table th {
        font-size: 0.7rem;
        padding: 0.4rem 0.5rem 0.4rem 0;
      }

      .standings-table td {
        padding: 0.5rem 0.5rem 0.5rem 0;
      }

      .deck-name {
        max-width: none;
        font-size: 0.8rem;
      }

      .deck-icon {
        width: 32px;
        height: 32px;
      }

      .btn-deck-image {
        padding: 0.4rem 0.6rem;
        font-size: 0.7rem;
        min-height: 32px;
      }

      .player-row,
      .deck-row {
        padding: 0.875rem 0.75rem;
        flex-wrap: wrap;
        gap: 0.5rem;
      }

      .player-row .player-name-link,
      .deck-row .deck-name-link {
        flex: 1;
        min-width: 0;
      }

      .player-row .player-events,
      .deck-row .deck-results-count {
        font-size: 0.85rem;
      }

      .pagination {
        flex-wrap: wrap;
        gap: 0.5rem;
        margin-top: 1rem;
      }

      .pagination-info {
        font-size: 0.8rem;
        margin: 0 0.25rem;
      }

      .pagination-btn {
        padding: 0.5rem 0.65rem;
        font-size: 0.85rem;
        min-height: 36px;
      }


      .page-header {
        margin-bottom: 1rem;
        padding-bottom: 0.75rem;
      }

      .page-title {
        font-size: 1.25rem;
      }

      .back-button {
        padding: 0.5rem 0.65rem;
        font-size: 0.85rem;
      }

      .player-result-card {
        padding: 0.75rem;
        margin-bottom: 0.5rem;
        gap: 0.5rem;
      }

      .player-result-card-header {
        gap: 0.75rem;
      }

      .player-result-card .event-name {
        font-size: 0.85rem;
        line-height: 1.3;
      }

      .player-result-card .event-date {
        font-size: 0.7rem;
        margin-bottom: 0.3rem;
      }

      .player-result-card .placing-record {
        font-size: 0.75rem;
      }

      .player-result-card .deck-name {
        font-size: 0.7rem;
        margin-top: 0.2rem;
      }

      .player-result-card-actions {
        gap: 0.4rem;
        margin-top: 0.2rem;
      }

      .player-result-card .btn-deck-image {
        padding: 0.4rem 0.65rem;
        font-size: 0.75rem;
        min-height: 32px;
      }

      .deck-result-card .player-name-inline {
        font-size: 0.95rem;
        margin-bottom: 0.4rem;
      }

      .modal-overlay {
        padding: 1rem;
      }

      .modal-content {
        max-height: calc(100vh - 2rem);
      }

      .modal-header {
        padding: 0.875rem 1rem;
      }

      .modal-body {
        padding: 0.75rem;
      }

      .decklist-pre {
        font-size: 0.75rem;
        padding: 0.75rem;
        max-height: 50vh;
      }

      .modal-actions {
        gap: 0.5rem;
      }

      .modal-actions .btn-deck-image {
        padding: 0.5rem 0.65rem;
        font-size: 0.8rem;
        min-height: 36px;
      }

      .decklist-content-row {
        flex-direction: column;
      }

      .deck-image-result {
        max-width: 100%;
      }
    }

    @media (max-width: 480px) {
      main {
        padding: 0.75rem;
      }

      h1 {
        font-size: 1.25rem;
      }

      .tab {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
      }

      .tournament-header {
        padding: 0.75rem;
      }

      .standings {
        padding: 0.5rem;
      }

      .standings-table {
        min-width: 0;
        font-size: 0.8rem;
      }

      .standings-table th {
        font-size: 0.65rem;
        padding: 0.35rem 0.4rem 0.35rem 0;
      }

      .standings-table td {
        padding: 0.4rem 0.4rem 0.4rem 0;
      }

      .deck-icon {
        width: 28px;
        height: 28px;
      }

      .deck-name {
        max-width: none;
        font-size: 0.75rem;
      }

      .btn-deck-image {
        padding: 0.35rem 0.5rem;
        font-size: 0.65rem;
        min-height: 28px;
      }

      .player-row,
      .deck-row {
        padding: 0.75rem;
      }

      .pagination-btn {
        padding: 0.45rem 0.6rem;
        font-size: 0.8rem;
        min-height: 32px;
      }

      .modal-overlay {
        padding: 0.5rem;
      }

      .modal-content {
        max-height: calc(100vh - 1rem);
        border-radius: 8px;
      }

      .modal-header {
        padding: 0.75rem;
      }

      .modal-body {
        padding: 0.5rem;
      }

      .decklist-pre {
        font-size: 0.7rem;
        padding: 0.5rem;
        max-height: 40vh;
      }


      .page-header {
        margin-bottom: 0.875rem;
        padding-bottom: 0.625rem;
      }

      .page-title {
        font-size: 1.1rem;
      }

      .back-button {
        padding: 0.45rem 0.6rem;
        font-size: 0.8rem;
      }

      .player-result-card {
        padding: 0.65rem;
        margin-bottom: 0.45rem;
        gap: 0.45rem;
      }

      .player-result-card-header {
        gap: 0.65rem;
      }

      .player-result-card .event-name {
        font-size: 0.8rem;
        line-height: 1.3;
      }

      .player-result-card .event-date {
        font-size: 0.65rem;
        margin-bottom: 0.25rem;
      }

      .player-result-card .placing-record {
        font-size: 0.7rem;
      }

      .player-result-card .deck-name {
        font-size: 0.65rem;
        margin-top: 0.2rem;
      }

      .player-result-card-actions {
        gap: 0.35rem;
        margin-top: 0.15rem;
      }

      .player-result-card .btn-deck-image {
        padding: 0.35rem 0.6rem;
        font-size: 0.7rem;
        min-height: 30px;
      }

      .deck-result-card .player-name-inline {
        font-size: 0.85rem;
        margin-bottom: 0.35rem;
      }
    }

    .tabs {
      display: flex;
      gap: 0;
      margin-bottom: 1.5rem;
      border-bottom: 1px solid var(--border);
    }

    .tab {
      background: none;
      border: none;
      border-bottom: 2px solid transparent;
      color: var(--text-muted);
      padding: 0.75rem 1.25rem;
      font-family: inherit;
      font-size: 1rem;
      font-weight: 500;
      cursor: pointer;
      margin-bottom: -1px;
      text-decoration: none;
      transition: color 0.15s, border-color 0.15s;
    }

    .tab:hover {
      color: var(--text);
    }

    .tab:visited {
      color: var(--text-muted);
    }

    .tab.active,
    .tab.active:visited {
      color: var(--accent);
      border-bottom-color: var(--accent);
    }

    .tab-panel {
      display: none;
    }

    .tab-panel.active {
      display: block;
    }

    .page-section-tabs {
      margin-top: 0.15rem;
      margin-bottom: 1.15rem;
    }

    .deck-sort-controls {
      display: flex;
      gap: 0.5rem;
      align-items: center;
      margin-bottom: 1rem;
      flex-wrap: wrap;
    }

    .deck-sort-label {
      font-size: 0.9rem;
      color: var(--text-muted);
    }

    .tab-panel .matchup-section {
      margin-bottom: 0;
    }

    .player-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0.75rem 1rem;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 8px;
      margin-bottom: 0.5rem;
      cursor: pointer;
      transition: background 0.15s;
    }

    .player-row:hover {
      background: var(--surface-hover);
    }

    .player-row .player-name-link {
      color: var(--accent);
      font-weight: 500;
      text-decoration: none;
    }

    .player-row .player-events {
      font-family: 'JetBrains Mono', monospace;
      font-size: 0.9rem;
      color: var(--text-muted);
    }

    .deck-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0.75rem 1rem;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 8px;
      margin-bottom: 0.5rem;
      cursor: pointer;
      transition: background 0.15s;
    }

    .deck-row:hover {
      background: var(--surface-hover);
    }

    .deck-row .deck-name-link {
      color: var(--accent);
      font-weight: 500;
      text-decoration: none;
    }

    .deck-row .deck-results-count {
      font-family: 'JetBrains Mono', monospace;
      font-size: 0.9rem;
      color: var(--text-muted);
    }

    .deck-result-card .player-name-inline {
      font-weight: 600;
      color: var(--accent);
      margin-bottom: 0.2rem;
      font-size: 0.85rem;
    }

    h1 {
      font-weight: 700;
      font-size: 1.75rem;
      letter-spacing: -0.02em;
      margin: 0 0 0.5rem;
      color: var(--accent);
    }

    .subtitle {
      color: var(--text-muted);
      margin-bottom: 1rem;
      font-size: 0.95rem;
    }

    .search-bar {
      margin-bottom: 1.25rem;
    }

    .matchup-rate {
      display: flex;
      align-items: center;
      gap: 0.55rem;
      min-width: 0;
    }

    .search-bar input {
      width: 100%;
      max-width: 320px;
      padding: 0.6rem 0.85rem;
      font-family: inherit;
      font-size: 0.95rem;
      color: var(--text);
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 8px;
      outline: none;
      transition: border-color 0.15s;
    }

    .filter-bar {
      display: flex;
      flex-direction: column;
      gap: 0.75rem;
      margin-bottom: 1.25rem;
    }

    .filter-bar .search-bar {
      margin-bottom: 0;
    }

    .filter-row {
      display: flex;
      flex-wrap: wrap;
      gap: 0.75rem;
      align-items: flex-end;
    }

    .filter-field {
      display: grid;
      gap: 0.3rem;
      font-size: 0.85rem;
      color: var(--text-muted);
    }

    .filter-field input[type="date"],
    .filter-field input[type="search"],
    .filter-field select {
      padding: 0.5rem 0.65rem;
      font-family: inherit;
      font-size: 0.9rem;
      color: var(--text);
      background: var(--bg);
      border: 1px solid var(--border);
      border-radius: 8px;
      min-width: 150px;
    }

    .filter-field select {
      min-width: 170px;
    }

    .detail-filters {
      margin-bottom: 1rem;
    }

    .detail-filters .search-bar {
      margin-bottom: 0.75rem;
    }

    .detail-filters .search-bar input {
      max-width: 100%;
    }

    .card-standings-filter {
      margin-bottom: 0.75rem;
    }

    .card-standings-filter input {
      max-width: 280px;
    }

    .filter-empty {
      color: var(--text-muted);
      text-align: center;
      padding: 1.5rem 1rem;
      font-size: 0.9rem;
    }

    .search-bar input::placeholder {
      color: var(--text-muted);
    }

    .search-bar input:focus {
      border-color: var(--accent-dim);
    }

    .card-search-controls {
      display: flex;
      flex-wrap: wrap;
      gap: 0.75rem;
      align-items: flex-start;
    }

    .card-search-field {
      position: relative;
      flex: 1 1 220px;
      max-width: 320px;
    }

    .card-search-field input,
    .card-search-controls > input {
      width: 100%;
      max-width: 320px;
    }

    .cards-filter-note {
      color: var(--text-muted);
      margin-bottom: 1rem;
    }

    .cards-filter-note a {
      color: var(--accent);
      text-decoration: none;
    }

    .cards-filter-note a:hover {
      text-decoration: underline;
    }

    .autocomplete-dropdown {
      position: absolute;
      top: 100%;
      left: 0;
      right: 0;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 6px;
      margin-top: 0.25rem;
      max-height: 300px;
      overflow-y: auto;
      z-index: 1000;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    .autocomplete-item {
      display: flex;
      align-items: center;
      min-height: 44px;
      padding: 0.75rem 1rem;
      cursor: pointer;
      border-bottom: 1px solid var(--border);
      color: var(--text);
    }

    .autocomplete-item:last-child {
      border-bottom: none;
    }

    .autocomplete-item:hover,
    .autocomplete-item.highlighted {
      background: var(--surface-hover);
    }

    .loading {
      padding: 2rem;
      color: var(--text-muted);
      font-size: 1rem;
    }

    .error {
      padding: 1rem 1.25rem;
      background: rgba(199, 92, 92, 0.15);
      border: 1px solid var(--danger);
      border-radius: 8px;
      color: #e8a0a0;
      margin-bottom: 1rem;
    }

    .tournament {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 10px;
      margin-bottom: 0.75rem;
      overflow: hidden;
    }

    .tournament-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 0.75rem;
      padding: 1rem 1.25rem;
      transition: background 0.15s;
    }

    .tournament-header:hover {
      background: var(--surface-hover);
    }

    .tournament-toggle {
      flex-shrink: 0;
      width: 1.5rem;
      height: 1.5rem;
      padding: 0;
      border: none;
      background: transparent;
      color: var(--text-muted);
      cursor: pointer;
      border-radius: 4px;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: transform 0.2s, color 0.15s;
    }

    .tournament-toggle:hover {
      color: var(--text);
    }

    .tournament.collapsed .tournament-toggle {
      transform: rotate(-90deg);
    }

    .tournament-toggle::before {
      content: '';
      width: 0;
      height: 0;
      border-left: 0.35rem solid transparent;
      border-right: 0.35rem solid transparent;
      border-top: 0.4rem solid currentColor;
      margin-bottom: 0.15rem;
    }

    .tournament-name {
      font-weight: 600;
      font-size: 1rem;
      flex: 1;
      min-width: 0;
    }

    .tournament-meta {
      display: flex;
      align-items: center;
      gap: 1rem;
      font-size: 0.85rem;
      color: var(--text-muted);
      font-family: 'JetBrains Mono', monospace;
    }

    .tournament-meta span {
      white-space: nowrap;
    }

    .tournament-body {
      overflow: hidden;
    }

    .tournament.collapsed .tournament-body {
      display: none;
    }

    .standings {
      border-top: 1px solid var(--border);
      padding: 0.75rem 1.25rem 1rem;
    }

    .standings-table {
      width: 100%;
      border-collapse: collapse;
      font-size: 0.9rem;
    }

    .standings-table th {
      text-align: left;
      padding: 0.5rem 0.75rem 0.5rem 0;
      font-weight: 600;
      color: var(--text-muted);
      font-size: 0.75rem;
      text-transform: uppercase;
      letter-spacing: 0.05em;
    }

    .standings-table td {
      padding: 0.5rem 0.75rem 0.5rem 0;
      border-top: 1px solid var(--border);
    }

    .player-name {
      color: var(--accent);
      cursor: pointer;
      text-decoration: none;
      font-weight: 500;
      border-radius: 4px;
      padding: 2px 4px;
      margin: -2px -4px;
      transition: background 0.15s, color 0.15s;
    }

    .player-name:hover {
      background: var(--accent-dim);
      color: var(--bg);
    }

    .record {
      font-family: 'JetBrains Mono', monospace;
      font-size: 0.85rem;
      color: var(--text-muted);
    }

    .record .w { color: var(--success); }
    .record .l { color: var(--danger); }
    .record .t { color: var(--text-muted); }

    .deck-name {
      font-size: 0.85rem;
      color: var(--text-muted);
      max-width: 180px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      display: flex;
      align-items: center;
      gap: 0.1rem;
    }

    .deck-name[data-deck-name]:not([data-deck-name=""]):not([data-deck-name="—"]) {
      color: var(--accent);
      cursor: pointer;
      font-weight: 500;
      border-radius: 4px;
      padding: 2px 4px;
      margin: -2px -4px;
      transition: background 0.15s, color 0.15s;
    }

    .deck-name[data-deck-name]:not([data-deck-name=""]):not([data-deck-name="—"]):hover {
      background: var(--accent-dim);
      color: var(--bg);
    }

    .deck-icon {
      width: 40px;
      height: 40px;
      flex-shrink: 0;
      image-rendering: pixelated;
    }

    .page-view {
      display: none;
    }

    .page-view.active {
      display: block;
    }

    .page-header {
      display: flex;
      align-items: center;
      gap: 1rem;
      margin-bottom: 1.5rem;
      padding-bottom: 1rem;
      border-bottom: 1px solid var(--border);
    }

    .back-button {
      background: var(--surface);
      border: 1px solid var(--border);
      color: var(--text);
      padding: 0.5rem 0.75rem;
      border-radius: 8px;
      cursor: pointer;
      font-family: inherit;
      font-size: 0.9rem;
      transition: background 0.15s, border-color 0.15s;
      flex-shrink: 0;
      display: flex;
      align-items: center;
      gap: 0.5rem;
    }

    .back-button:hover {
      background: var(--surface-hover);
      border-color: var(--accent-dim);
    }

    .page-title {
      font-weight: 700;
      font-size: 1.5rem;
      color: var(--accent);
      flex: 1;
      min-width: 0;
    }

    .sort-btn {
      background: var(--surface);
      border: 1px solid var(--border);
      color: var(--text);
      padding: 0.4rem 0.75rem;
      border-radius: 6px;
      cursor: pointer;
      font-family: inherit;
      font-size: 0.85rem;
      transition: background 0.15s, border-color 0.15s, color 0.15s;
    }

    .sort-btn:hover {
      background: var(--surface-hover);
      border-color: var(--accent-dim);
    }

    .sort-btn.active {
      background: var(--accent-dim);
      color: var(--bg);
      border-color: var(--accent);
      font-weight: 600;
    }

    .player-result-card {
      background: var(--bg);
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 0.75rem;
      margin-bottom: 0.5rem;
      display: flex;
      flex-direction: column;
      gap: 0.5rem;
      transition: border-color 0.15s, background 0.15s;
    }

    .player-result-card:hover {
      border-color: var(--accent-dim);
      background: var(--surface);
    }

    .player-result-card-header {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 1rem;
    }

    .player-result-card-main {
      flex: 1;
      min-width: 0;
    }

    .player-result-card .event-name {
      font-weight: 600;
      font-size: 0.9rem;
      margin-bottom: 0.2rem;
      word-break: break-word;
      line-height: 1.3;
    }

    .player-result-card .event-date {
      font-size: 0.75rem;
      color: var(--text-muted);
      margin-bottom: 0.35rem;
    }

    .player-result-card .placing-record {
      font-family: 'JetBrains Mono', monospace;
      font-size: 0.8rem;
      display: inline-flex;
      align-items: center;
      gap: 0.5rem;
    }

    .player-result-card .placing-record .place {
      color: var(--accent);
      font-weight: 600;
    }

    .player-result-card .deck-name {
      font-size: 0.75rem;
      color: var(--text-muted);
      margin-top: 0.25rem;
      word-break: break-word;
      display: flex;
      align-items: center;
      gap: 0.25rem;
    }

    .player-result-card .deck-name[data-deck-name]:not([data-deck-name=""]):not([data-deck-name="—"]) {
      color: var(--accent);
      font-weight: 500;
      transition: color 0.15s;
    }

    .player-result-card .deck-name[data-deck-name]:not([data-deck-name=""]):not([data-deck-name="—"]):hover {
      color: var(--bg);
      background: var(--accent-dim);
      border-radius: 4px;
      padding: 2px 4px;
      margin: -2px -4px;
    }

    .player-result-card-actions {
      display: flex;
      gap: 0.5rem;
      flex-wrap: wrap;
      margin-top: 0.25rem;
    }

    .player-result-card .btn-deck-image {
      width: auto;
      margin: 0;
      padding: 0.4rem 0.75rem;
      font-size: 0.8rem;
      flex-shrink: 0;
      transition: background 0.15s, border-color 0.15s, color 0.15s;
    }

    .empty-panel {
      color: var(--text-muted);
      font-size: 0.9rem;
      text-align: center;
      padding: 2rem 1rem;
    }

    .pagination {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 0.5rem;
      margin-top: 1.5rem;
      flex-wrap: wrap;
    }

    .standings .pagination {
      margin-top: 1rem;
    }

    .pagination-info {
      font-size: 0.9rem;
      color: var(--text-muted);
      margin: 0 0.5rem;
      font-family: 'JetBrains Mono', monospace;
    }

    .pagination-btn {
      background: var(--surface);
      border: 1px solid var(--border);
      color: var(--text);
      padding: 0.5rem 0.75rem;
      border-radius: 6px;
      cursor: pointer;
      font-family: inherit;
      font-size: 0.9rem;
      transition: background 0.15s, border-color 0.15s;
    }

    .pagination-btn:hover:not(:disabled) {
      background: var(--surface-hover);
      border-color: var(--accent-dim);
    }

    .pagination-btn:disabled {
      opacity: 0.4;
      cursor: not-allowed;
    }

    .btn-deck-image {
      background: var(--surface-hover);
      border: 1px solid var(--border);
      color: var(--accent);
      padding: 0.35rem 0.5rem;
      border-radius: 6px;
      cursor: pointer;
      font-family: inherit;
      font-size: 0.75rem;
      white-space: nowrap;
      transition: background 0.15s, border-color 0.15s, color 0.15s;
      font-weight: 500;
    }

    .btn-deck-image:hover:not(:disabled) {
      background: var(--accent-dim);
      color: var(--bg);
      border-color: var(--accent);
    }

    .btn-deck-image:disabled {
      opacity: 0.5;
      cursor: wait;
    }

    .modal-overlay {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.8);
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 1000;
      padding: 2rem;
      box-sizing: border-box;
    }

    .modal-overlay[hidden] {
      display: none;
    }

    .modal-content {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 12px;
      max-width: 100%;
      max-height: calc(100vh - 4rem);
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }

    #deck-image-modal .modal-content {
      width: min(960px, 100%);
    }

    #deck-image-modal .modal-body {
      align-items: stretch;
      justify-content: flex-start;
    }

    .modal-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 1rem 1.25rem;
      border-bottom: 1px solid var(--border);
      flex-shrink: 0;
    }

    .modal-title {
      font-weight: 600;
      font-size: 1rem;
      color: var(--text);
      min-width: 0;
      overflow-wrap: anywhere;
    }

    .modal-close {
      background: none;
      border: none;
      color: var(--text-muted);
      cursor: pointer;
      padding: 0.25rem;
      font-size: 1.5rem;
      line-height: 1;
      border-radius: 4px;
      transition: color 0.15s, background 0.15s;
    }

    .modal-close:hover {
      color: var(--text);
      background: var(--surface-hover);
    }

    .modal-body {
      padding: 1rem;
      overflow: auto;
      display: flex;
      align-items: center;
      justify-content: center;
      min-height: 200px;
    }

    .modal-body img {
      max-width: 100%;
      height: auto;
      display: block;
    }

    .modal-body .modal-loading,
    .modal-body .modal-error {
      color: var(--text-muted);
      padding: 2rem;
    }

    .modal-body .modal-error {
      color: var(--danger);
    }

    .decklist-modal-inner {
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      width: 100%;
      gap: 1rem;
    }

    .decklist-content-row {
      display: flex;
      flex-direction: column;
      gap: 1rem;
      width: 100%;
      align-items: stretch;
    }

    .deck-view-toggle {
      display: flex;
      gap: 0.4rem;
      flex-wrap: wrap;
    }

    .deck-preview-list {
      width: 100%;
      max-height: 60vh;
      overflow-y: auto;
      padding-right: 0.15rem;
    }

    #deck-preview-text {
      width: 100%;
    }

    .deck-preview-section + .deck-preview-section {
      margin-top: 1rem;
    }

    .deck-preview-section-title {
      margin: 0 0 0.55rem;
      font-size: 0.82rem;
      text-transform: uppercase;
      letter-spacing: 0.04em;
      color: var(--text-muted);
      display: flex;
      justify-content: space-between;
      gap: 0.5rem;
    }

    .deck-preview-section-title span {
      font-family: 'JetBrains Mono', monospace;
      color: var(--text);
      letter-spacing: 0;
      text-transform: none;
    }

    .deck-preview-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
      gap: 0.55rem;
    }

    .deck-preview-card {
      position: relative;
      display: flex;
      flex-direction: column;
      gap: 0.25rem;
      min-width: 0;
      cursor: pointer;
    }

    .deck-preview-card img,
    .deck-preview-fallback {
      width: 100%;
      aspect-ratio: 2.5 / 3.5;
      object-fit: cover;
      border-radius: 8px;
      border: 1px solid var(--border);
      background: var(--bg);
      display: block;
    }

    .deck-preview-fallback {
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 0.4rem;
      text-align: center;
      font-size: 0.68rem;
      color: var(--text-muted);
      line-height: 1.25;
    }

    .deck-preview-count {
      position: absolute;
      top: 0.3rem;
      left: 0.3rem;
      min-width: 1.35rem;
      padding: 0.05rem 0.28rem;
      border-radius: 4px;
      background: rgba(0, 0, 0, 0.78);
      color: #fff;
      font-family: 'JetBrains Mono', monospace;
      font-size: 0.72rem;
      text-align: center;
    }

    .deck-preview-name {
      font-size: 0.7rem;
      line-height: 1.2;
      color: var(--text-muted);
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .decklist-pre-hover {
      display: flex;
      flex-direction: column;
      gap: 0.1rem;
    }

    .decklist-section-label {
      color: var(--text-muted);
      font-weight: 600;
      margin-top: 0.35rem;
    }

    .decklist-line {
      display: block;
      border-radius: 4px;
      padding: 0.05rem 0.2rem;
      margin: 0 -0.2rem;
    }

    .decklist-line:hover {
      background: var(--surface-hover);
      color: var(--accent);
    }

    @media (max-width: 800px) {
      .deck-preview-grid {
        grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
      }
      .deck-image-result {
        max-width: 100%;
      }
    }

    .decklist-pre {
      font-family: 'JetBrains Mono', monospace;
      font-size: 0.8rem;
      white-space: pre-wrap;
      word-break: break-word;
      margin: 0;
      padding: 1rem;
      background: var(--bg);
      border: 1px solid var(--border);
      border-radius: 8px;
      overflow-y: auto;
      color: var(--text);
      flex: 1;
      min-width: 0;
      box-sizing: border-box;
      max-height: 60vh;
    }

    .deck-image-result {
      flex: 0 0 auto;
      max-width: 100%;
    }

    .deck-image-result img {
      max-width: 100%;
      height: auto;
      display: block;
      border-radius: 8px;
      border: 1px solid var(--border);
    }

    .modal-actions {
      display: flex;
      gap: 0.75rem;
      flex-wrap: wrap;
      margin: 0;
    }

    .modal-actions .btn-deck-image {
      margin: 0;
    }

    .modal-actions a.btn-deck-image {
      text-decoration: none;
      display: inline-block;
    }

    .deck-actions-cell {
      display: flex;
      gap: 0.4rem;
      flex-wrap: nowrap;
      white-space: nowrap;
    }

    .deck-actions-cell .btn-deck-image {
      flex-shrink: 0;
      margin: 0;
    }

    /* Stats & richer list metrics */
    .stats-summary {
      display: flex;
      flex-wrap: wrap;
      gap: 0.65rem;
      margin-bottom: 1.25rem;
    }

    .stats-pill {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 0.65rem 0.85rem;
      min-width: 110px;
      display: grid;
      gap: 0.15rem;
    }

    .stats-pill-label {
      font-size: 0.72rem;
      text-transform: uppercase;
      letter-spacing: 0.04em;
      color: var(--text-muted);
      font-weight: 600;
    }

    .stats-pill-value {
      font-size: 1rem;
      font-weight: 600;
    }

    .stats-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 1rem;
    }

    .stats-card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 1rem;
    }

    .stats-card-wide {
      grid-column: 1 / -1;
    }

    .stats-section-title {
      margin: 0 0 0.85rem;
      font-size: 0.95rem;
    }

    .meta-bar-row {
      display: grid;
      grid-template-columns: minmax(120px, 1.2fr) 1.4fr auto;
      gap: 0.55rem;
      align-items: center;
      padding: 0.35rem 0.15rem;
      cursor: pointer;
      border-radius: 6px;
    }

    .meta-bar-row:hover {
      background: var(--surface-hover);
    }

    .meta-bar-label {
      display: flex;
      align-items: center;
      gap: 0.15rem;
      font-size: 0.88rem;
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .meta-bar-track {
      height: 8px;
      background: var(--bg);
      border-radius: 999px;
      overflow: hidden;
      border: 1px solid var(--border);
    }

    .meta-bar-fill {
      height: 100%;
      background: var(--accent);
      border-radius: 999px;
    }

    .meta-bar-fill.conversion {
      background: var(--success);
    }

    .meta-bar-value {
      font-size: 0.78rem;
      color: var(--text-muted);
      font-family: 'JetBrains Mono', monospace;
      white-space: nowrap;
    }

    .tournament-meta-block {
      margin-top: 0.5rem;
      padding-top: 0.75rem;
      border-top: 1px solid var(--border);
    }

    .player-stats-inline,
    .deck-stats-inline {
      display: flex;
      align-items: center;
      gap: 0.45rem;
      flex-wrap: wrap;
      justify-content: flex-end;
    }

    .stat-chip {
      font-size: 0.75rem;
      color: var(--text-muted);
      border: 1px solid var(--border);
      border-radius: 999px;
      padding: 0.15rem 0.45rem;
      white-space: nowrap;
    }

    @media (max-width: 768px) {
      .stats-grid {
        grid-template-columns: 1fr;
      }

      .meta-bar-row {
        grid-template-columns: 1fr;
        gap: 0.25rem;
      }

      .player-stats-inline,
      .deck-stats-inline {
        justify-content: flex-start;
        width: 100%;
      }
    }

    .stats-date-filter {
      display: flex;
      flex-wrap: wrap;
      gap: 0.75rem;
      align-items: flex-end;
      margin-bottom: 1.25rem;
      padding: 0.85rem 1rem;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 12px;
    }

    .stats-date-field {
      display: grid;
      gap: 0.3rem;
      font-size: 0.85rem;
      color: var(--text-muted);
    }

    .stats-date-field input[type="date"] {
      padding: 0.5rem 0.65rem;
      font-family: inherit;
      font-size: 0.9rem;
      color: var(--text);
      background: var(--bg);
      border: 1px solid var(--border);
      border-radius: 8px;
      min-width: 150px;
    }

    .stats-date-optional {
      font-size: 0.75rem;
      color: var(--text-muted);
      font-weight: 400;
      text-transform: none;
      letter-spacing: 0;
    }

    .stats-date-range-label {
      font-size: 0.85rem;
      color: var(--text-muted);
      margin-left: auto;
      align-self: center;
    }

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

    .matchup-section {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 1rem;
      margin-bottom: 1.25rem;
    }

    .matchup-section-header {
      display: flex;
      flex-wrap: wrap;
      gap: 0.65rem;
      align-items: center;
      margin-bottom: 0.75rem;
    }

    .matchup-section-header .stats-section-title {
      margin: 0;
      flex: 1;
      min-width: 8rem;
    }

    .matchup-note {
      margin: 0 0 0.85rem;
      font-size: 0.82rem;
      color: var(--text-muted);
    }

    .matchup-bar {
      display: flex;
      height: 8px;
      min-width: 72px;
      background: var(--bg);
      border-radius: 999px;
      overflow: hidden;
      border: 1px solid var(--border);
    }

    .matchup-bar-win {
      background: var(--success);
      height: 100%;
    }

    .matchup-bar-tie {
      background: var(--text-muted);
      height: 100%;
      opacity: 0.55;
    }

    .matchup-bar-loss {
      background: var(--danger);
      height: 100%;
    }

    .matchup-wr {
      font-family: 'JetBrains Mono', monospace;
      font-size: 0.82rem;
      white-space: nowrap;
    }

    .matchup-wr.good { color: var(--success); }
    .matchup-wr.bad { color: var(--danger); }

    .matchup-matrix-wrap {
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
    }

    .matchup-matrix {
      width: 100%;
      border-collapse: collapse;
      font-size: 0.8rem;
      min-width: 520px;
    }

    .matchup-section .deck-name {
      max-width: none;
      overflow: visible;
      text-overflow: unset;
    }

    .matchup-opponent {
      display: flex;
      align-items: center;
      gap: 0.4rem;
      min-width: 0;
    }

    .typical-list-grid {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 1.1rem 1.4rem;
    }

    .typical-col-title {
      margin: 0 0 0.55rem;
      font-size: 0.82rem;
      text-transform: uppercase;
      letter-spacing: 0.04em;
      color: var(--text-muted);
      display: flex;
      justify-content: space-between;
      align-items: baseline;
      gap: 0.5rem;
    }

    .typical-col-avg {
      font-family: 'JetBrains Mono', monospace;
      color: var(--text);
      letter-spacing: 0;
      text-transform: none;
      font-size: 0.85rem;
    }

    .typical-card-row {
      display: grid;
      grid-template-columns: 3.15rem minmax(0, 1fr) 2.4rem;
      gap: 0.4rem;
      align-items: center;
      padding: 0.16rem 0.15rem;
      border-radius: 4px;
      cursor: pointer;
      color: inherit;
      text-decoration: none;
    }

    .typical-card-row:hover {
      background: var(--surface-hover);
    }

    .typical-count {
      font-family: 'JetBrains Mono', monospace;
      font-weight: 600;
      font-size: 0.82rem;
      color: var(--accent);
      text-align: right;
    }

    .typical-card-row.tech .typical-count {
      color: var(--text-muted);
      font-weight: 400;
    }

    .typical-name {
      min-width: 0;
      display: flex;
      align-items: baseline;
      gap: 0.4rem;
      font-size: 0.86rem;
    }

    .typical-card-title {
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .typical-card-row:hover .typical-card-title {
      color: var(--accent);
    }

    .typical-set {
      flex: 0 0 auto;
      font-family: 'JetBrains Mono', monospace;
      font-size: 0.7rem;
      letter-spacing: 0.02em;
      color: var(--text-muted);
      white-space: nowrap;
    }

    .typical-play {
      font-family: 'JetBrains Mono', monospace;
      font-size: 0.72rem;
      color: var(--text-muted);
      text-align: right;
    }

    .card-preview {
      position: fixed;
      z-index: 1200;
      width: 240px;
      pointer-events: none;
      filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.55));
    }

    .card-preview[hidden] {
      display: none !important;
    }

    .card-preview img {
      width: 100%;
      border-radius: 10px;
      display: block;
    }

    .card-preview-meta {
      margin-top: 0.35rem;
      font-size: 0.78rem;
      color: var(--text);
      text-shadow: 0 1px 2px #000;
    }

    @media (max-width: 768px) {
      .typical-list-grid {
        grid-template-columns: 1fr;
      }

      .typical-card-row {
        min-height: 40px;
      }
    }

    .matchup-matrix th,
    .matchup-matrix td {
      border: 1px solid var(--border);
      padding: 0.4rem 0.35rem;
      text-align: center;
      min-width: 3.4rem;
    }

    .matchup-matrix th {
      background: var(--bg);
      font-weight: 600;
      font-size: 0.72rem;
    }

    .matchup-matrix .matchup-matrix-corner,
    .matchup-matrix .matchup-matrix-rowhead {
      text-align: left;
      min-width: 8.5rem;
    }

    .matchup-matrix .matchup-matrix-rowhead {
      position: sticky;
      left: 0;
      background: var(--surface);
      z-index: 1;
    }

    .matchup-matrix td.matchup-cell {
      font-family: 'JetBrains Mono', monospace;
      cursor: pointer;
    }

    .matchup-matrix td.matchup-cell:hover {
      outline: 1px solid var(--accent);
    }

    .matchup-matrix td.matchup-cell.good {
      background: rgba(74, 155, 110, 0.18);
      color: var(--success);
    }

    .matchup-matrix td.matchup-cell.bad {
      background: rgba(199, 92, 92, 0.16);
      color: var(--danger);
    }

    .matchup-matrix td.matchup-cell.mirror {
      color: var(--text-muted);
      cursor: default;
    }

    .matchup-matrix td.matchup-cell.empty {
      color: var(--text-muted);
      cursor: default;
    }

    .matchup-matrix .matrix-deck {
      display: flex;
      align-items: center;
      gap: 0.15rem;
      cursor: pointer;
      color: var(--accent);
      font-weight: 500;
    }

    .matchup-matrix .matrix-deck:hover {
      text-decoration: underline;
    }

    .matchup-matrix .deck-icon {
      width: 22px;
      height: 22px;
    }

    @media (max-width: 768px) {
      .stats-date-range-label {
        margin-left: 0;
        width: 100%;
      }
    }

    /* —— Mobile layout —— */
    @media (max-width: 768px) {
      html {
        -webkit-text-size-adjust: 100%;
        text-size-adjust: 100%;
      }

      body {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
      }

      main {
        padding: 1rem;
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
      }

      .site-footer {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
      }

      input,
      select,
      textarea {
        font-size: 1rem;
        max-width: 100%;
      }

      button,
      .tab,
      .sort-btn,
      .pagination-btn,
      .back-button,
      .btn-deck-image {
        touch-action: manipulation;
      }

      .tabs {
        display: flex;
        flex-wrap: wrap;
        gap: 0;
        margin-bottom: 1.15rem;
        overflow: visible;
      }

      .tab {
        flex: 1 1 30%;
        min-width: 5.25rem;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 0.55rem 0.45rem;
        font-size: 0.82rem;
      }

      .page-header {
        align-items: flex-start;
        gap: 0.75rem;
      }

      .page-title {
        overflow-wrap: anywhere;
        word-break: break-word;
        line-height: 1.25;
      }

      .back-button,
      .sort-btn,
      .pagination-btn {
        min-height: 44px;
      }

      .btn-deck-image {
        min-height: 40px;
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
      }

      .search-bar input,
      .card-search-field,
      .card-search-field input,
      .card-search-controls > input,
      .card-standings-filter input,
      .detail-filters .search-bar input {
        max-width: 100%;
        width: 100%;
      }

      .card-search-controls {
        flex-direction: column;
        align-items: stretch;
      }

      .filter-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        align-items: end;
      }

      .filter-field {
        min-width: 0;
        flex: none;
      }

      .filter-field input[type="date"],
      .filter-field input[type="search"],
      .filter-field select {
        min-width: 0;
        width: 100%;
      }

      .filter-row > .sort-btn {
        grid-column: 1 / -1;
        width: 100%;
      }

      .stats-date-filter {
        display: grid;
        grid-template-columns: 1fr 1fr;
        align-items: end;
      }

      .stats-date-field input[type="date"] {
        min-width: 0;
        width: 100%;
      }

      .stats-date-filter > .sort-btn {
        width: 100%;
      }

      .stats-date-range-label {
        grid-column: 1 / -1;
        width: 100%;
      }

      .tournament-header {
        display: grid;
        grid-template-columns: 1fr;
        align-items: start;
        gap: 0.3rem 0.6rem;
      }

      .tournament-header:has(.tournament-toggle) {
        grid-template-columns: 2.75rem 1fr;
      }

      .tournament-toggle {
        grid-row: 1 / span 2;
        width: 2.75rem;
        height: 2.75rem;
        align-self: start;
      }

      .tournament-name {
        overflow-wrap: anywhere;
      }

      .tournament-meta {
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 0.45rem 0.85rem;
      }

      .player-row,
      .deck-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.45rem;
      }

      .player-stats-inline,
      .deck-stats-inline {
        justify-content: flex-start;
        width: 100%;
      }

      .stats-summary {
        display: grid;
        grid-template-columns: 1fr 1fr;
      }

      .stats-pill {
        min-width: 0;
      }

      .stats-date-optional {
        display: none;
      }

      .pagination {
        gap: 0.45rem;
      }

      .pagination-info + .pagination-info {
        display: none;
      }

      .standings {
        overflow-x: visible;
      }

      .standings-table.table-stack {
        min-width: 0;
        width: 100%;
      }

      .standings-table.table-stack thead {
        display: none;
      }

      .standings-table.table-stack,
      .standings-table.table-stack tbody {
        display: block;
      }

      .standings-table.table-stack tbody {
        display: flex;
        flex-direction: column;
        gap: 0.65rem;
      }

      .standings-table.table-stack tr {
        display: block;
        background: var(--bg);
        border: 1px solid var(--border);
        border-radius: 10px;
        padding: 0.75rem 0.85rem;
      }

      .standings-table.table-stack td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 0.75rem;
        padding: 0.28rem 0;
        border-top: none;
        text-align: right;
      }

      .standings-table.table-stack td + td {
        border-top: 1px solid var(--border);
      }

      .standings-table.table-stack td::before {
        content: attr(data-label);
        color: var(--text-muted);
        font-size: 0.7rem;
        font-weight: 600;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        text-align: left;
        flex: 0 0 auto;
      }

      .standings-table.table-stack td:not([data-label])::before {
        content: none;
      }

      .standings-table.table-stack td.deck-actions-cell,
      .standings-table.table-stack td:not([data-label]) {
        justify-content: flex-start;
        flex-wrap: wrap;
        white-space: normal;
        text-align: left;
        padding-top: 0.55rem;
      }

      .standings-table.table-stack .deck-name,
      .standings-table.table-stack .player-name,
      .standings-table.table-stack .tournament-name,
      .standings-table.table-stack .matchup-opponent {
        max-width: none;
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
        justify-content: flex-end;
        text-align: right;
      }

      .standings-table.table-stack .matchup-rate {
        justify-content: flex-end;
        flex-wrap: wrap;
      }

      .standings-table.table-compact-result tbody tr {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto;
        gap: 0.2rem 0.65rem;
        align-items: center;
      }

      .standings-table.table-compact-result td {
        border-top: none;
        padding: 0;
        text-align: left;
      }

      .standings-table.table-compact-result td[data-label="Place"] {
        grid-column: 1;
        grid-row: 1;
        font-weight: 700;
        color: var(--accent);
        font-family: 'JetBrains Mono', monospace;
      }

      .standings-table.table-compact-result td[data-label="Player"] {
        grid-column: 2;
        grid-row: 1;
        justify-content: flex-start;
      }

      .standings-table.table-compact-result td[data-label="Record"] {
        grid-column: 3;
        grid-row: 1;
        justify-content: flex-end;
      }

      .standings-table.table-compact-result td[data-label="Deck"] {
        grid-column: 1 / -1;
        grid-row: 2;
        justify-content: flex-start;
      }

      .standings-table.table-compact-result td.deck-actions-cell {
        grid-column: 1 / -1;
        grid-row: 3;
        padding-top: 0.4rem;
      }

      .standings-table.table-compact-result td[data-label="Place"]::before,
      .standings-table.table-compact-result td[data-label="Player"]::before,
      .standings-table.table-compact-result td[data-label="Record"]::before,
      .standings-table.table-compact-result td[data-label="Deck"]::before {
        content: none;
      }

      .standings-table.table-compact-result .deck-name,
      .standings-table.table-compact-result .player-name {
        justify-content: flex-start;
        text-align: left;
      }

      .modal-overlay {
        padding: 0;
        align-items: stretch;
        justify-content: stretch;
      }

      .modal-content {
        width: 100%;
        max-width: none;
        height: 100%;
        max-height: none;
        border-radius: 0;
        border-left: 0;
        border-right: 0;
      }

      .modal-header {
        padding: 0.75rem 0.9rem;
        padding-top: max(0.75rem, env(safe-area-inset-top));
      }

      .modal-close {
        min-width: 44px;
        min-height: 44px;
      }

      .modal-body {
        padding: 0.85rem;
        padding-bottom: max(0.85rem, env(safe-area-inset-bottom));
        align-items: stretch;
      }

      .modal-actions {
        position: sticky;
        bottom: 0;
        background: var(--surface);
        padding-top: 0.5rem;
      }

      .modal-actions .btn-deck-image {
        flex: 1 1 calc(50% - 0.5rem);
        text-align: center;
      }

      .matchup-matrix-wrap {
        margin-inline: -0.25rem;
        padding-bottom: 0.25rem;
      }

      .matchup-matrix-wrap::after {
        content: 'Swipe sideways to see more matchups';
        display: block;
        margin-top: 0.55rem;
        font-size: 0.75rem;
        color: var(--text-muted);
      }

      .matchup-matrix {
        min-width: 420px;
      }

      .matchup-matrix th,
      .matchup-matrix td {
        min-width: 2.6rem;
        padding: 0.3rem 0.2rem;
      }

      .matchup-matrix .matchup-matrix-corner,
      .matchup-matrix .matchup-matrix-rowhead {
        min-width: 6.25rem;
      }

      .card-preview {
        display: none !important;
      }
    }

    @media (max-width: 480px) {
      main {
        padding: 0.75rem;
        padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
      }

      .tab {
        padding: 0.5rem 0.35rem;
        font-size: 0.78rem;
      }

      .modal-actions .btn-deck-image {
        flex-basis: 100%;
      }
    }
