@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css');

:root {
    --bg: #ffffff;
    --card-bg: #f8fafc;
    --primary: #007aff; /* Apple Blue */
    --secondary: #5856d6;
    --accent: #ff2d55;
    --text-main: #1c1c1e;
    --text-sub: #8e8e93;
    --border: rgba(0,0,0,0.05);
    --shadow-sm: 0 4px 6px rgba(0,0,0,0.02);
    --shadow-md: 0 4px 30px rgba(0,0,0,0.03);
    --ball-shadow: 0 8px 16px rgba(0,0,0,0.1);
}

[data-theme="dark"] {
    --bg: #000000;
    --card-bg: #1c1c1e;
    --primary: #0a84ff;
    --secondary: #5e5ce6;
    --accent: #ff375f;
    --text-main: #f5f5f7;
    --text-sub: #8e8e93; /* Keep gray for subtext */
    --border: rgba(255,255,255,0.1);
    --shadow-sm: 0 4px 6px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 30px rgba(0,0,0,0.3);
    --ball-shadow: 0 8px 16px rgba(0,0,0,0.3);
}

body {
    font-family: 'Pretendard', sans-serif;
    background-color: var(--bg);
    color: var(--text-main);
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Header */
header {
    text-align: left;
    padding: 20px 0 10px 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.header-content {
    display: flex;
    flex-direction: column;
}

header h1 {
    font-size: 1.8rem;
    font-weight: 900;
    margin: 0;
    letter-spacing: -1px;
    background: linear-gradient(135deg, var(--text-main), var(--text-sub));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.ai-status {
    font-size: 0.8rem;
    color: var(--primary);
    font-weight: 700;
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-status::before {
    content: '';
    width: 8px; height: 8px;
    background: var(--primary);
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 8px var(--primary);
}

/* Theme Toggle Button */
.theme-toggle {
    background: var(--card-bg);
    border: 1px solid var(--border);
    color: var(--text-main);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.theme-toggle:hover {
    transform: scale(1.05);
    background: var(--border);
}

/* Card Styles */
.card {
    background: var(--card-bg);
    border-radius: 32px;
    padding: 30px 20px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.ball-display-group {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.ball-display {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.ball {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.1rem;
    color: #fff;
    box-shadow: var(--ball-shadow);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.ball:hover { transform: scale(1.1); }

.draw-info-stamp {
    font-size: 0.75rem;
    color: var(--text-sub);
    text-align: center;
    margin-top: 25px;
    font-family: monospace;
}

/* Button Group */
.btn-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.main-btns {
    display: flex;
    gap: 10px;
}

button {
    border-radius: 18px;
    border: none;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Pretendard', sans-serif;
}

.btn-single {
    flex: 1; padding: 20px;
    background: var(--text-main);
    color: var(--bg);
}

.btn-multi {
    flex: 1; padding: 20px;
    background: var(--primary);
    color: white;
    box-shadow: 0 10px 20px rgba(0, 122, 255, 0.2);
}

.btn-save {
    width: 100%; padding: 15px;
    background: var(--card-bg);
    color: var(--text-main);
    border: 1px solid var(--border);
    font-size: 0.9rem;
}

button:active { transform: scale(0.96); opacity: 0.8; }

/* History Card */
.history-card {
    background: var(--card-bg);
    border-radius: 32px;
    padding: 24px;
    border: 1px solid var(--border);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.history-title {
    font-size: 1rem;
    font-weight: 800;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text-main);
}

.scroll-area { max-height: 350px; overflow-y: auto; }

/* Scrollbar styling */
.scroll-area::-webkit-scrollbar {
    width: 6px;
}
.scroll-area::-webkit-scrollbar-track {
    background: transparent;
}
.scroll-area::-webkit-scrollbar-thumb {
    background-color: var(--border);
    border-radius: 20px;
}

.group-divider {
    padding: 10px;
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--text-sub);
    text-align: left;
    border-bottom: 1px solid var(--border);
    margin: 20px 0 10px 0;
    display: flex;
    justify-content: space-between;
}

.match-row {
    padding: 16px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.round-info { font-size: 0.95rem; font-weight: 700; color: var(--text-main); margin-bottom: 8px; }

.mini-balls { display: flex; gap: 6px; }
.mini-ball {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    background: var(--border);
    color: var(--text-sub);
    font-weight: 700;
}

.mini-ball.highlight { color: #fff; }

.rank-badge {
    font-size: 0.7rem;
    font-weight: 800;
    padding: 6px 12px;
    border-radius: 12px;
}

.rank-1 { background: #ffcc00; color: #000; }
.rank-3 { background: #34c759; color: #fff; }
.rank-4 { background: var(--border); color: var(--text-sub); }

.empty-msg { padding: 40px; text-align: center; color: var(--text-sub); font-size: 0.9rem; }