* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    /* Background image will be set by JavaScript with overlay gradient */
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.7) 0%, rgba(118, 75, 162, 0.7) 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-image 0.5s ease-in-out;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 40px;
    animation: fadeIn 0.5s ease-in;
}

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

header {
    text-align: center;
    margin-bottom: 40px;
}

header h1 {
    font-size: 2.5em;
    color: #667eea;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    color: #666;
    font-size: 1.1em;
}

.category-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.tab-btn {
    flex: 1;
    min-width: 120px;
    padding: 12px 20px;
    font-size: 1em;
    font-weight: 600;
    color: #667eea;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.tab-btn:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.tab-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.gambling-warning {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    border: 2px solid #ff4757;
    border-radius: 8px;
    padding: 10px 15px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 2px 8px rgba(255, 71, 87, 0.2);
}

.warning-icon {
    font-size: 1.3em;
    flex-shrink: 0;
}

.warning-text {
    flex: 1;
    color: white;
    font-size: 0.9em;
    line-height: 1.4;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.warning-text strong {
    font-weight: 700;
}

.warning-text a {
    color: white;
    font-weight: 600;
    text-decoration: underline;
    transition: all 0.3s ease;
}

.warning-text a:hover {
    color: #ffeaa7;
    text-shadow: 0 0 4px rgba(255, 234, 167, 0.5);
}

.lottery-selector {
    margin-bottom: 30px;
}

.lottery-selector label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #555;
}

