/* ตรวจหวย — The World Ready */
.lottery-page {
  --lotto-navy: #142238;
  --lotto-navy-2: #1d3557;
  --lotto-navy-3: #0e1b30;
  --lotto-gold: #d9a441;
  --lotto-gold-soft: #f0c879;
  --lotto-paper: #f7f4ec;
  --lotto-paper-line: #e4decf;
  --lotto-ink: #1c2536;
  --lotto-ink-soft: #5a6478;
  --lotto-red: #c0392b;
  --lotto-teal: #2a6fa8;
}

.lottery-page .lottery-wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px;
}

.lottery-page .lottery-hero {
  background: linear-gradient(180deg, var(--lotto-navy) 0%, var(--lotto-navy-2) 100%);
  color: #fff;
  padding: 28px 0 72px;
  text-align: center;
  border-radius: 0 0 20px 20px;
  margin: 0 -4px;
}

.lottery-page .lottery-hero h1 {
  font-size: clamp(1.35rem, 4vw, 2rem);
  font-weight: 700;
  line-height: 1.3;
  margin: 0;
  color: #fff;
}

.lottery-page .lottery-hero .lottery-date {
  color: var(--lotto-gold-soft);
  font-weight: 600;
  margin-top: 8px;
  font-size: clamp(0.95rem, 2.5vw, 1.15rem);
}

.lottery-page .lottery-hero .lottery-sub {
  opacity: 0.8;
  font-size: 0.9rem;
  margin-top: 4px;
}

.lottery-page .lottery-ticket {
  background: var(--lotto-paper);
  color: var(--lotto-ink);
  border-radius: 14px;
  max-width: 640px;
  margin: 0 auto;
  position: relative;
  box-shadow: 0 12px 30px rgba(10, 21, 38, 0.25);
  overflow: hidden;
}

.lottery-page .lottery-ticket::before,
.lottery-page .lottery-ticket::after {
  content: "";
  position: absolute;
  width: 26px;
  height: 26px;
  background: var(--lotto-navy-2);
  border-radius: 50%;
  top: 50%;
  transform: translateY(-50%);
}

.lottery-page .lottery-ticket::before { left: -13px; }
.lottery-page .lottery-ticket::after { right: -13px; }

.lottery-page .lottery-ticket-inner {
  border: 1.5px dashed var(--lotto-gold);
  border-radius: 10px;
  margin: 10px;
  padding: 22px 16px;
  text-align: center;
}

.lottery-page .lottery-ticket .lottery-label {
  font-weight: 600;
  color: var(--lotto-red);
  letter-spacing: 2px;
  font-size: 0.9rem;
}

.lottery-page .lottery-digits {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 14px 0 10px;
  flex-wrap: wrap;
}

.lottery-page .lottery-digit {
  width: clamp(42px, 9vw, 58px);
  height: clamp(56px, 12vw, 74px);
  background: #fff;
  border: 1px solid var(--lotto-paper-line);
  border-bottom: 3px solid var(--lotto-gold);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: clamp(1.75rem, 6vw, 2.5rem);
  color: var(--lotto-navy);
  font-variant-numeric: tabular-nums;
}

.lottery-page .lottery-ticket .lottery-amount {
  font-size: 0.82rem;
  color: var(--lotto-ink-soft);
}

.lottery-page .lottery-status {
  max-width: 640px;
  margin: 14px auto 0;
  text-align: center;
  font-size: 0.9rem;
  color: var(--twro-mute, var(--lotto-ink-soft));
}

.lottery-page .lottery-status.is-ok {
  color: var(--lotto-teal);
  font-weight: 600;
}

.lottery-page .lottery-status.is-error {
  display: none;
}

.lottery-page .lottery-alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 14px;
  padding: 16px 18px;
  border-radius: 12px;
  border: 2px solid #e74c3c;
  background: linear-gradient(180deg, #fff5f3 0%, #ffe8e4 100%);
  color: #8b1e14;
  box-shadow: 0 10px 28px rgba(192, 57, 43, 0.18);
  animation: lottery-alert-in 0.35s ease;
}

