:root {
    --bg-color: #e4ebf3;
    --card-bg: #ffffff;
    --primary-color: #065bc6; /* Button blue */
    --text-dark: #1e293b;
    --text-muted: #64748b;
    --border-light: #dee5e7;
    --accent-gradient: linear-gradient(135deg, #2563eb, #7c3aed);
}

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

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
    background-color: #ccd7e4; /* Slightly darker background for desktop contrast */
    color: var(--text-dark);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    -webkit-text-size-adjust: none;
    -moz-text-size-adjust: none;
    -ms-text-size-adjust: none;
}

/* Layout Container (Mock Mobile Device) */
.container {
    background-color: var(--bg-color);
    width: 100%;
    max-width: 420px;
    height: 92vh;
    max-height: 840px;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
    border-radius: 24px;
    overflow: hidden;
    border: 6px solid #1e293b; /* Sleek bezel for desktop view */
}

#wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: 80px; /* Space for marquee footer + back button spacing */
    position: relative;
}

/* Custom scrollbar for container */
#wrap::-webkit-scrollbar {
    width: 6px;
}
#wrap::-webkit-scrollbar-track {
    background: transparent;
}
#wrap::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

/* Header styling */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background-color: var(--bg-color);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.header_logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header_logo img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.header_logo h2 {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    font-size: 13px;
    font-weight: 800;
    color: #1e293b;
    letter-spacing: -0.3px;
}

.header_logo h2 span {
    display: block;
}

.header_list {
    display: flex;
    align-items: center;
    cursor: pointer;
    color: #475569;
    transition: color 0.2s ease;
}

.header_list:hover {
    color: #0f172a;
}

/* ID Card Main Box */
#box {
    background-color: var(--card-bg);
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
    padding: 24px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: relative;
}

/* Card Top Section: Photo & Profile side-by-side */
.id-card-top {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.photo-area {
    width: 90px;
    height: 115px;
    border-radius: 8px;
    overflow: hidden;
    background-color: #f8fafc;
    flex-shrink: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.photo-area img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-top: 4px;
}

.profile-text h1.user-name {
    font-size: 24px;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.profile-text h2.user-birth,
.profile-text h2.user-ssn {
    font-size: 16px;
    font-weight: 700;
    color: #334155;
    letter-spacing: 0.5px;
}

/* Address Styling */
h3.user-address {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.6;
    color: #475569;
    word-break: keep-all;
    border-bottom: 1px dashed #e2e8f0;
    padding-bottom: 20px;
    margin-top: -4px;
}

/* QR Code Section */
.QR_Code {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 8px 0;
}

.QR_Code img {
    width: 155px;
    height: 155px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 6px;
    background-color: #fff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
}

.QR_text {
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: -8px;
}

/* Progress bar & Timer */
.progress-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    gap: 8px;
    margin-top: 4px;
}

progress {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
    appearance: none;
    -webkit-appearance: none;
    border: none;
    background-color: #e2e8f0;
}

progress::-webkit-progress-bar {
    background-color: #e2e8f0;
}

progress::-webkit-progress-value {
    background: var(--primary-color);
    transition: width 1s linear;
}

progress::-moz-progress-bar {
    background: var(--primary-color);
}

.progress-time-info {
    display: flex;
    justify-content: space-between;
    width: 100%;
    font-size: 12px;
    font-weight: 700;
}

.progressbar_text {
    color: var(--text-muted);
}

.progressbar_time {
    color: var(--primary-color);
}

/* Current Time */
.current_time {
    text-align: center;
    font-size: 15px;
    font-weight: 700;
    color: #475569;
    letter-spacing: -0.2px;
    margin-bottom: 4px;
}

/* Box Footer / Detailed Info Button */
.box_footer {
    border-top: 1px solid #f1f5f9;
    margin: 8px -24px -24px -24px;
    background-color: var(--primary-color);
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
    overflow: hidden;
    transition: background-color 0.2s ease;
}

.box_footer:hover {
    background-color: #044aa3;
}

.box_footer p.js-click-modal {
    text-align: center;
    color: #ffffff;
    font-size: 16px;
    font-weight: 700;
    padding: 18px 0;
    cursor: pointer;
    user-select: none;
}

/* Modal Detailed Card specific styles */
.box_detail {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08) !important;
}

.issue-info {
    margin-top: 8px;
    border-top: 1px solid #f1f5f9;
    padding-top: 20px;
}

.issue-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    font-size: 14px;
}

.issue-date {
    color: #64748b;
}

.issue-authority {
    color: #0f172a;
}

/* Back button in detailed modal view */
.back {
    position: absolute;
    bottom: -64px;
    left: 50%;
    transform: translateX(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: #ffffff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.back:hover {
    transform: translateX(-50%) scale(1.08);
    background-color: #f8fafc;
}

.back bd {
    display: flex;
    justify-content: center;
    align-items: center;
    color: #475569;
}

/* Bottom banner */
#footer {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 48px;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    padding: 0 20px;
    z-index: 10;
}

#footer MARQUEE {
    width: 100%;
}

#footer MARQUEE p {
    color: rgba(255, 255, 255, 0.95);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

/* Media Queries for Real Mobile Screens */
@media (max-width: 480px) {
    body {
        align-items: flex-start;
        background-color: var(--bg-color);
        min-height: 100vh;
        overflow-y: auto;
    }
    
    .container {
        height: 100vh;
        max-height: 100%;
        max-width: 100%;
        box-shadow: none;
        border-radius: 0;
        border: none;
    }
    
    #wrap {
        padding: 16px;
        padding-bottom: 76px;
    }
    
    #box {
        padding: 20px;
    }
    
    .box_footer {
        margin: 8px -20px -20px -20px;
        border-bottom-left-radius: 20px;
        border-bottom-right-radius: 20px;
    }
    
    .back {
        bottom: -58px;
    }
}