/* ==========================================================================
   Lotto Stat NET - Main Stylesheet
   Mobile-first responsive design
   Requirements: 8.1, 8.2, 8.3, 8.4, 8.5, 8.6, 8.7, 4.6
   ========================================================================== */

/* --------------------------------------------------------------------------
   CSS Custom Properties
   -------------------------------------------------------------------------- */
:root {
    --color-bg: #f8f9fa;
    --color-surface: #ffffff;
    --color-text: #212529;
    --color-text-muted: #6c757d;
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-border: #dee2e6;
    --color-success: #198754;
    --color-error: #dc3545;
    --color-hot: #dc3545;
    --color-cold: #0d6efd;
    --color-bonus: #6f42c1;
    --color-number-bg: #e9ecef;

    /* Accent colors for country groups */
    --accent-1: #3b82f6;
    --accent-2: #6d9e6d;
    --accent-3: #d97706;
    --accent-4: #e07070;
    --accent-5: #8b5cf6;

    /* Stat section tints */
    --tint-hot: #fff5f5;
    --tint-cold: #f0f7ff;
    --tint-overdue: #fffbeb;

    --color-header-bg: #eef2f7;
    --color-footer-bg: #f1f5f9;

    --font-primary: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-mono: 'Segoe UI Mono', 'Courier New', monospace;

    --radius: 6px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.1);

    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;

    --touch-target: 44px;
    --touch-spacing: 8px;
}

/* --------------------------------------------------------------------------
   Reset & Base Styles (Mobile-First)
   Requirement 8.7: Minimum body text 16px on mobile
   Requirement 4.6: Light background, max two font families
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-primary);
    font-size: 1rem;
    line-height: 1.7;
    color: var(--color-text);
    background-color: var(--color-bg);
}

h1, h2, h3, h4, h5, h6 {
    margin-top: 0;
    margin-bottom: var(--spacing-sm);
    font-family: var(--font-primary);
    line-height: 1.3;
    font-weight: 700;
    letter-spacing: 0.3px;
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 {
    font-size: 1.1rem;
    padding-bottom: var(--spacing-xs);
    border-bottom: 2px solid var(--color-primary);
    display: inline-block;
    margin-bottom: var(--spacing-md);
}

p {
    margin-top: 0;
    margin-bottom: var(--spacing-md);
}

a {
    color: var(--color-primary);
    text-decoration: none;
}

a:focus {
    color: var(--color-primary-hover);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

ul, ol {
    padding-left: var(--spacing-lg);
    margin-top: 0;
    margin-bottom: var(--spacing-md);
}

/* --------------------------------------------------------------------------
   Layout - Mobile (Single Column)
   Requirement 8.2: Single-column layout below 768px
   -------------------------------------------------------------------------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: var(--color-header-bg);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow);
}

.header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 50px;
    padding: 0 var(--spacing-md);
}

.logo-link {
    display: flex;
    align-items: center;
    height: 100%;
}

.logo {
    height: 40px;
    width: auto;
    max-width: 170px;
    object-fit: contain;
}

.hamburger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--color-text);
    border-radius: var(--radius);
}

.hamburger:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    color: var(--color-primary);
}

.main-nav {
    display: none;
    background-color: var(--color-surface);
    border-top: 1px solid var(--color-border);
    max-height: calc(100vh - 50px);
    overflow-y: auto;
    padding: var(--spacing-md);
}

.main-nav.open {
    display: block;
}

.nav-links {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--color-border);
    margin-bottom: var(--spacing-md);
}

.nav-links a {
    display: flex;
    align-items: center;
    min-height: var(--touch-target);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius);
    font-weight: 500;
}

.nav-links a:focus {
    background-color: var(--color-bg);
    text-decoration: none;
}

.nav-lotteries {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-sm);
}

.nav-country-title {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--color-text);
    padding: var(--spacing-xs) var(--spacing-sm);
    margin-bottom: var(--spacing-xs);
}

.nav-country-title:hover {
    color: var(--color-primary);
    text-decoration: none;
}

.nav-country-list {
    list-style: none;
    padding: 0;
    margin: 0 0 var(--spacing-sm) 0;
}

.nav-country-list li a {
    display: block;
    padding: var(--spacing-xs) var(--spacing-sm) var(--spacing-xs) var(--spacing-md);
    font-size: 0.85rem;
    color: var(--color-primary);
    border-radius: var(--radius);
    min-height: 36px;
    line-height: 36px;
}

.nav-country-list li a:focus {
    background-color: var(--color-bg);
    text-decoration: none;
}

/* Legacy header support (for templates not yet updated) */
header {
    background-color: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    /*padding: var(--spacing-md);*/
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

header h1 {
    margin: 0 0 var(--spacing-sm) 0;
    font-size: 1.25rem;
}

header h1 a {
    color: var(--color-text);
    text-decoration: none;
}

header h1 a:hover {
    color: var(--color-primary);
    text-decoration: none;
}

/* Requirement 8.6: Minimum touch target 44x44px with 8px spacing */
nav:not(.main-nav):not(.back-link):not(.pagination):not(.admin-nav) {
    display: flex;
    flex-wrap: wrap;
    gap: var(--touch-spacing);
}

nav:not(.main-nav):not(.back-link):not(.pagination):not(.admin-nav) a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /*min-height: var(--touch-target);*/
    min-width: var(--touch-target);
    /*padding: var(--spacing-sm) var(--spacing-md);*/
    border-radius: var(--radius);
    font-weight: 500;
    transition: background-color 0.2s;
}

