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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f5f5;
    color: #333;
    overflow: hidden;
}

.hidden {
    display: none !important;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

.auth-panel {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background: #f5f5f5;
}

.auth-panel.hidden {
    display: none;
}

.auth-box {
    background: #fff;
    padding: 32px;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    width: 100%;
    max-width: 360px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.auth-box h2 {
    text-align: center;
    margin-bottom: 4px;
}

.auth-box input {
    padding: 12px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: 14px;
}

.auth-box .error {
    color: #ff4d4f;
    font-size: 13px;
    text-align: center;
}

.auth-box button.primary {
    padding: 12px;
    border: none;
    border-radius: 4px;
    background: #1890ff;
    color: #fff;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
}

.auth-switch {
    text-align: center;
    font-size: 14px;
    color: #666;
}

button.link {
    background: none;
    border: none;
    color: #1890ff;
    cursor: pointer;
    font-size: 14px;
    padding: 0;
}

.editor-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.editor-panel.hidden {
    display: none;
}

header {
    padding: 12px 16px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
    flex-shrink: 0;
}

header .nav {
    display: flex;
    align-items: center;
    gap: 12px;
}

.back-link {
    color: #1890ff;
    text-decoration: none;
    font-size: 14px;
}

header h1 {
    font-size: 18px;
    font-weight: 600;
}

.score {
    font-size: 16px;
    font-weight: bold;
    color: #1890ff;
}

main {
    flex: 1;
    display: flex;
    position: relative;
    overflow: hidden;
}

#map {
    flex: 1;
    min-width: 0;
    min-height: 0;
}

.legend {
    width: 150px;
    background: #fff;
    padding: 16px;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    flex-shrink: 0;
}

.legend h3 {
    font-size: 16px;
    margin-bottom: 4px;
}

.legend ul {
    list-style: none;
}

.legend li {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 14px;
}

.color-box {
    width: 18px;
    height: 18px;
    border-radius: 3px;
    display: inline-block;
    flex-shrink: 0;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.white-box {
    background: #ffffff;
    border: 1px solid #cccccc;
}

.actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: auto;
}

.actions button {
    padding: 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: opacity 0.2s;
}

.actions button:active {
    opacity: 0.8;
}

#exportBtn {
    background: #1890ff;
    color: #fff;
}

#clearBtn {
    background: #ff4d4f;
    color: #fff;
}

.submit-panel {
    background: #fff;
    padding: 16px;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.user-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.caption-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.caption-row label {
    font-size: 14px;
    font-weight: 500;
    flex-shrink: 0;
    padding-top: 10px;
}

.caption-row input,
.caption-row textarea {
    flex: 1;
    padding: 10px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
}

.caption-row textarea {
    min-height: 80px;
    line-height: 1.5;
}

.status-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.status-label {
    font-size: 14px;
    font-weight: 500;
}

.status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.pending { background: #fff2e8; color: #fa8c16; }
.status-badge.public { background: #f6ffed; color: #52c41a; }
.status-badge.private { background: #f0f5ff; color: #1890ff; }
.status-badge.rejected { background: #fff1f0; color: #ff4d4f; }
.status-badge.empty { background: #f5f5f5; color: #666; }

.admin-reason {
    color: #ff4d4f;
    font-size: 13px;
}

.admin-reason.hidden {
    display: none;
}

.submit-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.submit-actions button {
    padding: 10px 18px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: opacity 0.2s;
}

.submit-actions button.hidden {
    display: none;
}

.export-overlay {
    position: fixed;
    left: -9999px;
    top: -9999px;
    width: 1200px;
    height: 900px;
}

.submit-actions button:active {
    opacity: 0.8;
}

.submit-actions .primary {
    background: #1890ff;
    color: #fff;
}

.submit-actions .secondary {
    background: #f0f0f0;
    color: #333;
    border: 1px solid #d9d9d9;
}

.submit-actions .danger {
    background: #ff4d4f;
    color: #fff;
}

.hint {
    font-size: 12px;
    color: #999;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    padding: 16px;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    width: 100%;
    max-width: 320px;
    text-align: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.modal-content h3 {
    margin-bottom: 16px;
    font-size: 18px;
}

.color-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
}

.color-options button {
    padding: 12px;
    border: none;
    border-radius: 6px;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
}

.color-options button:active {
    transform: scale(0.96);
}

.color-options .c5 { background: #ff4d4f; }
.color-options .c4 { background: #ff9c6e; }
.color-options .c3 { background: #ffd666; color: #333; }
.color-options .c2 { background: #73d13d; }
.color-options .c1 { background: #40a9ff; }
.color-options .c0 {
    background: #ffffff;
    color: #333;
    border: 1px solid #d9d9d9;
}

#cancelBtn {
    width: 100%;
    padding: 10px;
    border: 1px solid #d9d9d9;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

#cancelBtn:active {
    background: #f5f5f5;
}

@media (max-width: 768px) {
    header {
        padding: 10px 12px;
    }

    header h1 {
        font-size: 16px;
    }

    .score {
        font-size: 14px;
    }

    .legend {
        position: absolute;
        right: 8px;
        top: 8px;
        width: auto;
        max-width: 130px;
        padding: 10px;
        border-radius: 8px;
        opacity: 0.95;
        gap: 8px;
    }

    .legend h3 {
        font-size: 14px;
    }

    .legend li {
        margin-bottom: 6px;
        font-size: 12px;
    }

    .color-box {
        width: 14px;
        height: 14px;
    }

    .actions button {
        padding: 8px;
        font-size: 12px;
    }

    .submit-panel {
        padding: 12px;
    }

    .caption-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .submit-actions button {
        flex: 1;
        min-width: 80px;
    }
}
