/* ==============================================
   Hello Page - Tablet / iPad (769px - 1024px)
   ============================================== */
@media screen and (min-width: 769px) and (max-width: 1024px) {

  /* --- Section & Content --- */
  .hello_section .content {
    width: calc(100% - 4rem);
    padding: 2.4rem 0 4rem;
  }

  /* --- Top Bar --- */
  .hello_section .hello_top h1 {
    font-size: 2.4rem;
  }

  .hello_section .hello_top .back {
    padding: 0 2rem;
    line-height: 3.8rem;
    font-size: 1.3rem;
  }

  .hello_section .hello_top .logo img {
    width: 8rem;
  }

  /* --- Main Area: stack vertically on tablet too --- */
  .hello_section .hello_main {
    flex-direction: column;
    margin-top: 3rem;
    gap: 3rem;
    align-items: stretch;
  }

  .hello_section .hello_main h2 {
    font-size: 2.6rem;
  }

  /* --- Upload Section (Right) -> appears first --- */
  .hello_section .hello_main .rt {
    width: 100%;
    order: 1;
    padding: 3rem 2.4rem;
    border-radius: 1.8rem;
  }

  .hello_section .hello_main .rt .wrap {
    padding: 2.8rem 3rem;
    border-radius: 1.6rem;
  }

  .hello_section .hello_main .rt .hello_upload {
    padding: 4rem 2.4rem 2.4rem;
  }

  .hello_section .hello_main .rt .hello_upload p {
    font-size: 1.5rem;
    margin-top: 3rem;
  }

  /* --- History: grid layout for tablet --- */
  .hello_section .hello_main .rt .history ul {
    gap: 1.6rem;
    max-height: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  }

  .hello_section .hello_main .rt .history li {
    width: auto;
    height: auto;
    aspect-ratio: 1;
  }

  /* --- How It Works (Left) -> appears second, two-column grid --- */
  .hello_section .hello_main .lt {
    order: 2;
  }

  .hello_section .hello_main .lt h2 {
    text-align: center;
  }

  .hello_section .hello_main .lt ul {
    margin-top: 2.4rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
  }

  .hello_section .hello_main .lt li {
    padding: 2rem;
    padding-left: 2rem;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 1.4rem;
    display: flex;
    align-items: center;
    gap: 1.6rem;
  }

  .hello_section .hello_main .lt li + li {
    margin-top: 0;
  }

  .hello_section .hello_main .lt li .icon {
    position: static;
    width: 5.2rem;
    height: 5.2rem;
    flex-shrink: 0;
  }

  .hello_section .hello_main .lt li .text {
    max-width: none;
  }

  .hello_section .hello_main .lt li .text h3 {
    font-size: 1.7rem;
  }

  .hello_section .hello_main .lt li .text p {
    font-size: 1.4rem;
    line-height: 2rem;
    margin-top: 0.4rem;
  }

  /* ==============================================
     Pattern Page - Tablet (769px - 1024px)
     ============================================== */

  /* Hide sidebar on tablet */
  .layout_sider {
    display: none;
  }

  .layout_container {
    height: auto;
    min-height: 100vh;
  }

  .layout_wrap {
    height: auto;
  }

  /* Header */
  .layout_header {
    padding: 1rem 2rem;
    gap: 1.4rem;
  }

  .layout_header::before {
    width: 100vw;
    transform: translateX(-50%);
  }

  .layout_header .header_title {
    font-size: 1.8rem;
    flex: 1;
    min-width: 0;
  }

  .layout_header .header_link {
    display: none;
  }

  .layout_header .logo img {
    height: 4rem;
  }

  /* Main body */
  main {
    overflow: visible;
  }

  .layout_body {
    min-height: auto;
    padding-bottom: 9rem;
  }

  /* Design layout: stack vertically on tablet portrait */
  .layout_main[data-main="design"] {
    padding: 1.2rem;
    gap: 0;
  }

  .layout_main[data-main="design"].active {
    flex-direction: column;
  }

  .layout_main[data-main="design"] .left {
    width: 100%;
    padding: 1.6rem;
    gap: 1.2rem;
  }

  .layout_main[data-main="design"] .left .main {
    height: auto;
    gap: 1.6rem;
  }

  .layout_main[data-main="design"] .left .lt {
    width: 9rem;
  }

  .layout_main[data-main="design"] .left .lt .img {
    min-height: 7.5rem;
    max-height: 7.5rem;
    border-radius: 1rem;
  }

  .layout_main[data-main="design"] .left .rt {
    height: auto;
    min-height: 28rem;
  }

  .layout_main[data-main="design"] .left .slide {
    height: auto;
    min-height: 26rem;
  }

  /* Right panel */
  .layout_main[data-main="design"] .right {
    width: 100%;
    padding: 1.6rem;
  }

  /* Pattern type + tile width */
  .layout_main[data-main="design"] .right .attrs {
    flex-direction: row;
    padding: 1.6rem;
    gap: 2rem;
    align-items: flex-start;
  }

  .layout_main[data-main="design"] .right .attrs .lt {
    margin-right: 0;
  }

  .layout_main[data-main="design"] .right .attrs .lt .title {
    font-size: 1.6rem;
    margin-bottom: 1rem;
  }

  .layout_main[data-main="design"] .right .attrs .lt ul {
    gap: 1rem;
  }

  .layout_main[data-main="design"] .right .attrs .lt li {
    width: 7.5rem;
  }

  .layout_main[data-main="design"] .right .attrs .lt li .img {
    height: 6rem;
    border-radius: 1rem;
  }

  .layout_main[data-main="design"] .right .attrs .lt li .name {
    font-size: 1.2rem;
    margin-top: 0.6rem;
  }

  .layout_main[data-main="design"] .right .attrs .rt {
    flex: 1;
    min-width: 0;
  }

  .layout_main[data-main="design"] .right .attrs .rt .tpc .title {
    font-size: 1.6rem;
  }

  .layout_main[data-main="design"] .right .attrs .rt .tpc .full {
    font-size: 1.4rem;
  }

  .layout_main[data-main="design"] .right .attrs .rt .slider {
    margin-top: 3.5rem;
  }

  .layout_main[data-main="design"] .right .attrs .rt .slider span {
    font-size: 1.3rem;
  }

  /* Fabric type */
  .layout_main[data-main="design"] .right .type {
    margin-top: 2rem;
  }

  .layout_main[data-main="design"] .right .type .img {
    width: 5.5rem;
    height: 5.5rem;
  }

  .layout_main[data-main="design"] .right .type .infos .title {
    font-size: 1.7rem;
  }

  .layout_main[data-main="design"] .right .type select {
    font-size: 1.4rem;
    height: 4.2rem;
    padding: 0 3.5rem 0 1.6rem;
    border-radius: 0.8rem;
    background-size: 1rem;
    background-position: right 1.5rem center;
  }

  /* Print size */
  .layout_main[data-main="design"] .right .size .size_options ul {
    gap: 1.6rem;
  }

  .layout_main[data-main="design"] .right .size .item select {
    min-width: 8rem;
  }

  /* Edge options */
  .layout_main[data-main="design"] .right .edge .img {
    width: 7rem;
    height: 7rem;
  }

  .layout_main[data-main="design"] .right .edge .name {
    width: 7rem;
    font-size: 1.2rem;
  }

  /* Footer: fixed bottom */
  .layout_footer,
  .layout_footer.active {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 0 2rem 0.6rem;
    min-height: auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 1rem;
    row-gap: 0;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
  }

  .layout_footer::before {
    width: 100%;
    left: 0;
    transform: none;
  }

  .layout_footer .note {
    flex-basis: 100%;
    width: calc(100% + 4rem);
    margin: 0 -2rem;
    font-size: 1.2rem;
    text-align: center;
    border-top: none;
    padding: 0.5rem 2rem;
    padding-top: 1rem;
    background: #ffffff;
    color: #5a6a85;
  }

  .layout_footer .qty_wrap {
    gap: 0.6rem;
    margin-top: 0.6rem;
  }

  .layout_footer .qty_wrap .qty_label {
    display: none;
  }

  .layout_footer .price {
    font-size: 2rem;
    font-weight: 600;
    padding: 0;
    flex: 1;
    text-align: right; 
    margin-top: 0.6rem;
  }

  .layout_footer .btn_b {
    font-size: 1.4rem;
    line-height: 3.8rem;
    min-width: auto;
    padding: 0 2rem;
    margin-top: 0.6rem;
  }

  .layout_footer .btn {
    font-size: 1.4rem;
    line-height: 3.8rem;
    min-width: auto;
    padding: 0 2.5rem;
    margin-top: 0.6rem;
  }

  /* Magnifier: hide on tablet */
  .magnifier-lens {
    display: none !important;
  }

  /* Modeling image */
  .modeling_image {
    right: 3rem !important;
    width: 16rem !important;
    height: 16rem !important;
  }

  /* Help Me Decide Modal */
  .help-decide-content {
    width: 95%;
  }

  .products-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.4rem;
    padding: 1.4rem;
  }

  /* ==============================================
     Design Page - Tablet (769px - 1024px)
     ============================================== */

  /* Stack preview on top, options below */
  .layout_body.active {
    flex-direction: column-reverse;
  }

  .layout_main {
    padding: 1.6rem;
    margin-right: 0;
  }

  .preview {
    width: 100%;
    height: auto;
    margin: 0;
    overflow: visible;
  }

  .preview .preview_top {
    padding: 1.4rem 2rem;
  }

  .preview .preview_wrap {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  .preview .preview_upload {
    min-height: 30rem;
    padding: 3rem;
    margin: 0 2rem;
  }

  .preview .preview_upload p {
    font-size: 1.8rem;
  }

  .preview .preview_bot {
    padding: 1.4rem 2rem;
  }

  .preview .canvas {
    height: auto;
  }

  /* Tabs */
  .tabs li {
    font-size: 1.5rem;
    line-height: 3.6rem;
  }

  /* Product Options */
  .products_options {
    padding: 2.4rem 2rem;
    margin-top: 1rem;
  }

  .products_options .title {
    font-size: 1.7rem;
  }

  .products_options .type .img {
    width: 8rem;
    height: 8rem;
  }

  .products_options .type select {
    height: 4.2rem;
    font-size: 1.4rem;
  }

  .products_options .size .item {
    grid-template-columns: 10rem 1fr auto;
    gap: 1rem;
  }

  .products_options .size .item .label {
    font-size: 1.6rem;
    white-space: nowrap;
  }

  .products_options .size .item select {
    min-width: 8rem;
  }

  .products_options .edge ul {
    gap: 1.4rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .products_options .edge li {
    width: 8rem;
    flex-shrink: 0;
  }

  .products_options .edge .name {
    font-size: 1.3rem;
    line-height: 1.6rem;
  }

  /* Design Tools */
  .design_tools {
    padding: 2rem 2rem;
    margin-top: 1rem;
  }

  .design_tools .top {
    gap: 1.6rem;
  }

  .design_tools .main {
    gap: 2rem;
    margin-top: 2rem;
    padding-top: 2rem;
  }

  .design_tools .main .layer .img {
    width: 12rem;
    height: 12rem;
  }

  .design_tools .main .actions .text_layer_box {
    width: 100%;
  }

  /* Images Modal */
  .images_modal .modal_wrap {
    margin: 20px auto;
    max-height: calc(100vh - 40px);
    height: calc(100% - 40px);
    width: calc(100% - 40px);
  }

  .images_modal .main {
    padding: 2rem;
  }

  .images_modal .list ul {
    grid-template-columns: repeat(6, 1fr);
    gap: 1rem;
  }

  /* Effects / Pattern popups */
  .effets_wrap,
  .pattern_wrap {
    max-width: 90%;
  }
}

/* ==============================================
   Landscape tablet / small laptop (1025px - 1280px)
   ============================================== */
@media screen and (min-width: 1025px) and (max-width: 1280px) {

  /* Hello page */
  .hello_section .content {
    width: calc(100% - 5rem);
  }

  .hello_section .hello_main .rt {
    width: 58%;
  }

  .hello_section .hello_main .lt li .text {
    max-width: 30rem;
  }

  .hello_section .hello_main .lt li .text h3 {
    font-size: 1.8rem;
  }

  .hello_section .hello_main .lt li .text p {
    font-size: 1.4rem;
    line-height: 2rem;
  }

  /* Pattern page: narrower sidebar, adjusted panels */
  .layout_sider {
    width: 7rem;
  }

  .sider_wrap {
    padding: 2rem 0.5rem 1rem;
  }

  .menu_item {
    min-height: 6rem;
  }

  .layout_header::before {
    width: calc(100vw + 7rem);
    transform: translateX(calc(-50% - 7rem));
  }

  .layout_footer::before {
    width: calc(100vw + 7rem);
    transform: translateX(calc(-50% - 7rem));
  }

  .layout_main[data-main="design"] .left {
    padding: 2rem 2.5rem;
  }

  .layout_main[data-main="design"] .right {
    padding: 1.5rem 2rem;
  }

  .modeling_image {
    right: 4rem !important;
    width: 20rem !important;
    height: 20rem !important;
  }
}