nav:not(.main-nav):not(.back-link):not(.pagination):not(.admin-nav) a:hover,
nav:not(.main-nav):not(.back-link):not(.pagination):not(.admin-nav) a:focus {
    background-color: var(--color-bg);
    text-decoration: none;
}

main {
    padding: var(--spacing-md);
    max-width: 1200px;
    margin: 0 auto;
    overflow-x: hidden;
}

footer {
    padding: var(--spacing-lg) var(--spacing-md);
    text-align: center;
    color: var(--color-text-muted);
    background-color: var(--color-footer-bg);
    border-top: 1px solid var(--color-border);
    margin-top: var(--spacing-xl);
}

.social-links {
    display: flex;
    justify-content: center;
    gap: var(--spacing-md);
    margin-top: var(--spacing-sm);
}

.social-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    color: var(--color-text-muted);
    border-radius: 50%;
    border: 1px solid var(--color-border);
}

.social-links a:focus {
    color: var(--color-primary);
    border-color: var(--color-primary);
}

/* --------------------------------------------------------------------------
   Country Groups & Lottery Entries (Main Page)
   -------------------------------------------------------------------------- */
.country-group {
    margin-bottom: var(--spacing-xl);
    border-left: 3px solid var(--accent-1);
    padding-left: var(--spacing-md);
}

.country-group:nth-child(5n+2) { border-left-color: var(--accent-2); }
.country-group:nth-child(5n+3) { border-left-color: var(--accent-3); }
.country-group:nth-child(5n+4) { border-left-color: var(--accent-4); }
.country-group:nth-child(5n+5) { border-left-color: var(--accent-5); }

.country-group h2 {
    padding-bottom: var(--spacing-sm);
    border-bottom: none;
    margin-bottom: var(--spacing-md);
}

.lottery-entry {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    box-shadow: var(--shadow);
    border-top: 2px solid transparent;
}

.lottery-entry h3 {
    margin-bottom: var(--spacing-sm);
}

.lottery-entry h3 a {
    min-height: var(--touch-target);
    display: inline-flex;
    align-items: center;
}

.lottery-details {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.lottery-details .label {
    font-weight: 600;
    color: var(--color-text-muted);
    margin-right: var(--spacing-xs);
}

/* Number balls */
.number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    min-height: 32px;
    padding: var(--spacing-xs);
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.875rem;
    margin: 2px;
}

.number.main {
    background-color: var(--color-number-bg);
    color: var(--color-text);
}

.number.bonus {
    background-color: var(--color-bonus);
    color: #fff;
}

.number.hot {
    background-color: var(--color-hot);
    color: #fff;
}

.number.cold {
    background-color: var(--color-cold);
    color: #fff;
}

.numbers .separator {
    margin: 0 var(--spacing-xs);
    font-weight: 700;
    color: var(--color-text-muted);
}

.last-draw,
.next-draw,
.jackpot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-xs);
}

.hot-cold-numbers {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-sm);
    padding-top: var(--spacing-sm);
    border-top: 1px solid var(--color-border);
}

.hot-numbers,
.cold-numbers {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-xs);
}

.insufficient-data-notice {
    margin-top: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    background-color: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: var(--radius);
    font-size: 0.875rem;
}

.insufficient-data-notice p {
    margin: 0;
}

.pending-results {
    color: var(--color-text-muted);
    font-style: italic;
}

/* --------------------------------------------------------------------------
   Category Page - Statistics
   -------------------------------------------------------------------------- */
