/* Shared public styles for lottery result and statistics shortcodes. */
.troy-page-box,
.troy-quick-summary {
  max-width: 1150px;
  margin: 0 auto 24px;
  border: 2px solid #d65300;
  background: #fff;
}

.troy-page-box h2,
.troy-quick-title {
  margin: 0;
  padding: 10px;
  background: #cf4f00;
  color: #fff;
  text-align: center;
  font-size: 19px;
  font-weight: 700;
}

.troy-page-box .troy-page-meta,
.troy-quick-group-title {
  padding: 8px;
  background: #fff0c5;
  color: #d65300;
  text-align: center;
  font-weight: 700;
}

.troy-page-table {
  width: 100%;
  border-collapse: collapse;
}

.troy-page-table th,
.troy-page-table td {
  border: 1px solid #d4d4d4;
  padding: 8px !important;
  text-align: center;
}

.troy-page-table th,
.troy-page-subtable h3 {
  background: #f4f4f4;
}

.troy-page-table tr:nth-child(even) td {
  background: #fafafa;
}

.troy-page-number {
  color: #d65300;
  font-size: 20px;
  font-weight: 700;
}

.troy-special-ending {
  color: #cf4f00;
}

.troy-special-history .troy-page-number {
  white-space: nowrap;
  color: #111;
}

.troy-special-page .troy-page-subtable {
  margin-top: 18px;
}

.troy-frequency-page {
  width: 100%;
}

.troy-frequency-page .troy-page-matrix {
  font-size: 14px;
}

.troy-page-empty {
  padding: 15px;
  text-align: center;
}

.troy-page-subtable {
  margin-top: 14px;
  overflow-x: auto;
}

.troy-page-subtable h3 {
  margin: 0;
  padding: 8px;
  text-align: left;
  font-size: 16px;
}

.troy-page-matrix {
  overflow-x: auto;
}

.troy-page-matrix .troy-page-table {
  min-width: 1800px;
  font-size: 12px;
}

.troy-page-matrix .troy-page-table th,
.troy-page-matrix .troy-page-table td {
  min-width: 24px;
  padding: 4px;
}

.troy-frequency-page h2 {
  font-size: 21px;
}

.troy-frequency-page .troy-page-matrix .troy-page-table {
  font-size: 14px;
}

.troy-frequency-page .troy-page-matrix .troy-page-table th,
.troy-frequency-page .troy-page-matrix .troy-page-table td {
  width: 32px;
  min-width: 32px;
  padding: 6px 5px;
  font-size: 14px;
}

.troy-frequency-page .troy-page-matrix .troy-page-table .troy-frequency-date {
  width: 92px;
  min-width: 92px;
}

.troy-frequency-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  padding: 10px 12px;
  background: #fff7ef;
  border-bottom: 1px solid #f0d8c5;
}

.troy-frequency-filters label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #555;
  font-size: 13px;
  font-weight: 700;
}

.troy-frequency-filters select {
  min-width: 120px;
  padding: 6px 8px;
  border: 1px solid #d4d4d4;
  background: #fff;
  color: #333;
  font-size: 13px;
}

.troy-frequency-top-number {
  color: #cf4f00;
}

/* Lô Gan follows the compact four-column statistics layout used by the reference. */
.troy-lo-gan-page,
.troy-lo-gan-secondary {
  overflow: hidden;
}

.troy-lo-gan-page .troy-lo-gan-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  padding: 10px 12px;
  background: #fff;
  border-bottom: 1px solid #e4e4e4;
}

.troy-lo-gan-radio {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  min-height: 32px;
  padding: 5px 12px;
  border: 1px solid #d5d5d5;
  border-radius: 3px;
  background: #f7f7f7;
  color: #333;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  user-select: none;
}

.troy-lo-gan-radio input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.troy-lo-gan-radio:has(input:checked) {
  border-color: #cf4f00;
  background: #cf4f00;
  color: #fff;
}

.troy-lo-gan-radio:focus-within,
.troy-lo-gan-switch:focus-within > span {
  outline: 2px solid #cf4f00;
  outline-offset: 2px;
}

.troy-lo-gan-switch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
  color: #333;
  cursor: pointer;
  user-select: none;
}

.troy-lo-gan-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.troy-lo-gan-switch > span {
  position: relative;
  display: inline-block;
  width: 37px;
  height: 23px;
  border-radius: 99px;
  background: #898989;
  transition: background .15s ease;
}

.troy-lo-gan-switch > span::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #fff;
  content: '';
  transition: left .15s ease;
}

