:root {
    --primary-color: #4a90e2;
    --background-color: #f0f4f8;
    --text-color: #333;
    --container-bg: #fff;
    --button-hover-color: #357ABD;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --number-bg: #eee;
    --nav-bg: #fff;
}

[data-theme="dark"] {
    --primary-color: #64b5f6;
    --background-color: #1a1a1a;
    --text-color: #f0f0f0;
    --container-bg: #2d2d2d;
    --button-hover-color: #42a5f5;
    --shadow-color: rgba(0, 0, 0, 0.5);
    --number-bg: #444;
    --nav-bg: #2d2d2d;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    margin: 0;
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background-color: var(--nav-bg);
    box-shadow: 0 2px 5px var(--shadow-color);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.theme-toggle {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-color);
    padding: 0.5rem;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.theme-toggle:hover {
    background-color: var(--shadow-color);
}

.container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 2rem;
    background-color: var(--container-bg);
    border-radius: 12px;
    box-shadow: 0 10px 20px var(--shadow-color);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

h1 {
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 0.5rem;
}

.subtitle {
    text-align: center;
    color: #777;
    margin-bottom: 2rem;
}

.generator-section {
    text-align: center;
}

.input-container {
    margin-bottom: 1.5rem;
}

label {
    font-size: 1rem;
    margin-right: 0.5rem;
}

input[type="number"] {
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid #ccc;
    width: 60px;
    text-align: center;
    font-size: 1rem;
    background-color: var(--container-bg);
    color: var(--text-color);
}

#generate-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease;
    width: 100%;
    max-width: 300px;
}

#generate-btn:hover {
    background-color: var(--button-hover-color);
}

#results-container {
    margin-top: 2rem;
}

.lotto-set {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: nowrap; /* 모바일에서 한 줄 유지를 위해 nowrap으로 변경 */
}

.lotto-number {
    background-color: var(--number-bg);
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0.25rem;
    font-weight: bold;
    font-size: 1.2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    flex-shrink: 0; /* 크기 줄어듦 방지 */
}

/* 로또 번호 대역별 색상 */
.ball-1-10 { background-color: #fbc400; color: #fff; }
.ball-11-20 { background-color: #69c8f2; color: #fff; }
.ball-21-30 { background-color: #ff7272; color: #fff; }
.ball-31-40 { background-color: #aaaaaa; color: #fff; }
.ball-41-45 { background-color: #b0d840; color: #fff; }

.divider {
    margin: 3rem 0;
    border: 0;
    border-top: 1px solid var(--shadow-color);
}

.content-article h2, .contact-section h2, .comments-section h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

.content-article ul {
    padding-left: 1.5rem;
}

.content-article li {
    margin-bottom: 0.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group input, .form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid #ccc;
    background-color: var(--container-bg);
    color: var(--text-color);
    box-sizing: border-box;
    font-size: 1rem;
}

.form-group textarea {
    height: 120px;
    resize: none;
}

.submit-btn {
    width: 100%;
    padding: 1rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
    transition: background-color 0.3s ease;
}

.submit-btn:hover {
    background-color: var(--button-hover-color);
}

.footer {
    text-align: center;
    padding: 3rem 1rem;
    background-color: var(--nav-bg);
    color: #777;
    margin-top: 4rem;
    font-size: 0.9rem;
}

.footer-links {
    margin-bottom: 1rem;
}

.footer-links a {
    color: var(--primary-color);
    text-decoration: none;
    margin: 0 0.5rem;
}

.footer-links a:hover {
    text-decoration: underline;
}

.lotto-pattern-container {
    margin: 1.5rem auto;
    max-width: 320px;
    padding: 2rem 1.5rem;
    background: #fffdf5; /* 미색 종이 */
    background-image: radial-gradient(#eee 1px, transparent 0); /* 미세한 종이 질감 */
    background-size: 20px 20px;
    border: 1px solid #dcd0b9;
    position: relative;
    box-shadow: 
        0 4px 6px rgba(0,0,0,0.1),
        0 1px 3px rgba(0,0,0,0.08),
        inset 0 0 40px rgba(255,255,255,0.5);
    transform: rotate(-0.5deg); /* 실제 사진 같은 미세한 각도 */
    border-radius: 2px;
}

[data-theme="dark"] .lotto-pattern-container {
    background: #2d2d2d;
    background-image: radial-gradient(#3d3d3d 1px, transparent 0);
    border-color: #444;
    box-shadow: 0 10px 20px rgba(0,0,0,0.4);
}

.slip-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    border-bottom: 2px solid #cc0000;
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
}

.slip-title {
    font-family: "Arial Black", sans-serif;
    font-size: 1.2rem;
    color: #cc0000;
    font-weight: 900;
    line-height: 1;
}

.slip-slot-label {
    font-size: 0.9rem;
    color: #cc0000;
    font-weight: bold;
}

.slip-slot-label span {
    font-size: 0.7rem;
    font-weight: normal;
    margin-left: 4px;
}

.grid-wrapper {
    position: relative;
    padding: 0.5rem 0;
}

.lotto-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    position: relative;
    z-index: 1;
}

.grid-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: #cc0000;
    border: 1px solid #ffcccc;
    border-radius: 1px;
    background: #fff;
    font-weight: bold;
    transition: all 0.2s ease;
}

[data-theme="dark"] .grid-cell {
    background: #1a1a1a;
    color: #ff6666;
    border-color: #553333;
}

.grid-cell.marked {
    background-color: #1a1a1a; /* 컴싸 마킹 */
    color: #1a1a1a;
    border-color: #000;
    transform: scale(1.05);
}

.grid-cell.marked::after {
    content: '';
    position: absolute;
    width: 60%;
    height: 85%;
    background: #000;
    border-radius: 1px;
}

[data-theme="dark"] .grid-cell.marked {
    background-color: #eee;
    color: #eee;
    border-color: #fff;
}

.slip-footer {
    margin-top: 1.5rem;
    height: 30px;
    background: repeating-linear-gradient(
        90deg,
        #333,
        #333 2px,
        transparent 2px,
        transparent 4px,
        #333 4px,
        #333 5px,
        transparent 5px,
        transparent 8px
    );
    opacity: 0.3;
}

.pattern-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
}

.pattern-line {
    fill: none;
    stroke: #4a90e2;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.7;
    filter: drop-shadow(0 0 2px rgba(0,0,0,0.2));
}

.lotto-set-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.disclaimer-text {
    font-size: 0.8rem;
    color: #999;
    text-align: left;
    margin-top: 1rem;
}

@media (max-width: 600px) {
    .container {
        margin: 1rem 0.25rem; /* 외부 여백 최소화 */
        padding: 1.5rem 0.5rem; /* 내부 좌우 여백 최소화 */
        width: calc(100% - 0.5rem);
        box-sizing: border-box;
    }
    
    .lotto-number {
        width: 42px; /* 공 크기 확대 (36px -> 42px) */
        height: 42px;
        font-size: 1.1rem;
        margin: 0.1rem; /* 공 사이 간격 최소화 */
    }

    .lotto-pattern-container {
        max-width: 280px;
        padding: 0.5rem;
    }

    .grid-cell {
        font-size: 0.7rem;
        gap: 2px;
    }
}
