/* ==========================================================================
   THE LOCK — 모바일 커뮤니티 글라스모피즘 디자인 시스템
   Palette : Blush White #FFF6FA / Lavender White #F0F1FF
             Rose #FF8FAE · Violet #9B8CFF · Mint #63E6BE · Coral #FF6B6B
   Type    : Pretendard (본문/헤딩) + Space Mono (타이머·코드류)
   ========================================================================== */

:root {
    /* Surface & background */
    --bg-a: #FFF6FA;
    --bg-b: #F0F1FF;
    --bg-c: #EAFBF5;

    --glass: rgba(255, 255, 255, 0.58);
    --glass-strong: rgba(255, 255, 255, 0.82);
    --glass-border: rgba(255, 255, 255, 0.9);
    --glass-shadow: 0 8px 32px rgba(155, 140, 255, 0.16), 0 2px 8px rgba(255, 143, 174, 0.08);

    /* Text */
    --ink: #3B3352;
    --ink-soft: #8A8099;
    --ink-faint: #B7ADC4;

    /* Accents */
    --rose: #FF8FAE;
    --rose-deep: #FF6B95;
    --violet: #9B8CFF;
    --violet-deep: #7C6AE8;
    --mint: #4FD8AE;
    --mint-deep: #2FBE94;
    --coral: #FF6B6B;
    --coral-deep: #F94D6A;
    --gold: #FFC97A;

    --border: rgba(155, 140, 255, 0.22);
    --radius-lg: 26px;
    --radius-md: 18px;
    --radius-sm: 12px;

    --font-display: 'Pretendard Variable', 'Pretendard', -apple-system, sans-serif;
    --font-body: 'Pretendard Variable', 'Pretendard', -apple-system, sans-serif;
    --font-mono: 'Space Mono', 'SFMono-Regular', monospace;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

body {
    font-family: var(--font-body);
    color: var(--ink);
    background:
        radial-gradient(circle at 12% 8%, rgba(255, 143, 174, 0.35), transparent 42%),
        radial-gradient(circle at 88% 18%, rgba(155, 140, 255, 0.30), transparent 46%),
        radial-gradient(circle at 20% 92%, rgba(79, 216, 174, 0.24), transparent 45%),
        linear-gradient(160deg, var(--bg-a) 0%, var(--bg-b) 55%, var(--bg-c) 100%);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
    padding-bottom: 48px;
}

/* Ambient floating blobs (pure decoration, no layout impact) */
body::before,
body::after {
    content: "";
    position: fixed;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    filter: blur(70px);
    z-index: -1;
    opacity: 0.55;
    pointer-events: none;
}
body::before {
    top: -60px;
    right: -60px;
    background: var(--rose);
    animation: float-blob 14s ease-in-out infinite;
}
body::after {
    bottom: -80px;
    left: -60px;
    background: var(--violet);
    animation: float-blob 16s ease-in-out infinite reverse;
}
@keyframes float-blob {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(20px, 30px) scale(1.08); }
}

h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: 800;
    color: var(--ink);
    letter-spacing: -0.02em;
    margin: 0 0 12px;
}
h2 { font-size: 20px; }
h3 { font-size: 17px; }
p { margin: 0; color: var(--ink-soft); font-size: 14px; }
label {
    display: block;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--ink-soft);
    margin-bottom: 6px;
    letter-spacing: -0.01em;
}
hr { border: none; border-top: 1px dashed var(--border); }

/* ==========================================================================
   App shell — mobile-first centered column
   ========================================================================== */

#app {
    max-width: 460px;
    margin: 0 auto;
    padding: 20px 18px 40px;
}

.view { display: none; }
.view.active { display: block; }
.view:not(.hidden) { display: block; }

.hidden { display: none !important; }

@keyframes view-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.view.active { animation: view-in 0.35s cubic-bezier(.2,.8,.2,1); }

/* ==========================================================================
   Top navbar
   ========================================================================== */

.navbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 460px;
    margin: 0 auto;
    padding: 12px 16px;
    background: var(--glass-strong);
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    border: 1px solid var(--glass-border);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    box-shadow: var(--glass-shadow);
}