.category-page {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.draw-count-selector {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.draw-count-selector label {
    font-weight: 600;
}

.draw-count-selector select {
    min-height: var(--touch-target);
    min-width: var(--touch-target);
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background-color: var(--color-surface);
}

.total-draw-count {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    margin-bottom: var(--spacing-md);
}

.stats-notice {
    padding: var(--spacing-sm) var(--spacing-md);
    background-color: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: var(--radius);
    margin-bottom: var(--spacing-md);
}

.stats-section {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: var(--spacing-md);
    box-shadow: var(--shadow);
}

.stats-section h3 {
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px solid var(--color-border);
}

/* Stat block tints (proposal 4) */
.stat-block {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    box-shadow: var(--shadow);
}

.stat-block:nth-child(1) { background-color: var(--tint-hot); }
.stat-block:nth-child(2) { background-color: var(--tint-cold); }
.stat-block:nth-child(3) { background-color: var(--tint-overdue); }

/* Requirement 8.4: Horizontally scrollable tables on mobile */
.table-wrapper,
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: var(--spacing-md);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    white-space: nowrap;
}

th, td {
    padding: var(--spacing-sm) var(--spacing-md);
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

th {
    background-color: var(--color-bg);
    font-weight: 600;
    position: sticky;
    top: 0;
}

tbody tr:hover {
    background-color: var(--color-bg);
}

/* Draw history table */
.draw-history {
    margin-bottom: var(--spacing-lg);
}

.draw-history .table-wrapper,
.draw-history .table-responsive {
    max-height: 400px;
    overflow-y: auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

.draw-history table {
    min-width: 100%;
}

.draw-history table td,
.draw-history table th {
    white-space: nowrap;
}

.draw-history table td:nth-child(2),
.draw-history table td:nth-child(3) {
    white-space: normal;
    min-width: 120px;
}

.draw-history .number {
    min-width: 28px;
    min-height: 28px;
    font-size: 0.75rem;
    margin: 1px;
}

/* Frequency table */
.frequency-table td:nth-child(3) {
    width: 100px;
}

.frequency-bar {
    height: 8px;
    background-color: var(--color-primary);
    border-radius: 4px;
    min-width: 2px;
}

/* Number ranking lists */
.number-ranking {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.number-ranking .number {
    min-width: 40px;
    min-height: 40px;
    font-size: 1rem;
}

/* Pairs list */
.pairs-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.pairs-list li {
    background-color: var(--color-bg);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius);
    font-size: 0.875rem;
}

/* Odd/Even and Sum Range */
.distribution-chart {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.distribution-bar {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.distribution-bar .bar-label {
    min-width: 80px;
    font-weight: 500;
}

.distribution-bar .bar-fill {
    height: 24px;
    background-color: var(--color-primary);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    padding: 0 var(--spacing-sm);
    color: #fff;
    font-size: 0.75rem;
    min-width: 30px;
}

/* --------------------------------------------------------------------------
   Draw Detail Page
   -------------------------------------------------------------------------- */
.draw-detail-page {
    max-width: 800px;
}

.breadcrumb {
    font-size: 0.7rem;
    color: var(--color-text-muted);
    margin-bottom: var(--spacing-md);
}

.breadcrumb a {
    color: var(--color-primary);
    background-color: #e8f0fe;
    padding: 2px 8px;
    border-radius: 12px;
    text-decoration: none;
}

.breadcrumb a:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.draw-numbers-display {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    text-align: center;
    box-shadow: var(--shadow);
}

.numbers-large {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: var(--spacing-sm);
}

.number.large {
    min-width: 48px;
    min-height: 48px;
    font-size: 1.25rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.draw-written-results {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    box-shadow: var(--shadow);
}

.draw-written-results p {
    line-height: 1.8;
    font-size: 1.05rem;
}

.draw-analysis {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    box-shadow: var(--shadow);
}

.analysis-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-md);
}

.analysis-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--spacing-sm);
    background-color: var(--color-bg);
    border-radius: var(--radius);
}

.analysis-label {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--spacing-xs);
}

.analysis-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text);
}

.draw-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) 0;
}

.draw-nav-link {
    display: inline-flex;
    align-items: center;
    min-height: var(--touch-target);
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 0.9rem;
}

.draw-nav-link.disabled {
    color: var(--color-text-muted);
    border-color: var(--color-border);
    cursor: default;
    opacity: 0.5;
}

.draw-detail-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    min-height: 36px;
    font-size: 1.1rem;
    color: var(--color-primary);
    text-decoration: none;
}

.draw-consecutive,
.draw-decades {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    box-shadow: var(--shadow);
}

.draw-consecutive ul {
    list-style: none;
    padding: 0;
}

