@font-face {
    font-family: 'Pretendard';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/pretendard@1.0/Pretendard-Thin.woff2') format('woff2');
    font-weight: 100;
    font-display: swap;
}
@font-face {
    font-family: 'Pretendard';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/pretendard@1.0/Pretendard-ExtraLight.woff2') format('woff2');
    font-weight: 200;
    font-display: swap;
}
@font-face {
    font-family: 'Pretendard';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/pretendard@1.0/Pretendard-Light.woff2') format('woff2');
    font-weight: 300;
    font-display: swap;
}
@font-face {
    font-family: 'Pretendard';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/pretendard@1.0/Pretendard-Regular.woff2') format('woff2');
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: 'Pretendard';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/pretendard@1.0/Pretendard-Medium.woff2') format('woff2');
    font-weight: 500;
    font-display: swap;
}
@font-face {
    font-family: 'Pretendard';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/pretendard@1.0/Pretendard-SemiBold.woff2') format('woff2');
    font-weight: 600;
    font-display: swap;
}
@font-face {
    font-family: 'Pretendard';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/pretendard@1.0/Pretendard-Bold.woff2') format('woff2');
    font-weight: 700;
    font-display: swap;
}
@font-face {
    font-family: 'Pretendard';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/pretendard@1.0/Pretendard-ExtraBold.woff2') format('woff2');
    font-weight: 800;
    font-display: swap;
}
@font-face {
    font-family: 'Pretendard';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/pretendard@1.0/Pretendard-Black.woff2') format('woff2');
    font-weight: 900;
    font-display: swap;
}

body, select, button, textarea {
    font-family: "Pretendard", sans-serif;
}
body {
    background: #f4f6f9;
    padding: 20px;
    font-size: 15px;
}
.container {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 10px 20px rgba(0,0,0,.1);
}
.container h1 {
    font-size: 30px;
    margin-bottom: 20px;
}
.container .reference {
    margin-top: 20px;
    font-size: 24px;
    font-weight: bold;
}
.controls {
    display: flex;
    justify-content: space-between;
}
.controls select {
    padding: 10px;
    border-radius: 5px;
    width: calc(100% - 100px);
}
.controls button {
    display: block;
    width: 90px;
    padding: 5px 10px;
    border-radius: 5px;
    background-color: #eee;
}
.typing-wrapper {
    position: relative;
    margin-top: 10px;
    background: #fafafa;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0,0,0,.1) inset;
}
#targetText,
#overlayText,
#typingInput {
    font-size: 18px;
    line-height: 2;
    letter-spacing: 0;
    padding: 10px 15PX;
    width: 100%;
    box-sizing: border-box;
    white-space: pre-wrap;
    word-break: break-all;
}
#targetText {
    color: rgba(0,0,0,.3);
}
#overlayText {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}
#targetText,
#overlayText {
    overflow: hidden;
}
#typingInput {
    position: absolute;
    top: 0;
    left: 0;
    background: transparent;
    color: transparent;
    caret-color: black;
    border: none;
    outline: none;
    resize: none;
    margin: 0;
}
.correct {
    color: black;
}
.wrong {
    color: red;
}
.stats {
    display: flex;
    margin-top: 5px;
}
.stats .col-left {
    width: 200px;
}
.stats .col > div {
    margin-top: 15px;
}
.stats strong {
    display: block;
    margin-bottom: 5px;
}
.share-card {
    width: 100%;
    padding: 40px;
    background: #36318f;
    color: #fff;
    border-radius: 20px;
    display: none;
}

.share-card h2 {
    text-align: center;
    font-size: 24px;
    margin-bottom: 20px;
}

.share-reference {
    font-size: 24px;
    margin-bottom: 20px;
    text-align: center;
    font-weight: bold;
}

