@import url("styles.css?v=navmenu1");

body.warp-page {
  overflow-x: clip;
}

body.warp-page .page {
  max-width: none;
  width: 100%;
  margin: 0;
  min-width: 0;
  box-sizing: border-box;
  padding: 1rem 0.65rem 2rem;
}

@media (max-width: 480px) {
  body.warp-page .page {
    padding-left: 0.65rem;
    padding-right: 0.65rem;
  }

  body.warp-page .hero h1 {
    font-size: 1.65rem;
  }

  body.warp-page .subtitle {
    font-size: 0.875rem;
  }
}

.warp-toolbar {
  margin-bottom: 1.25rem;
}

.warp-toolbar-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
  gap: 0.85rem;
  align-items: center;
}

.warp-search-col {
  min-width: 0;
}

@media (max-width: 820px) {
  .warp-toolbar-grid {
    grid-template-columns: 1fr;
  }
}

.search-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.search-label {
  font-size: 0.8rem;
  color: var(--ts-muted);
}

.search-wrap input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: 0.5rem;
  border: 1px solid #ffffff1a;
  background: var(--ts-surface);
  color: var(--ts-text);
  font: inherit;
}

.warp-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

.warp-table-wrap,
.warp-map-wrap {
  min-width: 0;
  max-width: 100%;
}

.warp-table-wrap {
  display: flex;
  flex-direction: column;
}

@media (min-width: 1100px) {
  .warp-layout {
    grid-template-columns: minmax(0, 0.46fr) minmax(0, 1fr);
    align-items: start;
  }
}

