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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

/* 학교 급식 정보 섹션 */
.meal-section {
    background: rgba(255, 255, 255, 0.95);
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    margin-bottom: 30px;
}

.meal-section h2 {
    text-align: center;
    margin-bottom: 20px;
    color: #667eea;
    font-size: 2em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

/* 학교 검색 섹션 */
.school-search-section {
    margin-bottom: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 2px solid #667eea;
}

.school-search-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.school-search-group label {
    font-weight: bold;
    color: #667eea;
    font-size: 16px;
}

.school-search-input-wrapper {
    display: flex;
    gap: 10px;
    position: relative;
}

#schoolName {
    flex: 1;
    padding: 12px 15px;
    font-size: 16px;
    border: 2px solid #667eea;
    border-radius: 8px;
    outline: none;
    transition: all 0.3s;
}

#schoolName:focus {
    border-color: #764ba2;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.3);
}

.search-school-btn {
    padding: 12px 25px;
    font-size: 16px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: bold;
    white-space: nowrap;
}

.search-school-btn:hover {
    background: #764ba2;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.search-school-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.school-search-results {
    position: relative;
    margin-top: 10px;
}

.school-results-list {
    background: white;
    border: 2px solid #667eea;
    border-radius: 8px;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    z-index: 1000;
}

.school-result-item {
    padding: 15px;
    border-bottom: 1px solid #e0e0e0;
    cursor: pointer;
    transition: all 0.2s;
}

.school-result-item:last-child {
    border-bottom: none;
}

.school-result-item:hover {
    background: #f0f0f0;
    transform: translateX(5px);
}

.school-result-item.selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.school-result-name {
    font-weight: bold;
    font-size: 1.1em;
    margin-bottom: 5px;
    color: #667eea;
}

.school-result-item:hover .school-result-name,
.school-result-item.selected .school-result-name {
    color: white;
}

.school-result-details {
    font-size: 0.9em;
    color: #666;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.school-result-item:hover .school-result-details,
.school-result-item.selected .school-result-details {
    color: rgba(255, 255, 255, 0.9);
}

.school-result-detail-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.school-search-loading {
    text-align: center;
    padding: 20px;
    color: #667eea;
    font-weight: bold;
}

.school-search-error {
    text-align: center;
    padding: 15px;
    color: #dc3545;
    background: rgba(220, 53, 69, 0.1);
    border-radius: 8px;
    border: 2px solid #dc3545;
}

.school-search-no-results {
    text-align: center;
    padding: 20px;
    color: #999;
    font-style: italic;
}

.meal-controls {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-end;
    margin-bottom: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.meal-input-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.meal-input-group label {
    font-weight: bold;
    color: #667eea;
    font-size: 14px;
}

.meal-input-group select,
.meal-input-group input[type="text"],
.meal-input-group input[type="date"] {
    padding: 10px 15px;
    font-size: 14px;
    border: 2px solid #667eea;
    border-radius: 8px;
    outline: none;
    transition: all 0.3s;
    min-width: 150px;
}

.meal-input-group select:focus,
.meal-input-group input[type="text"]:focus,
.meal-input-group input[type="date"]:focus {
    border-color: #764ba2;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.3);
}

.load-meal-btn {
    padding: 10px 25px;
    font-size: 16px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: bold;
    height: fit-content;
}

.load-meal-btn:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.load-meal-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.meal-info {
    padding: 20px;
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    border-radius: 10px;
    min-height: 100px;
    border: 2px solid #667eea;
}

.meal-placeholder {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 20px;
}

.meal-loading {
    text-align: center;
    color: #667eea;
    font-weight: bold;
    padding: 20px;
}

.meal-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.meal-date {
    font-size: 1.3em;
    font-weight: bold;
    color: #667eea;
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
}

.meal-menu {
    font-size: 1.1em;
    line-height: 1.8;
    color: #333;
    padding: 15px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
}

.meal-menu-item {
    margin: 8px 0;
    padding: 8px;
    background: white;
    border-radius: 5px;
    border-left: 4px solid #667eea;
}

.meal-error {
    text-align: center;
    color: #dc3545;
    font-weight: bold;
    padding: 20px;
    background: rgba(220, 53, 69, 0.1);
    border-radius: 8px;
    border: 2px solid #dc3545;
}

/* 날씨 중기예보 섹션 */
.weather-section {
    background: rgba(255, 255, 255, 0.95);
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    margin-bottom: 30px;
}

.weather-section h2 {
    text-align: center;
    margin-bottom: 20px;
    color: #667eea;
    font-size: 2em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.weather-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    align-items: flex-end;
    margin-bottom: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.weather-input-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.weather-input-group label {
    font-weight: bold;
    color: #667eea;
    font-size: 14px;
}

.weather-input-group select {
    padding: 10px 15px;
    font-size: 14px;
    border: 2px solid #667eea;
    border-radius: 8px;
    outline: none;
    transition: all 0.3s;
    min-width: 150px;
}

.weather-input-group select:focus {
    border-color: #764ba2;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.3);
}

.load-weather-btn {
    padding: 10px 25px;
    font-size: 16px;
    background: #17a2b8;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: bold;
    height: fit-content;
}

.load-weather-btn:hover {
    background: #138496;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.load-weather-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.weather-info {
    padding: 20px;
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
    border-radius: 10px;
    min-height: 100px;
    border: 2px solid #667eea;
}

.weather-placeholder {
    text-align: center;
    color: rgba(255, 255, 255, 0.9);
    font-style: italic;
    padding: 20px;
}

.weather-loading {
    text-align: center;
    color: white;
    font-weight: bold;
    padding: 20px;
}

.weather-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.weather-day-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
}

.weather-day-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

.weather-day-date {
    font-size: 1.1em;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
}

.weather-day-status {
    font-size: 1.3em;
    margin: 10px 0;
    color: #333;
    font-weight: bold;
}

.weather-day-temp {
    display: flex;
    justify-content: space-around;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.weather-temp-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.weather-temp-label {
    font-size: 0.9em;
    color: #666;
}

.weather-temp-value {
    font-size: 1.5em;
    font-weight: bold;
    color: #667eea;
}

.weather-temp-high {
    color: #e74c3c;
}

.weather-temp-low {
    color: #3498db;
}

.weather-error {
    text-align: center;
    color: white;
    font-weight: bold;
    padding: 20px;
    background: rgba(220, 53, 69, 0.3);
    border-radius: 8px;
    border: 2px solid rgba(220, 53, 69, 0.5);
}

header {
    text-align: center;
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.95);
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 20px;
    color: #667eea;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.username-section {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
}

#username {
    padding: 12px 20px;
    font-size: 16px;
    border: 2px solid #667eea;
    border-radius: 8px;
    outline: none;
    transition: all 0.3s;
    width: 300px;
}

#username:focus {
    border-color: #764ba2;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.3);
}