.troy-lo-gan-switch input:checked + span {
  background: #cf4f00;
}

.troy-lo-gan-switch input:checked + span::after {
  left: 17px;
}

.troy-lo-gan-switch b {
  font-size: 14px;
}

.troy-lo-gan-table {
  table-layout: fixed;
  background: #fff;
}

.troy-lo-gan-table th,
.troy-lo-gan-table td {
  height: 37px;
  padding: 7px 5px !important;
  border-color: #e4e4e4;
  color: #333;
  font-size: 16px;
  line-height: 1.25;
}

.troy-lo-gan-table th {
  background: linear-gradient(to bottom, #fafafa, #eee);
  color: #333;
  font-weight: 700;
}

.troy-lo-gan-table tr:nth-child(even) td {
  background: #fff;
}

.troy-lo-gan-table th:nth-child(1),
.troy-lo-gan-table td:nth-child(1) {
  width: 25%;
}

.troy-lo-gan-table th:nth-child(2),
.troy-lo-gan-table td:nth-child(2),
.troy-lo-gan-table th:nth-child(4),
.troy-lo-gan-table td:nth-child(4) {
  width: 21%;
}

.troy-lo-gan-key {
  color: #222 !important;
  font-weight: 700;
}

.troy-lo-gan-red {
  color: #cf4f00 !important;
  font-size: 18px !important;
  font-weight: 700;
}

.troy-lo-gan-secondary {
  margin-bottom: 14px;
}

.troy-lo-gan-secondary h2,
.troy-lo-gan-primary h2 {
  padding: 8px 10px;
  font-size: 17px;
  line-height: 1.35;
}

.troy-sidebar-provinces {
  columns: 2;
  column-gap: 18px;
  margin: 0;
  padding-left: 18px;
}

.troy-sidebar-provinces li {
  break-inside: avoid;
}

@media (max-width: 549px) {
  .troy-sidebar-provinces {
    columns: 2;
    column-gap: 12px;
  }
}

.troy-lottery-block-tabs {
  display: flex;
  max-width: 1150px;
  margin: 0 auto 14px;
  gap: 4px;
  padding: 4px;
  border: 1px solid #f0c7a5;
  border-radius: 6px;
  background: #fff7ef;
}

.troy-lottery-block-tabs a {
  display: flex;
  flex: 1 1 0;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid #f0d8c5;
  border-radius: 5px;
  background: #fff;
  color: #7a3b1b;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  transition: background .15s, color .15s, border-color .15s;
}

.troy-lottery-block-tabs a.active,
.troy-lottery-block-tabs a:hover {
  border-color: #cf4f00;
  background: #cf4f00;
  color: #fff;
}

/* Keep the shared navigation markup for future use without showing it now. */
.troy-lottery-block-tabs {
  display: none;
}

.troy-quick-group {
  margin: 10px 0;
}

.troy-quick-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border-left: 1px solid #d4d4d4;
}

.troy-quick-grid>div {
    padding: 8px;
    text-align: center;
    border-right: 1px solid #d4d4d4;
    border-bottom: 1px solid #d4d4d4;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.troy-quick-grid b,
.troy-quick-grid span {
  display: block;
}

.troy-quick-grid b {
  color: #cf4f00;
  font-size: 20px;
}

.troy-quick-grid span {
  font-size: 15px;
}

.troy-lottery-history {
  max-width: 1150px;
  margin: 0 auto;
}

.troy-lottery-history .troy-lottery-crawler-result {
  max-width: 100%;
  margin-bottom: 24px;
}

.troy-lottery-crawler-result {
  max-width: 760px;
  margin: 0 auto 24px;
  border: 3px solid #f60;
  background: #fff;
}

.troy-lottery-crawler-result .troy-result-title {
  padding: 9px;
  background: #cf4f00;
  color: #fff;
  font-size: 19px;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
}

.troy-lottery-crawler-result .troy-result-meta {
  padding: 8px;
  background: #fff2bc;
  color: #cf4f00;
  font-weight: 700;
  text-align: center;
}

.troy-result-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 10px 0;
}

.troy-result-tabs a {
  padding: 7px 12px;
  border: 1px solid #d9d3cb;
  background: #efefef;
  color: #333;
  text-decoration: none;
}

.troy-result-tabs a.active {
  background: #cf4f00;
  color: #fff;
}

.troy-result-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 10px 8px;
}