.lottery-selector select {
    width: 100%;
    padding: 12px 16px;
    font-size: 1em;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.lottery-selector select:hover {
    border-color: #667eea;
}

.lottery-selector select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.custom-settings {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.setting-group {
    display: flex;
    flex-direction: column;
}

.setting-group label {
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
    font-size: 0.9em;
}

.setting-group input[type="number"] {
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.3s ease;
}

.setting-group input[type="number"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.setting-group input[type="checkbox"] {
    margin-right: 8px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.setting-group label:has(input[type="checkbox"]) {
    flex-direction: row;
    align-items: center;
    cursor: pointer;
}

.generate-section {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.generate-btn {
    flex: 1;
    min-width: 150px;
    padding: 15px 30px;
    font-size: 1.1em;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

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

.generate-btn.secondary {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    box-shadow: 0 4px 15px rgba(245, 87, 108, 0.4);
}

.generate-btn.secondary:hover {
    box-shadow: 0 6px 20px rgba(245, 87, 108, 0.6);
}

.generate-btn.clear-btn {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
}

.generate-btn.clear-btn:hover {
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.6);
}

.results-container {
    margin-bottom: 30px;
}

.result-set {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 20px;
    animation: slideIn 0.4s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.result-set h3 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.numbers-display {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.number-ball {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3em;
    font-weight: 700;
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    animation: popIn 0.5s ease-out;
    animation-fill-mode: both;
}

@keyframes popIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.number-ball.special {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.result-text {
    font-size: 1.2em;
    font-weight: 600;
    color: #333;
    padding: 15px;
    background: white;
    border-radius: 10px;
    margin: 5px 0;
    text-align: center;
    word-break: break-all;
}

.result-text.large {
    font-size: 1.8em;
    padding: 20px;
}

.color-preview {
    width: 80px;
    height: 80px;
    border-radius: 10px;
    border: 3px solid #ddd;
    margin: 10px auto;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.coordinate-display {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
    width: 100%;
}

.coordinate-item {
    background: white;
    padding: 15px 25px;
    border-radius: 10px;
    font-weight: 600;
    color: #667eea;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.coordinate-item.country-name {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 700;
}

.country-loading {
    font-style: italic;
    opacity: 0.7;
}

.coordinate-map {
    width: 100%;
    height: 300px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    margin-top: 10px;
    z-index: 0;
}

.dice-display {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.die {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 4px;
    padding: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    animation: popIn 0.5s ease-out;
    animation-fill-mode: both;
    position: relative;
}

.dice-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: white;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

.dice-dot.center {
    grid-column: 2;
    grid-row: 2;
}

.dice-dot.top-left {
    grid-column: 1;
    grid-row: 1;
}

.dice-dot.top-right {
    grid-column: 3;
    grid-row: 1;
}

.dice-dot.middle-left {
    grid-column: 1;
    grid-row: 2;
}

.dice-dot.middle-right {
    grid-column: 3;
    grid-row: 2;
}

.dice-dot.bottom-left {
    grid-column: 1;
    grid-row: 3;
}

.dice-dot.bottom-right {
    grid-column: 3;
    grid-row: 3;
}

.dice-number {
    grid-column: 1 / -1;
    grid-row: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2em;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.die:nth-child(1) { animation-delay: 0.1s; }
.die:nth-child(2) { animation-delay: 0.2s; }
.die:nth-child(3) { animation-delay: 0.3s; }
.die:nth-child(4) { animation-delay: 0.4s; }
.die:nth-child(5) { animation-delay: 0.5s; }
.die:nth-child(6) { animation-delay: 0.6s; }
.die:nth-child(7) { animation-delay: 0.7s; }
.die:nth-child(8) { animation-delay: 0.8s; }
.die:nth-child(9) { animation-delay: 0.9s; }
.die:nth-child(10) { animation-delay: 1.0s; }

/* Coin Flip Display */
.coin-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 20px;
}

.coin {
    width: 150px;
    height: 150px;
    position: relative;
    perspective: 1000px;
}

.coin-face {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    border: 4px solid #ddd;
    animation: coinFlip 1s ease-out;
}

@keyframes coinFlip {
    0% {
        transform: rotateY(0deg) scale(0.8);
        opacity: 0;
    }
    50% {
        transform: rotateY(180deg) scale(1.1);
    }
    100% {
        transform: rotateY(360deg) scale(1);
        opacity: 1;
    }
}

.coin-face.heads {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
}

.coin-face.tails {
    background: linear-gradient(135deg, #c0c0c0 0%, #e8e8e8 100%);
}

.coin-heads,
.coin-tails {
    font-size: 4em;
    margin-bottom: 10px;
}

.coin-label {
    font-size: 1.2em;
    font-weight: 700;
    color: #333;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5);
}

.coin-result {
    font-size: 1.5em;
    font-weight: 700;
    color: #667eea;
    text-align: center;
}

/* Playing Card Display */
.card-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    padding: 20px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.playing-card {
    width: 120px;
    height: 168px;
    max-width: 100%;
    max-height: 100%;
    aspect-ratio: 120 / 168;
    background: white;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 10px;
    position: relative;
    border: 2px solid #333;
    animation: cardDeal 0.6s ease-out;
    animation-fill-mode: both;
    box-sizing: border-box;
    flex-shrink: 0;
}

@keyframes cardDeal {
    0% {
        transform: rotate(-180deg) scale(0);
        opacity: 0;
    }
    50% {
        transform: rotate(-90deg) scale(1.1);
    }
    100% {
        transform: rotate(0deg) scale(1);
        opacity: 1;
    }
}

.playing-card.red .card-rank,
.playing-card.red .card-suit,
.playing-card.red .card-suit-large {
    color: #dc2626;
}

.playing-card.black .card-rank,
.playing-card.black .card-suit,
.playing-card.black .card-suit-large {
    color: #1f2937;
}

.card-top,
.card-bottom {
    display: flex;
    flex-direction: column;
    font-weight: 700;
    position: absolute;
}

.card-top {
    top: 10px;
    left: 10px;
    align-items: flex-start;
}

.card-bottom {
    bottom: 10px;
    right: 10px;
    align-items: flex-end;
    flex-direction: column-reverse;
}

.card-rank {
    font-size: 1.4em;
    line-height: 1;
    font-weight: 700;
}

.card-suit {
    font-size: 1.2em;
    line-height: 1;
}

.card-center {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 0;
}

.card-suit-large {
    font-size: 3.5em;
    line-height: 1;
    max-width: 100%;
}

.card-name {
    font-size: 1.1em;
    font-weight: 600;
    color: #555;
    text-align: center;
}

.number-ball:nth-child(1) { animation-delay: 0.1s; }
.number-ball:nth-child(2) { animation-delay: 0.2s; }
.number-ball:nth-child(3) { animation-delay: 0.3s; }
.number-ball:nth-child(4) { animation-delay: 0.4s; }
.number-ball:nth-child(5) { animation-delay: 0.5s; }
.number-ball:nth-child(6) { animation-delay: 0.6s; }
.number-ball:nth-child(7) { animation-delay: 0.7s; }
.number-ball:nth-child(8) { animation-delay: 0.8s; }

.die:nth-child(1) { animation-delay: 0.1s; }
.die:nth-child(2) { animation-delay: 0.2s; }
.die:nth-child(3) { animation-delay: 0.3s; }
.die:nth-child(4) { animation-delay: 0.4s; }
.die:nth-child(5) { animation-delay: 0.5s; }
.die:nth-child(6) { animation-delay: 0.6s; }
.die:nth-child(7) { animation-delay: 0.7s; }
.die:nth-child(8) { animation-delay: 0.8s; }
.die:nth-child(9) { animation-delay: 0.9s; }
.die:nth-child(10) { animation-delay: 1.0s; }

.separator {
    font-size: 1.5em;
    color: #999;
    margin: 0 5px;
}

.info-section {
    margin-top: 30px;
}

.info-card {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.info-card h3 {
    color: #667eea;
    margin-bottom: 10px;
}

.info-card p {
    color: #666;
    line-height: 1.6;
    margin-bottom: 8px;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: #999;
    font-size: 1.1em;
}

.history-section {
    margin-top: 30px;
    margin-bottom: 30px;
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    border: 2px solid #e0e0e0;
}

.history-header {
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 15px;
}

.history-header h3 {
    color: #667eea;
    font-size: 1.5em;
    margin-bottom: 15px;
}

.history-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.history-tab-btn {
    padding: 10px 20px;
    font-size: 0.95em;
    font-weight: 600;
    color: #667eea;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.history-tab-btn:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.history-tab-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
}

.clear-history-btn {
    padding: 10px 15px;
    font-size: 1.1em;
    background: #ff6b6b;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-left: auto;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.clear-history-btn:hover {
    background: #ff4757;
    transform: scale(1.05);
}

.history-content {
    margin-top: 20px;
}

.history-tab {
    display: none;
}

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

.history-item {
    background: white;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 12px;
    border-left: 4px solid #667eea;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.history-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateX(5px);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e0e0e0;
}

.history-type {
    font-weight: 600;
    color: #667eea;
    font-size: 0.95em;
}

.history-date {
    color: #999;
    font-size: 0.85em;
}

.history-numbers {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.history-number-ball {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1em;
    font-weight: 700;
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.history-number-ball.special {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.empty-history {
    text-align: center;
    padding: 30px;
    color: #999;
    font-style: italic;
}

.winning-numbers-info {
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 20px;
    color: #856404;
    font-size: 0.9em;
}

.winning-numbers-info p {
    margin: 0;
}

.footer-section {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 3px solid #e0e0e0;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.footer-section-item {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 15px;
    border-left: 4px solid #667eea;
}

.footer-section-item h3 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.footer-section-item h4 {
    color: #555;
    margin-top: 15px;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.footer-section-item p {
    color: #666;
    line-height: 1.8;
    margin-bottom: 12px;
}

.footer-section-item ul,
.footer-section-item ol {
    color: #666;
    line-height: 1.8;
    margin-left: 20px;
    margin-bottom: 15px;
}

.footer-section-item li {
    margin-bottom: 8px;
}

.footer-section-item strong {
    color: #333;
}

.support-actions {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.support-item {
    background: white;
    padding: 20px;
    border-radius: 10px;
    border: 1px solid #e0e0e0;
}

.share-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 15px;
}

.share-btn {
    padding: 10px 20px;
    font-size: 0.95em;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.5);
}

.feedback-form {
    margin-top: 15px;
}

.feedback-form textarea {
    width: 100%;
    padding: 12px;
    font-size: 1em;
    font-family: inherit;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    resize: vertical;
    margin-bottom: 10px;
    transition: all 0.3s ease;
}

.feedback-form textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.feedback-btn {
    padding: 12px 30px;
    font-size: 1em;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(245, 87, 108, 0.3);
}

.feedback-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 87, 108, 0.5);
}

.footer-bottom {
    text-align: center;
    padding: 20px;
    color: #999;
    font-size: 0.9em;
    border-top: 1px solid #e0e0e0;
    margin-top: 30px;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 15px;
        border-radius: 15px;
    }

    header {
        margin-bottom: 25px;
    }

    header h1 {
        font-size: 1.8em;
        margin-bottom: 8px;
    }

    .subtitle {
        font-size: 0.95em;
    }

    .category-tabs {
        gap: 8px;
        margin-bottom: 20px;
    }

    .tab-btn {
        min-width: auto;
        padding: 10px 12px;
        font-size: 0.9em;
        flex: 1;
    }

    .lottery-selector {
        margin-bottom: 20px;
    }

    .gambling-warning {
        padding: 8px 12px;
        gap: 8px;
        margin-bottom: 12px;
    }

    .warning-icon {
        font-size: 1.1em;
    }

    .warning-text {
        font-size: 0.85em;
    }

    .lottery-selector select {
        padding: 14px 16px;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .custom-settings {
        grid-template-columns: 1fr;
        padding: 15px;
        gap: 12px;
    }

    .setting-group input[type="number"],
    .setting-group input[type="text"],
    .setting-group input[type="date"] {
        padding: 12px;
        font-size: 16px; /* Prevents zoom on iOS */
        min-height: 44px; /* Better touch target */
    }

    .generate-section {
        flex-direction: column;
        gap: 12px;
        margin-bottom: 25px;
    }

    .generate-btn {
        width: 100%;
        padding: 16px 20px;
        font-size: 1em;
        min-height: 50px; /* Better touch target */
    }

    .results-container {
        margin-bottom: 25px;
    }

    .result-set {
        padding: 20px;
        margin-bottom: 15px;
    }

    .result-set h3 {
        font-size: 1em;
        margin-bottom: 12px;
    }

    .numbers-display {
        gap: 8px;
    }

    .number-ball {
        width: 45px;
        height: 45px;
        font-size: 1em;
    }

    .separator {
        font-size: 1.2em;
        margin: 0 3px;
    }

    .result-text {
        font-size: 1em;
        padding: 12px;
    }

    .result-text.large {
        font-size: 1.4em;
        padding: 15px;
    }

    .color-preview {
        width: 70px;
        height: 70px;
    }

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

    .coordinate-item {
        width: 100%;
        padding: 12px 20px;
        text-align: center;
    }

    .coordinate-map {
        height: 250px;
        width: 100%;
    }

    .dice-display {
        gap: 10px;
    }

    .die {
        width: 60px;
        height: 60px;
        padding: 6px;
    }

    .dice-dot {
        width: 8px;
        height: 8px;
    }

    .dice-number {
        font-size: 1.3em;
    }

    .card-display {
        font-size: 1.5em;
        padding: 15px;
    }

    .info-section {
        margin-top: 25px;
    }

    .info-card {
        padding: 15px;
    }

    .info-card h3 {
        font-size: 1.1em;
    }

    .info-card p {
        font-size: 0.9em;
    }

    .footer-section {
        margin-top: 40px;
        padding-top: 30px;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 20px;
        margin-bottom: 25px;
    }

    .footer-section-item {
        padding: 20px;
    }

    .footer-section-item h3 {
        font-size: 1.1em;
        margin-bottom: 12px;
    }

    .footer-section-item h4 {
        font-size: 1em;
        margin-top: 12px;
        margin-bottom: 8px;
    }

    .footer-section-item p,
    .footer-section-item ul,
    .footer-section-item ol {
        font-size: 0.9em;
        line-height: 1.6;
    }

    .support-item {
        padding: 15px;
    }

    .share-buttons {
        flex-direction: column;
        gap: 8px;
    }

    .share-btn {
        width: 100%;
        padding: 12px 20px;
        min-height: 44px; /* Better touch target */
    }

    .feedback-form textarea {
        padding: 12px;
        font-size: 16px; /* Prevents zoom on iOS */
        min-height: 100px;
    }

    .feedback-btn {
        width: 100%;
        padding: 14px 20px;
        min-height: 44px; /* Better touch target */
    }

    .footer-bottom {
        padding: 15px;
        font-size: 0.85em;
    }

    .history-section {
        padding: 15px;
        margin-top: 20px;
        margin-bottom: 20px;
    }

    .history-header h3 {
        font-size: 1.2em;
    }

    .history-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .history-tab-btn {
        width: 100%;
        padding: 12px;
    }

    .clear-history-btn {
        width: 100%;
        margin-left: 0;
        margin-top: 10px;
    }

    .history-item {
        padding: 12px;
    }

    .history-number-ball {
        width: 40px;
        height: 40px;
        font-size: 0.9em;
    }

    .history-item-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    body {
        padding: 5px;
    }

    .container {
        padding: 12px;
    }

    header h1 {
        font-size: 1.5em;
    }

    .tab-btn {
        padding: 8px 10px;
        font-size: 0.85em;
    }

    .number-ball {
        width: 40px;
        height: 40px;
        font-size: 0.9em;
    }

    .die {
        width: 60px;
        height: 60px;
        padding: 6px;
    }

    .dice-dot {
        width: 8px;
        height: 8px;
    }

    .dice-number {
        font-size: 1.5em;
    }

    .coin {
        width: 120px;
        height: 120px;
    }

    .coin-heads,
    .coin-tails {
        font-size: 3em;
    }

    .coin-label {
        font-size: 1em;
    }

    .playing-card {
        width: min(90px, 22vw);
        height: auto;
        aspect-ratio: 120 / 168;
        padding: 6px;
        max-width: calc(100% - 20px);
    }

    .card-suit-large {
        font-size: 2em;
    }

    .card-rank {
        font-size: 1em;
    }

    .card-suit {
        font-size: 0.9em;
    }

    .result-text.large {
        font-size: 1.2em;
    }

    .card-display {
        padding: 10px 5px;
        gap: 10px;
    }

    .card-name {
        font-size: 0.85em;
    }
}

/* Landscape mobile optimization */
@media (max-width: 768px) and (orientation: landscape) {
    .container {
        padding: 20px;
    }

    header h1 {
        font-size: 1.6em;
    }

    .category-tabs {
        margin-bottom: 15px;
    }
}

/* Prevent horizontal scroll */
* {
    max-width: 100%;
}

html {
    overflow-x: hidden;
}

body {
    overflow-x: hidden;
    position: relative;
}

