        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
            -webkit-tap-highlight-color: transparent;
        }

        :root {
            --primary-color: #6a828e;
            /* Slate Gray */
            --primary-dark: #4d606a;
            /* Darker Slate Gray */
            --primary-light: #f4f6f7;
            --wrong-color: #d96e6e;
        }

        html,
        body {
            width: 100%;
            height: 100vh;
            height: 100dvh;
            font-family: "Pretendard", "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
            background: #f4f6f7;
            color: #222;
            overflow: hidden;
        }

        #app-container {
            position: relative;
            z-index: 10;
            width: 100%;
            max-width: 480px;
            height: 100vh;
            height: 100dvh;
            margin: 0 auto;
            background: #ffffff;
            display: flex;
            flex-direction: column;
            overflow-y: auto;
            overflow-x: hidden;
        }

        .view-section {
            width: 100%;
            height: 100%;
            display: none;
            flex-direction: column;
        }

        .view-section.active {
            display: flex;
        }

        /* ----- PROMO BANNER ----- */
        .promo-banner {
            background: linear-gradient(135deg, #4d606a 0%, #6a828e 100%);
            color: #fff;
            padding: 20px;
            margin-bottom: 24px;
            text-align: center;
            cursor: pointer;
            transition: transform 0.2s;
            border: 1px solid rgba(255, 255, 255, 0.1);
        }

        .promo-banner:active {
            transform: scale(0.98);
        }

        /* ----- CATEGORY TABS ----- */
        .category-tabs {
            display: flex;
            gap: 0;
            margin-bottom: 20px;
            border-bottom: 1px solid #ebebeb;
        }

        .category-tab {
            flex: 1;
            padding: 14px;
            border: none;
            background: #fff;
            font-size: 15px;
            font-weight: 700;
            color: #888;
            cursor: pointer;
            position: relative;
            transition: all 0.2s;
        }

        .category-tab.active {
            color: var(--primary-color);
        }

        .category-tab.active::after {
            content: "";
            position: absolute;
            bottom: -1px;
            left: 0;
            width: 100%;
            height: 3px;
            background: var(--primary-color);
        }

        .promo-banner-title {
            font-size: 18px;
            font-weight: 800;
            margin-bottom: 4px;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
        }

        .promo-banner-sub {
            font-size: 13px;
            opacity: 0.9;
            font-weight: 500;
        }

        /* ----- SUBJECT CARDS LOCKS ----- */
        .subject-card {
            position: relative;
            overflow: hidden;
            transition: all 0.2s;
        }

        .subject-card.locked-card {
            background-color: #f9f9f9 !important;
            border-color: #eee !important;
            cursor: pointer;
            opacity: 0.6;
            /* Faded/dimmed look as in Image 2 */
        }

        .subject-card.locked-card .subject-name {
            color: #888 !important;
            /* Slightly darker than before for readability on dimmed card */
        }

        .badge-free {
            position: absolute;
            top: 0;
            left: 0;
            background: #d96e6e;
            color: #fff;
            font-size: 10px;
            font-weight: 800;
            padding: 3px 8px;
            letter-spacing: 0.05em;
            z-index: 5;
            border-bottom-right-radius: 4px;
        }

        .lock-icon {
            margin-left: auto;
            color: #fbc531;
            /* Bright premium gold color */
            flex-shrink: 0;
            display: flex;
            align-items: center;
        }

        .subject-name {
            display: flex;
            align-items: center;
            width: 100%;
            gap: 8px;
            font-weight: 600;
        }

        /* ----- PAYMENT VIEW ----- */
        #view-payment {
            background: #fff;
            flex-direction: column;
            align-items: center;
            justify-content: flex-start;
            padding: 60px 24px 40px;
            text-align: center;
            overflow-y: auto;
        }

        .pay-card {
            border: 2px solid var(--primary-color);
            padding: 30px 24px;
            max-width: 400px;
            width: 100%;
        }

        .pay-title {
            font-size: 22px;
            font-weight: 800;
            color: var(--primary-color);
            margin-bottom: 12px;
        }

        .pay-price {
            font-size: 28px;
            font-weight: 800;
            margin-bottom: 24px;
        }

        .pay-desc {
            font-size: 14px;
            color: #666;
            line-height: 1.6;
            margin-bottom: 30px;
            text-align: left;
        }

        .pay-desc li {
            list-style: none;
            margin-bottom: 8px;
        }

        .pay-desc li::before {
            content: "✓ ";
            color: var(--primary-color);
            font-weight: 800;
        }

        .btn-pay-now {
            width: 100%;
            background: var(--primary-color);
            color: #fff;
            padding: 16px;
            border: none;
            font-size: 16px;
            font-weight: 800;
            cursor: pointer;
        }

        /* ----- HOME VIEW ----- */
        #view-home {
            background: #ffffff;
            padding: 0;
            justify-content: space-between;
        }

        .top-bar {
            background: var(--primary-color);
            height: 48px;
            width: 100%;
            flex-shrink: 0;
            display: flex;
            align-items: center;
            padding: 0 16px;
        }

        .home-content-area {
            flex: 1;
            padding: 16px 24px;
            overflow-y: auto;
            display: flex;
            flex-direction: column;
        }

        .home-title-wrap {
            text-align: center;
            margin-bottom: 0;
        }

        .main-title {
            font-size: 48px;
            font-weight: 800;
            color: var(--primary-color);
            line-height: 1.2;
            letter-spacing: -0.04em;
            margin-bottom: 8px;
        }

        .sub-title {
            font-size: 26px;
            font-weight: 700;
            color: #333;
            margin-bottom: 6px;
            letter-spacing: -0.02em;
        }

        .home-subtitle {
            font-size: 15px;
            /* 크기 약간 확대 및 깔끔하게 */
            color: #666;
            font-weight: 500;
            letter-spacing: 0.02em;
        }

        .subject-grid {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 12px;
        }

        .subject-card {
            background: #ffffff;
            border: 1px solid #ebebeb;
            border-radius: 0;
            padding: 24px 16px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            text-align: center;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
            /* Subtle shadow for premium look */
            transition: all 0.2s;
        }

        .subject-card:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
        }

        .subject-card:active {
            background: #fafafa;
        }

        .subject-name {
            font-size: 16px;
            font-weight: 600;
            color: #222;
            word-break: keep-all;
        }

        .card-dark {
            background: var(--primary-dark) !important;
            border-color: var(--primary-dark) !important;
        }

        .card-dark .subject-name {
            color: #ffffff;
        }

        .past-random-banner,
        .mock-random-banner {
            grid-column: span 2;
            background: linear-gradient(135deg, #3a5160, #6a828e);
            border: none;
            padding: 20px 16px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
            text-align: center;
            box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
            transition: all 0.2s;
            position: relative;
        }

        .past-random-banner:hover,
        .mock-random-banner:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
        }

        .past-random-banner:active,
        .mock-random-banner:active {
            transform: translateY(0);
        }

        .past-random-banner.locked-card,
        .mock-random-banner.locked-card {
            opacity: 0.6;
        }

        .past-random-content {
            display: flex;
            flex-direction: column;
            gap: 4px;
        }

        .past-random-title {
            font-size: 17px;
            font-weight: 700;
            color: #ffffff;
            letter-spacing: -0.3px;
        }

        .past-random-sub {
            font-size: 12px;
            color: rgba(255, 255, 255, 0.78);
        }

        .bottom-bar {
            background: var(--primary-color);
            height: 48px;
            flex-shrink: 0;
            display: flex;
            align-items: center;
            justify-content: space-between;
            /* 양 끝 정렬 */
            padding: 0 16px;
        }

        .btn-share-main {
            background: transparent;
            color: #ffffff;
            font-size: 14px;
            font-weight: 800;
            border: none;
            padding: 8px;
            cursor: pointer;
        }

        .btn-admin-login-bar {
            background: transparent;
            color: rgba(255, 255, 255, 0.4);
            font-size: 11px;
            border: none;
            padding: 8px;
            cursor: pointer;
        }

        /* ----- MODE SELECT VIEW ----- */
        #view-mode-select {
            background: #ffffff;
            position: relative;
        }

        .mode-header {
            display: flex;
            align-items: center;
            background: var(--primary-color);
            color: #ffffff;
            padding: 14px 16px;
        }

        .mode-header-title {
            font-size: 16px;
            font-weight: 600;
            flex: 1;
            text-align: center;
        }

        .mode-content-area {
            padding: 40px 24px;
            text-align: center;
        }

        .mode-title {
            font-size: 22px;
            font-weight: 800;
            color: var(--primary-color);
            margin-bottom: 8px;
        }

        .mode-subtitle {
            font-size: 15px;
            color: #888;
            font-weight: 500;
            margin-bottom: 32px;
        }

        .mode-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 12px;
        }

        .mode-card-btn {
            background: #fff;
            border: 2px solid var(--primary-color);
            border-radius: 0;
            padding: 24px 12px;
            text-align: center;
            cursor: pointer;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 8px;
            transition: all 0.2s;
        }

        .mode-card-btn:hover {
            background: #f4f6f7;
        }

        .m-card-title {
            font-size: 15px;
            font-weight: 700;
            color: #444;
            word-break: keep-all;
        }

        .m-card-count {
            font-size: 14px;
            font-weight: 600;
            color: #888;
        }

        /* ----- QUIZ VIEW ----- */
        #view-quiz {
            background: #ffffff;
            position: relative;
        }

        .btn-bookmark-toggle {
            background: transparent;
            border: none;
            cursor: pointer;
            color: rgba(255, 255, 255, 0.4);
            display: flex;
            align-items: center;
            justify-content: center;
            width: 32px;
            height: 32px;
            margin-left: 8px;
            transition: color 0.2s;
        }

        .btn-bookmark-toggle.bookmarked {
            color: #FFD700;
            /* Gold */
        }

        .quiz-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            background: var(--primary-color);
            color: #ffffff;
            padding: 14px 16px;
        }

        .btn-home-icon {
            width: 44px;
            /* generous padding */
            height: 44px;
            border: none;
            background: transparent;
            color: #ffffff;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: flex-start;
            padding: 10px 10px 10px 0;
            /* offset touch area */
            border-radius: 0;
        }

        .quiz-header-left {
            display: flex;
            align-items: center;
            gap: 4px;
        }

        .quiz-progress {
            font-size: 18px;
            font-weight: 500;
        }

        .quiz-header-right {
            display: flex;
            align-items: center;
            gap: 4px;
            justify-content: flex-end;
        }

        .quiz-score {
            font-size: 16px;
            font-weight: 600;
            text-align: right;
            min-width: 42px;
        }

        .quiz-content-area {
            flex: 1;
            padding: 24px;
            overflow-y: auto;
            position: relative;
        }

        .q-label {
            font-size: 14px;
            font-weight: 600;
            color: var(--primary-color);
            margin-bottom: 12px;
        }

        #question-text {
            font-size: 20px;
            font-weight: 700;
            line-height: 1.5;
            color: #111;
            word-break: keep-all;
            white-space: pre-wrap;
        }

        .explanation-box {
            display: none;
            margin-top: 24px;
            padding-top: 20px;
            border-top: 1px dashed #ccc;
        }

        .explanation-box.show {
            display: block;
        }

        .exp-result {
            margin-bottom: 12px;
            border-radius: 8px;
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 14px 16px;
        }

        .exp-result.correct {
            background: #EAF3DE;
            border-left: 4px solid #639922;
        }

        .exp-result.incorrect {
            background: #FCEBEB;
            border-left: 4px solid #E24B4A;
        }

        .exp-result p {
            margin: 0;
            font-size: 17px;
            font-weight: 500;
        }

        .exp-result.correct p {
            color: #3B6D11;
        }

        .exp-result.incorrect p {
            color: #A32D2D;
        }

        .exp-text {
            font-size: 15px;
            color: #444;
            line-height: 1.6;
            word-break: keep-all;
            white-space: pre-wrap;
        }

        /* Overlay for immediate O/X feedback - REMOVED */

        /* Bottom Controls */
        .quiz-bottom {
            width: 100%;
            background: #ffffff;
            border-top: 1px solid #ebebeb;
            padding: 12px 16px;
            padding-bottom: Env(safe-area-inset-bottom, 16px);
        }

        .options-group {
            display: flex;
            flex-direction: column;
            gap: 12px;
            margin-top: 20px;
        }

        .btn-option {
            width: 100%;
            min-height: 60px;
            border-radius: 0;
            border: 2px solid #ebebeb;
            background: #ffffff;
            color: #222;
            font-size: 16px;
            font-weight: 600;
            padding: 16px 20px;
            text-align: left;
            cursor: pointer;
            word-break: keep-all;
            transition: all 0.2s;
            line-height: 1.4;
        }

        .btn-option:active {
            background: #fafafa;
        }

        .btn-option.selected.correct {
            border-color: var(--primary-color);
            background: rgba(106, 130, 142, 0.05);
            color: var(--primary-color);
        }

        .btn-option.selected.incorrect {
            border-color: var(--wrong-color);
            background: rgba(217, 110, 110, 0.05);
            color: var(--wrong-color);
        }

        .btn-option.disabled {
            opacity: 0.6;
            pointer-events: none;
        }

        .nav-row {
            display: flex;
            gap: 0;
            margin-top: 0;
        }

        .btn-nav {
            flex: 1;
            height: 52px;
            border-radius: 0;
            border: 1px solid #ffffff;
            /* distinct separation */
            background: var(--primary-dark);
            color: #fff;
            font-weight: 600;
            font-size: 16px;
            cursor: pointer;
        }

        .btn-nav:active {
            background: #3c4c54;
        }

        /* ----- ADMIN VIEW ----- */
        #view-admin {
            background: #f4f6f7;
            flex-direction: column;
            height: 100vh;
            height: 100dvh;
            overflow: hidden;
            position: relative;
            z-index: 9999;
        }

        .admin-header {
            padding: 20px 24px;
            background: #fff;
            border-bottom: 1px solid #ebebeb;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .admin-header h2 {
            font-size: 18px;
            font-weight: 700;
            color: #333;
        }

        .btn-exit-admin {
            font-size: 13px;
            font-weight: 600;
            color: #fff;
            background: var(--primary-dark);
            border: none;
            padding: 8px 12px;
            border-radius: 0;
            cursor: pointer;
        }

        .admin-content {
            padding: 20px 24px;
            overflow-y: auto;
            flex: 1;
        }

        .admin-card {
            background: #fff;
            border-radius: 0;
            padding: 20px;
            border: 1px solid #ebebeb;
            margin-bottom: 20px;
        }

        .admin-card h3 {
            font-size: 15px;
            font-weight: 700;
            margin-bottom: 16px;
            color: #444;
        }

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

        .form-group label {
            display: block;
            font-size: 13px;
            font-weight: 600;
            color: #666;
            margin-bottom: 6px;
        }

        .form-input {
            width: 100%;
            padding: 10px 12px;
            border: 1px solid #ddd;
            border-radius: 0;
            font-size: 14px;
            font-family: inherit;
            background: #fafafa;
            outline: none;
        }

        .form-input:focus {
            border-color: var(--primary-color);
            background: #fff;
        }

        textarea.form-input {
            resize: vertical;
            min-height: 60px;
        }

        /* 이미지 업로드 영역 (관리자) */
        .q-image-upload-row {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-top: 8px;
        }

        .btn-image-upload {
            padding: 7px 14px;
            background: #f0f4f6;
            border: 1px solid #c5d0d5;
            border-radius: 0;
            font-size: 13px;
            font-weight: 600;
            color: var(--primary-color);
            cursor: pointer;
            white-space: nowrap;
        }

        .btn-image-upload:hover {
            background: #e0eaed;
        }

        .image-upload-status {
            font-size: 12px;
            font-weight: 600;
        }

        .image-preview-area {
            display: flex;
            align-items: flex-start;
            gap: 10px;
            margin-top: 10px;
            padding: 8px;
            border: 1px dashed #c5d0d5;
            background: #f8fbfc;
        }

        .image-preview-area img {
            max-width: 200px;
            max-height: 160px;
            object-fit: contain;
            border: 1px solid #ddd;
        }

        .btn-image-remove {
            padding: 4px 10px;
            background: #fdeaea;
            border: 1px solid #f5c6c6;
            border-radius: 0;
            font-size: 12px;
            font-weight: 700;
            color: #d96e6e;
            cursor: pointer;
            white-space: nowrap;
        }

        /* 퀴즈 화면 문제 이미지 */
        #question-image-area {
            margin: 12px 0;
            text-align: center;
        }

        #question-image-area img {
            max-width: 100%;
            max-height: 320px;
            object-fit: contain;
            border: 1px solid #e0e0e0;
            border-radius: 4px;
        }

        .btn-save {
            width: 100%;
            padding: 12px;
            background: var(--primary-color);
            color: #fff;
            border: none;
            border-radius: 0;
            font-weight: 700;
            font-size: 15px;
            cursor: pointer;
            margin-top: 8px;
        }

        .search-bar {
            position: relative;
            margin-bottom: 16px;
        }

        .search-bar input {
            width: 100%;
            padding: 12px 16px 12px 40px;
            border-radius: 0;
            border: 1px solid #ddd;
            font-size: 14px;
            background: #fff;
            outline: none;
        }

        .search-bar svg {
            position: absolute;
            left: 12px;
            top: 50%;
            transform: translateY(-50%);
            color: #888;
        }

        .admin-q-list {
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        .admin-q-item {
            background: #fff;
            border: 1px solid #ebebeb;
            border-radius: 0;
            padding: 16px;
        }

        .admin-q-head {
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            margin-bottom: 8px;
        }

        .admin-q-badge {
            font-size: 11px;
            font-weight: 600;
            background: var(--primary-light);
            color: var(--primary-dark);
            padding: 4px 8px;
        }

        .admin-q-ans {
            font-weight: 800;
            font-size: 14px;
            color: var(--primary-color);
        }

        .admin-q-text {
            font-size: 14px;
            color: #333;
            line-height: 1.4;
            margin-bottom: 12px;
            font-weight: 500;
        }

        .admin-q-actions {
            display: flex;
            gap: 8px;
            justify-content: flex-end;
        }

        .btn-action {
            font-size: 12px;
            padding: 6px 12px;
            border-radius: 0;
            border: 1px solid #ddd;
            background: #fff;
            cursor: pointer;
            color: #555;
            font-weight: 600;
        }

        .btn-action.edit:hover {
            background: var(--primary-light);
            border-color: var(--primary-color);
            color: var(--primary-dark);
        }

        .btn-action.del:hover {
            color: #d66;
        }

        /* ----- ADMIN TABS ----- */
        .admin-tab-container {
            display: flex;
            background: #fff;
            border-bottom: 1px solid #ebebeb;
            padding: 0 24px;
        }

        .admin-tab {
            padding: 14px 20px;
            font-size: 14px;
            font-weight: 700;
            color: #888;
            cursor: pointer;
            border-bottom: 3px solid transparent;
            transition: all 0.2s;
        }

        .admin-tab.active {
            color: var(--primary-color);
            border-bottom-color: var(--primary-color);
        }

        .admin-pane {
            display: none;
            flex-direction: column;
        }

        .admin-pane.active {
            display: flex;
        }

        /* ----- SIGNUP PAGE ----- */
        #signup-page {
            background-color: #f4f7f6;
            display: none;
            flex-direction: column;
            align-items: center;
            justify-content: flex-start;
            min-height: 100vh;
            padding: 50px 20px 40px 20px;
            overflow-y: auto;
        }

        #signup-page.active {
            display: flex;
        }

        #signup-page .signup-container {
            background-color: #fff;
            width: 100%;
            max-width: 440px;
            /* Reduced to fit better in 480px container with padding */
            padding: 30px 24px;
            border-radius: 0;
            border: 1px solid #ebebeb;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
            box-sizing: border-box;
        }

        #signup-page .signup-title {
            text-align: center;
            font-size: 22px;
            color: var(--primary-color);
            font-weight: 700;
            margin-bottom: 24px;
        }

        #signup-page .form-group {
            margin-bottom: 24px;
        }

        #signup-page .form-label {
            display: block;
            font-size: 13px;
            color: #555;
            margin-bottom: 6px;
            font-weight: 600;
        }

        #signup-page .input-field {
            width: 100%;
            padding: 12px;
            border: 1px solid #ddd;
            border-radius: 0;
            font-size: 15px;
            transition: border-color 0.3s;
            background: #fafafa;
        }

        #signup-page .input-field:focus {
            outline: none;
            border-color: var(--primary-color);
            background: #fff;
        }

        #signup-page .input-with-btn {
            display: flex;
            gap: 8px;
            flex-wrap: wrap;
        }

        #signup-page .input-with-btn .input-field {
            flex: 1;
            min-width: 0;
            /* Changed from 150px to prevent overflow */
        }

        #signup-page .btn-inline {
            padding: 12px 16px;
            background-color: #fff;
            border: 1px solid var(--primary-color);
            color: var(--primary-color);
            border-radius: 0;
            font-size: 13px;
            cursor: pointer;
            white-space: nowrap;
            font-weight: 600;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        #signup-page .btn-inline:hover {
            background-color: var(--primary-color);
            color: #fff;
        }

        @media (max-width: 480px) {
            #signup-page {
                padding: 12px;
            }

            #signup-page .signup-container {
                padding: 24px 16px;
            }

            #signup-page .input-with-btn .btn-inline {
                width: 100%;
                flex: none;
            }
        }

        #signup-page .p-msg {
            font-size: 11px;
            color: #888;
            margin-top: 4px;
        }

        #signup-page .sms-agree-group {
            margin-top: 20px;
            margin-bottom: 24px;
            padding: 12px;
            border: 1px solid #eee;
            background-color: #fafafa;
        }

        #signup-page .sms-agree-title {
            font-size: 13px;
            font-weight: 700;
            color: #333;
            margin-bottom: 8px;
        }

        #signup-page .checkbox-label {
            display: flex;
            align-items: center;
            font-size: 13px;
            color: #555;
            cursor: pointer;
        }

        #signup-page .checkbox-label input {
            margin-right: 8px;
            width: 16px;
            height: 16px;
            accent-color: var(--primary-color);
        }

        #signup-page .btn-signup {
            width: 100%;
            padding: 14px;
            background-color: var(--primary-color);
            color: #fff;
            border: none;
            border-radius: 0;
            font-size: 16px;
            font-weight: 700;
            cursor: pointer;
            transition: opacity 0.2s;
        }

        #signup-page .btn-signup:hover {
            opacity: 0.9;
        }

        #signup-page .back-link {
            text-align: center;
            margin-top: 16px;
            font-size: 13px;
        }

        #signup-page .back-link a {
            color: #888;
            text-decoration: none;
        }

        .btn-logout {
            background: transparent;
            color: #fff;
            border: 1px solid rgba(255, 255, 255, 0.4);
            padding: 4px 10px;
            border-radius: 0;
            font-size: 12px;
            font-weight: 600;
            cursor: pointer;
            margin-left: 8px;
            /* 버튼 사이 간격 */
            transition: all 0.2s;
        }

        /* 첫 번째 버튼만 왼쪽 여백을 auto로 주어 우측 정렬 */
        #btn-signup-entry,
        #btn-logout {
            margin-left: auto;
        }

        .btn-logout:hover {
            background: rgba(255, 255, 255, 0.1);
            border-color: #fff;
        }

        /* ----- LOGIN PAGE REDESIGN ----- */
        #view-login {
            background-color: #f4f6f7;
            display: none;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            /* Center horizontally and vertically */
            min-height: 100vh;
            padding: 20px;
            overflow-y: auto;
        }

        #view-login.active {
            display: flex;
        }

        #view-login .login-card {
            background-color: #fff;
            width: 100%;
            max-width: 440px;
            padding: 40px 30px;
            border-radius: 0;
            border: 1px solid #ebebeb;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
            /* Stronger shadow */
            box-sizing: border-box;
            position: relative;
            /* For home button */
            display: flex;
            flex-direction: column;
        }

        #view-login .login-title {
            text-align: center;
            font-size: 26px;
            /* Slightly larger */
            color: var(--primary-color);
            font-weight: 800;
            /* Bolder */
            margin-bottom: 32px;
        }

        #view-login .btn-home-right {
            position: absolute;
            top: 20px;
            right: 20px;
            background: transparent;
            border: none;
            cursor: pointer;
            color: #6a828e;
            padding: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            opacity: 0.8;
            transition: opacity 0.2s;
        }

        #view-login .btn-home-right:hover {
            opacity: 1;
        }

        #view-login .form-group {
            margin-bottom: 24px;
        }

        #view-login .form-label {
            display: block;
            font-size: 13px;
            color: #666;
            margin-bottom: 8px;
            font-weight: 600;
        }

        #view-login .input-field {
            width: 100%;
            height: 52px;
            /* Increased height */
            padding: 0 16px;
            border: 1px solid #ddd;
            border-radius: 0;
            font-size: 16px;
            transition: all 0.2s;
            background: #fafafa;
            box-sizing: border-box;
        }

        #view-login .input-field:focus {
            outline: none;
            border-color: var(--primary-color);
            background: #fff;
        }

        #view-login .btn-login-submit {
            width: 100%;
            height: 56px;
            background-color: var(--primary-color);
            color: #fff;
            border: none;
            border-radius: 0;
            font-size: 16px;
            font-weight: 800;
            cursor: pointer;
            margin-top: 8px;
            transition: background 0.2s;
        }

        #view-login .btn-login-submit:active {
            background-color: var(--primary-dark);
        }

        #view-login .recovery-group {
            display: flex;
            justify-content: center;
            align-items: center;
            gap: 12px;
            margin-top: 24px;
        }

        #view-login .recovery-link {
            font-size: 13px;
            color: #888;
            text-decoration: none;
            transition: color 0.2s;
        }

        #view-login .recovery-link:hover {
            color: var(--primary-color);
        }

        #view-login .divider-dot {
            color: #ddd;
            font-size: 12px;
        }

        #view-login .footer-link {
            margin-top: 32px;
            padding-top: 24px;
            border-top: 1px solid #f0f0f0;
            text-align: center;
        }

        #view-login .footer-link a {
            font-size: 14px;
            color: var(--primary-color);
            text-decoration: none;
            font-weight: 700;
        }

        #view-login .footer-text {
            font-size: 13px;
            color: #888;
            margin-right: 8px;
        }

        /* ----- MODAL POPUP ----- */
        .modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.5);
            display: none;
            align-items: center;
            justify-content: center;
            z-index: 1000;
        }

        .modal-content {
            background: #fff;
            width: 90%;
            max-width: 360px;
            border-radius: 12px;
            padding: 24px;
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
            position: relative;
        }

        .modal-title {
            font-size: 18px;
            font-weight: 800;
            margin-bottom: 20px;
            color: var(--primary-color);
            text-align: center;
        }

        .modal-form-group {
            margin-bottom: 16px;
        }

        .modal-label {
            display: block;
            font-size: 13px;
            font-weight: 700;
            margin-bottom: 6px;
            color: #555;
        }

        .modal-input {
            width: 100%;
            padding: 12px;
            border: 1px solid #ddd;
            border-radius: 6px;
            font-size: 14px;
        }

        .modal-btn-group {
            display: flex;
            gap: 10px;
            margin-top: 24px;
        }

        .modal-btn {
            flex: 1;
            padding: 12px;
            border: none;
            border-radius: 6px;
            font-size: 14px;
            font-weight: 700;
            cursor: pointer;
        }

        .btn-modal-change {
            background: var(--primary-color);
            color: #fff;
        }

        .btn-modal-cancel {
            background: #eee;
            color: #666;
        }

        /* ----- 약관 모달 ----- */
        .modal-terms-content {
            max-width: 480px;
            max-height: 80vh;
            display: flex;
            flex-direction: column;
        }

        .modal-terms-body {
            overflow-y: auto;
            flex: 1;
            padding: 4px 2px 8px 2px;
            font-size: 13px;
            color: #444;
            line-height: 1.7;
            border-top: 1px solid #eee;
            margin-top: 12px;
        }

        .modal-terms-body h4 {
            font-size: 13px;
            font-weight: 700;
            color: #333;
            margin: 16px 0 4px 0;
        }

        .modal-terms-body p {
            margin: 0 0 8px 0;
        }

        .terms-updated {
            font-size: 12px;
            color: #999;
            margin-bottom: 12px !important;
        }

        .terms-link {
            color: var(--primary-color);
            font-weight: 700;
            text-decoration: underline;
        }

        /* ----- SMS 필터 탭 ----- */
        .sms-filter-tab {
            padding: 6px 16px;
            border: 1px solid #d8e2e6;
            border-radius: 20px;
            background: #fff;
            color: #6a828e;
            font-size: 13px;
            font-weight: 600;
            cursor: pointer;
            font-family: inherit;
            transition: background 0.15s, color 0.15s;
        }

        .sms-filter-tab.active {
            background: var(--primary-color);
            color: #fff;
            border-color: var(--primary-color);
        }

                        .admin-filter-tabs {
                            display: grid;
                            grid-template-columns: repeat(4, 1fr);
                            gap: 8px;
                            margin-bottom: 16px;
                            margin-top: 12px;
                        }

                        .filter-tab {
                            padding: 10px 8px;
                            border: 1px solid #e0e0e0;
                            border-radius: 8px;
                            background: #fafafa;
                            color: #555;
                            font-size: 13px;
                            font-weight: 600;
                            cursor: pointer;
                            transition: all 0.2s;
                            text-align: center;
                            width: 100%;
                            box-sizing: border-box;
                        }

                        .filter-tab.filter-tab-full {
                            grid-column: 1 / -1;
                            text-align: left;
                            font-size: 14px;
                            padding: 10px 16px;
                        }

                        .filter-tab:hover {
                            background: #f0f0f0;
                        }

                        .filter-tab.active {
                            background: #222;
                            color: #fff;
                            border-color: #222;
                        }

        /* ----- QUIZ HEADER CORRECT/WRONG COUNT ----- */
        .quiz-correct-count {
            font-size: 20px;
            font-weight: 700;
            color: #a8f0a8;
        }

        .quiz-wrong-count {
            font-size: 20px;
            font-weight: 700;
            color: #f5a8a8;
        }

        /* ----- RESULT SCREEN ----- */
        #view-result {
            background: #fff;
            flex-direction: column;
            justify-content: space-between;
        }

        /* 상단 바 */
        .result-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            background: var(--primary-color);
            padding: 14px 16px;
        }

        .result-header-home {
            width: 44px;
            height: 44px;
            border: none;
            background: transparent;
            color: #fff;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: flex-start;
        }

        .result-header-title {
            font-size: 20px;
            font-weight: 700;
            color: #fff;
            flex: 1;
            text-align: center;
        }

        .result-header-spacer {
            width: 44px;
        }

        /* 본문 */
        .result-body {
            flex: 1;
            padding: 28px 20px;
            display: flex;
            flex-direction: column;
            gap: 20px;
            border-left: 0.5px solid #e0e0e0;
            border-right: 0.5px solid #e0e0e0;
            overflow-y: auto;
        }

        .result-total-text {
            font-size: 20px;
            font-weight: 500;
            color: #999;
            text-align: center;
            margin-bottom: 4px;
        }

        /* 정답/오답 카드 */
        .result-card {
            background: #f4f6f7;
            border-radius: 0;
            padding: 24px;
            display: flex;
            flex-direction: column;
            gap: 0;
        }

        .result-row {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 10px 0;
        }

        .result-icon {
            width: 26px;
            height: 26px;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
        }

        .result-icon-correct {
            background: #EAF3DE;
        }

        .result-icon-wrong {
            background: #FCEBEB;
        }

        .result-label {
            font-size: 19px;
            color: #222;
            flex: 1;
        }

        .result-value {
            font-size: 19px;
            font-weight: 500;
        }

        .result-value-correct {
            color: #639922;
        }

        .result-value-wrong {
            color: #E24B4A;
        }

        /* 정답률 행 */
        .result-rate-row {
            display: flex;
            align-items: baseline;
            justify-content: center;
            padding-top: 16px;
            margin-top: 6px;
            border-top: 0.5px solid #ddd;
        }

        .result-rate-label {
            font-size: 18px;
            color: #999;
        }

        .result-rate-num {
            font-size: 36px;
            font-weight: 500;
            color: #222;
        }

        .result-rate-pct {
            font-size: 20px;
            color: #999;
        }

        /* 버튼 */
        .result-btns {
            display: flex;
            flex-direction: column;
            gap: 10px;
        }

        .btn-result-retry {
            width: 100%;
            padding: 16px;
            background: #378ADD;
            color: #fff;
            border: none;
            border-radius: 0;
            font-size: 16px;
            font-weight: 500;
            cursor: pointer;
        }

        .btn-result-back {
            width: 100%;
            padding: 16px;
            background: #f4f6f7;
            color: #888;
            border: 0.5px solid #ccc;
            border-radius: 0;
            font-size: 16px;
            font-weight: 400;
            cursor: pointer;
        }

        /* 하단 바 */
        .result-footer {
            background: var(--primary-color);
            color: #fff;
            font-size: 13px;
            text-align: center;
            padding: 14px;
        }