#saveUsername {
    padding: 12px 25px;
    font-size: 16px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: bold;
}

#saveUsername:hover {
    background: #764ba2;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

main {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.game-controls {
    margin-bottom: 30px;
}

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

.time-selector h2 {
    text-align: center;
    margin-bottom: 15px;
    color: #667eea;
    font-size: 1.5em;
}

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

.time-btn {
    padding: 15px 30px;
    font-size: 18px;
    background: #f0f0f0;
    border: 3px solid #667eea;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: bold;
    color: #667eea;
    min-width: 100px;
}

.time-btn:hover {
    background: #667eea;
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.time-btn.selected {
    background: #667eea;
    color: white;
    border-color: #764ba2;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.start-btn {
    display: block;
    margin: 20px auto;
    padding: 18px 50px;
    font-size: 20px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: bold;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.start-btn:hover:not(:disabled) {
    background: #218838;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.start-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.game-area {
    margin-bottom: 30px;
}

.game-info {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    color: white;
    font-size: 1.3em;
    font-weight: bold;
}

.timer-display, .score-display {
    display: flex;
    align-items: center;
    gap: 10px;
}

#timer {
    font-size: 1.5em;
    color: #ffd700;
}

#score {
    font-size: 1.5em;
    color: #ffd700;
}

.click-zone {
    width: 100%;
    min-height: 400px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border: 4px dashed #667eea;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.click-zone.inactive {
    cursor: not-allowed;
    opacity: 0.6;
    background: #e0e0e0;
}

.click-zone.active {
    cursor: crosshair;
    border-color: #28a745;
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
}

.click-zone.active:hover {
    transform: scale(1.02);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.click-zone.waiting {
    border-color: #ffc107;
    background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
}

.instruction {
    text-align: center;
    font-size: 1.5em;
    color: #667eea;
    font-weight: bold;
    padding: 20px;
}

.click-effect {
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(102, 126, 234, 0.6);
    pointer-events: none;
    animation: clickAnimation 0.5s ease-out;
}

@keyframes clickAnimation {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(3);
        opacity: 0;
    }
}

.results {
    text-align: center;
    padding: 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    color: white;
    margin-bottom: 30px;
    display: none;
}

.results.show {
    display: block;
    animation: slideDown 0.5s ease-out;
}

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

.results h2 {
    margin-bottom: 20px;
    font-size: 2em;
}

.result-info {
    font-size: 1.3em;
    margin-bottom: 20px;
}

.result-info p {
    margin: 10px 0;
}

#cps {
    color: #ffd700;
    font-size: 1.2em;
}

.play-again-btn {
    padding: 15px 40px;
    font-size: 18px;
    background: white;
    color: #667eea;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: bold;
}

.play-again-btn:hover {
    background: #f0f0f0;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.records-section {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 12px;
    border: 2px solid #667eea;
}

.records-section h2 {
    text-align: center;
    margin-bottom: 20px;
    color: #667eea;
    font-size: 1.8em;
}