.draw-consecutive li {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    margin-bottom: var(--spacing-sm);
}

.consecutive-label {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-left: var(--spacing-sm);
}

.decade-chart {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.decade-bar-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.decade-label {
    min-width: 50px;
    font-size: 0.85rem;
    font-weight: 500;
    text-align: right;
}

.decade-bar-container {
    flex: 1;
    height: 28px;
    background-color: var(--color-bg);
    border-radius: var(--radius);
    overflow: hidden;
}

.decade-bar-fill {
    height: 100%;
    background-color: var(--color-primary);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    min-width: 24px;
    transition: width 0.3s;
}

/* --------------------------------------------------------------------------
   Jackpots Page
   -------------------------------------------------------------------------- */
.jackpots-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.jackpot-card {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: var(--spacing-md);
    box-shadow: var(--shadow);
}

.jackpot-card h4 {
    margin-bottom: var(--spacing-xs);
}

.jackpot-country {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.jackpot-amount {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--color-text);
    margin: var(--spacing-sm) 0;
}

.jackpot-usd {
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--color-text-muted);
}

.jackpot-date {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

/* --------------------------------------------------------------------------
   Draw Result Image
   -------------------------------------------------------------------------- */
.draw-result-image {
    margin: var(--spacing-lg) 0;
    text-align: center;
}

.draw-result-image img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* --------------------------------------------------------------------------
   Blog Templates
   -------------------------------------------------------------------------- */
.blog-listing h2 {
    margin-bottom: var(--spacing-lg);
}

.post-list {
    list-style: none;
    padding: 0;
}

.post-item {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    box-shadow: var(--shadow);
}

.post-item h3 {
    margin-bottom: var(--spacing-xs);
}

.post-item h3 a {
    min-height: var(--touch-target);
    display: inline-flex;
    align-items: center;
}

.post-meta {
    color: var(--color-text-muted);
    font-size: 0.875rem;
    margin-bottom: var(--spacing-sm);
}

.no-posts {
    color: var(--color-text-muted);
    font-style: italic;
}

/* Pagination */
.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: var(--touch-spacing);
    justify-content: center;
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--color-border);
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--touch-target);
    min-width: var(--touch-target);
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-weight: 500;
}

.pagination a:hover,
.pagination a:focus {
    background-color: var(--color-primary);
    color: #fff;
    text-decoration: none;
    border-color: var(--color-primary);
}

.pagination-current {
    background-color: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

/* Blog Post */
.blog-post article {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow);
}

.blog-post .post-body {
    line-height: 1.8;
}

.blog-post .post-image {
    margin: var(--spacing-md) 0;
}

.blog-post .post-image img {
    border-radius: var(--radius);
}

.back-link {
    margin-top: var(--spacing-lg);
}

.back-link a {
    min-height: var(--touch-target);
    display: inline-flex;
    align-items: center;
    padding: var(--spacing-sm) 0;
}

/* --------------------------------------------------------------------------
   Admin & Login Forms
   -------------------------------------------------------------------------- */
.admin-panel,
.admin-login {
    max-width: 600px;
    margin: 0 auto;
    padding: var(--spacing-lg);
}

.admin-nav {
    margin-bottom: var(--spacing-lg);
}

.admin-nav a {
    min-height: var(--touch-target);
    display: inline-flex;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-md);
    background-color: var(--color-bg);
    border-radius: var(--radius);
}

.form-group {
    margin-bottom: var(--spacing-md);
}

.form-group label {
    display: block;
    margin-bottom: var(--spacing-xs);
    font-weight: 600;
    font-size: 0.9rem;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="date"],
.form-group textarea {
    width: 100%;
    min-height: var(--touch-target);
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 1rem;
    font-family: var(--font-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background-color: var(--color-surface);
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group textarea {
    min-height: 200px;
    resize: vertical;
}

button[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--touch-target);
    min-width: 120px;
    padding: var(--spacing-sm) var(--spacing-lg);
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-primary);
    color: #fff;
    background-color: var(--color-primary);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background-color 0.2s;
}

button[type="submit"]:hover,
button[type="submit"]:focus {
    background-color: var(--color-primary-hover);
}

/* Messages */
.success-message {
    padding: var(--spacing-md);
    background-color: #d1e7dd;
    border: 1px solid var(--color-success);
    border-radius: var(--radius);
    color: #0f5132;
    margin-bottom: var(--spacing-md);
}

.error-message,
.validation-errors {
    padding: var(--spacing-md);
    background-color: #f8d7da;
    border: 1px solid var(--color-error);
    border-radius: var(--radius);
    color: #842029;
    margin-bottom: var(--spacing-md);
}

