/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #3d4556;
    --bg-secondary: #4a5568;
    --bg-card: #5a6578;
    --accent-primary: #e94560;
    --accent-secondary: #7c6fb0;
    --accent-gold: #ffc107;
    --accent-exp: #5cc9f5;
    --text-primary: #ffffff;
    --text-secondary: #c0c8d4;
    --success: #48d879;
    --danger: #ff6b6b;
    --warning: #ffab00;
    --info: #64a0ff;
    --border-radius: 8px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

body {
    font-family: 'Segoe UI', 'Noto Sans KR', sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 20px;
}

/* 3열 레이아웃 (광고 - 콘텐츠 - 광고) */
.page-wrapper {
    display: flex;
    justify-content: center;
    gap: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.container {
    max-width: 900px;
    flex: 1;
    min-width: 0;
}

/* 광고 사이드바 */
.ad-sidebar {
    width: 160px;
    flex-shrink: 0;
}

.ad-sidebar.ad-left .ad-slot {
    position: fixed;
    left: max(20px, calc((100vw - 1400px) / 2 + 20px));
    top: 50%;
    transform: translateY(-50%);
}

.ad-sidebar.ad-right .ad-slot {
    position: fixed;
    right: max(20px, calc((100vw - 1400px) / 2 + 20px));
    top: 50%;
    transform: translateY(-50%);
}

.ad-slot {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.ad-placeholder {
    width: 160px;
    height: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-secondary);
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius);
    background: rgba(0, 0, 0, 0.1);
}

.ad-placeholder span {
    font-size: 14px;
    font-weight: 600;
}

.ad-placeholder small {
    font-size: 11px;
    opacity: 0.6;
}


/* Header */
.header {
    text-align: center;
    margin-bottom: 24px;
}

.header h1 {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(90deg, var(--accent-exp), var(--accent-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn .icon {
    font-size: 16px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: var(--text-primary);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(233, 69, 96, 0.4);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--accent-secondary);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--accent-secondary);
}

.btn-success {
    background: var(--success);
    color: var(--text-primary);
}

.btn-success:hover:not(:disabled) {
    background: #00e676;
    transform: translateY(-2px);
}

.btn-danger {
    background: var(--danger);
    color: var(--text-primary);
}

.btn-danger:hover:not(:disabled) {
    background: #ff6b6b;
}

.btn-warning {
    background: var(--warning);
    color: #1a1a2e;
}

.btn-warning:hover:not(:disabled) {
    background: #ffc107;
}

.btn-info {
    background: var(--info);
    color: var(--text-primary);
}

.btn-info:hover:not(:disabled) {
    background: #5c9aff;
    transform: translateY(-2px);
}

.btn-accent {
    background: linear-gradient(135deg, #00b894, #00cec9);
    color: var(--text-primary);
}

.btn-accent:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 184, 148, 0.4);
}

.btn-small {
    padding: 8px 12px;
    font-size: 12px;
}

.btn.selecting {
    background: var(--accent-primary) !important;
    animation: pulse 1s ease-in-out infinite;
}

/* Controls */
.controls {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

/* Preview */
.preview-container {
    position: relative;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    overflow: hidden;
    margin-bottom: 20px;
    min-height: 300px;
    border: 2px solid var(--bg-card);
}

.preview-wrapper {
    position: relative;
    display: none;
}

.preview-wrapper.active {
    display: block;
}

#previewCanvas {
    width: 100%;
    display: block;
}

.preview-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    color: var(--text-secondary);
    font-size: 16px;
}

.preview-placeholder.hidden {
    display: none;
}

/* Selection Overlay */
.selection-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    z-index: 10;
}

.selection-overlay.hidden {
    display: none;
}

.selection-box {
    position: absolute;
    border: 2px dashed var(--accent-primary);
    background: rgba(233, 69, 96, 0.2);
    pointer-events: none;
}

/* Region Indicators */
.region-indicators {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.region-indicator {
    position: absolute;
    border: 2px solid;
    border-radius: 4px;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 4px;
    font-size: 11px;
    font-weight: bold;
}

.region-indicator.exp {
    border-color: var(--accent-exp);
    background: rgba(0, 217, 255, 0.15);
    color: var(--accent-exp);
}

.region-indicator.gold {
    border-color: var(--accent-gold);
    background: rgba(255, 193, 7, 0.15);
    color: var(--accent-gold);
}

.region-indicator.map {
    border-color: #a855f7;
    background: rgba(168, 85, 247, 0.15);
    color: #a855f7;
}

/* Region Info */
.region-info {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.region-item {
    background: var(--bg-card);
    padding: 10px 16px;
    border-radius: var(--border-radius);
    font-size: 13px;
}

.region-label {
    color: var(--text-secondary);
    margin-right: 8px;
}

.region-value {
    color: var(--text-primary);
    font-weight: 500;
}

.region-value.map-name {
    color: var(--accent-exp);
    font-weight: 600;
    font-size: 14px;
}

.region-coords {
    font-size: 12px;
}

.region-coords .region-item {
    padding: 8px 12px;
}

.region-coords .region-value {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 11px;
}

/* Action Controls */
.action-controls {
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

/* Interval Selector */
.interval-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
    padding: 8px 12px;
    border-radius: var(--border-radius);
}

.interval-label {
    color: var(--text-secondary);
    font-size: 13px;
}

#intervalSelect {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-radius);
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 13px;
    cursor: pointer;
    outline: none;
}

#intervalSelect:hover {
    background: var(--bg-primary);
}

