@import url('https://fonts.googleapis.com/css2?family=Black+Han+Sans&family=Do+Hyeon&family=Noto+Sans+KR:wght@400;700;900&display=swap');

:root {
    --bg-color: #ffde00; /* 강렬한 노랑 */
    --main-color: #ffffff;
    --accent-color: #ff4d4d; /* 강렬한 레드 */
    --border-width: 4px;
    --black: #1a1a1a;
    --shadow: 8px 8px 0px #1a1a1a;
}

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

body {
    background-color: var(--bg-color);
    background-image: radial-gradient(var(--black) 1px, transparent 1px);
    background-size: 30px 30px; /* 도트 배경 */
    font-family: 'Noto Sans KR', sans-serif;
    color: var(--black);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    overflow-x: hidden;
}

/* 배경 장식 */
.bg-decoration {
    position: fixed;
    font-size: 3rem;
    opacity: 0.15;
    z-index: -1;
    pointer-events: none;
    animation: float 6s infinite ease-in-out;
}
.dec-1 { top: 10%; left: 10%; }
.dec-2 { top: 70%; left: 5%; animation-delay: 1s; }
.dec-3 { top: 20%; right: 10%; animation-delay: 2s; }
.dec-4 { top: 80%; right: 8%; animation-delay: 3s; }
.dec-5 { top: 45%; left: 85%; animation-delay: 4s; }

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(10deg); }
}

.container {
    width: 100%;
    max-width: 500px;
    z-index: 1;
}

header {
    text-align: center;
    margin-bottom: 40px;
}

.badge {
    display: inline-block;
    background: var(--black);
    color: white;
    padding: 5px 15px;
    font-weight: 900;
    font-size: 0.8rem;
    transform: rotate(-2deg);
    margin-bottom: 15px;
}

h1 {
    font-family: 'Black Han Sans', sans-serif;
    font-size: 3rem;
    line-height: 1.1;
    text-shadow: 4px 4px 0px white;
    margin-bottom: 10px;
}

.subtitle {
    font-family: 'Do Hyeon', sans-serif;
    font-size: 1.2rem;
    background: white;
    display: inline-block;
    padding: 2px 10px;
    border: var(--border-width) solid var(--black);
    box-shadow: 4px 4px 0px var(--black);
}

/* 메인 박스 */
.issuance-box {
    background: white;
    border: var(--border-width) solid var(--black);
    padding: 30px;
    box-shadow: var(--shadow);
    margin-bottom: 40px;
}

.input-row {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.input-wrapper {
    flex: 1;
    text-align: left;
}

.input-wrapper label {
    display: block;
    font-weight: 900;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

input {
    width: 100%;
    padding: 15px;
    border: var(--border-width) solid var(--black);
    font-size: 1.2rem;
    font-weight: bold;
    outline: none;
    box-shadow: 4px 4px 0px var(--black);
}

input[type="file"] {
    padding: 10px;
    background: #f0f0f0;
    cursor: pointer;
    font-size: 0.9rem;
}

button {
    width: 100%;
    padding: 20px;
    background-color: var(--accent-color);
    color: white;
    border: var(--border-width) solid var(--black);
    font-size: 1.5rem;
    font-family: 'Black Han Sans', sans-serif;
    cursor: pointer;
    box-shadow: 4px 4px 0px var(--black);
    transition: all 0.1s;
    margin-bottom: 10px;
}

button:active {
    transform: translate(4px, 4px);
    box-shadow: 0px 0px 0px var(--black);
}

.secondary-btn {
    background-color: var(--main-color);
    color: var(--black);
    font-size: 1rem;
    padding: 10px;
    margin-top: 10px;
}

/* 로딩 화면 */
#loading {
    margin: 40px 0;
    background: white;
    border: var(--border-width) solid var(--black);
    padding: 20px;
    box-shadow: var(--shadow);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 8px solid var(--bg-color);
    border-top: 8px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 신분증 카드 디자인 */
.id-card {
    background-color: #fff;
    border: var(--border-width) solid var(--black);
    box-shadow: 15px 15px 0px var(--black);
    padding: 0;
    overflow: hidden;
    margin-top: 40px;
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.card-inner {
    padding: 25px;
}

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: var(--border-width) solid var(--black);
    padding-bottom: 10px;
}

.serial-no { font-size: 0.7rem; font-weight: bold; font-family: monospace; }
.card-label { font-family: 'Black Han Sans', sans-serif; color: var(--accent-color); }

.card-main {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.photo-container {
    width: 110px;
    height: 140px; /* 높이 고정 */
    border: var(--border-width) solid var(--black);
    background: var(--bg-color);
    text-align: center;
    box-shadow: 4px 4px 0px var(--black);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.emoji-display { font-size: 4rem; flex: 1; display: flex; align-items: center; justify-content: center; }

#resultImage {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-label { background: var(--black); color: white; font-size: 0.6rem; font-weight: bold; padding: 5px; }

.info-table {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 12px;
}

.info-row { border-bottom: 2px solid #eee; padding-bottom: 5px; }
.info-row .label { font-size: 0.7rem; font-weight: 900; color: #666; display: block; }
.info-row .value { font-size: 1.1rem; font-weight: 900; }

.card-story {
    background: #f0f0f0;
    border: 2px solid var(--black);
    padding: 15px;
    margin-bottom: 20px;
    font-size: 0.95rem;
    line-height: 1.5;
    font-weight: 500;
}

.card-bottom {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.crime-info { flex: 1; font-size: 0.8rem; border-left: 5px solid var(--accent-color); padding-left: 10px; }

.official-stamp {
    width: 70px;
    height: 70px;
}

.stamp-circle {
    width: 60px;
    height: 60px;
    border: 4px double var(--accent-color);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--accent-color);
    font-weight: 900;
    font-size: 0.8rem;
    transform: rotate(-15deg);
    text-align: center;
}

.barcode {
    background: var(--black);
    color: white;
    text-align: center;
    padding: 5px;
    font-family: monospace;
    font-size: 0.8rem;
    letter-spacing: 2px;
}

/* 모달 스타일 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(5px);
}

.modal-content {
    position: relative;
    background: white;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    border: var(--border-width) solid var(--black);
    box-shadow: 15px 15px 0px var(--black);
    overflow-y: auto;
    z-index: 1001;
    animation: popIn 0.3s ease-out;
}

.modal-header {
    position: sticky;
    top: 0;
    background: var(--black);
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
}

#closeManualBtn {
    background: var(--accent-color);
    width: auto;
    padding: 5px 15px;
    font-size: 1.5rem;
    margin: 0;
}

.policy-content {
    padding: 25px;
    font-size: 0.85rem;
    line-height: 1.8;
    color: #333;
    text-align: left;
}

.policy-content h3 {
    margin: 20px 0 10px;
    border-left: 4px solid var(--accent-color);
    padding-left: 10px;
    font-size: 1rem;
    color: var(--black);
}

footer {
    margin-top: 50px;
    padding-bottom: 20px;
    font-size: 0.8rem;
    opacity: 0.6;
}

.hidden { display: none !important; }

@media (max-width: 480px) {
    h1 { font-size: 2.2rem; }
    .card-main { flex-direction: column; align-items: center; }
    .photo-container { width: 100%; max-width: 150px; }
}
