@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css");

/* ==========================================
   ⚡ MEGA POP LOTTO - DESIGN SYSTEM & STYLES
   ========================================== */

/* --- Foundational Tokens --- */
:root {
  --font-family: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, system-ui, Roboto, 'Helvetica Neue', 'Segoe UI', 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', sans-serif;
  
  /* Color Palette (Deep dark universe with rich electric accents) */
  --bg-color-main: #0a0813;
  --bg-color-deck: rgba(18, 14, 33, 0.7);
  --color-primary: #8a2be2;
  --color-primary-glow: rgba(138, 43, 226, 0.4);
  --color-accent: #ffd700;
  --color-accent-glow: rgba(255, 215, 0, 0.35);
  --color-neon-blue: #00e5ff;
  --color-neon-pink: #ff007f;
  --color-neon-green: #39ff14;
  
  /* Text Colors */
  --text-primary: #f8f9fa;
  --text-secondary: #a9a9cc;
  --text-muted: #6c757d;
  
  /* Borders and Blurs */
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-bg: rgba(255, 255, 255, 0.03);
  --glass-blur: blur(16px);
  --radius-xlarge: 24px;
  --radius-large: 16px;
  --radius-medium: 12px;
  --radius-small: 8px;
  
  /* Lotto Ball Color Swatches */
  --ball-yellow: radial-gradient(circle at 35% 35%, #fff275 0%, #fbc02d 40%, #f57f17 100%);
  --ball-blue: radial-gradient(circle at 35% 35%, #64b5f6 0%, #1976d2 40%, #0d47a1 100%);
  --ball-red: radial-gradient(circle at 35% 35%, #ff8a80 0%, #d32f2f 40%, #b71c1c 100%);
  --ball-grey: radial-gradient(circle at 35% 35%, #cfd8dc 0%, #78909c 40%, #37474f 100%);
  --ball-green: radial-gradient(circle at 35% 35%, #81c784 0%, #388e3c 40%, #1b5e20 100%);
}

/* --- Base Reset & General Layout --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-color-main);
  background-image: 
    radial-gradient(at 10% 20%, rgba(138, 43, 226, 0.15) 0px, transparent 50%),
    radial-gradient(at 90% 80%, rgba(0, 229, 255, 0.12) 0px, transparent 50%),
    radial-gradient(at 50% 50%, rgba(255, 0, 127, 0.08) 0px, transparent 40%);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Background Effects Canvas overlay */
.effects-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
}

.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

/* --- Header & Brand Styling --- */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 28px;
  background: rgba(18, 14, 33, 0.65);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-large);
  backdrop-filter: var(--glass-blur);
  margin-bottom: 24px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
  z-index: 100;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.logo-container:hover {
  transform: scale(1.03);
}

.logo-icon {
  font-size: 1.8rem;
  text-shadow: 0 0 10px var(--color-primary-glow);
  animation: logo-pulsate 1.5s ease-in-out infinite alternate;
}

.logo-text {
  font-family: 'Pretendard Variable', Pretendard, sans-serif;
  font-weight: 900;
  font-size: 1.6rem;
  letter-spacing: 1px;
}

.logo-text .highlight {
  background: linear-gradient(45deg, var(--color-accent), var(--color-neon-pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Navigation Menu */
.app-nav {
  display: flex;
  gap: 8px;
}

.nav-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-family);
  font-weight: 500;
  font-size: 0.95rem;
  padding: 10px 18px;
  border-radius: var(--radius-small);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
  transition: transform 0.3s ease;
}

.nav-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.nav-btn:hover .nav-icon {
  transform: translateY(-2px);
}

.nav-btn.active {
  color: var(--color-accent);
  background: rgba(138, 43, 226, 0.15);
  box-shadow: inset 0 0 0 1px rgba(138, 43, 226, 0.3);
}

/* Sound Controller toggler */
.audio-control-container {
  display: flex;
  align-items: center;
}

.audio-btn {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.25s ease;
}

.audio-btn:hover {
  background: rgba(138, 43, 226, 0.2);
  border-color: var(--color-primary);
  transform: scale(1.05);
}

.audio-icon {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.hidden {
  display: none !important;
}

/* --- Container Components --- */
.app-main-content {
  flex-grow: 1;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.4s ease forwards;
}

.tab-pane.active {
  display: block;
}

/* Glassmorphism Cards */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-large);
  padding: 24px;
  box-shadow: 0 10px 40px 0 rgba(0, 0, 0, 0.2);
  position: relative;
  overflow: hidden;
}

.glass-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0) 100%);
  pointer-events: none;
}