.share-stats {
    font-size: 18px;
    text-align: center;
    line-height: 1.8;
}
#result {
    margin-top: 20px;
}
#shareBtn {
    display: block;
    width: 100%;
    padding: 10px;
    background-color: gold;
    font-weight: bold;
    font-size: 18px;
    border-radius: 10px;
}
.result-card {
    width: 320px;
    padding: 24px;
    border-radius: 16px;
    background: linear-gradient(135deg, #4a90e2, #357ABD);
    color: #fff;
    font-family: 'Pretendard', serif;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.result-card .card-title {
    font-size: 18px;
    margin-bottom: 20px;
    font-weight: bold;
}

.result-card .stat {
    margin: 10px 0;
    font-size: 16px;
}
/* ===== 이름 입력 모달 ===== */

.name-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.name-modal-box {
    background: #ffffff;
    width: 90%;
    max-width: 360px;
    padding: 25px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}

.name-modal-box h3 {
    margin-bottom: 15px;
    font-size: 18px;
}

.name-modal-box input {
    width: 100%;
    padding: 10px;
    font-size: 16px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
}

.name-modal-buttons {
    display: flex;
    gap: 10px;
}

.name-modal-buttons button {
    flex: 1;
    padding: 8px;
    font-size: 14px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
}

#confirmNameBtn {
    background: #4a90e2;
    color: white;
}

#cancelNameBtn {
    background: #ccc;
}
#nameModal {
    display: none;
}
#nameModal.show {
    display: flex;
}


/* =========================
   ✅ 랭킹보드
========================= */

.ranking-section {
    width: 100%;
    max-width: 1000px;
    margin: 30px auto;
    padding-top: 18px;
    border-top: 1px solid #eef1f6;
}

.ranking-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.ranking-head h2 {
    margin: 0;
    font-size: 18px;
}

.ranking-tabs {
    display: inline-flex;
    background: #f1f5f9;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    padding: 4px;
    gap: 4px;
}

.ranking-tabs input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.ranking-tabs .tab {
    padding: 8px 14px;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 800;
    font-size: 13px;
    color: #374151;
    user-select: none;
}

#tabMo:checked + label.tab,
#tabPc:checked + label.tab {
    background: #111827;
    color: #fff;
}

.ranking-panels {
    margin-top: 12px;
}

.ranking-panel {
    display: none;
}

#tabMo:checked ~ .ranking-panels .panel-mo { display: block; }
#tabPc:checked ~ .ranking-panels .panel-pc { display: block; }

.ranking-subtitle {
    font-size: 13px;
    font-weight: 800;
    color: #6b7280;
    margin: 10px 0 8px;
}

.table-wrap {
    width: 100%;
    overflow: auto;
    border: 1px solid #eef1f6;
    border-radius: 10px;
}

.ranking-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.ranking-table thead th {
    position: sticky;
    top: 0;
    background: #f8fafc;
    z-index: 1;
    font-size: 12px;
    color: #374151;
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid #eef1f6;
    white-space: nowrap;
}

.ranking-table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
    color: #111;
    white-space: nowrap;
}

.ranking-table tbody tr:nth-child(even) td {
    background: #fcfdff;
}

.ranking-table tbody tr.empty td {
    text-align: center;
    color: #6b7280;
    padding: 16px 12px;
}

.col-rank { width: 70px; }
.col-name { width: 140px; }
.col-ref  { width: 180px; }
.col-cpm  { width: 90px; }
.col-acc  { width: 90px; }
.col-time { width: 90px; }
.col-date { width: 170px; }

.ranking-section h2 {
    margin-bottom: 15px;
}

.ranking-grid {
}

.ranking-card {
    background: #fff;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 10px 20px rgba(0,0,0,.1);
    margin-bottom: 20px;
}

.ranking-title {
    font-weight: bold;
    margin-bottom: 10px;
}

.table-wrap {
    overflow-x: auto;
}

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

.ranking-table th,
.ranking-table td {
    padding: 8px;
    border-bottom: 1px solid #eaeaea;
    text-align: left;
}

.ranking-table th {
    background: #f1f5f9;
}

.ranking-table tbody tr:nth-child(even) {
    background: #fcfcfc;
}

.ranking-table .empty td {
    text-align: center;
    color: #888;
}