@keyframes lottery-alert-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.lottery-page .lottery-alert[hidden] {
  display: none !important;
}

.lottery-page .lottery-alert-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--lotto-red);
  color: #fff;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
}

.lottery-page .lottery-alert-title {
  display: block;
  font-size: 1.05rem;
  margin-bottom: 4px;
  color: #c0392b;
}

.lottery-page .lottery-alert-msg {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.55;
}

.lottery-page .lottery-alert-retry {
  flex-shrink: 0;
  align-self: center;
  margin-left: auto;
  border: 0;
  border-radius: 999px;
  padding: 8px 16px;
  background: var(--lotto-red);
  color: #fff;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.lottery-page .lottery-alert-retry:hover {
  background: #a93226;
}

.lottery-page .lottery-results.has-error .lottery-results-body {
  opacity: 0.72;
}

.lottery-page .lottery-results.has-error .lottery-ticket {
  box-shadow: 0 0 0 2px rgba(192, 57, 43, 0.22);
}

.lottery-page .lottery-checker {
  max-width: 640px;
  margin: 22px auto 0;
  background: #fff;
  color: var(--lotto-ink);
  border: 1px solid var(--lotto-paper-line);
  border-radius: 14px;
  padding: 18px 16px;
}

.lottery-page .lottery-checker h2 {
  font-size: 1.05rem;
  color: var(--lotto-navy);
  margin: 0 0 10px;
}

.lottery-page .lottery-check-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.lottery-page .lottery-check-row input {
  flex: 1;
  min-width: 200px;
  font-size: clamp(1.5rem, 5vw, 2rem);
  font-weight: 700;
  letter-spacing: 0.28em;
  text-align: center;
  padding: 14px 16px;
  min-height: 58px;
  border: 2px solid var(--lotto-gold);
  border-radius: 12px;
  outline: none;
  background: #fff;
  color: #142238;
  caret-color: #142238;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  box-shadow: inset 0 1px 4px rgba(20, 34, 56, 0.08);
}

.lottery-page .lottery-check-row input::placeholder {
  color: #9aa3b2;
  opacity: 1;
  font-weight: 500;
  letter-spacing: 0.2em;
}

.lottery-page .lottery-check-row input:focus {
  border-color: var(--lotto-navy);
  box-shadow: 0 0 0 3px rgba(217, 164, 65, 0.35);
}

html[data-twro-theme="dark"] .lottery-page .lottery-check-row input {
  background: #fff;
  color: #142238;
  -webkit-text-fill-color: #142238;
}

html[data-twro-theme="dark"] .lottery-page .lottery-check-row input::placeholder {
  -webkit-text-fill-color: #9aa3b2;
}

.lottery-page .lottery-check-row button {
  font-weight: 600;
  font-size: 1rem;
  background: var(--lotto-navy);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 26px;
  cursor: pointer;
  font-family: inherit;
  min-height: 58px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.lottery-page .lottery-check-row button.is-checking::before {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: var(--lotto-gold-soft);
  border-radius: 50%;
  animation: lottery-spin 0.7s linear infinite;
  flex-shrink: 0;
}

.lottery-page .lottery-check-row input:disabled {
  opacity: 0.72;
  cursor: wait;
}

.lottery-page .lottery-check-result.is-checking {
  display: block;
  padding: 14px 16px;
  border-radius: 10px;
  background: #eef3fa;
  border: 1px solid #c8d6ea;
  color: var(--lotto-navy);
}

.lottery-page .lottery-check-processing {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.lottery-page .lottery-check-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(20, 34, 56, 0.2);
  border-top-color: var(--lotto-navy);
  border-radius: 50%;
  animation: lottery-spin 0.7s linear infinite;
  flex-shrink: 0;
}

.lottery-page .lottery-check-row button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.lottery-page .lottery-check-row button:hover:not(:disabled) {
  background: var(--lotto-navy-2);
}

.lottery-page .lottery-check-result {
  margin-top: 14px;
  padding: 0;
  border-radius: 14px;
  font-size: 0.95rem;
  display: none;
  overflow: hidden;
}

.lottery-page .lottery-check-result.is-win {
  display: block;
  background: transparent;
  border: none;
  animation: lottery-win-pop 0.45s ease;
}

@keyframes lottery-win-pop {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.lottery-page .lottery-win-card {
  position: relative;
  padding: 20px 18px 18px;
  border-radius: 14px;
  border: 3px solid #27ae60;
  background: linear-gradient(165deg, #f0fff4 0%, #dff5e6 45%, #c8edd4 100%);
  color: #145a32;
  box-shadow:
    0 0 0 4px rgba(39, 174, 96, 0.15),
    0 16px 40px rgba(30, 107, 58, 0.22);
}

.lottery-page .lottery-win-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 11px;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.55) 50%, transparent 70%);
  background-size: 200% 100%;
  animation: lottery-win-shine 2.8s ease-in-out infinite;
  pointer-events: none;
}

