* {
    box-sizing: border-box;
    font-family: 'Malgun Gothic', sans-serif;
    margin: 0;
    padding: 0;
    word-break: keep-all;
    overflow-wrap: break-word;
}

body {
    background-color: #f5f5f5;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 15px;
}

.container {
    background: white;
    border: 3px solid #222;
    width: 100%;
    max-width: 480px;
    padding: 25px 20px;
    text-align: center;
    border-radius: 4px;
}

.main-title {
    font-family: "Song Myung", serif;
    font-size: 3rem;
}

.title {
    font-size: 1rem;
    font-weight: 800;
    margin-bottom: 25px;
    color: #454545;
    letter-spacing: -0.5px;
    font-family: "Song Myung", serif;
}

.photo-tag {
    text-align: left;
    font-weight: bold;
    font-size: 1.05rem;
    margin-bottom: 6px;
    color: #222;
    font-family: "Song Myung", serif;
}

.upload-box {
    border: 2px dashed #444;
    height: 100px; 
    margin-bottom: 25px;
    position: relative;
    cursor: pointer;
    background: #fafafa;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: all 0.2s;
    border-radius: 6px;
}

.upload-box:hover {
    background: #f0f0f0;
}

.upload-box.uploaded {
    border: 2px solid #ff4d4d;
    background-color: #fffafb;
}
.upload-box.uploaded .upload-label {
    color: #ff4d4d;
    font-weight: bold;
}

.upload-label {
    font-size: 0.95rem;
    font-weight: 500;
    color: #555;
    font-family: "Song Myung", serif;
}

.upload-box input[type="file"] {
    display: none;
}

.upload-box img.preview {
    display: none !important;
}

.main-btn {
    width: 100%;
    padding: 14px;
    background-color: #222;
    color: white;
    border: none;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    margin-top: 5px;
    font-family: "Song Myung", serif;
    transition: 0.1s;
}

.share-btn {
    margin-top: 25px;
    background-color: #303030; 
}

.retry-btn {
    background-color: #555;
    margin-top: 8px; 
}

#result-screen {
    display: none;
}

.result-score {
    font-size: 2.8rem;
    color: #ff4d4d;
    font-weight: 900;
    margin-bottom: 20px;
    font-family: "Song Myung", serif;
}

.image-container {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 25px;
}

.result-img-box {
    width: 50%;
    aspect-ratio: 1 / 1;
    border: 1px solid #222;
    background: #eee;
    overflow: hidden;
    border-radius: 12px; 
}

.result-img-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.result-comment {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 25px; 
    color: #222;
    padding: 0 5px;
    line-height: 1.4;
    font-family: "Song Myung", serif;
    white-space: pre-wrap; 
}

.detail-section {
    border: 2px solid #222;
    background: #fff;
    text-align: left;
    margin-top: 15px;
    border-radius: 2px;
}

.detail-toggle-btn {
    font-weight: bold;
    font-size: 0.95rem;
    padding: 12px;
    cursor: pointer;
    background-color: #fefefe;
    outline: none;
    list-style: none;
    font-family: "Song Myung", serif;
}
.detail-toggle-btn::-webkit-details-marker {
    display: none;
}

.detail-content {
    padding: 10px 15px 18px 15px;
    font-family: "Song Myung", serif;
    background-color: #fafafa;
}

.analysis-bar-group {
    margin-bottom: 12px;
}
.analysis-bar-group:last-child {
    margin-bottom: 0;
}

.bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 4px;
}

.bar-bg {
    width: 100%;
    height: 12px;
    background-color: #e0e0e0;
    border-radius: 2px;
    overflow: hidden;
    border: 1px solid #222;
}

.bar-fill {
    width: 0%;
    height: 100%;
    background-color: #222222;
    transition: width 0.6s ease-out;
}

.individual-analysis {
    margin-top: 20px;
    border-top: 1px dashed #ccc;
    padding-top: 15px;
}

.analysis-box {
    margin-bottom: 12px;
    background: #ffffff;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.analysis-box:last-child {
    margin-bottom: 0;
}

.box-tag {
    display: inline-block;
    font-size: 0.75rem;
    background: #222222;
    color: #ffffff;
    padding: 2px 6px;
    font-weight: bold;
    margin-bottom: 5px;
    border-radius: 2px;
}

.analysis-box p {
    font-size: 0.85rem;
    color: #444;
    line-height: 1.4;
}

#loading-text {
    color: #666;
    font-weight: bold;
    font-size: 0.9rem;
    margin-top: 15px;
    display: none;
    font-family: "Song Myung", serif;
}

