/* ============================================
   မြန်မာ 2D တိုက်ရိုက်လဒ်များ — Full Stylesheet
   Version: 4.1.0 — History SET/VALUE Columns
   ============================================ */

@import "tailwindcss";

@theme {
  --color-emerald-500: #10b981;
  --color-emerald-400: #34d399;
  --color-gold-400: #ffd600;
  --color-slate-800: #1e293b;
  --color-slate-900: #0f172a;
  --color-slate-950: #020617;
}

/* -------------------------------------------
   CSS Custom Properties
   ------------------------------------------- */
:root {
  --bg-primary: #121212;
  --bg-card: #1e1e1e;
  --bg-nav: #1a1a2e;
  --bg-hover: #2a2a3e;
  --bg-modal: #1e1e2e;

  --accent: #00e676;
  --accent-glow: rgba(0, 230, 118, 0.3);
  --gold: #ffd600;
  --gold-glow: rgba(255, 214, 0, 0.3);
  --danger: #ff1744;

  --text-primary: #ffffff;
  --text-secondary: #aaa;
  --text-muted: #888;
  --text-dim: #666;
  --text-nav: #666;

  --border-nav: #2a2a3e;
  --border-card: #2a2a3e;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --font-stack: system-ui, -apple-system, Pyidaungsu, "Noto Sans Myanmar", "Myanmar3", "Zawgyi-One", sans-serif;
  --font-mono: "SF Mono", "Consolas", "Monaco", monospace;

  --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.4);
  --shadow-modal: 0 8px 32px rgba(0, 0, 0, 0.6);
  --shadow-btn: 0 4px 20px var(--accent-glow);
}

/* ---- everything below this line stays exactly as it was ---- */

/* -------------------------------------------
   Base
   ------------------------------------------- */
html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-stack);
  background: var(--bg-primary);
  color: var(--text-primary);
}

/* Scrollbar styling */
.main-content::-webkit-scrollbar {
  width: 4px;
}
.main-content::-webkit-scrollbar-track {
  background: transparent;
}
.main-content::-webkit-scrollbar-thumb {
  background: var(--bg-hover);
  border-radius: 4px;
}

/* -------------------------------------------
   Hidden Utility
   ------------------------------------------- */
.hidden {
  display: none !important;
}

/* -------------------------------------------
   STATUS BAR
   ------------------------------------------- */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 4px 0;
}

.status-bar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.live-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  animation: pulse-dot 1.5s ease-in-out infinite;
  box-shadow: 0 0 8px var(--accent);
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

.status-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

/* -------------------------------------------
   DATA SOURCE BADGE
   ------------------------------------------- */
.data-source-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border: 1px solid transparent;
}

.data-source-badge.api {
  color: #00e676;
  background: rgba(0, 230, 118, 0.12);
  border-color: rgba(0, 230, 118, 0.3);
}

.data-source-badge.api::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #00e676;
  display: inline-block;
  animation: pulse-dot 1.5s ease-in-out infinite;
  box-shadow: 0 0 6px #00e676;
}

.data-source-badge.cached {
  color: #ffd600;
  background: rgba(255, 214, 0, 0.12);
  border-color: rgba(255, 214, 0, 0.3);
}

.data-source-badge.cached::before {
  content: '🕐';
  font-size: 10px;
  margin-right: 2px;
}

.data-source-badge.offline {
  color: #888;
  background: rgba(102, 102, 102, 0.12);
  border-color: rgba(102, 102, 102, 0.3);
}

.data-source-badge.offline::before {
  content: '⚠';
  font-size: 10px;
  margin-right: 2px;
}

/* -------------------------------------------
   COUNTDOWN
   ------------------------------------------- */
.countdown-section {
  text-align: center;
  margin-bottom: 20px;
  padding: 16px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-card);
}

.countdown-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
}

.countdown-time {
  font-family: var(--font-mono);
  font-size: 32px;
  font-weight: 800;
  color: var(--accent);
  text-shadow: 0 0 12px var(--accent-glow);
  letter-spacing: 3px;
}

/* -------------------------------------------
   CARD GRID — 2-Column Semantic Layout
   ------------------------------------------- */
.card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 16px;
}

.draw-card-v2 {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-card);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
}

.draw-card-v2:active {
  transform: scale(0.97);
}

.draw-card-v2.morning {
  border-top: 3px solid #00bcd4;
}

.draw-card-v2.evening {
  border-top: 3px solid #ff9800;
}

.draw-card-v2.live {
  border-top-color: var(--accent);
  box-shadow: 0 0 20px var(--accent-glow), 0 2px 12px rgba(0, 0, 0, 0.4);
}

/* --- Card Header --- */
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px 4px;
}