.lottery-page .lottery-win-card.is-jackpot {
  border-color: var(--lotto-gold);
  background: linear-gradient(165deg, #fff9e8 0%, #ffefb8 40%, #f5d76e 100%);
  color: #5c3d00;
  box-shadow:
    0 0 0 4px rgba(217, 164, 65, 0.28),
    0 20px 48px rgba(180, 120, 20, 0.28);
}

@keyframes lottery-win-shine {
  0%, 100% { background-position: 200% 0; }
  50% { background-position: -200% 0; }
}

.lottery-page .lottery-win-banner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.lottery-page .lottery-win-icon {
  flex-shrink: 0;
  font-size: 2.4rem;
  line-height: 1;
  animation: lottery-win-bounce 0.9s ease infinite alternate;
}

@keyframes lottery-win-bounce {
  from { transform: translateY(0) scale(1); }
  to { transform: translateY(-4px) scale(1.06); }
}

.lottery-page .lottery-win-title {
  display: block;
  font-size: clamp(1.2rem, 4vw, 1.55rem);
  font-weight: 800;
  line-height: 1.25;
  color: inherit;
}

.lottery-page .lottery-win-card.is-jackpot .lottery-win-title {
  color: #8b5a00;
}

.lottery-page .lottery-win-sub {
  display: block;
  margin-top: 4px;
  font-size: 0.92rem;
  font-weight: 600;
  opacity: 0.88;
}

.lottery-page .lottery-win-number {
  position: relative;
  display: flex;
  justify-content: center;
  gap: clamp(6px, 2vw, 10px);
  margin: 6px 0 16px;
  flex-wrap: wrap;
}

.lottery-page .lottery-win-digit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: clamp(42px, 11vw, 54px);
  height: clamp(52px, 13vw, 64px);
  padding: 0 6px;
  border-radius: 12px;
  background: #fff;
  color: var(--lotto-navy);
  font-size: clamp(1.6rem, 5.5vw, 2.2rem);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  border: 2px solid rgba(20, 34, 56, 0.12);
  box-shadow: 0 4px 14px rgba(20, 34, 56, 0.12);
}

.lottery-page .lottery-win-card.is-jackpot .lottery-win-digit {
  border-color: var(--lotto-gold);
  background: #fffdf5;
  color: #8b5a00;
  box-shadow: 0 6px 18px rgba(180, 120, 20, 0.2);
}

.lottery-page .lottery-win-prizes {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lottery-page .lottery-win-prize {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
  font-size: clamp(0.95rem, 2.8vw, 1.05rem);
  font-weight: 700;
  line-height: 1.4;
  border: 1px solid rgba(30, 107, 58, 0.18);
}

.lottery-page .lottery-win-prize::before {
  content: '✓';
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #27ae60;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.lottery-page .lottery-win-card.is-jackpot .lottery-win-prize {
  border-color: rgba(180, 120, 20, 0.25);
}

.lottery-page .lottery-win-card.is-jackpot .lottery-win-prize::before {
  background: var(--lotto-gold);
  color: #5c3d00;
}

.lottery-page .lottery-win-note {
  position: relative;
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px dashed rgba(20, 34, 56, 0.15);
  font-size: 0.82rem;
  line-height: 1.5;
  opacity: 0.85;
}

.lottery-page .lottery-check-result.is-lose {
  display: block;
  padding: 12px 14px;
  background: #f6eeea;
  color: #8a4a3a;
  border: 1px solid #e7d2c8;
  border-radius: 10px;
}

.lottery-page .lottery-main {
  padding: 28px 0 10px;
  color: var(--twro-cream, var(--lotto-ink));
}

.lottery-page .lottery-prizes h2,
.lottery-page .lottery-history h2,
.lottery-page .lottery-seo h2 {
  font-size: 1.2rem;
  margin: 26px 0 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--twro-cream, var(--lotto-navy));
}