/* --- TAB 1: LIVE DRAW PANEL --- */
.draw-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  grid-template-rows: auto auto;
  gap: 20px;
}

/* Grid Spanning */
.control-panel {
  grid-column: 1;
  grid-row: 1 / 3;
}

.machine-panel {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 40px;
  min-height: 520px;
  padding: 30px;
}

.machine-core {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.live-log-panel {
  flex: 0 0 320px;
  height: 490px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: var(--radius-medium);
  border: 1px solid var(--glass-border);
  padding: 20px;
  display: flex;
  flex-direction: column;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
}

.live-log-title {
  margin: 0 0 15px 0;
  color: var(--text-primary);
  text-align: center;
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 15px;
}

.live-log-counter-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: normal;
}

.live-log-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  flex-grow: 1;
  padding-right: 5px;
}

.live-log-list::-webkit-scrollbar {
  width: 6px;
}
.live-log-list::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: 3px;
}

.live-log-empty {
  color: var(--text-secondary);
  text-align: center;
  margin-top: 20px;
  font-size: 0.9rem;
}

@keyframes slideDownTicket {
  from { opacity: 0; transform: translateY(-15px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 950px) {
  .machine-panel {
    flex-direction: column;
    gap: 30px;
    padding: 20px;
  }
}

.results-panel {
  grid-column: 2;
  grid-row: 2;
}

/* Form Styles inside Glass */
.panel-header h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-subtitle {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-top: -6px;
  margin-bottom: 16px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

/* Custom Styled Select dropdown */
.custom-select-wrapper {
  position: relative;
}

.custom-select-wrapper select {
  width: 100%;
  background: rgba(18, 14, 33, 0.8);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  padding: 12px 16px;
  border-radius: var(--radius-small);
  font-family: var(--font-family);
  font-size: 0.95rem;
  cursor: pointer;
  appearance: none;
  transition: border-color 0.3s;
}

.custom-select-wrapper select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 10px rgba(138, 43, 226, 0.3);
}

.custom-select-wrapper::after {
  content: '▼';
  font-size: 0.7rem;
  color: var(--text-secondary);
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

/* Range Slider styling */
input[type="range"] {
  -webkit-appearance: none;
  background: transparent;
}
input[type="range"]:focus {
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  height: 20px;
  width: 20px;
  border-radius: 50%;
  background: var(--color-accent);
  cursor: pointer;
  margin-top: -7px;
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.7);
  border: 2px solid #fff;
  transition: transform 0.15s;
}
input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}
input[type="range"]::-webkit-slider-runnable-track {
  width: 100%;
  height: 6px;
  cursor: pointer;
  background: linear-gradient(90deg, var(--color-primary), rgba(255, 255, 255, 0.15));
  border-radius: 3px;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.6);
}

/* Progress status */
.status-box {
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-small);
  padding: 14px;
  margin-bottom: 24px;
}

.status-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.85rem;
}

.status-label {
  color: var(--text-secondary);
}

.status-value {
  font-weight: 700;
  color: var(--color-neon-blue);
}

