:root {
    --primary-color: #ffffff;
    --secondary-color: #666666;
    --background-color: #1a1a1a;
    --text-color: #ffffff;
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.8rem 2rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    margin-bottom: 1rem;
    flex-shrink: 0;
}

header h1 {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
    color: var(--primary-color);
}

main {
    display: grid;
    grid-template-columns: 60% 40%;
    gap: 2rem;
    flex-grow: 1;
    min-height: 0;
    align-items: start;
}

.generator {
    padding: 1.5rem;
    background: #222;
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    height: auto;
}

.generator-content {
    display: flex;
    gap: 3rem;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    flex-grow: 1;
}

.generator-left {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-width: 160px;
}

.primary-btn {
    background-color: var(--primary-color);
    color: var(--background-color);
    border: none;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    font-size: 1.4rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.primary-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0) 70%);
    pointer-events: none;
}

.primary-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(105, 200, 242, 0.4);
    background-color: #69c8f2;
    color: white;
}

.primary-btn:active {
    transform: scale(0.98);
}

.secondary-btn {
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    padding: 0.9rem 2rem;
    border-radius: var(--border-radius);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.secondary-btn:hover {
    background-color: var(--primary-color);
    color: var(--background-color);
}

.number-sets {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    justify-content: center;
    max-width: 600px;
    width: 100%;
}

.number-sets::-webkit-scrollbar {
    width: 8px;
}

.number-sets::-webkit-scrollbar-track {
    background: #1a1a1a;
    border-radius: 4px;
}

.number-sets::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}

.number-sets::-webkit-scrollbar-thumb:hover {
    background: #444;
}

.number-set {
    background: #2a2a2a;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: center;
    gap: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
}

.number-set:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
    background: #333;
}

.number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.1rem;
    color: #000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* 로또 공 색상 */