.lottery-page .lottery-prizes h2::before,
.lottery-page .lottery-history h2::before {
  content: "";
  width: 5px;
  height: 22px;
  background: var(--lotto-gold);
  border-radius: 3px;
  flex-shrink: 0;
}

.lottery-page .lottery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.lottery-page .lottery-pcard {
  background: #fff;
  color: var(--lotto-ink);
  border: 1px solid var(--lotto-paper-line);
  border-radius: 12px;
  padding: 14px;
  text-align: center;
}

.lottery-page .lottery-pcard .lottery-t {
  font-size: 0.82rem;
  color: var(--lotto-ink-soft);
}

.lottery-page .lottery-pcard .lottery-n {
  font-weight: 700;
  font-size: clamp(1.2rem, 3.5vw, 1.6rem);
  color: var(--lotto-navy);
  letter-spacing: 0.08em;
  margin-top: 4px;
  word-wrap: break-word;
  font-variant-numeric: tabular-nums;
}

.lottery-page .lottery-pcard .lottery-r {
  font-size: 0.75rem;
  color: var(--lotto-gold);
  margin-top: 2px;
}

.lottery-page .lottery-pcard.is-hl {
  background: var(--lotto-navy);
  border-color: var(--lotto-navy);
}

.lottery-page .lottery-pcard.is-hl .lottery-t,
.lottery-page .lottery-pcard.is-hl .lottery-r {
  color: var(--lotto-gold-soft);
}

.lottery-page .lottery-pcard.is-hl .lottery-n {
  color: #fff;
}

.lottery-page .lottery-pcard.is-wide {
  grid-column: 1 / -1;
  text-align: left;
}

.lottery-page .lottery-list-nums {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--lotto-navy);
  letter-spacing: 0.02em;
  line-height: 1.4;
  word-spacing: 0;
  margin-top: 8px;
}

.lottery-page .lottery-num-tag {
  display: inline-block;
  padding: 5px 10px;
  background: var(--lotto-paper);
  border: 1px solid var(--lotto-paper-line);
  border-radius: 8px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
}

.lottery-page .lottery-history {
  margin-top: 34px;
  background: #fff;
  color: var(--lotto-ink);
  border: 1px solid var(--lotto-paper-line);
  border-radius: 14px;
  padding: 20px 16px;
}

.lottery-page .lottery-history--top {
  position: relative;
  z-index: 5;
  max-width: 640px;
  margin: -48px auto 18px;
  box-shadow: 0 10px 28px rgba(10, 21, 38, 0.14);
}

.lottery-page .lottery-history--top h2 {
  margin: 0 0 6px;
  font-size: 1.05rem;
  color: var(--lotto-navy);
}

.lottery-page .lottery-results {
  position: relative;
}

.lottery-page .lottery-results-body {
  transition: opacity 0.2s ease;
}

.lottery-page .lottery-results.is-loading .lottery-results-body {
  opacity: 0.38;
  pointer-events: none;
  user-select: none;
}