.status-progress-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-neon-blue));
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* Buttons System */
.btn {
  font-family: var(--font-family);
  font-weight: 700;
  padding: 12px 20px;
  border-radius: var(--radius-small);
  cursor: pointer;
  border: none;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.btn-primary {
  background: linear-gradient(45deg, var(--color-primary), #a03cff);
  color: var(--text-primary);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(138, 43, 226, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-accent {
  background: linear-gradient(45deg, #ff8a00, var(--color-accent));
  color: #0c0812;
}

.btn-accent:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 215, 0, 0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
}

.btn-danger {
  background: rgba(211, 47, 47, 0.2);
  color: #ff5252;
  border: 1px solid rgba(211, 47, 47, 0.4);
}

.btn-danger:hover:not(:disabled) {
  background: rgba(211, 47, 47, 0.4);
  box-shadow: 0 4px 15px rgba(211, 47, 47, 0.3);
}

.btn-large {
  padding: 16px 24px;
  font-size: 1.05rem;
}

.btn-glow {
  animation: pulse-neon 2s infinite alternate;
}

.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* --- Lottery Machine View --- */
.machine-wrapper {
  position: relative;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.02) 40%, rgba(138, 43, 226, 0.05) 80%, rgba(138, 43, 226, 0.15) 100%);
  border: 2px solid rgba(138, 43, 226, 0.2);
  box-shadow: 
    0 0 40px rgba(138, 43, 226, 0.1),
    inset 0 0 60px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: transform 0.1s ease; /* For camera shake */
}

#machine-canvas {
  border-radius: 50%;
  display: block;
}

.machine-tube-glowing {
  position: absolute;
  bottom: -5px;
  left: calc(50% - 30px);
  width: 60px;
  height: 70px;
  background: linear-gradient(180deg, rgba(0, 229, 255, 0.2), rgba(0, 229, 255, 0.6));
  clip-path: polygon(15% 0%, 85% 0%, 100% 100%, 0% 100%);
  border-top: 2px solid var(--color-neon-blue);
  box-shadow: 0 0 20px rgba(0, 229, 255, 0.3);
  pointer-events: none;
}

.glass-reflection {
  position: absolute;
  top: 10px;
  left: 20px;
  width: 380px;
  height: 180px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0) 100%);
  border-radius: 190px 190px 40px 40px;
  pointer-events: none;
}

.machine-info {
  text-align: center;
  margin-top: 16px;
}

.info-tag {
  background: rgba(57, 255, 20, 0.15);
  border: 1px solid rgba(57, 255, 20, 0.3);
  color: var(--color-neon-green);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 30px;
  letter-spacing: 0.5px;
}