.records-list {
    max-height: 300px;
    overflow-y: auto;
}

.record-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    margin: 10px 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
}

.record-item:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.record-item.best {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    font-weight: bold;
}

.record-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.record-name {
    font-weight: bold;
    color: #667eea;
    font-size: 1.1em;
}

.record-details {
    font-size: 0.9em;
    color: #666;
}

.record-score {
    font-size: 1.5em;
    font-weight: bold;
    color: #667eea;
}

.no-records {
    text-align: center;
    color: #999;
    padding: 20px;
    font-style: italic;
}

/* 스크롤바 스타일링 */
.records-list::-webkit-scrollbar {
    width: 8px;
}

.records-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.records-list::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

.records-list::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

/* 랭킹 섹션 */
.rank-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 25px;
    border-radius: 12px;
    margin-top: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

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

.rank-section h2 {
    text-align: center;
    margin: 0;
    color: white;
    font-size: 1.8em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.load-rank-btn {
    padding: 10px 20px;
    font-size: 14px;
    background: white;
    color: #667eea;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: bold;
}

.load-rank-btn:hover {
    background: #f0f0f0;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.load-rank-btn:disabled {
    background: rgba(255, 255, 255, 0.5);
    cursor: not-allowed;
    transform: none;
}

.rank-list {
    max-height: 400px;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    padding: 15px;
}

.rank-loading {
    text-align: center;
    color: #667eea;
    font-weight: bold;
    padding: 20px;
}

.no-ranks {
    text-align: center;
    color: #999;
    padding: 20px;
    font-style: italic;
}

.rank-error {
    text-align: center;
    color: #dc3545;
    font-weight: bold;
    padding: 20px;
    background: rgba(220, 53, 69, 0.1);
    border-radius: 8px;
    border: 2px solid #dc3545;
}

.rank-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    margin: 10px 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
    border-left: 4px solid #667eea;
}

.rank-item:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.rank-item.rank-first {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    border-left-color: #ff8c00;
    font-weight: bold;
}

.rank-item.rank-second {
    background: linear-gradient(135deg, #c0c0c0 0%, #e8e8e8 100%);
    border-left-color: #808080;
}

.rank-item.rank-third {
    background: linear-gradient(135deg, #cd7f32 0%, #e6a85c 100%);
    border-left-color: #8b4513;
}

.rank-position {
    font-size: 1.3em;
    font-weight: bold;
    color: #667eea;
    min-width: 60px;
    text-align: center;
}

.rank-item.rank-first .rank-position,
.rank-item.rank-second .rank-position,
.rank-item.rank-third .rank-position {
    color: #333;
}

.rank-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
    margin: 0 15px;
}

.rank-username {
    font-weight: bold;
    color: #667eea;
    font-size: 1.1em;
}

.rank-item.rank-first .rank-username,
.rank-item.rank-second .rank-username,
.rank-item.rank-third .rank-username {
    color: #333;
}

.rank-timestamp {
    font-size: 0.85em;
    color: #999;
}

.rank-score {
    font-size: 1.5em;
    font-weight: bold;
    color: #667eea;
    min-width: 80px;
    text-align: right;
}

.rank-item.rank-first .rank-score,
.rank-item.rank-second .rank-score,
.rank-item.rank-third .rank-score {
    color: #333;
}

/* 랭킹 스크롤바 스타일링 */
.rank-list::-webkit-scrollbar {
    width: 8px;
}

.rank-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.rank-list::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

.rank-list::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .meal-section h2 {
        font-size: 1.5em;
    }

    .school-search-input-wrapper {
        flex-direction: column;
    }

    .search-school-btn {
        width: 100%;
    }

    .school-result-details {
        flex-direction: column;
        gap: 8px;
    }

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

    .meal-input-group {
        width: 100%;
    }

    .meal-input-group select,
    .meal-input-group input[type="text"],
    .meal-input-group input[type="date"] {
        width: 100%;
        min-width: auto;
    }

    .load-meal-btn {
        width: 100%;
    }

    .weather-section h2 {
        font-size: 1.5em;
    }

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

    .weather-input-group {
        width: 100%;
    }

    .weather-input-group select {
        width: 100%;
        min-width: auto;
    }

    .load-weather-btn {
        width: 100%;
    }

    .weather-content {
        grid-template-columns: 1fr;
    }

    header h1 {
        font-size: 2em;
    }

    #username {
        width: 200px;
    }

    .time-buttons {
        gap: 10px;
    }

    .time-btn {
        padding: 12px 20px;
        font-size: 16px;
        min-width: 80px;
    }

    .click-zone {
        min-height: 300px;
    }

    .game-info {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .rank-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }

    .rank-section h2 {
        text-align: center;
    }

    .load-rank-btn {
        width: 100%;
    }

    .rank-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .rank-position {
        align-self: flex-start;
    }

    .rank-score {
        align-self: flex-end;
        text-align: right;
    }
}

