/* 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}
}


/* LIVE inside Bunheng168 - no external website */
.live-lottery-btn{
  background:#b91c1c!important;color:#fff!important;border-color:#991b1b!important;
  white-space:nowrap;min-height:38px;font-weight:900!important;
}
.live-lottery-btn:hover{filter:brightness(.96)}
.live-lottery-btn.is-live{
  background:#15803d!important;border-color:#166534!important;
  box-shadow:0 0 0 4px rgba(34,197,94,.14)!important;
}
.live-inline-banner{
  display:flex;align-items:center;gap:9px;padding:9px 12px;margin:8px 0;
  border-radius:10px;background:linear-gradient(180deg,#d91c1c,#b80f0f);color:#fff;
  border:1px solid #9f1239;box-shadow:inset 0 1px rgba(255,255,255,.25);
  font-size:12px;font-weight:800;
}
.live-inline-banner.hidden{display:none!important}
.live-inline-banner strong{font-size:13px;letter-spacing:.1px}
.live-inline-banner #liveInlineInfo{margin-left:auto;opacity:.95;font-size:11px;text-align:right}
.live-dot{width:9px;height:9px;border-radius:50%;background:#fff;box-shadow:0 0 0 0 rgba(255,255,255,.7);animation:livePulse 1.25s infinite;flex:0 0 auto}
@keyframes livePulse{0%{box-shadow:0 0 0 0 rgba(255,255,255,.65)}70%{box-shadow:0 0 0 7px rgba(255,255,255,0)}100%{box-shadow:0 0 0 0 rgba(255,255,255,0)}}
#autoResultModal .auto-result-table thead th{background:#eef3fb;color:#0b4fc4;font-weight:900}
#autoResultModal .auto-result-table .g8{color:#b91c1c;font-weight:950}
#autoResultModal .auto-result-table .special{color:#b91c1c;font-weight:950;font-size:24px;letter-spacing:2px}
@media(max-width:650px){
  .live-lottery-btn{width:100%!important}
  .live-inline-banner{align-items:flex-start;flex-wrap:wrap;padding:8px 10px}
  .live-inline-banner #liveInlineInfo{width:100%;margin-left:18px;text-align:left;font-size:10px}
}

/* Compact image export: 3 columns only, every number in its own bordered row */
.auto-compact-export-wrap{
  position:fixed;
  left:-10000px;
  top:0;
  z-index:-1;
  background:#fff;
  padding:0;
  margin:0;
  width:max-content;
}
.auto-compact-export-table{
  border-collapse:collapse;
  border-spacing:0;
  table-layout:fixed;
  background:#fff;
  font-family:Arial,"Noto Sans Khmer",sans-serif;
  font-variant-numeric:tabular-nums;
}
.auto-compact-export-table td{
  width:126px;
  min-width:126px;
  height:31px;
  box-sizing:border-box;
  border:1px solid #8f8f8f;
  padding:1px 8px;
  background:#fff;
  color:#111827;
  text-align:center;
  vertical-align:middle;
  white-space:nowrap;
  font-size:20px;
  line-height:1.05;
  font-weight:800;
}
.auto-compact-export-table tr.g8 td{
  color:#980000;
  font-size:38px;
  line-height:1;
  font-weight:900;
  height:48px;
}
.auto-compact-export-table tr.g7 td{
  color:#0000d8;
  font-size:23px;
  line-height:1;
  font-weight:900;
  height:31px;
}
.auto-compact-export-table tr.special td{
  color:#980000;
  font-size:29px;
  line-height:1;
  font-weight:900;
  height:40px;
}


/* Night/Mien Bac export used every day at 6:30 PM, 7:30 PM and 8:30 PM. */
.auto-north-export-table{
  border-collapse:collapse;
  border-spacing:0;
  table-layout:fixed;
  width:472px;
  background:#fff;
  font-family:Arial,"Noto Sans Khmer",sans-serif;
  font-variant-numeric:tabular-nums;
}
.auto-north-export-table td{
  box-sizing:border-box;
  border:1px solid #8f8f8f;
  height:31px;
  padding:1px 5px;
  background:#fff;
  color:#111827;
  text-align:center;
  vertical-align:middle;
  white-space:nowrap;
  font-size:20px;
  line-height:1.05;
  font-weight:800;
}
.auto-north-export-table tr.special td{
  color:#980000;
  font-size:31px;
  line-height:1;
  height:43px;
  font-weight:900;
}
.auto-north-export-table tr.g1 td{
  color:#111827;
  font-size:24px;
  height:33px;
  font-weight:900;
}
.auto-north-export-table tr.g2 td,
.auto-north-export-table tr.g3 td,
.auto-north-export-table tr.g5 td{
  font-size:18px;
}
.auto-north-export-table tr.g4 td{
  font-size:18px;
}
.auto-north-export-table tr.g6 td{
  font-size:18px;
}
.auto-north-export-table tr.g7 td{
  color:#980000;
  font-size:24px;
  height:35px;
  font-weight:900;
}

/* V-NORTH APP COMPAT: exact compact Miền Bắc geometry for 6:30/7:30/8:30. */
.auto-north-export-wrap{
  width:376px !important;
  height:290px !important;
  overflow:hidden !important;
}
.auto-north-export-table{
  width:376px !important;
  height:290px !important;
  border-collapse:collapse !important;
  border-spacing:0 !important;
  table-layout:fixed !important;
  background:#fff !important;
  font-family:Arial,sans-serif !important;
}
.auto-north-export-table td{
  border:1px solid #929292 !important;
  padding:0 4px !important;
  color:#111827 !important;
  text-align:center !important;
  vertical-align:middle !important;
  white-space:nowrap !important;
  font-weight:800 !important;
  line-height:1.02 !important;
  box-sizing:border-box !important;
}
.auto-north-export-table tr.special td{height:40px !important;font-size:29px !important;color:#980000 !important;font-weight:900 !important;}
.auto-north-export-table tr.g1 td{height:33px !important;font-size:21px !important;font-weight:900 !important;}
.auto-north-export-table tr.g2 td{height:25px !important;font-size:14px !important;}
.auto-north-export-table tr.g3 td{height:42px !important;font-size:14px !important;}
.auto-north-export-table tr.g4 td{height:43px !important;font-size:14px !important;}
.auto-north-export-table tr.g5 td{height:42px !important;font-size:14px !important;}
.auto-north-export-table tr.g6 td{height:25px !important;font-size:14px !important;}
.auto-north-export-table tr.g7 td{height:31px !important;font-size:22px !important;color:#980000 !important;font-weight:900 !important;}
.auto-north-export-table .north-stack-line{height:19px;line-height:19px;display:block;}