.lottery-page .lottery-loading {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 10;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.lottery-page .lottery-results.is-loading .lottery-loading {
  display: flex;
}

.lottery-page .lottery-loading-inner {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 999px;
  background: rgba(20, 34, 56, 0.92);
  color: #fff;
  font-size: 0.92rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.lottery-page .lottery-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: var(--lotto-gold-soft);
  border-radius: 50%;
  animation: lottery-spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes lottery-spin {
  to { transform: rotate(360deg); }
}

.lottery-page .lottery-history h2 {
  margin-top: 0;
  color: var(--lotto-navy);
}

.lottery-page .lottery-history .lottery-hint {
  font-size: 0.9rem;
  color: var(--lotto-ink-soft);
  margin: 0 0 12px;
}

.lottery-page .lottery-history select {
  width: 100%;
  max-width: 420px;
  font-size: 1rem;
  font-weight: 600;
  padding: 10px 12px;
  border: 2px solid var(--lotto-paper-line);
  border-radius: 10px;
  background: #fff;
  color: var(--lotto-navy);
  outline: none;
  font-family: inherit;
  min-height: 46px;
}

.lottery-page .lottery-history select:focus {
  border-color: var(--lotto-gold);
}

.lottery-page .lottery-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.lottery-page .lottery-chip {
  font-size: 0.92rem;
  font-weight: 600;
  border: 1px solid var(--lotto-paper-line);
  background: var(--lotto-paper);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  color: var(--lotto-navy);
  font-family: inherit;
  white-space: nowrap;
}

.lottery-page .lottery-chip:hover {
  border-color: var(--lotto-gold);
  background: #fff;
}

.lottery-page .lottery-chip.is-active {
  background: var(--lotto-navy);
  color: #fff;
  border-color: var(--lotto-navy);
}

.lottery-page .lottery-chip:disabled {
  opacity: 0.55;
  cursor: wait;
}

.lottery-page .lottery-history select:disabled {
  opacity: 0.65;
  cursor: wait;
}

.lottery-page .lottery-seo {
  margin-top: 38px;
}

.lottery-page .lottery-seo p,
.lottery-page .lottery-seo li {
  font-size: 0.98rem;
  color: var(--twro-cream, var(--lotto-ink));
  line-height: 1.7;
}

.lottery-page .lottery-seo ul {
  padding-left: 1.25rem;
  margin: 8px 0;
}

.lottery-page .lottery-seo a {
  color: var(--lotto-gold-soft, var(--lotto-teal));
}

.lottery-page .lottery-seo details {
  background: #fff;
  color: var(--lotto-ink);
  border: 1px solid var(--lotto-paper-line);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 10px;
}

.lottery-page .lottery-seo details summary {
  font-weight: 600;
  color: var(--lotto-navy);
  cursor: pointer;
  font-size: 0.98rem;
}

.lottery-page .lottery-seo details p {
  margin-top: 8px;
  color: var(--lotto-ink);
}

.lottery-page .lottery-disclaimer {
  font-size: 0.8rem;
  color: var(--twro-mute, var(--lotto-ink-soft));
  margin-top: 20px;
  line-height: 1.55;
}

.lottery-page .lottery-related {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.lottery-page .lottery-related a {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--twro-line, rgba(255, 255, 255, 0.14));
  text-decoration: none;
  color: var(--twro-cream, #f4efe6);
  font-size: 0.88rem;
}

.lottery-page .lottery-related a:hover {
  border-color: var(--lotto-gold);
  color: var(--lotto-gold-soft);
}

html[data-twro-theme="light"] .lottery-page .lottery-main,
html[data-twro-theme="light"] .lottery-page .lottery-seo p,
html[data-twro-theme="light"] .lottery-page .lottery-seo li,
html[data-twro-theme="light"] .lottery-page .lottery-prizes h2,
html[data-twro-theme="light"] .lottery-page .lottery-seo h2 {
  color: var(--lotto-ink);
}

html[data-twro-theme="light"] .lottery-page .lottery-related a {
  color: var(--lotto-navy);
  border-color: var(--lotto-paper-line);
}

@media (prefers-reduced-motion: reduce) {
  .lottery-page .lottery-win-card::before,
  .lottery-page .lottery-win-icon {
    animation: none;
  }
  .lottery-page .lottery-check-result.is-win {
    animation: none;
  }
  .lottery-page .lottery-check-row button.is-checking::before,
  .lottery-page .lottery-check-spinner {
    animation: none;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .lottery-page .lottery-ticket {
    animation: lottery-pop 0.5s ease;
  }
  @keyframes lottery-pop {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
  }
}
