/* V7 incremental responsive layout. Breakpoints use CSS viewport pixels, not device resolution. */
:root {
  --app-height: 100vh;
  --top-stack-height: 94px;
  --sticky-head-height: 63px;
  --bottom-bar-height: 78px;
}
@supports (height: 100dvh) {
  :root {
    --app-height: 100dvh;
  }
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 80px;
}
body {
  min-width: 0;
  width: 100%;
  overflow-wrap: break-word;
}
.shell,
.detail-wrap {
  width: 100%;
  min-width: 0;
}
.shell {
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
}
img,
video {
  max-width: 100%;
}
button,
input,
textarea,
select {
  max-width: 100%;
}
input,
textarea,
select {
  font-size: 16px;
}
button {
  touch-action: manipulation;
}
button:focus-visible,
a:focus-visible {
  outline: 3px solid #bd946a;
  outline-offset: 2px;
}
.brand,
.top-actions,
.section-title > *,
.strip > *,
.video-row > *,
.detail-main > *,
.accountbar > * {
  min-width: 0;
}
.brandmark {
  flex-shrink: 0;
}
.top-actions {
  flex-shrink: 0;
}
.section-title,
.classic-title,
.address-title,
.address-sheet-head,
.accountbar,
.picker-size-heading {
  flex-wrap: wrap;
}
.section-title .small,
.classic-title small,
.panel p,
.detail-desc,
.address-radio span,
.address-line,
.checkout-variant,
.codebox {
  overflow-wrap: anywhere;
}
.productgrid,
.category-grid,
.series-grid,
.classic-category-view,
.fieldrow,
.rules-grid,
.detail-main {
  min-width: 0;
}
.product,
.product .details {
  min-width: 0;
}
.product h3 {
  overflow-wrap: anywhere;
  min-height: 0;
}
.primary,
.ghost,
.product button,
.classic-sidebar button,
.bottomnav button,
.quick-series button {
  min-height: 44px;
}
#content {
  min-height: calc(var(--app-height) - var(--top-stack-height));
  padding-bottom: calc(var(--bottom-bar-height) + 24px);
}
.bottom-inner {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}
.bottomnav button {
  min-width: 0;
  line-height: 1.4;
}
.detail-top {
  top: var(--sticky-head-height);
}
#pageProductDetail {
  padding-bottom: calc(110px + env(safe-area-inset-bottom));
  min-height: var(--app-height);
}
.detail-actions {
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
}
.detail-actions > div {
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
}
.detail-actions button {
  min-width: 0;
  white-space: normal;
}
.video-page {
  margin-left: 0;
  margin-right: 0;
  min-height: 0;
}
.videotop {
  min-width: 0;
  max-width: 540px;
}
.videotop > strong {
  flex-shrink: 0;
}
.videofilters {
  min-width: 0;
}
.video-feed {
  height: calc(var(--app-height) - var(--top-stack-height) - var(--bottom-bar-height) - 44px);
  min-height: 120px;
  max-width: 540px;
}
.video-text {
  overflow-wrap: anywhere;
}
.video-text button {
  max-width: 100%;
  white-space: normal;
  min-height: 44px;
}
.dialog {
  padding: 12px;
  padding-top: max(12px, env(safe-area-inset-top));
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}
.modal,
.picker-card,
.address-sheet {
  min-width: 0;
  max-height: calc(var(--app-height) - 24px);
  max-height: calc(
    var(--app-height) - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom)
  );
  overscroll-behavior: contain;
}
.modal {
  width: 100%;
  max-width: 530px;
}
.modal > label,
.modal > form {
  display: block;
  min-width: 0;
}
.modal select,
.modal input:not([type='checkbox']):not([type='radio']) {
  width: 100%;
  min-width: 0;
}
.modal select {
  overflow: hidden;
  text-overflow: ellipsis;
}
.picker-card,
.address-sheet {
  width: 100%;
  max-width: 540px;
}
.picker-title h2 {
  min-width: 0;
  overflow-wrap: anywhere;
}
.picker-title button {
  flex-shrink: 0;
}
.video-row {
  flex-wrap: wrap;
}
.video-row > div:first-child {
  flex: 1 1 120px;
  overflow-wrap: anywhere;
}
.admin-table,
.detail-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
#modules {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.panel pre {
  max-width: 100%;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.toast {
  max-width: calc(100vw - 24px);
  overflow-wrap: anywhere;
  bottom: calc(var(--bottom-bar-height) + 12px);
}
@media (max-width: 767px) {
  :root {
    --head: 59px;
    --sticky-head-height: 59px;
  }
  .shell {
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }
  .toprow {
    min-height: 59px;
    height: auto;
    padding-top: 8px;
    padding-bottom: 8px;
  }
  .brand b {
    font-size: 16px;
    letter-spacing: 1px;
  }
  .top-actions button {
    min-height: 40px;
    font-size: 12px;
    padding: 8px 10px;
  }
  .hero {
    padding: 28px 18px 30px;
  }
  .hero h1 {
    font-size: clamp(28px, 7.5vw, 42px);
  }
  .hero p {
    font-size: 14px;
  }
  .category-grid,
  .series-grid,
  .productgrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .section-title h2 {
    font-size: 22px;
  }
  .intro h1 {
    font-size: 26px;
  }
  .intro p {
    line-height: 1.7;
  }
  .classic-category-view {
    grid-template-columns: clamp(82px, 24vw, 132px) minmax(0, 1fr);
    gap: 10px;
  }
  .classic-sidebar {
    top: calc(var(--sticky-head-height) + 8px);
    max-height: calc(
      var(--app-height) - var(--sticky-head-height) - var(--bottom-bar-height) - 24px
    );
  }
  .classic-sidebar strong {
    font-size: 12px;
    padding: 12px 8px;
  }
  .classic-sidebar button {
    font-size: 13px;
    white-space: normal;
    padding: 12px 8px;
    overflow-wrap: anywhere;
  }
  .classic-right .productgrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .classic-title {
    font-size: 14px;
  }
  .classic-right .product h3 {
    font-size: 12px;
    line-height: 1.6;
    min-height: 0;
  }
  .product .details {
    padding: 10px;
  }
  .product button,
  .classic-right .product button {
    font-size: 12px;
    padding: 9px 5px;
    white-space: normal;
    line-height: 1.5;
  }
  .product .price {
    font-size: 18px;
  }
  .strip {
    flex-wrap: wrap;
    padding: 12px;
  }
  .strip > div {
    flex: 1 1 160px;
  }
  .fieldrow,
  .picker-fields {
    grid-template-columns: minmax(0, 1fr);
  }
  .detail-main {
    display: block;
    padding: 0;
  }
  .detail-left {
    padding: 0 12px;
  }
  .detail-info,
  .detail-section {
    margin: 10px 12px 0;
    padding: 16px;
  }
  .detail-info h1 {
    font-size: 21px;
    overflow-wrap: anywhere;
  }
  .detail-feature {
    grid-template-columns: minmax(60px, 28%) minmax(0, 1fr);
  }
  .detail-feature b {
    overflow-wrap: anywhere;
  }
  .detail-actions button {
    min-height: 48px;
    font-size: 14px;
  }
  .modal,
  .picker-card,
  .address-sheet {
    padding-left: 16px;
    padding-right: 16px;
  }
  .address-radio {
    flex-wrap: wrap;
  }
  .reward-hero {
    gap: 12px;
    padding: 18px 14px;
  }
  .codebox {
    font-size: 17px;
  }
  .fit-table th,
  .fit-table td {
    min-width: 60px;
  }
}
@media (max-width: 359px) {
  .classic-right .productgrid {
    grid-template-columns: minmax(0, 1fr);
  }
  .brand {
    gap: 7px;
  }
  .brand b {
    font-size: 15px;
  }
  .brand small {
    letter-spacing: 1px;
  }
  .brandmark {
    width: 32px;
    height: 32px;
  }
  .top-actions button {
    padding: 7px;
    font-size: 11px;
  }
  .hero {
    padding-left: 14px;
    padding-right: 14px;
  }
  .rules-grid,
  .reward-hero {
    grid-template-columns: minmax(0, 1fr);
  }
  .size-pills.size-reference-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .bottomnav button {
    font-size: 10px;
  }
}
@media (min-width: 768px) {
  .productgrid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .classic-category-view {
    grid-template-columns: clamp(150px, 20vw, 215px) minmax(0, 1fr);
    gap: 20px;
  }
  .classic-right .productgrid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (hover: none) and (pointer: coarse) and (orientation: landscape) and (max-height: 600px) {
  :root {
    --head: 48px;
    --navh: 58px;
    --sticky-head-height: 48px;
  }
  .toprow {
    height: 48px;
    min-height: 48px;
    padding-top: 4px;
    padding-bottom: 4px;
  }
  .bottom-inner {
    min-height: 58px;
  }
  .bottomnav button {
    padding-top: 5px;
    padding-bottom: 5px;
  }
  .bottomnav button .navicon {
    font-size: 18px;
  }
  .notice {
    padding-top: 4px;
    padding-bottom: 4px;
    font-size: 10px;
  }
  .detail-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
    padding: 12px;
  }
  .detail-left {
    padding: 0;
  }
  .detail-info,
  .detail-section {
    margin: 0 0 10px;
    padding: 12px;
  }
  .picker-card,
  .address-sheet {
    max-width: 680px;
  }
  .video-text {
    left: 12px;
    right: 65px;
    bottom: 10px;
  }
  .video-text b {
    font-size: 15px;
  }
  .video-text p {
    font-size: 11px;
    margin: 4px 0;
  }
  .video-aside {
    bottom: 12px;
    gap: 8px;
  }
  .video-aside button {
    width: 40px;
    height: 40px;
  }
}

#chatLog {
  max-height: 50vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.chat-line {
  max-width: 90%;
  padding: 10px 12px;
  margin: 10px 0;
  border-radius: 12px;
  overflow-wrap: anywhere;
}
.chat-line p {
  margin: 4px 0;
}
.chat-member {
  margin-left: auto;
  background: #edf4eb;
}
.chat-staff {
  background: #f2eee8;
}