.table-scroll {
  overflow: auto;
  max-height: min(70vh, 640px);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.table-scroll::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.warp-table {
  width: 100%;
  min-width: 18rem;
  border-collapse: collapse;
  font-size: 0.875rem;
  table-layout: fixed;
}

.warp-table th,
.warp-table td {
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid #ffffff12;
  text-align: left;
  vertical-align: top;
}

.warp-table th {
  position: sticky;
  top: 0;
  background: #1e282f;
  color: var(--ts-gold);
  font-weight: 600;
  z-index: 1;
}

.warp-table tbody tr {
  cursor: pointer;
  transition: background 0.15s ease;
}

.warp-table tbody tr:hover {
  background: #ffffff0a;
}

.warp-table tbody tr.is-selected {
  background: #20b2aa22;
  box-shadow: inset 3px 0 0 var(--ts-jade);
}

.col-id code,
.btn-copy-id {
  color: var(--ts-jade);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.warp-table .col-id {
  width: 6.5rem;
  min-width: 6.25rem;
  padding-right: 0.35rem;
}

.warp-table .col-name {
  width: 7.25rem;
  min-width: 6.75rem;
  padding-left: 0.2rem;
  padding-right: 0.35rem;
}

.warp-table .col-condition {
  width: auto;
  min-width: 7.5rem;
  padding-left: 0.35rem;
}

.col-name {
  font-weight: 600;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.col-condition {
  color: var(--ts-muted);
  line-height: 1.45;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (max-width: 1099px) {
  .table-scroll {
    max-height: min(48vh, 440px);
    overflow-x: hidden;
  }

  .warp-table-wrap {
    overflow-x: hidden;
  }

  .warp-table {
    font-size: 0.75rem;
    min-width: 0;
    width: 100%;
    table-layout: fixed;
  }

  .warp-table th,
  .warp-table td {
    padding: 0.4rem 0.28rem;
  }

  .warp-table .col-id {
    width: 22%;
    min-width: 4.75rem;
    padding-right: 0.2rem;
  }

  .warp-table .col-name {
    width: 28%;
    min-width: 0;
    padding-left: 0.12rem;
    padding-right: 0.2rem;
  }

  .warp-table .col-condition {
    width: auto;
    min-width: 0;
    padding-left: 0.2rem;
  }

  .col-id code,
  .btn-copy-id {
    font-size: 0.92rem;
  }

  .btn-copy-id {
    padding: 0.2rem 0.28rem;
  }
}

.col-condition .pin {
  margin-right: 0.15rem;
}

.btn-copy {
  border: 1px solid #ffffff22;
  background: transparent;
  color: var(--ts-text);
  font: inherit;
  padding: 0.25rem 0.4rem;
  border-radius: 0.35rem;
  cursor: pointer;
  max-width: 100%;
  line-height: 1.25;
  text-align: left;
}

.btn-copy-id {
  font-variant-numeric: tabular-nums;
}

.btn-copy:hover {
  border-color: var(--ts-jade);
  color: var(--ts-jade);
}

.btn-copy-id.is-copied {
  border-color: var(--ts-gold);
  color: var(--ts-gold);
}

.map-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.map-head h2 {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
  color: var(--ts-gold);
}

.map-zoom-controls {
  display: flex;
  gap: 0.35rem;
}

.map-zoom-btn {
  min-width: 2rem;
  height: 2rem;
  border-radius: 0.4rem;
  border: 1px solid #ffffff22;
  background: var(--ts-surface);
  color: var(--ts-text);
  font: inherit;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.map-zoom-btn:hover {
  border-color: var(--ts-jade);
  color: var(--ts-jade);
}

.map-open-tab-btn {
  font-size: 0.95rem;
}

.map-hint {
  margin: 0 0 0.65rem;
  font-size: 0.75rem;
  color: var(--ts-muted);
}

.map-selected {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  color: var(--ts-muted);
  line-height: 1.4;
  min-height: 2.5em;
  overflow-wrap: anywhere;
}

.map-stage {
  position: relative;
  display: inline-block;
  width: 100%;
  max-width: 100%;
  border-radius: 0.65rem;
  overflow: hidden;
  border: 1px solid #ffffff14;
  background: #0a1218;
  line-height: 0;
  vertical-align: top;
}

.map-viewport {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  aspect-ratio: 1024 / 657;
  height: auto;
  max-width: 100%;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
  user-select: none;
}

.map-viewport.is-dragging {
  cursor: grabbing;
}

.warp-calibrate .map-viewport {
  cursor: crosshair;
}

@media (max-width: 1099px) {
  .map-viewport {
    max-height: min(52vh, 460px);
    width: min(100%, calc(min(52vh, 460px) * 1024 / 657));
    margin-inline: auto;
  }
}

.map-panzoom {
  position: relative;
  width: 100%;
  height: 100%;
}

.world-map {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Desktop 1920×1080 @ 100% — ย่อหัวข้อ + จัดเลย์เอาต์ให้ไม่ scroll ทั้งหน้า */
@media (min-width: 1100px) {
  body.warp-page {
    overflow: hidden;
    height: 100dvh;
  }

  body.warp-page .page {
    padding: 0.4rem 0.5rem 0.45rem;
    height: 100%;
    max-height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  body.warp-page .hero {
    margin-bottom: 0.35rem;
    flex-shrink: 0;
  }

  body.warp-page .back-btn {
    padding: 0.2rem 0.55rem;
    font-size: 0.72rem;
  }

  body.warp-page .badge {
    margin-bottom: 0.2rem;
    padding: 0.1rem 0.5rem;
    font-size: 0.62rem;
    letter-spacing: 0.06em;
  }

  body.warp-page .hero h1 {
    font-size: 1.125rem;
    margin: 0 0 0.15rem;
    line-height: 1.2;
  }

  body.warp-page .subtitle {
    font-size: 0.68rem;
    margin: 0 auto;
    max-width: 50rem;
    line-height: 1.35;
  }

  body.warp-page .subtitle code {
    font-size: 0.65rem;
  }

  body.warp-page .warp-toolbar.card {
    margin-bottom: 0.35rem;
    padding: 0.4rem 0.6rem;
    flex-shrink: 0;
  }

  body.warp-page .warp-toolbar-grid {
    gap: 0.55rem;
  }

  body.warp-page .tool-nav-compact .tool-tile {
    padding: 0.28rem 0.22rem 0.32rem;
  }

  body.warp-page .tool-nav-compact .tool-name {
    font-size: 0.62rem;
  }

  body.warp-page .tool-nav-compact .tool-glyph {
    width: 1.2rem;
    height: 1.2rem;
    font-size: 0.75rem;
  }

  body.warp-page .search-label {
    font-size: 0.8rem;
  }

  body.warp-page .search-wrap {
    gap: 0.35rem;
  }

  body.warp-page .search-wrap input {
    padding: 0.5rem 0.75rem;
    font-size: inherit;
  }

  body.warp-page .warp-toolbar .hint {
    margin: 0.2rem 0 0;
    font-size: 0.875rem;
    line-height: 1.35;
  }

  body.warp-page .warp-layout {
    flex: 1;
    min-height: 0;
    gap: 0.5rem;
    align-items: stretch;
    grid-template-rows: minmax(0, 1fr);
  }

  body.warp-page .warp-layout > .card {
    margin-bottom: 0;
    padding: 0.4rem 0.5rem;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
  }

  body.warp-page .table-scroll {
    flex: 1;
    min-height: 0;
    max-height: none;
    overflow: auto;
  }

  body.warp-page .warp-map-wrap {
    align-self: stretch;
    min-height: 0;
  }

  body.warp-page .map-head {
    flex-shrink: 0;
    margin-bottom: 0.15rem;
  }

  body.warp-page .map-head h2 {
    font-size: 1.1rem;
    margin: 0;
  }

  body.warp-page .map-selected {
    font-size: 0.875rem;
    min-height: 0;
    margin: 0.15rem 0 0.35rem;
    line-height: 1.4;
  }

  body.warp-page .map-hint {
    display: none;
  }

  body.warp-page .map-zoom-btn {
    min-width: 1.6rem;
    height: 1.6rem;
    font-size: 0.8rem;
  }

  body.warp-page .map-stage {
    flex: 1;
    min-height: 0;
    width: 100%;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0a1218;
  }

  /* ภาพรวม — สัดส่วน 1024:657 (ขอบดำได้) */
  body.warp-page .map-viewport {
    aspect-ratio: 1024 / 657;
    height: 100%;
    width: auto;
    max-width: 100%;
    max-height: 100%;
    flex: 0 1 auto;
    margin: 0;
  }

  /* ซูมเข้า — เต็มการ์ด 100% ไม่มีขอบดำ */
  body.warp-page .map-stage.is-map-zoomed {
    align-items: stretch;
    justify-content: stretch;
  }

  body.warp-page .map-viewport.is-zoomed {
    aspect-ratio: auto;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    flex: 1 1 auto;
    align-self: stretch;
  }

  body.warp-page .warp-table .col-id {
    width: 6.75rem;
  }

  body.warp-page .warp-table .col-id code,
  body.warp-page .btn-copy-id {
    font-size: 1.05rem;
  }
}
