:root {
    --bg-gradient: linear-gradient(to right, #6a11cb, #2575fc);
    --container-bg: rgba(255, 255, 255, 0.1);
    --text-color: white;
    --ball-bg: linear-gradient(145deg, #e6e6e6, #ffffff);
    --ball-text: #333;
    --btn-bg: #ff4081;
    --btn-text: white;
    --nav-bg: rgba(0, 0, 0, 0.3);
}

[data-theme="light"] {
    --bg-gradient: linear-gradient(to right, #f5f7fa, #c3cfe2);
    --container-bg: rgba(255, 255, 255, 0.9);
    --text-color: #333;
    --ball-bg: linear-gradient(145deg, #2575fc, #6a11cb);
    --ball-text: white;
    --btn-bg: #333;
    --btn-text: white;
    --nav-bg: rgba(255, 255, 255, 0.8);
}

body {
    font-family: 'Helvetica Neue', sans-serif;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--bg-gradient);
    color: var(--text-color);
    margin: 0;
    transition: background 0.3s, color 0.3s;
}

header {
    background: var(--nav-bg);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 10px 0;
}

nav {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

.logo {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--btn-bg);
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.lang-switcher {
    display: flex;
    gap: 5px;
}

.lang-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 1.4em;
    transition: all 0.3s;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

[data-theme="light"] .lang-btn {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.lang-btn.active {
    background: var(--btn-bg);
    border-color: var(--btn-bg);
    box-shadow: 0 0 10px rgba(255, 64, 129, 0.3);
}

.lang-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

#theme-toggle {

    list-style: none;
    display: flex;
    gap: 20px;
    margin: 0;
    padding: 0;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    transition: color 0.3s;
}

.nav-links a:hover {
    color: var(--btn-bg);
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 60px;
    padding: 60px 20px;
}

.container, .form-container, .animal-test-container {
    text-align: center;
    background: var(--container-bg);
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transition: background 0.3s;
    width: 100%;
    max-width: 600px;
}

.description {
    line-height: 1.6;
    margin-bottom: 30px;
    opacity: 0.9;
    text-align: left;
}

#webcam-container {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    overflow: hidden;
    border-radius: 10px;
}

#webcam-container canvas {
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

#label-container {
    margin-top: 20px;
    font-size: 1.2em;
    font-weight: bold;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#label-container div {
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    transition: all 0.3s;
}

[data-theme="light"] #label-container div {
    background: rgba(0, 0, 0, 0.05);
}

h1, h2 {
    font-size: 2.2em;
    margin-bottom: 20px;
}

.form-group {
    text-align: left;
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    font-size: 0.9em;
}

.form-group input, .form-group textarea {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-color);
    font-family: inherit;
    box-sizing: border-box;
}

[data-theme="light"] .form-group input, 
[data-theme="light"] .form-group textarea {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.submit-btn {
    width: 100%;
    padding: 15px;
    font-size: 1.1em;
    cursor: pointer;
    border: none;
    border-radius: 10px;
    background: var(--btn-bg);
    color: var(--btn-text);
    transition: transform 0.2s, background 0.3s;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    font-weight: bold;
}

.submit-btn:hover {
    transform: scale(1.02);
}

#generate-btn {
    padding: 15px 30px;
    font-size: 1.2em;
    cursor: pointer;
    border: none;
    border-radius: 10px;
    background: var(--btn-bg);
    color: var(--btn-text);
    margin-top: 30px;
    transition: transform 0.2s, background 0.3s, color 0.3s;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

#generate-btn:hover {
    transform: scale(1.05);
}

#theme-toggle {
    padding: 8px 15px;
    cursor: pointer;
    border: none;
    border-radius: 5px;
    background: var(--btn-bg);
    color: var(--btn-text);
    transition: all 0.3s;
    font-weight: bold;
}

lotto-numbers {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 10px;
}

