/* Auto Lottery Result add-on — responsive phone fix */
.auto-result-modal-card{
  max-width:1120px!important;
  width:min(96vw,1120px)!important;
  box-sizing:border-box;
}
.auto-result-top{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:10px;
  align-items:center;
  margin-bottom:12px
}
.auto-result-meta{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  min-width:0;
  font-size:12px;
  color:#475467
}
.auto-pill{
  padding:6px 9px;
  border:1px solid #e4e7ec;
  border-radius:999px;
  background:#f8fafc;
  font-weight:800;
  max-width:100%;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap
}
.auto-result-actions{
  display:flex;
  flex-wrap:wrap;
  justify-content:flex-end;
  gap:8px
}
.auto-api-box{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:8px;
  margin:10px 0
}
.auto-api-box input{
  min-height:40px;
  width:100%;
  min-width:0;
  box-sizing:border-box;
  border:1px solid #d8dee9;
  border-radius:10px;
  padding:0 11px
}
.auto-result-status{
  margin:10px 0;
  padding:10px 12px;
  border:1px solid #e6eaf0;
  border-radius:10px;
  background:#f8fafc;
  font-weight:800;
  font-size:12px;
  line-height:1.45;
  color:#475467;
  overflow-wrap:anywhere
}
.auto-result-status.ok{background:#ecfdf3;border-color:#bbf7d0;color:#166534}
.auto-result-status.bad{background:#fff1f2;border-color:#fecdd3;color:#9f1239}

.auto-result-scroll{
  width:100%;
  max-width:100%;
  overflow-x:auto;
  overflow-y:visible;
  -webkit-overflow-scrolling:touch;
  overscroll-behavior-x:contain;
  border:1px solid #e5e7eb;
  border-radius:12px;
  background:#fff
}
.auto-result-table{
  width:100%;
  border-collapse:collapse;
  min-width:720px;
  font-family:Arial,"Noto Sans Khmer",sans-serif
}
.auto-result-table th,.auto-result-table td{
  border:1px solid #d1d5db;
  padding:7px 8px;
  text-align:center;
  vertical-align:middle
}
.auto-result-table thead th{
  position:sticky;
  top:0;
  background:#f8fafc;
  z-index:2
}
.auto-result-table th:first-child,
.auto-result-table td:first-child{
  position:sticky;
  left:0;
  z-index:1;
  background:#fafafa
}
.auto-result-table thead th:first-child{z-index:3;background:#f8fafc}
.auto-result-table .prize{font-weight:900;white-space:nowrap;background:#fafafa}
.auto-result-table .g8{font-size:28px;font-weight:900;color:#9f1239}
.auto-result-table .g7{font-size:20px;font-weight:900;color:#1d4ed8}
.auto-result-table .special{font-size:25px;font-weight:900;color:#991b1b}
.auto-result-table .nums{white-space:pre-line;font-weight:800;line-height:1.45}
.auto-result-empty{padding:28px;text-align:center;color:#667085}

.auto-schedule{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  margin:10px 0 12px
}
.auto-schedule button{
  padding:7px 9px!important;
  font-size:11px!important;
  background:#fff!important;
  color:#344054!important;
  border:1px solid #d8dee9!important;
  white-space:nowrap
}
.auto-schedule button.active{
  background:#eef2ff!important;
  color:#3730a3!important;
  border-color:#a5b4fc!important
}
.auto-source-note{
  font-size:11px;
  line-height:1.45;
  color:#667085;
  margin:8px 0
}

/* Tablet */
@media(max-width:850px){
  #autoResultModal.pro-modal{
    padding:8px!important;
    align-items:flex-start!important;
    overflow:hidden!important;
  }

  .auto-result-modal-card{
    width:100%!important;
    max-width:100%!important;
    height:calc(100dvh - 16px)!important;
    max-height:calc(100dvh - 16px)!important;
    margin:0 auto!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
    overscroll-behavior:contain;
    -webkit-overflow-scrolling:touch;
  }

  #autoResultModal .pro-modal-head{
    position:sticky;
    top:0;
    z-index:20;
    background:#fff;
    margin:-1px -1px 10px;
    padding:2px 2px 10px;
    border-bottom:1px solid #edf0f5;
  }

  .auto-result-top{grid-template-columns:1fr}
  .auto-result-actions{justify-content:stretch}
  .auto-api-box{grid-template-columns:1fr}
  .auto-api-box button{width:100%}
}

/* Phone */
@media(max-width:650px){
  #autoResultModal.pro-modal{padding:0!important}

  .auto-result-modal-card{
    width:100vw!important;
    max-width:100vw!important;
    height:100dvh!important;
    max-height:100dvh!important;
    margin:0!important;
    border-radius:0!important;
    padding:12px!important;
  }

  #autoResultModal .pro-modal-head{
    min-height:48px;
    margin:-12px -12px 10px!important;
    padding:9px 12px!important;
    border-radius:0!important;
  }

  #autoResultModal .pro-modal-head h3{
    font-size:16px!important;
    line-height:1.25;
    margin:0!important;
  }

  #closeAutoResultBtn{
    width:42px!important;
    min-width:42px!important;
    height:42px!important;
    padding:0!important;
    flex:0 0 42px!important;
    font-size:18px!important;
  }

  .auto-result-top{
    display:flex;
    flex-direction:column;
    align-items:stretch;
    gap:9px
  }

  .auto-result-meta{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:6px;
  }
  .auto-result-meta .auto-pill{
    width:100%;
    box-sizing:border-box;
    text-align:center;
    padding:6px 7px;
    font-size:10px;
  }
  .auto-result-meta .auto-pill:last-child{
    grid-column:1/-1;
  }

  .auto-result-actions{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:7px;
  }
  .auto-result-actions button{
    width:100%!important;
    min-width:0!important;
    min-height:42px;
    padding:8px 6px!important;
    font-size:11px!important;
    line-height:1.25;
    white-space:normal!important;
  }

  .auto-schedule{
    display:grid;
    grid-template-columns:repeat(5,minmax(0,1fr));
    gap:5px;
    margin:8px 0 10px;
  }
  .auto-schedule button{
    width:100%!important;
    min-width:0!important;
    padding:7px 2px!important;
    font-size:9px!important;
    border-radius:8px!important;
  }

  .auto-api-box{gap:6px}
  .auto-api-box input{
    min-height:42px;
    font-size:12px;
  }
  .auto-api-box button{
    min-height:42px;
    font-size:12px!important;
  }

  #autoResultModal label{
    max-width:100%;
    line-height:1.35;
  }

  .auto-result-status{
    font-size:11px;
    padding:9px 10px;
    margin:8px 0;
  }

  .auto-source-note{font-size:10px}

  .auto-result-scroll{
    border-radius:9px;
    margin-bottom:max(8px,env(safe-area-inset-bottom));
  }

  .auto-result-table{
    min-width:600px;
    font-size:11px;
  }
  .auto-result-table th,.auto-result-table td{
    padding:6px 5px;
  }
  .auto-result-table th:first-child,
  .auto-result-table td:first-child{
    min-width:58px;
  }
  .auto-result-table .g8{font-size:22px}
  .auto-result-table .g7{font-size:17px}
  .auto-result-table .special{font-size:20px}
  .auto-result-table .nums{line-height:1.35}
}

/* Small phone */
@media(max-width:420px){
  .auto-result-modal-card{padding:9px!important}

  #autoResultModal .pro-modal-head{
    margin:-9px -9px 9px!important;
    padding:7px 9px!important;
  }

  .auto-result-meta{grid-template-columns:1fr 1fr}
  .auto-result-actions{grid-template-columns:1fr 1fr}

  .auto-schedule{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
  .auto-schedule button{
    font-size:10px!important;
    min-height:36px;
  }

  .auto-result-table{min-width:560px}
}

/* Very narrow phones */
@media(max-width:340px){
  .auto-result-actions{grid-template-columns:1fr}
  .auto-result-meta{grid-template-columns:1fr}
  .auto-result-meta .auto-pill:last-child{grid-column:auto}
}