.nav-brand {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 15px;
    color: var(--ink);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ==========================================================================
   Logo / hero
   ========================================================================== */

.logo-container {
    text-align: center;
    padding: 34px 10px 26px;
}
.logo-container h1 {
    font-size: 30px;
    background: linear-gradient(120deg, var(--rose-deep), var(--violet-deep));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 8px;
}
.logo-container p {
    font-size: 13.5px;
    color: var(--ink-soft);
}

/* ==========================================================================
   Glass surfaces — cards, forms, modals
   ========================================================================== */

.form-container {
    background: var(--glass);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow);
    padding: 22px 20px;
    margin-bottom: 16px;
}

.form-group { margin-bottom: 14px; }
.form-group:last-child { margin-bottom: 0; }

.guide-text {
    font-size: 12.5px;
    color: var(--ink-faint);
    line-height: 1.55;
}

/* ==========================================================================
   Inputs
   ========================================================================== */

input[type="text"],
input[type="password"],
input[type="number"],
textarea,
select {
    width: 100%;
    font-family: var(--font-body);
    font-size: 14.5px;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.65);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
textarea {
    min-height: 84px;
    resize: vertical;
    font-family: var(--font-body);
}
input::placeholder,
textarea::placeholder { color: var(--ink-faint); }

input:focus,
textarea:focus,
select:focus {
    border-color: var(--violet);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 0 0 4px rgba(155, 140, 255, 0.16);
}

input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--rose-deep);
    cursor: pointer;
}

/* Auth-code / id-like mono fields */
#reg-tweet-url,
#reg-auth-code,
#admin-id,
#am-target,
#aa-id {
    font-family: var(--font-mono);
    letter-spacing: -0.02em;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 14.5px;
    letter-spacing: -0.01em;
    border: none;
    border-radius: var(--radius-sm);
    padding: 13px 18px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }
.full-width { width: 100%; display: block; }

.primary-btn {
    color: #fff;
    background: linear-gradient(120deg, var(--rose-deep), var(--violet-deep));
    box-shadow: 0 6px 18px rgba(255, 107, 149, 0.32);
}
.primary-btn:hover { filter: brightness(1.05); }

.outline-btn {
    color: var(--violet-deep);
    background: rgba(255, 255, 255, 0.55);
    border: 1.5px solid rgba(155, 140, 255, 0.45);
}
.outline-btn:hover { background: rgba(255, 255, 255, 0.85); }

.success-btn {
    color: #fff;
    background: linear-gradient(120deg, var(--mint), var(--mint-deep));
    box-shadow: 0 6px 18px rgba(47, 190, 148, 0.30);
}

.danger-btn {
    color: #fff;
    background: linear-gradient(120deg, var(--coral), var(--coral-deep));
    box-shadow: 0 6px 18px rgba(249, 77, 106, 0.30);
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--ink-soft);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 13px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.icon-btn:hover { background: rgba(155, 140, 255, 0.12); color: var(--ink); }

.text-danger { color: var(--coral-deep) !important; }

/* Admin entry — visible but deliberately small & quiet */
#btn-admin-login {
    font-size: 11.5px;
    font-weight: 700;
    padding: 7px 16px;
    border-radius: 999px;
    color: var(--ink-faint);
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(155, 140, 255, 0.25);
    letter-spacing: 0.02em;
}
#btn-admin-login:hover {
    color: var(--violet-deep);
    border-color: rgba(155, 140, 255, 0.5);
}

/* ==========================================================================
   Utility spacing
   ========================================================================== */

.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.text-center { text-align: center; }
.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ==========================================================================
   Dashboard signature element — glowing lock/timer dial
   ========================================================================== */