.card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.card-time {
  font-size: 10px;
  color: var(--text-dim);
  font-weight: 500;
}

/* --- Card Number --- */
.card-number-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8px 14px 6px;
}

.card-number {
  font-family: var(--font-mono);
  font-size: 42px;
  font-weight: 800;
  letter-spacing: 6px;
  transition: all 0.3s ease;
  text-align: center;
  line-height: 1;
  min-height: 48px;
}

.card-number.live {
  color: var(--accent);
  text-shadow: 0 0 24px var(--accent-glow);
}

.card-number.pending {
  color: var(--text-dim);
  font-size: 32px;
  letter-spacing: 4px;
  opacity: 0.5;
}

.card-number.done {
  color: var(--text-secondary);
}

.card-number.loading {
  opacity: 0.5;
  animation: card-pulse 1.2s ease-in-out infinite;
}

@keyframes card-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.25; }
}

.card-number.updated {
  animation: num-update 0.5s ease;
}

@keyframes num-update {
  0% { transform: scale(1); opacity: 1; }
  25% { transform: scale(1.2); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 0.6; }
  100% { transform: scale(1); opacity: 1; }
}

/* --- Card Breakdown (SET Data Panel) --- */
.card-breakdown {
  margin: 0 10px 8px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.card-breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
}

.card-breakdown-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.card-breakdown-value {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.card-breakdown-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin: 5px 0 6px;
}

.card-breakdown-formula {
  text-align: center;
  padding: 2px 0;
}

.card-breakdown-result {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.5px;
}

/* Highlighted Digit */
.hl-digit {
  display: inline-block;
  background: rgba(0, 230, 118, 0.2);
  border: 1px solid rgba(0, 230, 118, 0.5);
  border-radius: 4px;
  padding: 0 4px;
  font-weight: 800;
  color: var(--accent);
  animation: hl-pulse 2s ease-in-out infinite;
  min-width: 16px;
  text-align: center;
}

@keyframes hl-pulse {
  0%, 100% { box-shadow: 0 0 4px rgba(0, 230, 118, 0.2); }
  50% { box-shadow: 0 0 10px rgba(0, 230, 118, 0.5); }
}

/* Muted decimal portion for VALUE display */
.dec-muted {
  color: rgba(255, 255, 255, 0.3);
  font-size: 0.85em;
}

/* --- Card Footer --- */
.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px 12px;
  border-top: 1px solid var(--border-card);
}

.card-open-label {
  font-size: 10px;
  color: var(--text-dim);
  font-weight: 500;
}

.card-open-num {
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 12px;
}

.card-badge {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 10px;
  border-radius: 20px;
}

.card-badge.live {
  color: #00e676;
  background: rgba(0, 230, 118, 0.12);
  border: 1px solid rgba(0, 230, 118, 0.3);
}

.card-badge.live::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #00e676;
  display: inline-block;
  margin-right: 4px;
  animation: pulse-dot 1.5s ease-in-out infinite;
  box-shadow: 0 0 6px #00e676;
  vertical-align: middle;
}

.card-badge.pending {
  color: var(--gold);
  background: rgba(255, 214, 0, 0.08);
  border: 1px solid rgba(255, 214, 0, 0.2);
}

.card-badge.done {
  color: #888;
  background: rgba(102, 102, 102, 0.1);
  border: 1px solid rgba(102, 102, 102, 0.2);
}

/* -------------------------------------------
   Last Update
   ------------------------------------------- */
.last-update {
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
  padding-top: 8px;
  margin-bottom: 20px;
  line-height: 1.6;
}

.last-update span {
  color: var(--text-muted);
}

/* -------------------------------------------
   Section Title
   ------------------------------------------- */
.section-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
}

/* -------------------------------------------
   History Table (5 columns: Date, 2D, SET, VALUE, Time)
   ------------------------------------------- */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-card);
  -webkit-overflow-scrolling: touch;
}

#history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  min-width: 340px;
}

#history-table thead tr {
  border-bottom: 1px solid var(--border-nav);
  background: var(--bg-card);
}

#history-table th {
  padding: 12px 8px;
  text-align: left;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

#history-table th:nth-child(2) {
  text-align: center;
}

#history-table th:nth-child(5) {
  text-align: right;
}

#history-table td {
  padding: 8px;
  border-bottom: 1px solid var(--border-card);
  color: var(--text-secondary);
  white-space: nowrap;
}

#history-table td:nth-child(2) {
  text-align: center;
  font-family: var(--font-mono);
  font-weight: 700;
}

#history-table td:nth-child(3),
#history-table td:nth-child(4) {
  font-family: var(--font-mono);
  font-size: 11px;
  text-align: right;
}

#history-table td:nth-child(5) {
  text-align: right;
  font-size: 11px;
  color: var(--text-dim);
}