footer {
    background: var(--nav-bg);
    padding: 40px 20px;
    text-align: center;
    margin-top: 60px;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-links {
    list-style: none;
    padding: 0;
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 20px;
}

.footer-links a {
    color: var(--text-color);
    text-decoration: none;
    opacity: 0.8;
}

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

@media (max-width: 768px) {
    .nav-links {
        display: none;
    }
    h1, h2 {
        font-size: 1.8em;
    }
}

.faq-section {
    text-align: left;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="light"] .faq-section {
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.faq-section h3 {
    font-size: 1.4em;
    margin-bottom: 20px;
    color: var(--btn-bg);
}

details {
    margin-bottom: 15px;
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 8px;
    cursor: pointer;
}

[data-theme="light"] details {
    background: rgba(0, 0, 0, 0.03);
}

summary {
    font-weight: bold;
    outline: none;
}

details p {
    margin-top: 10px;
    line-height: 1.6;
    opacity: 0.9;
    cursor: default;
}

.kbo-official-container {
    max-width: 1000px;
    padding: 30px;
    background: var(--container-bg);
}

.kbo-official-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
    background: #041E42; /* KBO Navy */
    padding: 15px 25px;
    border-radius: 12px;
    color: white;
}

.kbo-main-logo {
    background: #C40D2E; /* KBO Red */
    padding: 5px 12px;
    font-weight: 900;
    font-size: 1.4em;
    border-radius: 4px;
    letter-spacing: -1px;
}

.kbo-official-header h2 {
    margin: 0;
    font-size: 1.3em;
    color: white;
}

.live-indicator {
    font-size: 0.7em;
    background: #C40D2E;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: bold;
    margin-left: 10px;
    animation: blink 1.5s infinite;
}

@keyframes blink {
    0% { opacity: 1; }
    50% { opacity: 0.4; }
    100% { opacity: 1; }
}

.kbo-official-content {
    display: grid;
    grid-template-columns: 1.8fr 1fr;
    gap: 25px;
}

.official-standings {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 10px;
    overflow: hidden;
}

[data-theme="light"] .official-standings {
    background: rgba(0, 0, 0, 0.03);
}

#kbo-standings {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85em;
}

#kbo-standings th {
    background: rgba(0, 0, 0, 0.1);
    padding: 12px 6px;
    font-weight: 700;
    border-bottom: 2px solid #041E42;
    text-align: center;
}

#kbo-standings td {
    padding: 10px 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    text-align: center;
}