.troy-result-filter {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 2px;
  border: 0;
  background: transparent;
  color: #555;
  font-size: 13px;
  cursor: pointer;
}

.troy-result-filter input {
  margin: 0 !important;
  accent-color: #cf4f00;
}

.troy-result-filter.active {
  color: #cf4f00;
  font-weight: 700;
}

.hover-panel {
  width: 100%;
  padding: 0 8px 8px;
}

.hover-row {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  width: 100%;
  gap: 2px;
}

.hover-row span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 35px;
  border: 1px solid #ddd;
  background: #f7f7f7;
  color: #555;
  font-size: 12px;
  cursor: pointer;
}

.hover-row span:hover,
.hover-row span.active {
  border-color: #e1bd00;
  background: #ffeb3b;
  color: #111;
}

.troy-hover-target.hover-highlight {
  background: transparent !important;
  color: inherit !important;
}

/* The source highlights Loto endings, never the complete prize cell. */
.number-grid .troy-hover-target.hover-highlight .troy-hover-tail,
.troy-result-head-tail .troy-hover-target.hover-highlight {
  border-radius: 2px;
  background: #ffeb3b !important;
  color: #111 !important;
}

.troy-result-table {
  width: 100%;
  border: 1px solid #d9d3cb;
  border-collapse: collapse;
  table-layout: fixed;
}

.troy-result-table tr {
  height: auto !important;
}

.troy-result-table tr:nth-child(even) {
  background: #efefef;
}

.troy-result-table td {
  height: auto !important;
  padding: 0;
  border: 1px solid #d9d3cb;
}

.troy-result-table .prize-label {
  width: 55px;
  padding: 8px 2px;
  background: transparent;
  color: #333;
  font-size: 16px;
  text-align: center;
}

.troy-result-table .number-cell,
.troy-result-table .number-grid {
  text-align: center;
}

.troy-result-table .number-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: flex-start;
  width: 100%;
}

.troy-result-table .number-grid > .troy-hover-target {
  box-sizing: border-box;
  flex: 1 1 100%;
  min-width: 0;
  padding: 9px 4px;
  border-left: 1px solid #d9d3cb;
  color: #111;
  font-size: 24px;
  font-weight: 700;
  line-height: 26px;
}

.troy-result-table .number-grid > .troy-hover-target:first-child {
  border-left: 0;
}

.troy-result-table .count-2 > .troy-hover-target { flex-basis: 50%; }
.troy-result-table .count-3 > .troy-hover-target { flex-basis: 33.333%; }
.troy-result-table .count-4 > .troy-hover-target { flex-basis: 25%; }
.troy-result-table .count-5 > .troy-hover-target { flex-basis: 20%; }
/* Six Northern prizes are arranged as two aligned rows of three cells. */
.troy-result-table .count-6 > .troy-hover-target { flex-basis: 33.333%; }
.troy-result-table .count-7 > .troy-hover-target { flex-basis: 25%; }