.machine-info h3 {
  font-size: 1.1rem;
  font-weight: 900;
  letter-spacing: 2px;
  margin-top: 8px;
  background: linear-gradient(90deg, #fff, #999);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Camera Shake trigger */
.camera-shake {
  animation: shake 0.15s infinite;
}

/* --- Results Panel & Ball Slots --- */
.results-panel .panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.badge {
  padding: 6px 12px;
  border-radius: 30px;
  font-size: 0.8rem;
  font-weight: 700;
}

.badge-gold {
  background: rgba(255, 215, 0, 0.15);
  border: 1px solid rgba(255, 215, 0, 0.3);
  color: var(--color-accent);
}

.slots-container {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
}

.slot-card {
  background: rgba(0, 0, 0, 0.3);
  border: 1px dashed var(--glass-border);
  border-radius: var(--radius-medium);
  padding: 16px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  min-height: 120px;
  position: relative;
  transition: all 0.3s ease;
}

.slot-card.filled {
  border-style: solid;
  border-color: rgba(138, 43, 226, 0.3);
  background: rgba(138, 43, 226, 0.03);
}

.slot-num {
  font-family: 'Pretendard Variable', Pretendard, sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.slot-ball-holder {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-grow: 1;
  width: 100%;
}

.empty-glow {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 1.1rem;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.4);
}

/* --- Lotto Ball Standard Styles --- */
.lotto-ball {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: 'Pretendard Variable', Pretendard, sans-serif;
  font-weight: 800;
  font-size: 1.3rem;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  position: relative;
  box-shadow: 
    0 4px 10px rgba(0, 0, 0, 0.4),
    inset 0 -6px 12px rgba(0, 0, 0, 0.3),
    inset 0 4px 10px rgba(255, 255, 255, 0.4);
  cursor: default;
  user-select: none;
  animation: ball-appear 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* Subtle highlights for 3D sphere look */
.lotto-ball::after {
  content: '';
  position: absolute;
  top: 4px;
  left: 10px;
  width: 14px;
  height: 8px;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  transform: rotate(-15deg);
}

/* Official Color Ranges */
.lotto-ball.num-yellow { background: var(--ball-yellow); }
.lotto-ball.num-blue { background: var(--ball-blue); }
.lotto-ball.num-red { background: var(--ball-red); }
.lotto-ball.num-grey { background: var(--ball-grey); }
.lotto-ball.num-green { background: var(--ball-green); }

/* Ball sizing modifiers */
.size-small {
  width: 32px;
  height: 32px;
  font-size: 0.85rem;
  box-shadow: 
    0 2px 5px rgba(0, 0, 0, 0.4),
    inset 0 -3px 6px rgba(0, 0, 0, 0.3),
    inset 0 2px 5px rgba(255, 255, 255, 0.4);
}
.size-small::after {
  top: 2px;
  left: 6px;
  width: 8px;
  height: 4px;
}

.size-medium {
  width: 44px;
  height: 44px;
  font-size: 1.1rem;
}
.size-medium::after {
  top: 3px;
  left: 8px;
  width: 11px;
  height: 6px;
}

.size-xlarge {
  width: 90px;
  height: 90px;
  font-size: 2.2rem;
  box-shadow: 
    0 10px 25px rgba(0, 0, 0, 0.5),
    inset 0 -10px 20px rgba(0, 0, 0, 0.35),
    inset 0 6px 15px rgba(255, 255, 255, 0.5);
}
.size-xlarge::after {
  top: 8px;
  left: 20px;
  width: 25px;
  height: 12px;
}

/* --- Pop Zoom In Overlay --- */
.pop-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 8, 19, 0.9);
  border-radius: var(--radius-large);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease forwards;
}

.pop-content {
  text-align: center;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.flash-ring {
  position: absolute;
  top: 45px;
  left: 45px;
  transform: translate(-50%, -50%);
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 4px solid var(--color-neon-blue);
  box-shadow: 0 0 30px var(--color-neon-blue);
  animation: flash-zoom 0.8s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
  pointer-events: none;
}

.pop-description {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-neon-blue);
  text-shadow: 0 0 10px rgba(0, 229, 255, 0.3);
  letter-spacing: 0.5px;
  animation: slideUpText 0.4s ease forwards;
}

/* --- Draw Complete Screen Overlay --- */
.draw-complete-card {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(138, 43, 226, 0.95) 0%, rgba(10, 8, 19, 0.98) 100%);
  border-radius: var(--radius-large);
  z-index: 12;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 30px;
  text-align: center;
  gap: 16px;
  animation: scaleUpDrawCard 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.1) forwards;
}

.complete-icon {
  font-size: 3rem;
  animation: bounce 1.2s infinite alternate;
}

.draw-complete-card h3 {
  font-size: 1.8rem;
  font-weight: 900;
  background: linear-gradient(45deg, var(--color-accent), var(--color-neon-green));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-top: -8px;
}

.draw-complete-card p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  max-width: 420px;
}

.drawn-result-display {
  display: flex;
  gap: 12px;
  margin: 10px 0;
}

.complete-actions {
  margin-top: 10px;
}

/* --- TAB 2: WINNING NUMBERS VIEW & EDITOR --- */
.numbers-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.round-picker-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--glass-border);
}

.round-picker-bar label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.btn-round-step {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  padding: 10px 16px;
  border-radius: var(--radius-small);
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
}

.btn-round-step:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--color-accent);
}

.winning-display-board {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-medium);
  padding: 24px;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.8);
}

.board-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 28px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.board-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 900;
  font-size: 1.8rem;
  background: linear-gradient(135deg, #fff 0%, #888 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.board-date {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.winning-balls-layout {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 16px;
}

.main-numbers-box, .bonus-number-box {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.main-numbers-box h4, .bonus-number-box h4 {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.balls-row {
  display: flex;
  gap: 8px;
}

.plus-sign {
  font-family: 'Outfit', sans-serif;
  font-size: 1.8rem;
  font-weight: 300;
  color: var(--text-muted);
  margin-top: 18px;
}

/* Form Styles for custom manager */
.custom-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-row {
  display: flex;
  gap: 16px;
}

.col-6 {
  flex: 1;
}

.custom-form input[type="number"],
.custom-form input[type="date"] {
  width: 100%;
  background: rgba(10, 8, 19, 0.8);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  padding: 12px 14px;
  border-radius: var(--radius-small);
  font-family: var(--font-family);
  font-size: 0.95rem;
  transition: all 0.3s;
}

.custom-form input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.2);
}