#history-table tbody tr:nth-child(odd) {
  background: var(--bg-card);
}

#history-table tbody tr:nth-child(even) {
  background: rgba(30, 30, 30, 0.5);
}

#history-table tbody tr:last-child td {
  border-bottom: none;
}

/* -------------------------------------------
   Lucky Dip
   ------------------------------------------- */
.dip-container {
  text-align: center;
  padding: 30px 0;
}

.dip-icon {
  font-size: 56px;
  margin-bottom: 16px;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.dip-number {
  font-family: var(--font-mono);
  font-size: 64px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 24px;
  transition: transform 0.3s;
}

.dip-number.bounce {
  animation: dip-bounce 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes dip-bounce {
  0% { transform: scale(0.3); opacity: 0; }
  50% { transform: scale(1.15); }
  70% { transform: scale(0.9); }
  100% { transform: scale(1); opacity: 1; }
}

.btn-primary {
  background: var(--accent);
  color: var(--bg-primary);
  border: none;
  border-radius: var(--radius-md);
  padding: 14px 48px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  box-shadow: var(--shadow-btn);
  width: 80%;
  max-width: 280px;
  transition: transform 0.2s, box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary:active {
  transform: scale(0.96);
  box-shadow: 0 2px 12px var(--accent-glow);
}

.dip-hint {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 16px;
}

/* -------------------------------------------
   BOTTOM SHEET (Install-Only Modal)
   ------------------------------------------- */
.bottom-sheet-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
}

.bottom-sheet-overlay:not(.hidden) {
  animation: fadeIn 0.3s ease;
}

/* Centered variant for notification modal (Phase B) */
.bottom-sheet-overlay.centered {
  justify-content: center;
  align-items: center;
}

.bottom-sheet-overlay.centered .bottom-sheet-card {
  max-width: 360px;
  width: calc(100% - 40px);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-card);
  margin: 0 auto;
  animation: modalPopIn 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes modalPopIn {
  from {
    transform: scale(0.85) translateY(20px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.bottom-sheet-scrim {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 0;
}

.bottom-sheet-card {
  position: relative;
  z-index: 1;
  background: var(--bg-modal);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 28px 24px calc(24px + env(safe-area-inset-bottom, 0px));
  max-width: 480px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-modal);
  border: 1px solid var(--border-card);
  border-bottom: none;
  animation: slideUpSheet 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes slideUpSheet {
  from {
    transform: translateY(100%);
    opacity: 0.5;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.bottom-sheet-icon {
  font-size: 44px;
  margin-bottom: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 24px;
  background: rgba(0, 230, 118, 0.08);
  border: 2px solid rgba(0, 230, 118, 0.2);
}

.bottom-sheet-text {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 24px;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

.bottom-sheet-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.bottom-sheet-btn-ignore {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.2s, border-color 0.2s;
  -webkit-tap-highlight-color: transparent;
  order: 2;
}

.bottom-sheet-btn-ignore:active {
  color: var(--text-muted);
  border-color: var(--bg-hover);
}

.bottom-sheet-btn-cta {
  background: var(--accent);
  color: var(--bg-primary);
  border: none;
  border-radius: var(--radius-md);
  padding: 14px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  box-shadow: var(--shadow-btn);
  transition: transform 0.2s, box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
  order: 1;
}

.bottom-sheet-btn-cta:active {
  transform: scale(0.97);
  box-shadow: 0 2px 12px var(--accent-glow);
}

/* -------------------------------------------
   Animations & Utilities
   ------------------------------------------- */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.3s ease;
}

/* -------------------------------------------
   Responsive (Desktop Enhancement)
   ------------------------------------------- */
@media (min-width: 481px) {
  body {
    background: #0a0a0a;
  }

  #app {
    border-left: 1px solid var(--border-nav);
    border-right: 1px solid var(--border-nav);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
  }

  .draw-card-v2:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
  }
}

/* -------------------------------------------
   Very Narrow Screens (<340px)
   ------------------------------------------- */
@media (max-width: 339px) {
  .card-grid {
    gap: 10px;
  }
  .card-number {
    font-size: 32px;
    letter-spacing: 4px;
    min-height: 36px;
  }
  .card-number.pending {
    font-size: 24px;
  }
  .card-title {
    font-size: 11px;
  }
  .card-time {
    font-size: 9px;
  }
  .card-breakdown {
    padding: 8px 10px;
  }
  .card-breakdown-value {
    font-size: 10px;
  }
  .card-footer {
    padding: 6px 10px 10px;
  }
}

/* -------------------------------------------
   Safe Area Support
   ------------------------------------------- */
@supports (padding: env(safe-area-inset-bottom)) {
  .main-content {
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
  }
}