.team-name {
    text-align: left !important;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.team-rank-high {
    color: #C40D2E;
    font-weight: 800;
}

.lg-highlight {
    background: rgba(196, 13, 46, 0.15) !important;
}

.lg-official-stats {
    background: #fff;
    color: #333;
    border-radius: 15px;
    padding: 20px;
    background-image: repeating-linear-gradient(90deg, transparent, transparent 15px, rgba(196, 13, 46, 0.05) 15px, rgba(196, 13, 46, 0.05) 16px);
    border: 1px solid #ddd;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

[data-theme="dark"] .lg-official-stats {
    background: #1a1a1a;
    color: #eee;
    background-image: repeating-linear-gradient(90deg, transparent, transparent 15px, rgba(196, 13, 46, 0.1) 15px, rgba(196, 13, 46, 0.1) 16px);
    border: 1px solid #333;
}

.lg-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 2px solid #000;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.lg-logo-small { width: 35px; }

.player-stats-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.player-stat-row {
    background: rgba(0, 0, 0, 0.03);
    padding: 12px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 5px solid #000;
}

[data-theme="dark"] .player-stat-row {
    background: rgba(255, 255, 255, 0.05);
    border-left: 5px solid #eee;
}

.stat-group { display: flex; gap: 20px; }
.stat-item { text-align: center; }
.stat-item .val { font-size: 1.1em; font-weight: 800; color: #C40D2E; }
.stat-item .lbl { font-size: 0.7em; opacity: 0.7; display: block; }

.kbo-official-footer {
    margin-top: 25px;
    font-size: 0.8em;
    opacity: 0.7;
    display: flex;
    justify-content: space-between;
}

.footer-links a {
    color: inherit;
    text-decoration: none;
    margin-left: 15px;
    font-weight: bold;
}

.hong-chang-ki-card {
    margin-top: 15px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    padding: 15px;
    border-left: 6px solid #C40D2E;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    color: #333;
    display: flex;
    gap: 20px;
    align-items: center;
}

[data-theme="dark"] .hong-chang-ki-card {
    background: linear-gradient(135deg, #2b2d42 0%, #1a1b2e 100%);
    color: #eee;
    border-left: 6px solid #C40D2E;
}

.hong-profile {
    flex: 0 0 80px;
    height: 80px;
    background: #041E42;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.5em;
    border: 3px solid #C40D2E;
}

.hong-content {
    flex: 1;
    text-align: left;
}

.hong-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.hong-name {
    font-size: 1.2em;
    font-weight: 800;
}

.hong-record-pill {
    background: #C40D2E;
    color: white;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: bold;
}

.hong-stats {
    display: flex;
    gap: 15px;
    margin-bottom: 8px;
    font-weight: 700;
    color: #041E42;
}

[data-theme="dark"] .hong-stats {
    color: #4facfe;
}

.hong-highlight {
    font-size: 0.85em;
    line-height: 1.5;
    opacity: 0.9;
}

@media (max-width: 500px) {
    .hong-chang-ki-card { flex-direction: column; text-align: center; }
    .hong-content { text-align: center; }
    .hong-header { justify-content: center; gap: 10px; }
    .hong-stats { justify-content: center; }
}

.weather-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    border-bottom: 2px solid var(--btn-bg);
    padding-bottom: 10px;
}

.weather-header h2 {
    margin: 0;
    font-size: 1.6em;
}

.weather-source {
    font-size: 0.8em;
    opacity: 0.7;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 10px;
    border-radius: 20px;
}

.weather-main-card {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
}

[data-theme="light"] .weather-main-card {
    box-shadow: 0 10px 25px rgba(79, 172, 254, 0.3);
}

.weather-main-card::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    pointer-events: none;
}

.weather-main-left {
    text-align: left;
}

.weather-main-temp {
    font-size: 4.5em;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.weather-main-desc {
    font-size: 1.4em;
    font-weight: 600;
}

.weather-main-right {
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.weather-info-pill {
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 15px;
    border-radius: 12px;
    backdrop-filter: blur(5px);
    font-size: 0.95em;
    font-weight: 500;
}

.forecast-title {
    font-size: 1.1em;
    font-weight: bold;
    text-align: left;
    margin-bottom: 15px;
    padding-left: 5px;
}

.forecast-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 10px 5px 20px 5px;
    scrollbar-width: none; /* Firefox */
}

.forecast-scroll::-webkit-scrollbar {
    display: none; /* Chrome, Safari */
}

.forecast-card {
    flex: 0 0 100px;
    background: rgba(255, 255, 255, 0.08);
    padding: 15px 10px;
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s;
}

[data-theme="light"] .forecast-card {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.forecast-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.15);
}

.forecast-card .date { font-size: 0.85em; opacity: 0.8; }
.forecast-card .icon { font-size: 2em; }
.forecast-card .temp { font-size: 1.1em; font-weight: bold; color: var(--btn-bg); }
.forecast-card .pop { font-size: 0.75em; color: #4facfe; font-weight: bold; }

.weather-footer {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.85em;
    opacity: 0.7;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.kma-link {
    color: var(--btn-bg);
    text-decoration: none;
    font-weight: bold;
}

/* --- Radio Section Styles --- */
.radio-container {
    max-width: 800px;
}

.radio-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--btn-bg);
    padding-bottom: 10px;
}

.radio-header h2 {
    margin: 0;
    font-size: 1.6em;
}

.radio-player-container {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

[data-theme="light"] .radio-player-container {
    background: rgba(0, 0, 0, 0.03);
}

.current-station-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2em;
    font-weight: bold;
}

.station-icon {
    font-size: 1.5em;
}

#radio-player {
    width: 100%;
    height: 40px;
}

.station-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 15px;
    width: 100%;
}

.station-btn {
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

[data-theme="light"] .station-btn {
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.station-btn:hover {
    background: var(--btn-bg);
    color: white;
    transform: translateY(-2px);
}

.station-btn.active {
    background: var(--btn-bg);
    color: white;
    border-color: var(--btn-bg);
}

.btn-icon {
    font-size: 1.2em;
}

@media (max-width: 500px) {
    .station-grid {
        grid-template-columns: 1fr 1fr;
    }
}