/* G.4 has seven values: four equal cells above and three wider cells below. */
.troy-result-table .number-grid.count-7 {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.troy-result-table .number-grid.count-7 > .troy-hover-target {
  width: auto;
  flex: none;
}

.troy-result-table .number-grid.count-7 > .troy-hover-target:nth-child(-n + 4) {
  grid-column: span 3;
}

.troy-result-table .number-grid.count-7 > .troy-hover-target:nth-child(n + 5) {
  grid-column: span 4;
  border-top: 1px solid #d9d3cb;
}

.troy-result-table .number-grid.count-6 > .troy-hover-target:nth-child(n + 4) {
  border-top: 1px solid #d9d3cb;
}

/* Do not stretch the final incomplete row; its cells retain the same borders. */
.troy-result-table .count-2 > .troy-hover-target,
.troy-result-table .count-3 > .troy-hover-target,
.troy-result-table .count-4 > .troy-hover-target,
.troy-result-table .count-5 > .troy-hover-target,
.troy-result-table .count-6 > .troy-hover-target,
.troy-result-table .count-7 > .troy-hover-target {
  flex-grow: 0;
}

/* Every new visual row starts at the table border without an extra divider. */
.troy-result-table .count-2 > .troy-hover-target:nth-child(2n + 1),
.troy-result-table .count-3 > .troy-hover-target:nth-child(3n + 1),
.troy-result-table .count-4 > .troy-hover-target:nth-child(4n + 1),
.troy-result-table .count-5 > .troy-hover-target:nth-child(5n + 1),
.troy-result-table .count-6 > .troy-hover-target:nth-child(3n + 1),
.troy-result-table .count-7 > .troy-hover-target:nth-child(4n + 1) {
  border-left: 0;
}

.troy-result-table .special-row td,
.troy-result-table .special-row .number-grid > .troy-hover-target {
  color: #cf4f00;
}

.troy-result-table .special-row .number-grid span {
  font-size: 26px;
}

.troy-result-tabs + .troy-result-table {
  margin-top: 5px;
}

.troy-result-head-tail {
  margin-top: 14px;
  overflow-x: auto;
}

.troy-result-head-tail h3 {
  margin: 0;
  padding: 9px 10px;
  border: 1px solid #d9d3cb;
  border-bottom: 0;
  background: #f3f3f3;
  color: #222;
  font-size: 16px;
}

.troy-result-head-tail .troy-result-table {
  width: 100%;
  min-width: 460px;
  background: #fff;
}

.troy-result-head-tail .troy-result-table th {
  padding: 7px 6px !important;
  background: #f3f3f3;
  color: #333;
  font-size: 13px;
  font-weight: 700;
}

.troy-result-head-tail .troy-result-table td {
  height: 34px !important;
  padding: 7px 10px !important;
  background: #fff;
  font-size: 13px;
  vertical-align: middle;
}

.troy-result-head-tail .troy-result-table tbody tr:nth-child(even) td {
  background: #fff;
}

.troy-result-head-tail .troy-result-table td:first-child,
.troy-result-head-tail .troy-result-table td:nth-child(4) {
  width: 42px;
  background: #fff !important;
  color: #cf4f00;
  font-weight: 700;
}

.troy-result-head-tail .troy-result-table td:nth-child(2),
.troy-result-head-tail .troy-result-table td:nth-child(3) {
  color: #111;
  font-size: 18px !important;
  font-weight: 600;
}

.troy-result-head-tail .troy-special-digit {
  color: #cf4f00;
  font-weight: 700;
}

.troy-lottery-source {
  padding: 0 10px;
  color: #777;
  font-size: 12px;
  text-align: right;
}

.troy-lottery-empty {
  padding: 15px;
  text-align: center;
}

@media (max-width: 600px) {
  .troy-page-table th,
  .troy-page-table td {
    padding: 6px 4px;
    font-size: 13px;
  }

  .troy-lottery-block-tabs {
    flex-wrap: wrap;
  }

  .troy-lottery-block-tabs a {
    flex: 1 1 calc(50% - 4px);
  }

  .troy-quick-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .troy-result-table .number-grid > .troy-hover-target {
    padding: 7px 2px;
    font-size: 20px;
  }

  .troy-result-table .special-row .number-grid > .troy-hover-target {
    font-size: 22px;
  }

  .troy-result-table .count-4 > .troy-hover-target,
  .troy-result-table .count-5 > .troy-hover-target,
  .troy-result-table .count-6 > .troy-hover-target {
    flex-basis: 50%;
  }

  .troy-result-table .number-grid.count-6 > .troy-hover-target {
    border-top: 0;
  }

  .troy-result-table .number-grid.count-6 > .troy-hover-target:nth-child(n + 3) {
    border-top: 1px solid #d9d3cb;
  }

  .troy-result-head-tail .troy-result-table th,
  .troy-result-head-tail .troy-result-table td {
    padding: 7px 5px !important;
    font-size: 12px;
  }

  .troy-result-head-tail {
    overflow-x: visible;
  }

  .troy-result-head-tail .troy-result-table {
    min-width: 0;
  }

  .troy-result-head-tail .troy-result-table td:first-child,
  .troy-result-head-tail .troy-result-table td:nth-child(4) {
    width: 32px;
  }

  .troy-result-head-tail .troy-result-table td:nth-child(2),
  .troy-result-head-tail .troy-result-table td:nth-child(3) {
    font-size: 14px !important;
    overflow-wrap: anywhere;
  }

  .troy-lo-gan-page .troy-lo-gan-controls {
    gap: 7px;
    padding: 8px;
  }

  .troy-lo-gan-radio {
    min-width: 0;
    padding: 5px 10px;
    font-size: 13px;
  }

  .troy-lo-gan-switch {
    width: 100%;
    margin-left: 0;
    padding-top: 3px;
  }

  .troy-lo-gan-table th,
  .troy-lo-gan-table td {
    height: 34px;
    padding: 6px 3px !important;
    font-size: 13px;
  }

  .troy-lo-gan-red {
    font-size: 16px !important;
  }
}