.number:nth-child(1) { background: #fbc400; } /* 노란색 */
.number:nth-child(2) { background: #69c8f2; } /* 파란색 */
.number:nth-child(3) { background: #ff7272; } /* 빨간색 */
.number:nth-child(4) { background: #aaa; }    /* 회색 */
.number:nth-child(5) { background: #b0d840; } /* 초록색 */
.number:nth-child(6) { background: #ff7272; } /* 빨간색 */

.saved-numbers {
    background: #222;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: auto;
}

.saved-numbers-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
    padding: 0.8rem 1.2rem;
    border-radius: var(--border-radius);
    background: linear-gradient(to right, #2a2a2a, #333);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.saved-numbers-header h2 {
    font-size: 1.3rem;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.saved-numbers-header h2 i {
    color: #69c8f2;
}

.delete-all-btn {
    background: transparent;
    color: #ff7272;
    border: 2px solid #ff7272;
    padding: 0.5rem 1.2rem;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.delete-all-btn i {
    font-size: 0.9rem;
}

.delete-all-btn:hover {
    background: #ff7272;
    color: white;
    transform: translateY(-2px);
}

.delete-all-btn:active {
    transform: translateY(0);
}

.history-list {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1rem 0.5rem 0 0.5rem;
    display: grid;
    gap: 1rem;
    align-content: start;
    height: auto;
    min-height: 200px;
}

.history-list::-webkit-scrollbar {
    width: 6px;
}

.history-list::-webkit-scrollbar-track {
    background: #1a1a1a;
    border-radius: 4px;
}

.history-list::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}

.history-list::-webkit-scrollbar-thumb:hover {
    background: #444;
}

.history-item {
    background: #2a2a2a;
    padding: 1rem;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.history-item .numbers {
    display: flex;
    gap: 0.6rem;
}

.history-item .number {
    width: 32px;
    height: 32px;
    font-size: 0.95rem;
}

.history-item .memo {
    color: #999;
    font-size: 0.9rem;
    border-top: 1px solid #333;
    padding-top: 0.8rem;
}

.history-item .date {
    color: #666;
    font-size: 0.8rem;
}

.history-item .delete-btn {
    position: absolute;
    top: 0.8rem;
    right: 0.8rem;
    background: none;
    border: none;
    color: #ff7272;
    cursor: pointer;
    padding: 0.4rem;
    border-radius: 4px;
    opacity: 0;
    transition: var(--transition);
}

.history-item:hover .delete-btn {
    opacity: 1;
}

.history-item .delete-btn:hover {
    background: rgba(255, 114, 114, 0.1);
    transform: scale(1.1);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #2a2a2a;
    padding: 2rem;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 500px;
    color: var(--text-color);
}

.modal h3 {
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

.modal .selected-numbers {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.modal input {
    width: 100%;
    padding: 0.8rem;
    margin: 1rem 0;
    border: 1px solid #444;
    border-radius: var(--border-radius);
    font-size: 1rem;
    background: #333;
    color: var(--text-color);
}

.modal-buttons {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

.lotto-info {
    color: #e0e0e0;
    padding: 1.5rem;
}

.info-section {
    background: #2a2a2a;
    border-radius: var(--border-radius);
    padding: 1rem 1.2rem;
    margin-bottom: 0.8rem;
}

.info-section h3 {
    color: #fff;
    margin-bottom: 0.8rem;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.info-section.warning h3 {
    color: #ff6b6b;
}

.info-section.prize h3 {
    color: #ffd93d;
}

.info-section.draw h3 {
    color: #4cd964;
}

.info-section ul {
    padding-left: 0;
    list-style: none;
    margin: 0;
}

.info-section li {
    margin-bottom: 0.6rem;
    font-size: 0.95rem;
    color: #cccccc;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.info-section li:last-child {
    margin-bottom: 0;
}

.info-section li i {
    color: #69c8f2;
    font-size: 0.9rem;
}

.info-section .draw-info {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.info-section .draw-info p {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    color: #cccccc;
}

.info-section .draw-info i {
    color: #69c8f2;
}

.save-guide {
    background: #2a2a2a;
    border-radius: var(--border-radius);
    padding: 1.2rem 1.5rem;
    margin: 1rem 0;
    flex-shrink: 0;
    border-left: 4px solid #69c8f2;
}

.save-guide h3 {
    color: #fff;
    margin-bottom: 1rem;
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.save-guide h3 i {
    color: #69c8f2;
}

.save-guide ol {
    padding-left: 0;
    list-style: none;
    counter-reset: item;
}

.save-guide li {
    margin-bottom: 0.7rem;
    font-size: 0.95rem;
    color: #cccccc;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    counter-increment: item;
}

.save-guide li::before {
    content: counter(item);
    background: #69c8f2;
    color: #fff;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
}

.save-guide li i {
    color: #69c8f2;
}

.number-counter {
    background: #69c8f2;
    color: #fff;
    font-size: 0.9rem;
    padding: 0.2rem 0.6rem;
    border-radius: 1rem;
    margin-left: 0.8rem;
    font-weight: normal;
}

/* 반응형 디자인 개선 */
@media (max-width: 1200px) {
    .container {
        padding: 0.5rem 1rem;
    }
    
    main {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .generator {
        padding: 1rem;
    }
    
    .saved-numbers {
        padding: 1rem;
        height: auto;
        max-height: none;
        min-height: 500px;
        margin-bottom: 20px;
    }
    
    .generator-content {
        gap: 1.5rem;
    }
    
    .generator-left {
        min-width: auto;
    }
    
    .number-sets {
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0.5rem;
        height: auto;
        overflow-y: auto;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
    
    header p {
        font-size: 0.9rem;
    }
    
    main {
        display: flex;
        flex-direction: column;
        gap: 1rem;
        padding-bottom: 2rem;
    }
    
    .generator-content {
        flex-direction: column;
        gap: 1rem;
        padding: 0.5rem;
    }
    
    .primary-btn {
        width: 100px;
        height: 100px;
        font-size: 1.2rem;
    }
    
    .number-set {
        padding: 1rem;
        gap: 0.6rem;
    }
    
    .number {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
    
    .saved-numbers {
        min-height: 400px;
    }
    
    .saved-numbers-header {
        padding: 0.5rem 0.8rem;
    }
    
    .saved-numbers-header h2 {
        font-size: 1.1rem;
    }
    
    .delete-all-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .history-list {
        height: auto;
        min-height: 300px;
        overflow-y: visible;
    }
    
    .history-item {
        padding: 0.8rem;
    }
    
    .modal-content {
        width: 90%;
        padding: 1.2rem;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.5rem;
    }
    
    .primary-btn {
        width: 90px;
        height: 90px;
        font-size: 1.1rem;
    }
    
    .number-set {
        padding: 0.8rem;
        gap: 0.4rem;
    }
    
    .number {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }
    
    .history-item .numbers {
        gap: 0.4rem;
    }
    
    .history-item .number {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }
    
    .modal .selected-numbers {
        gap: 0.4rem;
    }
    
    .save-guide li {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }
    
    .info-section li {
        font-size: 0.9rem;
    }
    
    .saved-numbers {
        margin-bottom: 0;
        overflow: visible;
    }
    
    footer {
        margin-top: 1rem;
        padding: 1rem 0;
        position: relative;
        width: 100%;
    }
}

/* 모바일 터치 최적화 */
@media (pointer: coarse) {
    .number-set {
        padding: 1.2rem 0.8rem;
    }
    
    .delete-btn {
        padding: 0.8rem;
    }
    
    .history-item .delete-btn {
        opacity: 1;
    }
    
    .primary-btn, .secondary-btn, .delete-all-btn {
        padding: 0.8rem 1.2rem;
    }
}

/* 푸터 스타일 */
footer {
    text-align: center;
    margin-top: 1.5rem;
    padding: 1rem 0;
    font-size: 0.9rem;
    color: #888;
    border-top: 1px solid #333;
    width: 100%;
    box-sizing: border-box;
    flex-shrink: 0;
}

/* 모바일 뷰 클래스 스타일 */
.mobile-view {
    display: flex;
    flex-direction: column;
    width: 100%;
}

@media (max-width: 768px) {
    .mobile-view {
        margin-top: 1rem;
        padding-bottom: 2rem;
    }
    
    /* 스크롤시 저장된 번호 영역으로 바로 이동할 수 있는 버튼 */
    .scroll-to-saved {
        position: fixed;
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
        border-radius: 50%;
        background: var(--primary-color);
        color: var(--background-color);
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
        cursor: pointer;
        z-index: 100;
    }
}

/* 모바일에서 화면 스크롤 동작 개선 */
@media (max-width: 480px) {
    body {
        overflow-y: auto;
        height: auto;
        min-height: 100vh;
    }
    
    .container {
        height: auto;
        min-height: 100vh;
    }
    
    main {
        height: auto;
    }
    
    /* 저장 목록이 잘 보이도록 수정 */
    .saved-numbers {
        margin-bottom: 1rem;
        overflow: visible;
    }
    
    .history-list {
        overflow-y: visible;
    }
    
    /* footer 스타일 수정 */
    footer {
        margin-top: 2rem;
        padding: 1rem 0 1.5rem 0;
    }
} 