#intervalSelect:focus {
    border-color: var(--accent-primary);
}

/* Status Bar */
.status-bar {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    padding: 16px;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    margin-bottom: 20px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-label {
    color: var(--text-secondary);
    font-size: 14px;
}

.status-value {
    font-weight: 600;
    font-size: 14px;
}

.status-value.analyzing {
    color: var(--success);
}

.status-value.error {
    color: var(--danger);
}

/* Results Panel */
.results-panel {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 20px;
    border: 1px solid var(--bg-card);
}

.results-panel h3 {
    text-align: center;
    margin-bottom: 16px;
    color: var(--text-secondary);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.result-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.result-card h4 {
    margin-bottom: 16px;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.exp-card h4 {
    color: var(--accent-exp);
}

.gold-card h4 {
    color: var(--accent-gold);
}

.result-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 14px;
}

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

.result-row span:first-child {
    color: var(--text-secondary);
}

.result-row span:last-child {
    font-weight: 600;
    font-family: 'Consolas', 'Monaco', monospace;
}

/* Animations */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.analyzing {
    animation: pulse 1.5s ease-in-out infinite;
}

/* 모바일 접속 안내 */
.mobile-notice {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.mobile-notice.active {
    display: flex;
}

.mobile-notice-content {
    text-align: center;
    padding: 40px;
    background: var(--bg-card);
    border-radius: 16px;
    box-shadow: var(--shadow);
    max-width: 400px;
    margin: 20px;
}

.mobile-notice .mobile-icon {
    font-size: 64px;
    display: block;
    margin-bottom: 20px;
}

.mobile-notice h2 {
    font-size: 24px;
    margin-bottom: 16px;
    color: var(--accent-exp);
}

.mobile-notice p {
    color: var(--text-secondary);
    line-height: 1.6;
}

.page-wrapper.hidden {
    display: none;
}

/* 사냥 기록 패널 */
.history-panel {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 20px;
    border: 1px solid var(--bg-card);
    margin-top: 20px;
}

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

.history-header h3 {
    margin: 0;
    font-size: 16px;
    color: var(--text-primary);
}

/* 기록 테이블 */
.history-table-wrapper {
    overflow-x: auto;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.history-table th,
.history-table td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid var(--bg-card);
}

.history-table th {
    background: var(--bg-card);
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
}

.history-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.history-table td {
    color: var(--text-primary);
}

.history-table .exp-value {
    color: var(--accent-exp);
    font-weight: 600;
    font-family: 'Consolas', 'Monaco', monospace;
}

.history-table .meso-value {
    color: var(--accent-gold);
    font-weight: 600;
    font-family: 'Consolas', 'Monaco', monospace;
}

.history-table .duration {
    color: var(--text-secondary);
}

.history-table .delete-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 16px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.history-table .delete-btn:hover {
    background: var(--danger);
    color: white;
}

.history-empty {
    display: none;
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.history-empty.active {
    display: block;
}

/* 메모 입력 */
.memo-cell {
    min-width: 100px;
}

.memo-input {
    width: 100%;
    min-width: 80px;
    padding: 4px 8px;
    border: 1px solid var(--bg-secondary);
    border-radius: 4px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 12px;
    transition: all 0.2s;
}

.memo-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: var(--bg-secondary);
}

.memo-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

/* 도움말 버튼 */
.btn-help {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: 2px solid var(--text-secondary);
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-help:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: rgba(233, 69, 96, 0.1);
}

.header {
    position: relative;
}

/* 모달 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--bg-secondary);
}

.modal-header h2 {
    font-size: 18px;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: var(--danger);
}

.modal-body {
    padding: 20px;
}

.help-section {
    margin-bottom: 20px;
}

.help-section:last-child {
    margin-bottom: 0;
}

.help-section h3 {
    font-size: 14px;
    color: var(--accent-exp);
    margin-bottom: 10px;
}

.help-section ol,
.help-section ul {
    padding-left: 20px;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.8;
}

.help-section li {
    margin-bottom: 4px;
}

.help-section strong {
    color: var(--text-primary);
}

.modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-top: 1px solid var(--bg-secondary);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}