.number-input-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.input-lotto-val, .input-lotto-bonus-val {
  text-align: center;
  font-weight: 700;
}

.editor-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
}

/* --- TAB 3: MY HISTORY & STATISTICS --- */
.history-layout {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.stat-item {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-medium);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.3);
}

.stat-icon {
  font-size: 2rem;
  background: rgba(255, 255, 255, 0.03);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.stat-details {
  display: flex;
  flex-direction: column;
}

.stat-num {
  font-family: 'Outfit', sans-serif;
  font-size: 1.4rem;
  font-weight: 800;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.text-gold { color: var(--color-accent) !important; }
.text-green { color: var(--color-neon-green) !important; }

.roi-bar-container {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.85rem;
}

.roi-label {
  color: var(--text-secondary);
}

.roi-value {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 1rem;
}

/* History list structure */
.panel-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.history-filters {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.15);
  padding: 10px 16px;
  border-radius: var(--radius-small);
  margin-bottom: 20px;
  width: fit-content;
}

.history-filters label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.history-items-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 500px;
  overflow-y: auto;
  padding-right: 8px;
}

/* Scrollbar Customization */
.history-items-grid::-webkit-scrollbar {
  width: 6px;
}
.history-items-grid::-webkit-scrollbar-track {
  background: rgba(0,0,0,0.1);
}
.history-items-grid::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
}

.empty-history-placeholder {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.placeholder-icon {
  font-size: 3.5rem;
  display: block;
  margin-bottom: 16px;
}

.empty-history-placeholder h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.empty-history-placeholder p {
  font-size: 0.85rem;
  margin-bottom: 20px;
}

/* Historical Ticket Card */
.history-ticket {
  background: rgba(18, 14, 33, 0.5);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-medium);
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.25s ease;
  position: relative;
}

.history-ticket:hover {
  border-color: rgba(138, 43, 226, 0.25);
  background: rgba(18, 14, 33, 0.7);
  transform: translateX(4px);
}

.ticket-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ticket-round {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 1.1rem;
}

.ticket-date {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.ticket-balls-section {
  display: flex;
  align-items: center;
  gap: 20px;
}

.balls-sub-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  text-align: center;
  margin-bottom: 4px;
}

.matching-indicator-box {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ticket-status-badge {
  min-width: 140px;
  text-align: center;
  padding: 8px 12px;
  border-radius: var(--radius-small);
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Match colors for prize brackets */
.prize-rank-1 {
  background: rgba(255, 215, 0, 0.15);
  border: 1px solid rgba(255, 215, 0, 0.4);
  color: var(--color-accent);
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.2);
}
.prize-rank-2 {
  background: rgba(0, 229, 255, 0.15);
  border: 1px solid rgba(0, 229, 255, 0.4);
  color: var(--color-neon-blue);
  box-shadow: 0 0 15px rgba(0, 229, 255, 0.2);
}
.prize-rank-3 {
  background: rgba(255, 0, 127, 0.15);
  border: 1px solid rgba(255, 0, 127, 0.4);
  color: var(--color-neon-pink);
}
.prize-rank-4 {
  background: rgba(138, 43, 226, 0.2);
  border: 1px solid rgba(138, 43, 226, 0.4);
  color: #b388ff;
}
.prize-rank-5 {
  background: rgba(57, 255, 20, 0.15);
  border: 1px solid rgba(57, 255, 20, 0.4);
  color: var(--color-neon-green);
}
.prize-none {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
}

.ticket-prize-amount {
  font-size: 0.7rem;
  font-weight: 400;
  opacity: 0.85;
}

.btn-delete-ticket {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.2s;
}

.btn-delete-ticket:hover {
  color: #ff5252;
  background: rgba(255, 82, 82, 0.1);
}

/* Glowing outline for balls that MATCHED winning numbers! */
.lotto-ball.matched {
  box-shadow: 
    0 0 0 3px #fff,
    0 0 15px 5px var(--color-accent),
    inset 0 -6px 12px rgba(0, 0, 0, 0.3);
  animation: glow-rotate 2s linear infinite;
}

/* --- Celebration Modals --- */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 3, 10, 0.85);
  backdrop-filter: blur(8px);
}