#dash-status {
    position: relative;
    padding: 30px 20px;
    overflow: hidden;
    background: var(--glass-strong);
}
#dash-status::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 220px;
    height: 220px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: conic-gradient(from 0deg, var(--rose), var(--violet), var(--mint), var(--gold), var(--rose));
    filter: blur(38px);
    opacity: 0.28;
    animation: spin-glow 10s linear infinite;
    z-index: 0;
}
#dash-status > * { position: relative; z-index: 1; }
#dash-status h1,
#dash-status h2,
#dash-status .timer,
#dash-status strong {
    font-family: var(--font-mono);
    font-weight: 700;
    letter-spacing: -0.01em;
}
@keyframes spin-glow {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}
.timer-display { font-size: 40px; font-weight: 900; color: var(--violet-deep); margin: 20px 0; font-family: var(--font-mono); font-variant-numeric: tabular-nums; text-shadow: 0 4px 12px rgba(155, 140, 255, 0.2); }


/* ==========================================================================
   Lists — board, ranking, comments
   ========================================================================== */

.board-list,
.comment-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.board-list li,
.comment-list li {
    background: var(--glass);
    backdrop-filter: blur(16px) saturate(150%);
    -webkit-backdrop-filter: blur(16px) saturate(150%);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    box-shadow: 0 4px 16px rgba(155, 140, 255, 0.10);
    font-size: 13.5px;
    color: var(--ink);
    transition: transform 0.15s ease;
}
.board-list li:active,
.comment-list li:active { transform: scale(0.98); }

.comment-list { max-height: 260px; overflow-y: auto; padding-right: 2px; }
.comment-list li { font-size: 13px; }

/* Scrollbar (webkit) */
.comment-list::-webkit-scrollbar { width: 5px; }
.comment-list::-webkit-scrollbar-thumb {
    background: rgba(155, 140, 255, 0.35);
    border-radius: 10px;
}

/* ==========================================================================
   Dynamic JS Rendered Elements (Badges & Admin Panels)
   ========================================================================== */

.rank-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 800;
    margin-bottom: 6px;
}
.badge-locked {
    background: rgba(155, 140, 255, 0.15);
    color: var(--violet-deep);
    border: 1px solid rgba(155, 140, 255, 0.3);
}
.badge-failed {
    background: rgba(249, 77, 106, 0.15);
    color: var(--coral-deep);
    border: 1px solid rgba(249, 77, 106, 0.3);
}
.badge-completed {
    background: rgba(47, 190, 148, 0.15);
    color: var(--mint-deep);
    border: 1px solid rgba(47, 190, 148, 0.3);
}

.fatal-secret-expose {
    color: var(--coral-deep);
    font-weight: 800;
    background: rgba(249, 77, 106, 0.08);
    padding: 12px;
    border-radius: 8px;
    border: 1.5px dashed rgba(249, 77, 106, 0.4);
    margin-top: 10px;
    font-size: 13.5px;
    box-shadow: inset 0 2px 10px rgba(249, 77, 106, 0.05);
}

.admin-secret-panel {
    background: rgba(249, 77, 106, 0.05);
    padding: 14px;
    border: 1px solid rgba(249, 77, 106, 0.3);
    border-radius: 10px;
    margin-top: 12px;
}

/* ==========================================================================
   Tabs (Admin)
   ========================================================================== */

.tabs {
    display: flex;
    gap: 6px;
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 5px;
    margin-bottom: 16px;
}

.tab-btn {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--ink-soft);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 12px;
    padding: 10px 6px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}
.tab-btn.active {
    background: linear-gradient(120deg, var(--rose-deep), var(--violet-deep));
    color: #fff;
    box-shadow: 0 4px 12px rgba(155, 140, 255, 0.30);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ==========================================================================
   Modals
   ========================================================================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(59, 51, 82, 0.28);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: view-in 0.25s ease;
}

.modal-content {
    width: 100%;
    max-width: 380px;
    background: var(--glass-strong);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 60px rgba(123, 106, 232, 0.28);
    padding: 24px 22px;
}
.modal-content h3 { margin-bottom: 10px; }
.modal-content p { margin-bottom: 18px; }
.modal-content .btn { margin-top: 4px; }

/* ==========================================================================
   Small screens
   ========================================================================== */

@media (max-width: 380px) {
    #app { padding: 16px 14px 32px; }
    .logo-container h1 { font-size: 26px; }
    .form-container { padding: 18px 16px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}

/* Focus visibility for accessibility */
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--violet-deep);
    outline-offset: 2px;
}