.validation-errors ul {
    margin: 0;
    padding-left: var(--spacing-lg);
}

/* --------------------------------------------------------------------------
   404 & Error Pages
   -------------------------------------------------------------------------- */
main h1:only-of-type + p + p a,
.back-link a,
main p a {
    min-height: var(--touch-target);
    display: inline-flex;
    align-items: center;
    padding: var(--spacing-sm) 0;
}

/* --------------------------------------------------------------------------
   Utility Classes
   -------------------------------------------------------------------------- */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* --------------------------------------------------------------------------
   Desktop Styles (768px+)
   Requirement 8.3: Multi-column layout at 768px+
   -------------------------------------------------------------------------- */
@media (min-width: 768px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }

    .header-bar {
        padding: 0 var(--spacing-xl);
    }

    .nav-lotteries {
        grid-template-columns: repeat(3, 1fr);
    }

    header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: var(--spacing-md) var(--spacing-xl);
    }

    header h1 {
        margin-bottom: 0;
    }

    main {
        padding: var(--spacing-xl);
    }

    /* Multi-column lottery grid */
    .country-group .lottery-entries {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
        gap: var(--spacing-md);
    }

    /* Lottery entry cards in grid */
    .lottery-entry {
        display: flex;
        flex-direction: column;
    }

    .hot-cold-numbers {
        flex-direction: row;
        gap: var(--spacing-lg);
    }

    /* Category page multi-column stats */
    .stats-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-md);
    }

    .stats-grid .stats-section.full-width {
        grid-column: 1 / -1;
    }

    /* Blog listing multi-column */
    .post-list {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
        gap: var(--spacing-md);
    }

    .post-item {
        margin-bottom: 0;
    }

    /* Blog post max-width for readability */
    .blog-post article {
        max-width: 800px;
        margin: 0 auto;
    }

    /* Tables don't need scroll wrapper on desktop */
    table {
        font-size: 0.9rem;
    }

    /* Number balls slightly larger on desktop */
    .number {
        min-width: 36px;
        min-height: 36px;
    }

    /* Distribution charts horizontal */
    .distribution-chart {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .distribution-bar {
        flex: 1;
        min-width: 200px;
    }
}

/* --------------------------------------------------------------------------
   Large Desktop (1024px+)
   -------------------------------------------------------------------------- */
@media (min-width: 1024px) {
    .nav-lotteries {
        grid-template-columns: repeat(4, 1fr);
    }

    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .country-group .lottery-entries {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}

/* --------------------------------------------------------------------------
   Focus States for Accessibility (proposal 9)
   -------------------------------------------------------------------------- */
a:focus,
button:focus,
select:focus,
input:focus,
textarea:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Remove outline for mouse users, keep for keyboard */
:focus:not(:focus-visible) {
    outline: none;
}

:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Desktop Hover Effects (only for non-touch devices)
   -------------------------------------------------------------------------- */
@media (hover: hover) {
    .lottery-entry:hover {
        box-shadow: var(--shadow-md);
        border-top-color: var(--accent-1);
        transform: translateY(-2px);
    }

    .country-group:nth-child(5n+2) .lottery-entry:hover { border-top-color: var(--accent-2); }
    .country-group:nth-child(5n+3) .lottery-entry:hover { border-top-color: var(--accent-3); }
    .country-group:nth-child(5n+4) .lottery-entry:hover { border-top-color: var(--accent-4); }
    .country-group:nth-child(5n+5) .lottery-entry:hover { border-top-color: var(--accent-5); }

    .draw-nav-link:hover {
        background-color: var(--color-primary);
        color: #fff;
        border-color: var(--color-primary);
        text-decoration: none;
    }

    .nav-links a:hover {
        background-color: var(--color-bg);
        text-decoration: none;
    }

    .nav-country-list li a:hover {
        background-color: var(--color-bg);
        text-decoration: none;
    }
}

/* --------------------------------------------------------------------------
   Print Styles
   -------------------------------------------------------------------------- */
@media print {
    header,
    footer,
    nav,
    .draw-count-selector,
    .pagination {
        display: none;
    }

    body {
        background: #fff;
        color: #000;
        font-size: 12pt;
    }

    main {
        padding: 0;
    }

    .lottery-entry,
    .stats-section,
    .post-item,
    .blog-post article {
        box-shadow: none;
        border: 1px solid #ccc;
        break-inside: avoid;
    }

    a {
        color: #000;
        text-decoration: underline;
    }
}