.modal-content {
  position: relative;
  width: 90%;
  max-width: 520px;
  background: radial-gradient(circle at top, rgba(138, 43, 226, 0.25) 0%, rgba(18, 14, 33, 0.98) 80%);
  border: 1px solid rgba(138, 43, 226, 0.4);
  box-shadow: 0 15px 50px rgba(138, 43, 226, 0.3);
  z-index: 10;
  padding: 30px;
}

.modal-header {
  display: flex;
  justify-content: flex-end;
}

.close-modal-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.8rem;
  cursor: pointer;
  line-height: 1;
}

.close-modal-btn:hover {
  color: var(--text-primary);
}

.celebration-emoji {
  font-size: 4rem;
  margin-bottom: 12px;
  animation: swing 1s infinite alternate;
}

.celebration-title {
  font-size: 1.8rem;
  font-weight: 900;
  margin-bottom: 14px;
}

.celebration-rank-badge {
  background: linear-gradient(45deg, #ff8a00, var(--color-accent));
  color: #0c0812;
  font-weight: 900;
  font-size: 1.3rem;
  padding: 8px 24px;
  border-radius: 30px;
  display: inline-block;
  margin-bottom: 14px;
  box-shadow: 0 5px 15px rgba(255, 215, 0, 0.4);
}

.celebration-text {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-bottom: 24px;
}

.justify-center {
  justify-content: center;
}

/* --- Responsive CSS media queries --- */
@media (max-width: 1024px) {
  .draw-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }
  .control-panel {
    grid-column: 1;
    grid-row: auto;
  }
  .machine-panel {
    grid-column: 1;
    grid-row: auto;
  }
  .results-panel {
    grid-column: 1;
    grid-row: auto;
  }
  .numbers-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .app-header {
    flex-direction: column;
    gap: 16px;
    padding: 16px;
  }
  .app-nav {
    width: 100%;
    justify-content: space-around;
  }
  .nav-btn {
    padding: 8px 12px;
    font-size: 0.85rem;
  }
  .machine-wrapper {
    width: 320px;
    height: 320px;
  }
  #machine-canvas {
    width: 320px;
    height: 320px;
  }
  .glass-reflection {
    width: 280px;
    height: 140px;
  }
  .slots-container {
    grid-template-columns: repeat(3, 1fr);
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .winning-balls-layout {
    flex-direction: column;
    gap: 12px;
  }
  .plus-sign {
    margin-top: 0;
    transform: rotate(90deg);
  }
  .history-ticket {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  .ticket-balls-section {
    width: 100%;
    justify-content: space-between;
  }
  .btn-delete-ticket {
    position: absolute;
    top: 14px;
    right: 14px;
  }
}

/* --- KEYFRAME ANIMATIONS --- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes logo-pulsate {
  from { text-shadow: 0 0 10px var(--color-primary-glow); }
  to { text-shadow: 0 0 25px var(--color-primary), 0 0 10px var(--color-neon-blue); }
}

@keyframes pulse-neon {
  0% { box-shadow: 0 0 5px var(--color-primary-glow), 0 0 0px var(--color-primary-glow); }
  100% { box-shadow: 0 0 20px var(--color-primary-glow), 0 0 8px var(--color-primary); }
}

@keyframes shake {
  0% { transform: translate(1px, 1px) rotate(0deg); }
  10% { transform: translate(-1px, -2px) rotate(-1deg); }
  20% { transform: translate(-3px, 0px) rotate(1deg); }
  30% { transform: translate(0px, 2px) rotate(0deg); }
  40% { transform: translate(1px, -1px) rotate(1deg); }
  50% { transform: translate(-1px, 2px) rotate(-1deg); }
  60% { transform: translate(-3px, 1px) rotate(0deg); }
  70% { transform: translate(2px, 1px) rotate(-1deg); }
  80% { transform: translate(-1px, -1px) rotate(1deg); }
  90% { transform: translate(2px, 2px) rotate(0deg); }
  100% { transform: translate(1px, -2px) rotate(-1deg); }
}

@keyframes ball-appear {
  0% { opacity: 0; transform: scale(0.3) rotate(-180deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

@keyframes flash-zoom {
  0% { transform: translate(-50%, -50%) scale(0.6); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(2.2); opacity: 0; border-width: 1px; }
}

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

@keyframes scaleUpDrawCard {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes bounce {
  from { transform: translateY(0); }
  to { transform: translateY(-10px); }
}

@keyframes glow-rotate {
  0% { box-shadow: 0 0 0 3px #fff, 0 0 10px 4px var(--color-accent); }
  50% { box-shadow: 0 0 0 4px #fff, 0 0 20px 8px var(--color-accent); }
  100% { box-shadow: 0 0 0 3px #fff, 0 0 10px 4px var(--color-accent); }
}

@keyframes swing {
  0% { transform: rotate(10deg); }
  100% { transform: rotate(-10deg); }
}

/* --- Footer Copyright Section --- */
.app-footer {
  margin-top: 50px;
  padding: 24px 20px;
  text-align: center;
  background: rgba(18, 14, 33, 0.55);
  border-top: 1px solid var(--glass-border);
  border-radius: var(--radius-large) var(--radius-large) 0 0;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  color: var(--text-secondary);
  font-size: 0.85rem;
  letter-spacing: 0.5px;
  box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.25);
  transition: all 0.3s ease;
}

