@media (max-width: 640px) {
  :root { --mobile-side: 14px; --mobile-line: #e8ecf3; }

  html { overflow-x: hidden; background: #f7f8fb; }
  body {
    overflow-x: hidden;
    padding-bottom: calc(58px + env(safe-area-inset-bottom));
    background: #f7f8fb;
  }

  .topbar {
    height: 58px;
    padding: 0 var(--mobile-side);
    background: rgba(255,255,255,.97);
    border-bottom: 1px solid var(--mobile-line);
    box-shadow: none;
  }
  .brand-block { gap: 9px; }
  .brand-mark { width: 31px; height: 31px; border-radius: 9px; font-size: 12px; box-shadow: none; }
  .brand-block .eyebrow { display: none; }
  h1 { margin: 0; font-size: 17px; letter-spacing: -.03em; }
  .connection { padding: 5px 8px; font-size: 10px; border-radius: 999px; }

  .page { padding: 10px 0 0; }
  .hero-card { display: none; }

  .searchbox {
    margin: 0 0 8px;
    padding: 12px var(--mobile-side) 13px;
    gap: 8px;
    border: 0;
    border-bottom: 1px solid var(--mobile-line);
    border-radius: 0;
    background: #fff;
    box-shadow: none;
  }
  .searchbox.active { grid-template-columns: 1fr; }
  .field { gap: 5px; font-size: 10px; }
  .field-wide select { min-width: 0; width: 100%; }
  input, select { min-height: 40px; border-radius: 10px; background: #fff; }
  .action-row { grid-column: auto; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; }
  .action-row button { width: 100%; min-width: 0; min-height: 38px; padding: 8px 6px; box-shadow: none; font-size: 11px; }
  .action-row button:first-child { grid-column: 1 / -1; min-height: 40px; box-shadow: none; }
  .search-result { min-height: 0; margin-top: 1px; font-size: 10px; line-height: 1.35; }

  .toolbar {
    display: grid;
    grid-template-columns: minmax(0,2fr) minmax(82px,1fr);
    gap: 8px;
    align-items: end;
    margin: 0;
    padding: 9px var(--mobile-side) 10px;
    border: 0;
    border-bottom: 1px solid var(--mobile-line);
    border-radius: 0;
    background: #fff;
    box-shadow: none;
  }
  .meta {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3,minmax(0,1fr));
    gap: 5px;
    overflow: visible;
    padding: 0;
  }
  .meta span {
    min-width: 0;
    padding: 5px 4px;
    border-radius: 8px;
    background: #f3f5f8;
    font-size: 9px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .item-filter, .item-filter input, #page-size-wrap { width: 100%; min-width: 0; }
  .toolbar input, .toolbar select { min-height: 36px; padding: 7px 9px; }

  .data-card { overflow: visible; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
  .table-wrap { overflow: visible; }
  table { display: block; min-width: 0; width: 100%; }
  thead {
    display: block;
    margin: 0;
    padding: 8px var(--mobile-side);
    border-bottom: 1px solid var(--mobile-line);
    background: #fff;
  }
  thead tr {
    display: grid;
    grid-template-columns: repeat(5,minmax(0,1fr));
    gap: 6px;
    overflow: visible;
    padding: 0;
  }
  thead th { display: none; position: static; min-width: 0; padding: 0; border: 0; background: transparent; }
  thead th:nth-child(3),
  thead th:nth-child(5),
  thead th:nth-child(8),
  thead th:nth-child(9),
  thead th:nth-child(10) { display: block; }
  .sort-header {
    width: 100%;
    min-width: 0;
    min-height: 31px;
    justify-content: center;
    padding: 5px 3px;
    border: 1px solid #e3e7ee;
    border-radius: 9px;
    background: #fff;
    color: #6d798b;
    box-shadow: none;
    font-size: 9px;
    white-space: nowrap;
  }
  .sort-header:hover:not(:disabled) { transform: none; background: #fff; }
  .sort-header.asc, .sort-header.desc {
    border-color: #cbd5ff;
    background: #eef2ff;
    color: #4864e4;
  }

  tbody { display: block; background: #fff; }
  tbody tr {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 0 14px;
    padding: 13px var(--mobile-side) 12px;
    border: 0;
    border-bottom: 1px solid var(--mobile-line);
    border-radius: 0;
    background: #fff;
    box-shadow: none;
  }
  tbody tr:hover { background: #fff; }
  tbody td {
    min-width: 0;
    padding: 0;
    border: 0;
    white-space: normal;
    text-align: left;
    font-size: 10px;
    color: #59677a;
  }
  tbody td::before { color: #9aa5b5; font-size: 8px; font-weight: 700; }

  tbody td:nth-child(1) {
    grid-column: 1 / -1;
    margin-bottom: 7px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f1f3f7;
    font-size: 14px;
    line-height: 1.3;
    color: #3158dc;
  }
  tbody td:nth-child(2), tbody td:nth-child(4), tbody td:nth-child(7), tbody td:nth-child(11) { display: none; }

  tbody td:nth-child(3), tbody td:nth-child(5), tbody td:nth-child(6), tbody td:nth-child(8) {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    min-height: 25px;
    margin: 0;
    padding: 3px 0;
    background: transparent;
    border-radius: 0;
    font-size: 9px;
    font-weight: 700;
    color: #59677a;
  }
  tbody td:nth-child(3) { grid-column: 1; grid-row: 2; }
  tbody td:nth-child(5) { grid-column: 2; grid-row: 2; }
  tbody td:nth-child(6) { grid-column: 1; grid-row: 3; }
  tbody td:nth-child(8) { grid-column: 2; grid-row: 3; text-align: right; }
  tbody td:nth-child(3)::before { content: "Lv"; }
  tbody td:nth-child(5)::before { content: "봉인"; }
  tbody td:nth-child(6)::before { content: "판매자"; }
  tbody td:nth-child(8)::before { content: "수량"; }

  tbody td:nth-child(9) {
    grid-column: 1 / -1;
    grid-row: 4;
    display: flex;
    justify-content: space-between;
    margin-top: 2px;
    padding-top: 6px;
    border-top: 1px solid #f1f3f7;
    color: #7f8a9b;
    font-size: 9px;
  }
  tbody td:nth-child(9)::before { content: "남은 시간"; }

  tbody td:nth-child(10) {
    grid-column: 1;
    grid-row: 5;
    align-self: end;
    margin-top: 10px;
    padding-right: 10px;
    font-size: 15px;
    line-height: 1.05;
    font-weight: 850;
    color: #1f2d43;
    white-space: nowrap;
    overflow: visible;
  }
  tbody td:nth-child(10)::before { display: none; }
  tbody td:nth-child(10) .auction-price-unit { margin-top: 3px; font-size: 8px; white-space: nowrap; }

  tbody td:nth-child(12) {
    grid-column: 2;
    grid-row: 5;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    align-self: end;
    justify-self: stretch;
    margin-top: 8px;
  }
  tbody td:nth-child(12)::before { display: none; }
  .auction-option-button {
    width: auto;
    min-width: 0;
    min-height: 32px;
    padding: 6px 8px;
    border-radius: 9px;
    font-size: 9px;
    justify-content: center;
    white-space: nowrap;
  }
  .auction-option-count { margin-left: 3px; padding: 1px 5px; font-size: 8px; }
  .auction-combat-power { margin-top: 2px; font-size: 8px; }

  .empty { display: block !important; grid-column: 1 / -1 !important; padding: 30px var(--mobile-side) !important; text-align: center !important; }

  .pager {
    display: grid;
    grid-template-columns: repeat(3,minmax(0,1fr));
    gap: 7px;
    margin: 0;
    padding: 10px var(--mobile-side) 12px;
    border: 0;
    border-bottom: 1px solid var(--mobile-line);
    border-radius: 0;
    background: #fff;
  }
  .pager > button { width: 100%; min-height: 34px; padding: 6px 4px; box-shadow: none; font-size: 10px; }
  #page-buttons {
    grid-column: 1 / -1;
    grid-row: 1;
    display: grid;
    grid-template-columns: repeat(7,minmax(0,1fr));
    gap: 5px;
    width: 100%;
    overflow: hidden;
  }
  #page-buttons .page-number { width: 100%; min-width: 0; height: 30px; padding: 0 2px; border-radius: 8px; font-size: 9px; }
  #page-buttons .page-number:nth-child(n+8) { display: none; }
  #prev-page { grid-column: 1; grid-row: 2; }
  #page-info { grid-column: 2; grid-row: 2; align-self: center; text-align: center; font-size: 9px; white-space: nowrap; }
  #next-page { grid-column: 3; grid-row: 2; }

  .message-panel {
    margin: 8px 0 0;
    border: 0;
    border-radius: 0;
    background: #fff;
    box-shadow: none;
  }
  .message-header {
    display: grid;
    grid-template-columns: minmax(0,1fr) auto;
    gap: 8px;
    padding: 11px var(--mobile-side) 9px;
    align-items: center;
    border-bottom: 1px solid var(--mobile-line);
    background: #fff;
  }
  .message-header .eyebrow { display: none; }
  .message-header h2 { margin: 0; font-size: 14px; }
  .message-title-row { gap: 6px; }
  .message-filters {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 6px;
    margin: 0;
    font-size: 9px;
  }
  .message-filters label {
    justify-content: center;
    min-height: 30px;
    gap: 5px;
    padding: 5px 7px;
    border: 1px solid #e7eaf0;
    border-radius: 8px;
    background: #fafbfc;
  }
  .message-filters input { width: 13px; height: 13px; }

  .message-filter-bar {
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 7px;
    padding: 9px var(--mobile-side) 10px;
    border-bottom: 1px solid var(--mobile-line);
    background: #fff;
  }
  .message-filter-field { gap: 3px; font-size: 8px; }
  .message-filter-field.content { grid-column: 1 / -1; }
  .message-filter-field input { min-height: 36px; padding: 6px 8px; font-size: 10px; }
  .message-filter-count { grid-column: 1 / -1; min-height: 0; font-size: 8px; text-align: center; }

  .message-rows { max-height: 340px; overflow: auto; }
  .message-entry {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0,1fr);
    gap: 3px 7px;
    padding: 10px var(--mobile-side) 9px;
    padding-right: 104px;
    border-bottom: 1px solid #f0f2f6;
  }
  .message-time {
    position: absolute;
    top: 10px;
    right: var(--mobile-side);
    font-size: 8px;
    color: #8b97a8;
    white-space: nowrap;
  }
  .message-kind { grid-column: 1; align-self: center; padding: 2px 5px; font-size: 8px; }
  .message-sender { grid-column: 2; align-self: center; min-width: 0; font-size: 9px; }
  .message-text { grid-column: 1 / -1; margin-top: 2px; padding-right: 0; font-size: 11px; line-height: 1.42; }

  .help, .ldt-details { display: none; }
  .development-watermark-text { font-size: 40px; opacity: .12; }
}

@media (max-width: 390px) {
  :root { --mobile-side: 12px; }
  .sort-header { font-size: 8px; }
  .meta span { font-size: 8px; }
  tbody td:nth-child(10) { font-size: 14px; }
  .message-entry { padding-right: 96px; }
}