.modal-overlay {
    display: none; 
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.7); 
    z-index: 9999;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-content {
    background: #ffffff;
    padding: 20px;
    border-radius: 6px;
    border: 3px solid #222;
    width: 100%;
    max-width: 400px;
    text-align: center;
    box-shadow: 5px 5px 0px rgba(0,0,0,0.2);
}

.modal-title {
    font-family: "Song Myung", serif;
    font-size: 1.4rem;
    margin-bottom: 5px;
    color: #222;
}

.modal-sub {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 15px;
}

.modal-share-url-box {
    margin-bottom: 15px;
    font-size: 0.8rem;
    color: #888; 
}
.modal-share-url-box .url-text {
    margin-left: 5px;
    font-weight: bold;
    cursor: pointer; 
    text-decoration: underline; 
    transition: color 0.2s; 
}
.modal-share-url-box .url-text:hover {
    color: #222; 
}

#screenshot-preview-container {
    border: 1px solid #ddd;
    max-height: 55vh;
    overflow-y: auto; 
    margin-bottom: 15px;
    background: #fdfdfd;
}

.modal-image-view {
    width: 100%;
    height: auto;
    display: block;
}

.modal-btn-flex {
    display: flex;
    gap: 10px;
}

.modal-action-btn {
    flex: 1;
    padding: 12px;
    font-weight: bold;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-family: "Song Myung", serif;
}

.modal-action-btn.save {
    background-color: #222;
    color: white;
}

.modal-action-btn.cancel {
    background-color: #eee;
    color: #333;
    border: 1px solid #ccc;
}

.crop-modal-content {
    max-width: 440px !important;
}

.crop-wrapper {
    position: relative;
    width: 100%;
    max-height: 50vh;
    background: #222;
    overflow: hidden;
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 2px solid #222;
}

#crop-target-img {
    max-width: 100%;
    max-height: 50vh;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
}

#crop-guide-box {
    position: absolute;
    border: 2px dashed #ff4d4d;
    box-shadow: 0 0 0 4000px rgba(0, 0, 0, 0.5); 
    cursor: move;
    box-sizing: border-box;
}

#crop-guide-box::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 8px; height: 8px;
    background: #ff4d4d;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.mbti-section {
    margin-top: 25px;
    border-top: 1px dashed #ccc;
    padding-top: 20px;
}

.mbti-toggle-title {
    font-family: "Song Myung", serif;
    font-weight: bold;
    font-size: 1.05rem;
    color: #222;
    cursor: pointer;
    list-style: none;
    outline: none;
    user-select: none;
    margin-bottom: 8px;
}
.mbti-toggle-title::-webkit-details-marker {
    display: none;
}

.mbti-container-box {
    border: 2px solid #222;
    background: #ffffff;
    padding: 20px 15px;
    text-align: left;
}

.mbti-input-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 20px;
    gap: 10px;
}

.mbti-select-block {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.mbti-block-label {
    font-family: "Song Myung", serif;
    font-size: 0.9rem;
    font-weight: bold;
    color: #222;
    margin-bottom: 6px;
}

.mbti-select-block select {
    width: 100%;
    padding: 10px;
    font-size: 0.95rem;
    font-weight: bold;
    border: 2px solid #222;
    border-radius: 0;
    background: #ffffff;
    outline: none;
    text-align-last: center;
    cursor: pointer;
}

.mbti-submit-circle {
    width: 50px;
    height: 50px;
    min-width: 50px;
    border-radius: 50%;
    border: 2px solid #ff4d4d;
    font-family: "Song Myung", serif;
    background: #ffffff;
    color: #ff4d4d;
    font-size: 0.75rem;
    font-weight: bold;
    cursor: pointer;
    line-height: 1.2;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
    transition: transform 0.1s;
    margin-bottom: -2px; 
}

.mbti-submit-circle:active {
    transform: scale(0.95);
    background: #fdfdfd;
}

.mbti-result-wrapper {
    margin-top: 10px;
}

.mbti-result-label {
    font-family: "Song Myung", serif;
    font-size: 0.85rem;
    font-weight: bold;
    color: #222;
    margin-bottom: 5px;
}

.mbti-result-comment-box {
    width: 100%;
    border: 2px solid #222;
    padding: 12px 15px;
    font-size: 0.85rem;
    color: #444;
    line-height: 1.5;
    background: #fafafa;
    min-height: 45px;
}

@media screen and (max-width: 360px) {
    .container { padding: 15px 10px; }
    .main-title { font-size: 2.3rem; }
    .upload-box { height: 85px; }
    .result-score { font-size: 2.2rem; }
    .detail-toggle-btn { font-size: 0.85rem; }
    .mbti-submit-circle { width: 44px; height: 44px; min-width: 44px; font-size: 0.7rem; }
    .mbti-block-label { font-size: 0.8rem; }
}