.app-footer p {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.app-footer p span {
  color: var(--color-accent);
}

/* ============================================================================
   👤 ULTRA-CONVENIENT USER LOGIN & GLASSMORPHIC MODAL STYLES
   ============================================================================ */

.login-trigger-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  padding: 8px 14px;
  border-radius: 30px;
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.login-trigger-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--color-neon-blue);
  color: var(--color-neon-blue);
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.35);
  transform: translateY(-1px);
}

/* Modal Overlay Layer */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 4, 9, 0.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  opacity: 1;
  transition: all 0.3s ease;
}

.modal-overlay.hidden {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

/* Glassmorphism Card for Login */
.login-modal-card {
  width: 100%;
  max-width: 420px;
  background: rgba(18, 14, 33, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-large);
  padding: 35px 30px;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 
              0 0 40px rgba(138, 43, 226, 0.15);
  animation: modalScaleUp 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
}

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

.close-modal-btn {
  position: absolute;
  top: 15px;
  right: 18px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.8rem;
  cursor: pointer;
  transition: color 0.2s ease;
}

.close-modal-btn:hover {
  color: var(--color-neon-pink);
}

.modal-header {
  text-align: center;
  margin-bottom: 25px;
}

.modal-header h3 {
  font-size: 1.35rem;
  font-weight: 800;
  background: linear-gradient(45deg, #fff 30%, var(--color-neon-blue) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 6px;
}

.modal-subtitle {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.form-group {
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Premium Neon Input style */
.custom-input {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-small);
  color: #fff;
  padding: 12px 16px;
  font-family: var(--font-family);
  font-size: 0.95rem;
  transition: all 0.25s ease;
  outline: none;
}

.custom-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 10px rgba(138, 43, 226, 0.25), 
              inset 0 0 5px rgba(0, 0, 0, 0.5);
  background: rgba(0, 0, 0, 0.6);
}

.custom-input[type="password"] {
  letter-spacing: 6px;
  text-align: center;
  font-size: 1.2rem;
  font-weight: 900;
}

.help-text {
  line-height: 1.4;
}

.login-error {
  background: rgba(255, 0, 127, 0.08);
  border: 1px solid rgba(255, 0, 127, 0.2);
  border-radius: var(--radius-small);
  padding: 10px 12px;
  text-align: center;
  margin-bottom: 15px;
  animation: shake 0.3s ease;
}
