/* 로컬 폰트 정의 */
@font-face {
    font-family: 'CookieRun';
    src: url('./fonts/CookieRun-Regular.otf') format('opentype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'CookieRun';
    src: url('./fonts/CookieRun-Regular.otf') format('opentype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'CookieRun';
    src: url('./fonts/CookieRun-Regular.otf') format('opentype');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'CookieRun';
    src: url('./fonts/CookieRun-Black.otf') format('opentype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'CookieRun', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif, 'lucide';
    line-height: 1.6;
    color: #333;
    transition: background-color 0.3s ease, color 0.3s ease;
}

button {
    font-family: 'CookieRun', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif, 'lucide';
}

.notes-text {
    font-size: 0.875rem;
    line-height: 1.5;
    white-space: pre-line;
}

.app-container {
    min-height: 100vh;
    background: linear-gradient(135deg, #f8f4ff 0%, #e8f4fd 100%);
    padding: 1rem;
}

.main-wrapper {
    max-width: 1200px;
    margin: 0 auto;
}

.card {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.header-content {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
}

.header-button {
    display: flex;
    align-content: flex-end;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
}

.title {
    font-size: 1.5rem;
    font-weight: 600;
    text-shadow: #583024 2px;
    color: #1f2937;
}

.info-box {
    background: #dbeafe;
    border-radius: 0.5rem;
    padding: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.info-icon {
    width: 1.25rem;
    height: 1.25rem;
    color: #2563eb;
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.info-text {
    font-size: 0.875rem;
    color: #1e40af;
}

.grid-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #1f2937;
}

.section-list {
    font-size: 0.875rem;
}

.section-list p{
    margin-bottom: 0.5rem;
}

.content-type-buttons {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.content-btn {
    flex: 1;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.content-btn.active {
    background: #8b5cf6;
    color: white;
}

.content-btn:not(.active) {
    background: #f3f4f6;
    color: #6b7280;
}

.content-btn:not(.active):hover {
    background: #e5e7eb;
}

.input-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.dropdown-wrapper {
    position: relative;
}

.label {
    display: block;
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

/* 커스텀 드롭다운 스타일 */
.custom-dropdown {
    position: relative;
    width: 100%;
}

.dropdown-selected {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    background: white;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dropdown-selected:hover {
    border-color: #9ca3af;
}

.dropdown-selected.open {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px #3b82f6;
}

.dropdown-selected img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.dropdown-arrow {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1rem;
    height: 1rem;
    color: #6b7280;
    pointer-events: none;
    transition: transform 0.2s ease;
}

.dropdown-selected.open .dropdown-arrow {
    transform: translateY(-50%) rotate(180deg);
}

.dropdown-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.25rem;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

.dropdown-options.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

.dropdown-option:hover {
    background: #f3f4f6;
}

.dropdown-option.selected {
    background: #e0e7ff;
}

.dropdown-option img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.input-field {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-family: 'CookieRun', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.input-field:focus {
    outline: none;
    box-shadow: 0 0 0 2px #3b82f6;
    border-color: #3b82f6;
}

/* notes-box 스타일 */
.notes-box {
    border-radius: 0.5rem;
    padding: 1rem;
    margin-top: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

/* notes-text 스타일 */
.notes-text {
    font-size: 0.875rem;
    line-height: 1.5;
    white-space: pre-line;
}

/* 결과 표시 스타일 */
.results-header-row {
    display: flex;
    align-items: center;
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 500;
    padding: 0.75rem 1rem;
    border-bottom: 2px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 0.5rem 0.5rem 0 0;
    margin-bottom: 0.5rem;
}

.header-rank {
    flex: 0 0 60px;
    font-weight: 600;
}

.header-item {
    flex: 1;
    text-align: center;
}

.header-efficiency {
    flex: 0 0 80px;
    text-align: right;
    font-weight: 600;
}

.results-list {
    font-size: 0.875rem;
}

.result-line {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    margin-bottom: 0.5rem;
    border: 1px solid transparent;
}

.result-line:hover {
    background: #f3f4f6;
    border-color: #e5e7eb;
}

.result-line.first-place {
    background:#fef3c7;
    border-color: #fbbf24;
    box-shadow: 0 2px 4px rgba(251, 191, 36, 0.2);
}

.result-line.first-place:hover {
    background:#fde68a;
    box-shadow: 0 4px 6px rgba(251, 191, 36, 0.3);
}

.rank {
    flex: 0 0 60px;
    font-weight: 600;
    color: #1f2937;
}

.upgrade-value {
    flex: 1;
    text-align: center;
    font-weight: 500;
    color: #4b5563;
}

.percentage {
    flex: 0 0 80px;
    text-align: right;
    font-weight: 600;
    color: #1f2937;
}

.first-place .rank {
    color: #92400e;
}

.first-place .upgrade-value {
    color: #78350f;
}

.first-place .percentage {
    color: #d97706;
    font-weight: 700;
}

.loading-state {
    text-align: center;
    padding: 2rem;
    color: #6b7280;
}

.update-section {
    margin-top: 1.5rem;
}

.update-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: #1f2937;
}

.update-list {
    font-size: 0.875rem;
    color: #6b7280;
}

.update-item {
    margin-bottom: 0.5rem;
    color: #6b7280;
}

.update-item strong {
    font-weight: 600;
    color: #000
}

.update-link {
    color: inherit;
    text-decoration: underline;
}

.copyright {
    margin-top: 1rem;
    background: #f3f4f6; 
    font-size: 0.875rem;
    color: #6b7280;
}

.copyright-item {
    margin-bottom: 0.5rem;
}

@media (max-width: 1024px) {
    .grid-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* 모바일 반응형 */
@media (max-width: 768px) {
    .app-container {
        padding: 0.5rem;
    }

    .card {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .grid-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .title {
        font-size: 1.25rem;
    }

    .header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
    }

    .header-content {
        flex-direction: row;
        align-items: flex-end;
    }

    .dark-mode-toggle {
        padding: 0.5rem;
    }
    
    .dark-mode-toggle i {
        font-size: 1.25rem;
    }

    .input-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .notes-box {
        margin-top: 0.75rem;
        padding: 0.75rem;
    }
            
    .notes-text {
        font-size: 0.8rem;
    }

    .results-header-row {
        font-size: 0.75rem;
        padding: 0.5rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .header-rank {
        flex: 0 0 45px;
    }

    .header-efficiency {
        flex: 0 0 60px;
    }

    .results-list {
        font-size: 0.75rem;
    }

    .result-line {
        padding: 0.5rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .rank {
        flex: 0 0 45px;
    }

    .percentage {
        flex: 0 0 60px;
    }
}

/* 추가 반응형 - 매우 작은 화면 */
@media (max-width: 480px) {
    .content-type-buttons {
        flex-direction: column;
    }
    
    .content-btn {
        margin-bottom: 0.25rem;
    }

    .results-header-row {
        font-size: 0.7rem;
    }

    .header-content {
        flex-direction: column;
        align-items: center;
    }

    .header-content img {
        height: 75px;
        width: auto;
    }

    .header-rank {
        flex: 0 0 40px;
        font-size: 0.65rem;
    }

    .header-item {
        font-size: 0.65rem;
    }

    .header-efficiency {
        flex: 0 0 55px;
        font-size: 0.65rem;
    }

    .results-list {
        font-size: 0.7rem;
    }

    .rank {
        flex: 0 0 40px;
    }

    .upgrade-value {
        font-size: 0.7rem;
    }

    .percentage {
        flex: 0 0 55px;
    }
}

.dark-mode-toggle {
    background: #f3f4f6;
    border: none;
    border-radius: 0.5rem;
    padding: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dark-mode-toggle:hover {
    background: #e5e7eb;
}

.dark-mode-toggle i {
    color: #6b7280;
    font-size: 1.5rem;
}

/* 다크모드 스타일 */
body.dark-mode {
    background: #1a1a1a;
    color: #e5e5e5;
}

body.dark-mode .app-container {
    background: linear-gradient(135deg, #1e1e2e 0%, #2a2a3e 100%);
}

body.dark-mode .card {
    background: #2d2d3d;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

body.dark-mode .title,
body.dark-mode .section-title {
    color: #f3f4f6;
}

body.dark-mode .info-box {
    background: #3d3d4d;
    border: 1px solid #4d4d5d;
}

body.dark-mode .info-text {
    color: #93bbfc;
}

body.dark-mode .info-icon {
    color: #60a5fa;
}

body.dark-mode .content-btn:not(.active) {
    background: #3d3d4d;
    color: #e5e5e5;
}

body.dark-mode .content-btn:not(.active):hover {
    background: #4d4d5d;
}

body.dark-mode .content-btn.active {
    background: #8b5cf6;
}

body.dark-mode .label {
    color: #d1d5db;
}

body.dark-mode .dropdown-selected {
    background: #3d3d4d;
    border-color: #4d4d5d;
    color: #e5e5e5;
}

body.dark-mode .dropdown-selected:hover {
    border-color: #6d6d7d;
}

body.dark-mode .dropdown-selected.open {
    border-color: #60a5fa;
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.5);
}

body.dark-mode .dropdown-arrow {
    color: #d1d5db;
}

body.dark-mode .dropdown-options {
    background: #3d3d4d;
    border-color: #4d4d5d;
}

body.dark-mode .dropdown-option:hover {
    background: #4d4d5d;
}

body.dark-mode .dropdown-option.selected {
    background: #5b4c8a;
}

body.dark-mode .input-field {
    background: #3d3d4d;
    border-color: #4d4d5d;
    color: #e5e5e5;
}

body.dark-mode .input-field:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.5);
}

body.dark-mode .notes-box {
    background: #3d3d4d;
    border: 1px solid #4d4d5d;
}

body.dark-mode .notes-text {
    color: #e5e5e5;
}

body.dark-mode .results-header-row {
    background: #3d3d4d;
    border-color: #4d4d5d;
    color: #d1d5db;
}

body.dark-mode .result-line {
    color: #e5e5e5;
}

body.dark-mode .result-line:hover {
    background: #3d3d4d;
    border-color: #4d4d5d;
}

body.dark-mode .result-line.first-place {
    background: #4a3f2a;
    border-color: #8b7355;
}

body.dark-mode .result-line.first-place:hover {
    background: #5a4f3a;
}

body.dark-mode .rank {
    color: #e5e5e5;
}

body.dark-mode .upgrade-value {
    color: #d1d5db;
}

body.dark-mode .percentage {
    color: #e5e5e5;
}

body.dark-mode .first-place .rank {
    color: #fbbf24;
}

body.dark-mode .first-place .upgrade-value {
    color: #f59e0b;
}

body.dark-mode .first-place .percentage {
    color: #fbbf24;
}

body.dark-mode .loading-state {
    color: #d1d5db;
}

body.dark-mode .update-title {
    color: #d1d5db;
}

body.dark-mode .update-item {
    color: #d1d5db;
}

body.dark-mode .update-item strong {
    color: #e5e5e5;
}

body.dark-mode .dark-mode-toggle {
    background: #4d4d5d;
}

body.dark-mode .dark-mode-toggle:hover {
    background: #5d5d6d;
}

body.dark-mode .dark-mode-toggle i {
    color: #fbbf24;
}

body.dark-mode .copyright p{
    color: #d1d5db;
}

/* 헤더 래퍼 스타일 */
.header-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.header-content {
    display: flex;
    gap: 0.75rem;
}

.header-content img {
    transition: opacity 0.3s ease;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* 언어 선택기 스타일 */
.language-selector {
    display: flex;
    gap: 0.5rem;
}

.lang-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #e5e7eb;
    background: white;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    white-space: nowrap;
    min-width: 4.5rem;
}

.lang-short {
    display: none;
}

.lang-full {
    display: inline;
}

.lang-btn:hover {
    background: #f3f4f6;
}

.lang-btn.active {
    background: #8b5cf6;
    color: white;
    border-color: #8b5cf6;
}

/* 다크모드 토글 버튼 */
.dark-mode-toggle {
    background: #f3f4f6;
    border: none;
    border-radius: 0.5rem;
    padding: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dark-mode-toggle:hover {
    background: #e5e7eb;
}

.dark-mode-toggle i {
    color: #6b7280;
    font-size: 1.25rem;
}

/* 다크모드 스타일 */
body.dark-mode .lang-btn:not(.active) {
    background: #3d3d4d;
    color: #e5e5e5;
    border-color: #4d4d5d;
}

body.dark-mode .lang-btn:not(.active):hover {
    background: #4d4d5d;
}

body.dark-mode .dark-mode-toggle {
    background: #4d4d5d;
}

body.dark-mode .dark-mode-toggle:hover {
    background: #5d5d6d;
}

body.dark-mode .dark-mode-toggle i {
    color: #fbbf24;
}

@media (max-width: 768px) {
    .header-wrapper {
        gap: 0.5rem;
    }

    .header-controls {
        gap: 0.5rem;
    }

    .lang-btn {
        padding: 0.375rem 0.75rem;
        font-size: 0.8rem;
        min-width: 4rem;
    }

    .dark-mode-toggle {
        padding: 0.5rem;
    }

    .dark-mode-toggle i {
        font-size: 1.125rem;
    }
}

@media (max-width: 480px) {
    .header-wrapper {
        flex-direction: column;
    }

    .header-controls {
        align-self: stretch;
        justify-content: space-between;
    }

    .header-content img {
        height: 75px;
        width: auto;
    }

    .lang-btn {
        padding: 0.375rem 0.5rem;
        font-size: 0.75rem;
        min-width: 2.5rem;
    }

    /* 작은 화면에서 짧은 텍스트 표시 */
    .lang-short {
        display: inline;
    }

    .lang-full {
        display: none;
    }
}

/* 추가 치피 입력 관련 스타일 */
.crit-dmg-wrapper {
    position: relative;
}

.crit-dmg-input-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.crit-dmg-select {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    background: white;
    cursor: pointer;
    font-family: 'CookieRun', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    transition: all 0.2s ease;
}

.crit-dmg-select:hover {
    border-color: #9ca3af;
}

.crit-dmg-select:focus {
    outline: none;
    box-shadow: 0 0 0 2px #3b82f6;
    border-color: #3b82f6;
}

.crit-dmg-input {
    flex: 0 0 auto;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-family: 'CookieRun', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    transition: all 0.2s ease;
    animation: fadeIn 0.2s ease-in-out;
}

.crit-dmg-input:hover {
    border-color: #9ca3af;
}

.crit-dmg-input:focus {
    outline: none;
    box-shadow: 0 0 0 2px #3b82f6;
    border-color: #3b82f6;
}

/* 페이드인 애니메이션 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 다크모드 추가 치피 스타일 */
body.dark-mode .crit-dmg-select {
    background: #3d3d4d;
    border-color: #4d4d5d;
    color: #e5e5e5;
}

body.dark-mode .crit-dmg-select:hover {
    border-color: #6d6d7d;
}

body.dark-mode .crit-dmg-select:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.5);
}

body.dark-mode .crit-dmg-select option {
    background: #3d3d4d;
    color: #e5e5e5;
}

body.dark-mode .crit-dmg-input {
    background: #3d3d4d;
    border-color: #4d4d5d;
    color: #e5e5e5;
}

body.dark-mode .crit-dmg-input:hover {
    border-color: #6d6d7d;
}

body.dark-mode .crit-dmg-input:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.5);
}

body.dark-mode .crit-dmg-input::placeholder {
    color: #9ca3af;
}

/* 768px 이하 */
@media (max-width: 768px) {
    .crit-dmg-input-group {
        flex-direction: column;
        gap: 0.5rem;
    }

    .crit-dmg-select,
    .crit-dmg-input {
        font-size: 0.8rem;
        padding: 0.375rem 0.5rem;
        width: 100%;
    }

    .crit-dmg-input {
        flex: 1;
    }
}

/* 480px 이하 */
@media (max-width: 480px) {
    .crit-dmg-select,
    .crit-dmg-input {
        font-size: 0.75rem;
        padding: 0.25rem 0.375rem;
        width: 100%;
    }
}