/* ================================================================== */
/* [ROBIN Design System v17.0] Ultimate Integrated Style Sheet
/* ================================================================== */
/* * Content:
 * 1. Root Variables & Reset
 * 2. Global Layout & Aurora Background
 * 3. Typography & Common Utilities
 * 4. Glassmorphism Components (Card, Modal, Input)
 * 5. Buttons & Badges
 * 6. Animation Keyframes
 * 7. Page Specific Styles:
 * - Login View
 * - Dashboard (Sidebar, Main Content)
 * - Mobile Navigation (Bottom Tab Bar)
 * 8. Feature Specific Styles:
 * - Certificates (Grid, Card)
 * - Threads (Community)
 * - BIN Explorer (Ledger Table)
 * - Public Viewer (Paper Layout)
 * 9. System UI (Loading, Alerts)
 * 10. Responsive Media Queries
/* ================================================================== */

/* ================================================================== */
/* 1. Root Variables & Reset
/* ================================================================== */
:root {
  /* --- Color Palette (Light Mode Default) --- */
  --bg-base: #f3f4f6; 
  --bg-elevated: #ffffff;
  --text-main: #1e293b; 
  --text-sub: #64748b;  
  --text-muted: #94a3b8; 

  /* --- Aurora Gradients (Brand Identity) --- */
  --aurora-1: #6366f1; /* Indigo */
  --aurora-2: #a855f7; /* Purple */
  --aurora-3: #ec4899; /* Pink */
  --aurora-4: #3b82f6; /* Blue */
  --aurora-gradient: linear-gradient(135deg, var(--aurora-1), var(--aurora-3));

  /* --- Glassmorphism System --- */
  --glass-bg: rgba(255, 255, 255, 0.65);
  --glass-border: rgba(255, 255, 255, 0.8);
  --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
  --glass-blur: blur(20px);
  --glass-hover-bg: rgba(255, 255, 255, 0.5);

  /* --- Functional Colors --- */
  --accent-color: #4f46e5; 
  --accent-hover: #4338ca;
  --danger-color: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.1);
  --success-color: #10b981;
  --success-bg: rgba(16, 185, 129, 0.1);
  --warning-color: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.1);
  
  /* --- Layout Dimensions --- */
  --sidebar-width: 260px;
  --header-height: 60px;
  --mobile-nav-height: 65px; 
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
  --content-max-width: 1200px;
}

/* Dark Mode Support (Optional Future Proofing) */
@media (prefers-color-scheme: dark) {
  /* :root { ... overrides for dark mode ... } */
  /* 현재는 라이트 모드 강제 유지 */
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-base);
  color: var(--text-main);
  font-size: 16px;
  line-height: 1.5;
  overflow: hidden; /* SPA Scroll Handling */
}

/* ================================================================== */
/* 2. Global Layout & Aurora Background
/* ================================================================== */
body::before, body::after {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.35;
  z-index: -1;
  animation: aurora-move 25s infinite alternate cubic-bezier(0.4, 0.0, 0.2, 1);
  will-change: transform; 
  pointer-events: none; /* 클릭 방해 방지 */
}

body::before {
  background: radial-gradient(circle, var(--aurora-1), var(--aurora-2));
  top: -10%;
  left: -10%;
}

body::after {
  background: radial-gradient(circle, var(--aurora-3), var(--aurora-4));
  bottom: -10%;
  right: -10%;
  animation-delay: -12s;
}

@keyframes aurora-move {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(40px, 40px) scale(1.1); }
}

/* Main App Container */
#app-root {
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  z-index: 1;
}

.main-container {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  width: 100%;
  padding: 1.5rem;
  overflow-y: auto; 
}

/* ================================================================== */
/* 3. Typography & Common Utilities
/* ================================================================== */
h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: 700;
  color: var(--text-main);
}

/* [Fix] 폰트 이질감 해결: 버튼, 입력창이 부모 폰트를 강제 상속받도록 설정 */
button, input, optgroup, select, textarea {
  font-family: inherit;
  font-feature-settings: inherit;
  color: inherit;
}

a {
  color: var(--accent-color);
  text-decoration: none;
  transition: color 0.2s;
}

a {
  color: var(--accent-color);
  text-decoration: none;
  transition: color 0.2s;
}
a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-sub { color: var(--text-sub); }
.font-bold { font-weight: 700; }

/* Custom Scrollbar */
.custom-scrollbar::-webkit-scrollbar { width: 6px; height: 6px; }
.custom-scrollbar::-webkit-scrollbar-track { background: transparent; }
.custom-scrollbar::-webkit-scrollbar-thumb { background-color: rgba(0, 0, 0, 0.1); border-radius: 20px; }
.custom-scrollbar::-webkit-scrollbar-thumb:hover { background-color: rgba(0, 0, 0, 0.2); }

/* ================================================================== */
/* 4. Glassmorphism Components
/* ================================================================== */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: 1.2rem;
  box-shadow: var(--glass-shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

.glass-card:hover {
  /* Optional hover effect */
  /* transform: translateY(-2px); */
  /* box-shadow: 0 12px 40px rgba(0,0,0,0.1); */
}

/* Form Elements */
.form-group {
  margin-bottom: 1.2rem;
  text-align: left;
  width: 100%;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-sub);
  margin-bottom: 0.4rem;
  font-weight: 600;
}

.form-input {
  width: 100%;
  padding: 0.9rem 1rem;
  border-radius: 0.8rem;
  border: 1px solid rgba(0,0,0,0.05);
  background: rgba(255, 255, 255, 0.5);
  font-size: 1rem;
  color: var(--text-main);
  transition: all 0.2s;
  font-family: inherit;
  appearance: none; /* Remove default styling */
}

.form-input:focus {
  background: white;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
  outline: none;
}

.form-input:disabled {
  background: rgba(0,0,0,0.02);
  color: var(--text-muted);
  cursor: not-allowed;
}

/* ================================================================== */
/* 5. Buttons & Badges
/* ================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8rem 1.5rem;
  border-radius: 0.8rem;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border: none;
  outline: none;
  transition: all 0.2s ease;
  user-select: none;
  white-space: nowrap;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; pointer-events: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent-color), var(--aurora-2));
  color: white;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}
.btn-primary:hover {
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.4);
  filter: brightness(1.1);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.6);
  color: var(--text-main);
  border: 1px solid rgba(0,0,0,0.05);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(0,0,0,0.1);
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger-color);
  border: 1px solid transparent;
}
.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.2);
}

/* Status Badges */
.status-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.status-badge.active {
  background: var(--success-bg);
  color: var(--success-color);
  border: 1px solid rgba(16, 185, 129, 0.2);
}
.status-badge.revoked {
  background: var(--danger-bg);
  color: var(--danger-color);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* ================================================================== */
/* 6. Animation Keyframes
/* ================================================================== */
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slide-up {
  from { transform: translateY(50px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ================================================================== */
/* 7. Page Specific Styles
/* ================================================================== */

/* --- Login View --- */
.login-view {
  width: 100%;
  max-width: 420px;
  text-align: center;
  animation: fade-in-up 0.6s ease-out;
  margin: auto; /* Center vertically/horizontally */
}

.logo-header {
  font-size: 2.8rem;
  font-weight: 900;
  margin-bottom: 0.5rem;
  background: linear-gradient(to right, var(--text-main), var(--accent-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.03em;
}

.logo-sub {
  font-size: 1rem;
  color: var(--text-sub);
  margin-bottom: 2rem;
}

#login-form-wrapper {
  padding: 2.5rem 2rem;
}

/* --- Dashboard Layout (Sidebar + Main) --- */
.dashboard-layout {
  display: flex;
  height: 100%;
  overflow: hidden;
}

/* Sidebar (Desktop) */
#sidebar {
  width: var(--sidebar-width);
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid rgba(0,0,0,0.05);
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  z-index: 50;
  transition: transform 0.3s ease;
}

#sidebar .logo-header {
  font-size: 2rem;
  text-align: left;
  margin-bottom: 3rem;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
  overflow-y: auto;
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.2rem;
  border-radius: 1rem;
  color: var(--text-sub);
  font-weight: 600;
  transition: all 0.2s;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  width: 100%;
}

.nav-tab i {
  width: 24px;
  text-align: center;
  font-size: 1.2rem;
  transition: color 0.2s;
}

.nav-tab:hover {
  background: var(--glass-hover-bg);
  color: var(--accent-color);
}

.nav-tab.active {
  background: white;
  color: var(--accent-color);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(0,0,0,0.05);
}

/* Main Content Area */
#main-content {
  flex: 1;
  overflow-y: auto;
  padding: 2rem 3rem;
  /* 모바일 하단 탭바 공간 확보 (중요) */
  padding-bottom: calc(var(--mobile-nav-height) + var(--safe-area-bottom) + 2rem); 
  scroll-behavior: smooth;
  position: relative;
}

.content-section {
  max-width: var(--content-max-width);
  margin: 0 auto;
  animation: fade-in 0.4s ease-out;
}

.section-title {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

/* --- Mobile Navigation Bar (Legacy Ported) --- */
#mobile-nav {
  display: none; /* Desktop Hidden */
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--mobile-nav-height) + var(--safe-area-bottom));
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(0,0,0,0.08);
  padding-bottom: var(--safe-area-bottom);
  z-index: 100;
  justify-content: space-around;
  align-items: center;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.03);
  transition: transform 0.3s ease;
}

#mobile-nav .nav-tab {
  flex-direction: column;
  justify-content: center;
  padding: 0.5rem 0;
  gap: 0.25rem;
  font-size: 0.7rem;
  border-radius: 0;
  background: none;
  color: var(--text-muted);
  box-shadow: none;
  flex: 1;
  height: 100%;
}

#mobile-nav .nav-tab i {
  font-size: 1.4rem;
  margin-bottom: 0;
}

#mobile-nav .nav-tab.active {
  color: var(--accent-color);
  background: transparent;
}

#mobile-nav .nav-tab.active i {
  transform: translateY(-2px);
  transition: transform 0.2s ease;
}

/* ================================================================== */
/* 8. Feature Specific Styles
/* ================================================================== */

/* --- 8.1 Certificates (Grid & Card) --- */
.cert-card-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.cert-card {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 200px;
  position: relative;
}

.cert-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 4px;
  background: var(--aurora-gradient);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.cert-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0,0,0,0.08);
}

.cert-card:hover::before {
  opacity: 1;
}

.cert-type {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-sub);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.cert-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 1rem;
  line-height: 1.4;
}

.cert-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
}

.cert-card.revoked {
  filter: grayscale(100%);
  opacity: 0.75;
  background: #f8fafc;
  border-color: #e2e8f0;
}

.cert-card.revoked:hover {
  transform: none; /* 호버 효과 제거 */
  box-shadow: none;
  filter: grayscale(0%); /* 호버 시 컬러 복구 (선택 사항) */
  opacity: 1;
}

/* --- 8.2 Threads (Community) --- */
.thread-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 800px;
  margin: 0 auto;
}

.thread-input-card {
  padding: 1.5rem;
}

.thread-card {
  padding: 1.5rem;
  transition: transform 0.2s ease;
}

.thread-card:hover {
  background: rgba(255, 255, 255, 0.8);
}

.thread-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.8rem;
  font-size: 0.85rem;
  color: var(--text-sub);
}

.thread-author {
  font-weight: 600;
  color: var(--accent-color);
  background: rgba(79, 70, 229, 0.08);
  padding: 0.2rem 0.6rem;
  border-radius: 1rem;
}

.thread-content {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-main);
  white-space: pre-wrap;
  margin-bottom: 1rem;
}

.like-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  border-radius: 1rem;
  transition: all 0.2s;
  font-size: 0.9rem;
}

.like-btn:hover {
  background: rgba(236, 72, 153, 0.1);
  color: var(--aurora-3);
}

.like-btn.active {
  color: var(--aurora-3);
  font-weight: 600;
}

/* --- 8.3 BIN Explorer (Ledger Table) --- */
.table-wrapper {
  overflow-x: auto; /* Horizontal Scroll for Mobile */
  background: white;
  border-radius: 1rem;
  box-shadow: var(--glass-shadow);
  border: 1px solid rgba(0,0,0,0.05);
  margin-bottom: 1.5rem;
}

.explorer-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  white-space: nowrap; /* Prevent wrapping */
}

.explorer-table th {
  padding: 1rem 1.5rem;
  background: #f8fafc;
  color: var(--text-sub);
  font-weight: 600;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
}

.explorer-table td {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #f1f5f9;
  color: var(--text-main);
  vertical-align: middle;
  max-width: 150px; /* 적절한 최대 너비 설정 */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.explorer-table tr:last-child td {
  border-bottom: none;
}

.explorer-table tr:hover td {
  background: #f8fafc;
  cursor: pointer;
}

.tx-hash {
  font-family: 'Courier New', Courier, monospace;
  background: #eff6ff;
  color: #3b82f6;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.85rem;
  display: inline-block;
}

/* --- 8.4 Public Certificate Viewer (Paper Layout) --- */
#public-view-container {
  background: #f1f5f9; /* Distinguish from Dashboard */
  align-items: flex-start;
  padding-top: 3rem;
  padding-bottom: 3rem;
  min-height: 100vh;
}

.cert-viewer-layout {
  display: flex;
  justify-content: center;
  width: 100%;
  padding: 1rem;
}

.cert-paper {
  background: #ffffff;
  width: 100%;
  max-width: 700px;
  padding: 4rem 3rem;
  border-radius: 4px; /* Paper-like sharp corners */
  box-shadow: 0 20px 40px rgba(0,0,0,0.08);
  position: relative;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  text-align: center;
  animation: slide-up 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.cert-paper::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 6px;
  background: var(--aurora-gradient);
}

/* Watermark */
.cert-watermark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-30deg);
  font-size: 5rem;
  font-weight: 900;
  opacity: 0.1;
  color: var(--danger-color);
  border: 8px solid currentColor;
  padding: 1rem 3rem;
  border-radius: 1rem;
  pointer-events: none;
  white-space: nowrap;
  z-index: 0;
}

.cert-header-section {
  margin-bottom: 3rem;
  border-bottom: 2px solid #f8fafc;
  padding-bottom: 2rem;
  position: relative;
  z-index: 1;
}

.cert-title-text {
  font-size: 2.4rem;
  font-weight: 900;
  color: var(--text-main);
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
  word-break: keep-all;
}

.cert-doc-id {
  font-family: 'Courier New', monospace;
  color: var(--text-sub);
  font-size: 0.9rem;
  background: #f8fafc;
  display: inline-block;
  padding: 0.2rem 0.8rem;
  border-radius: 4px;
}

.cert-body-text {
  font-size: 1.15rem;
  line-height: 2;
  color: #334155;
  margin-bottom: 4rem;
  word-break: keep-all;
  position: relative;
  z-index: 1;
}

.cert-footer-section {
  margin-top: 3rem;
  position: relative;
  z-index: 1;
}

.cert-stamp {
  width: 110px;
  height: 110px;
  border: 4px solid var(--danger-color);
  border-radius: 50%;
  color: var(--danger-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1rem;
  transform: rotate(-15deg);
  opacity: 0.7;
  margin: 1rem auto 0;
  background: rgba(255,255,255,0.5); /* stamp overlay */
}

.verification-panel {
  margin-top: 4rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.8rem;
  padding: 1.5rem;
  text-align: left;
  font-size: 0.85rem;
  position: relative;
  z-index: 1;
}

.vp-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0;
  border-bottom: 1px dashed #e2e8f0;
}
.vp-row:last-child { border-bottom: none; }

.vp-label { font-weight: 600; color: var(--text-sub); }
.vp-value { font-family: monospace; color: var(--text-main); text-align: right; }

/* ================================================================== */
/* 9. System UI (Loading, Alerts, Modals)
/* ================================================================== */

/* Loading Overlay */
.loading-spinner {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 9999;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(79, 70, 229, 0.1);
  border-left-color: var(--accent-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Alerts */
.alert-message {
  padding: 1rem;
  border-radius: 0.8rem;
  margin-top: 1rem;
  text-align: center;
  font-weight: 500;
  animation: fade-in 0.3s ease;
}
.alert-error {
  background-color: var(--danger-bg);
  color: var(--danger-color);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* ================================================================== */
/* [NEW] Toss-Style Premium Modal System (v18.0)
/* ================================================================== */

/* 1. Overlay (Backdrop) */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55); /* 진하고 부드러운 딤 처리 */
  backdrop-filter: blur(8px);      /* 고급스러운 블러 효과 */
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); /* 부드러운 페이드 */
  pointer-events: none; /* 닫히는 중 클릭 방지 */
}
.modal-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

/* 2. Modal Card (The Box) */
.modal-content {
  width: 90%;
  max-width: 400px; /* 모바일 최적화된 너비 */
  background: #ffffff;
  border-radius: 28px; /* Toss 특유의 둥근 모서리 */
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.15), 0 8px 24px rgba(0,0,0,0.05);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(0.92) translateY(10px);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); /* 쫀득한 스프링 효과 */
  position: relative;
  border: none; /* 테두리 제거 (깔끔함) */
}
.modal-overlay.visible .modal-content {
  transform: scale(1) translateY(0);
}

/* 3. Typography & Layout */
.modal-header {
  padding: 1.8rem 1.8rem 0.5rem; /* 상단 여백 확보 */
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: white;
  border: none; /* 헤더 라인 제거 (미니멀리즘) */
}

.modal-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: #191f28; /* Toss Black */
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.close-btn {
  background: #f2f4f6;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8b95a1;
  cursor: pointer;
  transition: all 0.2s;
  position: absolute; /* 우측 상단 고정 */
  top: 1.2rem;
  right: 1.2rem;
  z-index: 10;
}
.close-btn:hover { background: #e5e8eb; color: #333; }
/* 알림창 등에서는 닫기 버튼 숨김 (선택 강제) */
.modal-content.alert-mode .close-btn { display: none; }

.modal-body {
  padding: 0.5rem 1.8rem 1.8rem;
  font-size: 1.05rem;
  color: #4e5968; /* Toss Gray */
  line-height: 1.6;
  text-align: center; /* 기본 중앙 정렬 */
  word-break: keep-all;
}
.modal-body.left-align { text-align: left; }

/* 4. Footer & Buttons */
.modal-footer {
  padding: 0 1.5rem 1.5rem;
  background: white;
  border: none;
  display: flex;
  flex-direction: column; /* 모바일 친화적 세로 배치 */
  gap: 0.8rem;
}

/* Toss Style Buttons */
.modal-footer .btn {
  width: 100%;
  height: 54px; /* 손가락 터치하기 좋은 높이 */
  border-radius: 16px;
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s ease;
}
.modal-footer .btn:active { transform: scale(0.96); }

.modal-footer .btn-primary {
  background: #3182f6; /* Toss Blue */
  color: white;
  box-shadow: 0 4px 12px rgba(49, 130, 246, 0.2);
  border: none;
}
.modal-footer .btn-secondary {
  background: #f2f4f6; /* 연한 회색 배경 */
  color: #4e5968;
  border: none;
}
.modal-footer .btn-danger {
  background: #fee2e2; /* 연한 빨강 */
  color: #ef4444;
  border: none;
}

/* 5. Custom Elements for Alerts */
.modal-icon-box {
  font-size: 3rem;
  margin-bottom: 1rem;
  display: inline-block;
  animation: pop-icon 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes pop-icon {
  0% { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* Mobile Bottom Sheet Style (Optional for larger screens) */
@media (max-width: 600px) {
  /* 모바일에서는 하단에서 올라오는 시트 스타일도 좋지만,
     Alert는 중앙 팝업이 표준이므로 중앙 유지하되 너비를 꽉 채움 */
  .modal-content {
    width: 88%;
    max-width: none;
  }
}

/* ================================================================== */
/* 10. Responsive Media Queries (Mobile Optimization)
/* ================================================================== */
@media (max-width: 900px) {
  :root {
    --sidebar-width: 0px; /* Hide Sidebar space */
  }
  
  /* Hide Desktop Sidebar */
  #sidebar {
    display: none;
  }
  
  /* Show Mobile Nav */
  #mobile-nav {
    display: flex;
  }
  
  /* Main Content Adjustment */
  #main-content {
    padding: 1.5rem 1.2rem;
    padding-bottom: calc(var(--mobile-nav-height) + var(--safe-area-bottom) + 1.5rem);
  }
  
  /* Grid Adjustments */
  .cert-card-list {
    grid-template-columns: 1fr; /* Single Column */
  }
  
  /* Explorer Table Card View (For very small screens) */
  /* If you prefer standard scrolling table, keep overflow-x: auto. 
     Here is a Card-style transformation for better UX on mobile. */
  @media (max-width: 600px) {
    .explorer-table thead { display: none; }
    .explorer-table, .explorer-table tbody, .explorer-table tr, .explorer-table td {
      display: block; width: 100%;
    }
    .explorer-table tr {
      margin-bottom: 1rem;
      background: white;
      border-radius: 1rem;
      border: 1px solid #e2e8f0;
      padding: 1rem;
      box-shadow: 0 2px 5px rgba(0,0,0,0.02);
    }
    .explorer-table td {
      padding: 0.5rem 0;
      border-bottom: none;
      text-align: right;
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
    .explorer-table td::before {
      content: attr(data-label);
      float: left;
      font-weight: 600;
      color: var(--text-sub);
      font-size: 0.85rem;
    }
    .explorer-table td:last-child {
      margin-top: 0.5rem;
      padding-top: 0.5rem;
      border-top: 1px dashed #f1f5f9;
    }
  }

  /* Certificate Paper Mobile */
  .cert-paper {
    padding: 2.5rem 1.5rem;
  }
  .cert-title-text {
    font-size: 1.8rem;
  }
  .cert-body-text {
    font-size: 1rem;
  }
  .cert-watermark {
    font-size: 3.5rem;
    padding: 0.5rem 1.5rem;
  }
}

/* ================================================================== */
/* [NEW] Hyper-Modern BIN UI (Mobile Optimized & Active Anim)
/* ================================================================== */

/* Full Screen Overlay */
.bin-overlay {
  position: fixed; inset: 0;
  background: rgba(255, 255, 255, 0.95); /* 가독성을 위해 불투명도 상향 */
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 10000;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--text-main);
  animation: fade-in 0.4s ease-out;
  overflow: hidden; /* 스크롤 방지 */
}

/* Animation Container (Mobile Scalable) */
.bin-anim-box {
  display: flex; align-items: center; gap: 1rem;
  margin-bottom: 4rem;
  height: 120px;
  perspective: 1000px; /* 3D 효과 */
  transform-origin: center;
}

/* The Blocks */
.bin-block {
  width: 64px; height: 64px;
  border-radius: 18px;
  background: white;
  box-shadow: 0 15px 35px rgba(0,0,0,0.1);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; color: var(--text-sub);
  position: relative;
  transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation: float 3s ease-in-out infinite; /* 둥둥 떠다니는 효과 */
}

/* Central Block (The Certificate) */
.bin-block.main {
  width: 90px; height: 90px;
  background: var(--aurora-gradient);
  color: white;
  z-index: 10;
  box-shadow: 0 25px 50px rgba(99, 102, 241, 0.4);
  font-size: 2.2rem;
  overflow: hidden; /* 스캔 효과용 */
}

/* Scanning Light Effect */
.bin-block.main::after {
  content: ''; position: absolute;
  top: 0; left: -150%; width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.6), transparent);
  transform: skewX(-25deg);
  animation: scan 2s infinite;
}

/* Ghost Blocks */
.bin-block.ghost {
  opacity: 0; transform: scale(0.5) translateY(20px);
  background: #f8fafc; border: 1px solid #e2e8f0;
}
.bin-block.ghost.visible { opacity: 1; transform: scale(1) translateY(0); }

/* Connecting Lines (Pulse) */
.bin-link {
  width: 0px; height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  transition: width 0.8s ease;
  position: relative;
  overflow: hidden;
}
.bin-link.active { width: 40px; background: #cbd5e1; }
.bin-link.active::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, var(--accent-color), transparent);
  transform: translateX(-100%);
  animation: data-flow 1.5s infinite;
}

/* Status Text */
.bin-status-box { text-align: center; padding: 0 2rem; }
.bin-status-title {
  font-size: 1.6rem; font-weight: 900;
  margin-bottom: 0.8rem;
  background: linear-gradient(to right, var(--text-main), var(--accent-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.03em;
}
.bin-status-desc {
  font-size: 1rem; color: var(--text-sub);
  font-weight: 500; opacity: 0.8;
}

/* Progress Bar */
.bin-progress-track {
  margin-top: 2.5rem; margin-bottom: 2rem;
  width: 220px; height: 6px;
  background: #f1f5f9; border-radius: 3px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
}
.bin-progress-bar {
  height: 100%; width: 0%;
  background: var(--accent-color);
  transition: width 0.1s linear;
  border-radius: 3px;
  box-shadow: 0 0 10px rgba(79, 70, 229, 0.5);
}

/* Cancel Button */
.bin-cancel-btn {
  padding: 0.8rem 2rem;
  border-radius: 2rem;
  border: 1px solid #e2e8f0;
  background: white;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.bin-cancel-btn:hover {
  color: var(--danger-color);
  border-color: var(--danger-bg);
  background: var(--danger-bg);
  transform: translateY(-2px);
}

/* Keyframes */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
@keyframes scan {
  0% { left: -150%; }
  50%, 100% { left: 150%; }
}
@keyframes data-flow {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Mobile Optimization */
@media (max-width: 600px) {
  .bin-anim-box { transform: scale(0.75); margin-bottom: 2rem; }
  .bin-status-title { font-size: 1.4rem; }
  .bin-status-desc { font-size: 0.9rem; }
}

/* ================================================================== */
/* [NEW] v2.3 Impact & Celebration UI
/* ================================================================== */

/* --- Enhanced Consent Modal --- */
/* Hero Fingerprint Icon */
.hero-icon-fingerprint {
  font-size: 5rem; /* 압도적인 크기 */
  color: var(--accent-color);
  margin-bottom: 2rem;
  display: inline-block;
  filter: drop-shadow(0 15px 30px rgba(99, 102, 241, 0.4)); /* 깊은 그림자 */
  animation: float-deep 3s ease-in-out infinite; /* 깊은 부유 효과 */
}

/* Deep Float Animation */
@keyframes float-deep {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-20px); }
}

/* Time Estimate Badge */
.time-badge {
  background: #e0e7ff; color: var(--accent-color);
  padding: 0.6rem 1.2rem; border-radius: 2rem;
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-weight: 700; font-size: 0.95rem;
  margin-bottom: 2rem;
}


/* --- Completion Hero UI (Success Screen) --- */
/* Success Container (Centers content) */
.success-hero-container {
  text-align: center; padding: 2rem;
  display: flex; flex-direction: column; align-items: center;
}

/* Giant Success Checkmark Icon */
.success-icon-hero {
  width: 140px; height: 140px;
  background: var(--success-color);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 5rem;
  box-shadow: 0 30px 60px rgba(16, 185, 129, 0.5); /* 강렬한 빛 번짐 */
  margin-bottom: 2.5rem;
  /* 등장 애니메이션: 튀어오르는 느낌 */
  animation: scale-in-bounce 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Success Texts */
.success-title-hero {
  font-size: 2.2rem; font-weight: 900; color: var(--text-main);
  margin-bottom: 1rem;
  opacity: 0; animation: fade-in-up 0.6s ease-out 0.3s forwards; /* 0.3초 딜레이 */
}
.success-desc-hero {
  font-size: 1.2rem; color: var(--text-sub); line-height: 1.6;
  opacity: 0; animation: fade-in-up 0.6s ease-out 0.5s forwards; /* 0.5초 딜레이 */
}

/* Keyframes for Entrance */
@keyframes scale-in-bounce {
  0% { opacity: 0; transform: scale(0.3); }
  50% { opacity: 1; transform: scale(1.1); }
  70% { transform: scale(0.95); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Cancel Hero UI (Soft & Minimal) --- */
/* Soft Cancel Icon Background */
.cancel-icon-hero {
  width: 100px; height: 100px; /* 성공보다는 조금 작게 */
  background: #fee2e2; /* 아주 연한 빨강 */
  color: #ef4444; /* 세련된 빨강 */
  border-radius: 40%; /* 완전 원형보다 부드러운 스퀘어클 */
  display: flex; align-items: center; justify-content: center;
  font-size: 3.5rem;
  margin-bottom: 2rem;
  animation: pop-in 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Minimal Consent Icon (Toss Style) */
.minimal-fingerprint {
  width: 80px; height: 80px;
  background: rgba(79, 70, 229, 0.08);
  color: var(--accent-color);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem;
  margin: 0 auto 1.5rem;
}

@keyframes pop-in {
  0% { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* ================================================================== */
/* [NEW] Premium UX Interactions (Toss Style)
/* ================================================================== */

/* 1. Staggered List Animation (순차 등장) */
@keyframes fade-slide-up {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.stagger-item {
  opacity: 0; /* 초기 상태: 안 보임 */
  animation: fade-slide-up 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* 2. Tactile Touch Feedback (쫀득한 터치감) */
/* 버튼이나 카드를 눌렀을 때 살짝 들어가는 효과 */
.clickable-card:active, .btn:active {
  transform: scale(0.96);
  transition: transform 0.1s ease;
}

/* 3. Glass Card Hover Lift (데스크탑용) */
@media (min-width: 768px) {
  .clickable-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.1);
  }
}

/* ================================================================== */
/* [NEW] v3.0 Premium 3D Flip Modal (Cinematic & Classy)
/* ================================================================== */

/* Background Overlay */
.flip-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0); /* 투명에서 시작 */
  z-index: 9999;
  transition: background 0.5s ease; /* 부드러운 페이드 */
  display: flex; align-items: center; justify-content: center;
}
.flip-overlay.active {
  background: rgba(0, 0, 0, 0.6); /* 고급스러운 어두운 배경 */
  backdrop-filter: blur(8px);
}

/* The Flying Card Container */
.animating-card {
  position: absolute;
  transform-style: preserve-3d; /* 3D 공간 활성화 */
  /* [CHANGE] 경박함 제거 -> 묵직하고 부드러운 회전 (0.8s ease-in-out) */
  transition: all 0.8s cubic-bezier(0.45, 0, 0.15, 1); 
  z-index: 10000;
}

/* Front & Back Faces Common */
.anim-face {
  position: absolute; inset: 0;
  -webkit-backface-visibility: hidden; /* 뒷면 숨김 (핵심) */
  backface-visibility: hidden;
  border-radius: 1.2rem;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0,0,0,0.2);
  background: white;
}

/* Front Face */
.anim-face.front {
  transform: rotateY(0deg);
  z-index: 2;
  padding: 1.5rem;
  display: flex; flex-direction: column; justify-content: space-between;
}

/* Back Face */
.anim-face.back {
  transform: rotateY(180deg); /* 미리 뒤집어둠 */
  display: flex; flex-direction: column;
  background: #fafafa;
}

/* Expanded State (The Flip Trigger) */
.animating-card.expanded {
  transform: translate(-50%, -50%) rotateY(180deg); /* 위치 이동 + 회전 */
  /* top: 50%, left: 50%는 JS에서 제어하거나 여기서 고정 가능 */
}

/* Back Face Content Styling */
.card-back-header {
  padding: 1.2rem 1.5rem;
  background: white;
  border-bottom: 1px solid #eee;
  display: flex; justify-content: space-between; align-items: center;
}
.card-back-body {
  padding: 1.5rem;
  flex: 1; overflow-y: auto;
  display: flex; flex-direction: column; gap: 1.2rem;
}
.info-group {
  background: white; padding: 1rem; border-radius: 0.8rem;
  border: 1px solid #f1f5f9;
  box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}
.info-label { font-size: 0.75rem; color: #94a3b8; font-weight: 600; margin-bottom: 0.3rem; text-transform: uppercase; }
.info-value { font-size: 0.95rem; color: #334155; font-weight: 500; word-break: break-all; }

/* Hash Link Style */
.hash-link {
  color: var(--accent-color); cursor: pointer;
  font-family: monospace; transition: opacity 0.2s;
  display: flex; align-items: center; gap: 0.5rem;
}
.hash-link:hover { text-decoration: underline; opacity: 0.8; }

.card-back-footer {
  padding: 1.2rem 1.5rem;
  background: white;
  border-top: 1px solid #eee;
}

/* Close Button */
.flip-close-btn {
  width: 32px; height: 32px; border-radius: 50%;
  background: #f1f5f9; border: none; color: #64748b;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.2s;
}
.flip-close-btn:hover { background: #e2e8f0; color: #0f172a; }

/* [NEW] v3.1 Clone Fidelity Fixes */

/* 애니메이션 중인 카드의 앞면은 기존 카드와 100% 동일하게 스타일링 */
.anim-face.front {
  /* 기존 패딩/정렬 제거 (복제된 요소가 이미 가지고 있음) */
  padding: 0 !important; 
  display: block !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
}

/* 복제된 카드 내부의 스타일 강제 조정 */
.anim-face.front .glass-card {
  height: 100%;
  border: 1px solid rgba(255, 255, 255, 0.8); /* 기존 테두리 유지 */
  background: rgba(255, 255, 255, 0.65); /* 기존 배경 유지 */
  box-shadow: none; /* 애니메이션 컨테이너가 그림자 담당 */
  cursor: default; /* 커서 변경 방지 */
  transform: none !important; /* 호버 효과 제거 */
}

/* 애니메이션 도중에는 '상세 보기' 버튼 등을 숨겨서 깔끔하게 만듦 (선택사항) */
.anim-face.front .hide-on-fly {
  opacity: 0;
  transition: opacity 0.2s;
}

/* ================================================================== */
/* [NEW] Solid Background with Network Particles (Visible Fix)
/* ================================================================== */

/* 1. 캔버스가 '진짜 배경' 역할을 하도록 설정 */
#network-canvas {
  position: fixed;
  top: 0; 
  left: 0; 
  width: 100%; 
  height: 100%;
  z-index: -1; /* 컨텐츠 바로 뒤 */
  
  /* [핵심] 배경색을 body가 아닌 캔버스에 직접 적용 */
  background-color: #f3f4f6 !important; 
  
  /* 캔버스 자체 투명도는 제거 (배경색이 흐려지지 않도록) */
  opacity: 1 !important; 
  pointer-events: none;
}

/* 2. 본문과 html은 투명하게 만들어 캔버스가 보이도록 함 */
html, body {
  background-color: transparent !important; 
  background-image: none !important;
  min-height: 100%;
}

/* ================================================================== */
/* [NEW] About Page & Version Tag Styles
/* ================================================================== */

/* Version Badge (Sidebar) */
.version-badge {
  font-size: 0.7rem;
  background: rgba(79, 70, 229, 0.1);
  color: var(--accent-color);
  padding: 2px 8px;
  border-radius: 12px;
  margin-left: 8px;
  vertical-align: middle;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.version-badge:hover {
  background: var(--accent-color);
  color: white;
  transform: scale(1.1);
}

/* About Overlay (Glassmorphism Fullscreen) */
.about-overlay {
  position: fixed; inset: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  z-index: 10001; /* 최상위 */
  overflow-y: auto;
  padding: 2rem;
  animation: fade-in 0.4s ease-out;
}

/* About Content Container */
.about-container {
  max-width: 600px;
  margin: 4rem auto;
  padding-bottom: 4rem;
}

/* Profile Card */
.maker-card {
  display: flex; align-items: center; gap: 1rem;
  background: white;
  padding: 1.5rem;
  border-radius: 1.5rem;
  box-shadow: 0 10px 30px rgba(0,0,0,0.06);
  margin-bottom: 1rem;
  transition: transform 0.2s;
}
.maker-card:hover { transform: translateY(-5px); }

.maker-avatar {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e0e7ff, #f3f4f6);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem;
}

/* Version Timeline */
.v-timeline {
  border-left: 2px solid #e2e8f0;
  margin-left: 1rem;
  padding-left: 2rem;
  margin-top: 2rem;
}
.v-item {
  position: relative;
  margin-bottom: 2rem;
}
.v-item::before {
  content: '';
  position: absolute;
  left: -2.4rem; top: 0.4rem;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: white;
  border: 3px solid var(--accent-color);
}

/* [UPDATE] About Overlay Transition Fix */
.about-overlay {
  position: fixed; inset: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  z-index: 10001;
  overflow-y: auto;
  padding: 2rem;
  
  /* [핵심] 부드러운 전환을 위한 초기 상태 설정 */
  opacity: 0;
  transition: opacity 0.4s ease-in-out; 
  pointer-events: none; /* 투명할 땐 클릭 방지 */
}

/* 활성화 클래스 (JS에서 추가) */
.about-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

/* 모바일 대응 (제목 강제 표시) */
@media (max-width: 600px) {
  .about-container { margin: 2rem auto; }
}

/* ================================================================== */
/* [PATCH] Mobile UX & Layout Fixes (v17.1 Final)
/* ================================================================== */

/* [Issue 6] 좌우 흔들림 및 줌 방지 */
html, body {
    width: 100vw;
    overflow-x: hidden; /* 가로 스크롤 강제 차단 */
    touch-action: manipulation; /* 더블탭 줌 방지 */
    position: relative; /* 고정 */
}

/* [Issue 5] 모바일 네비게이션 바 고정 (Always on Top) */
#mobile-nav {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    z-index: 9999 !important; /* 최상위 레이어 */
    padding-bottom: env(safe-area-inset-bottom, 20px) !important;
    background: rgba(255, 255, 255, 0.95) !important;
    border-top: 1px solid rgba(0,0,0,0.1);
    box-shadow: 0 -5px 20px rgba(0,0,0,0.05);
}

/* [Issue 8] 모바일 상단 투명 헤더 (Robin 로고) */
#mobile-header {
    display: none; /* PC에서는 숨김 */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    z-index: 9998; /* 네비게이션보다 한 단계 아래 */
    align-items: center;
    padding: 0 1.5rem;
    background: rgba(243, 244, 246, 0.85); /* 본문 배경과 유사한 반투명 */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

#mobile-header .logo-text {
    font-size: 1.4rem;
    font-weight: 900;
    background: linear-gradient(to right, var(--text-main), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* 모바일 미디어 쿼리 적용 */
@media (max-width: 900px) {
    #mobile-header {
        display: flex; /* 모바일에서만 보임 */
    }
    
    /* 헤더와 네비게이션 공간만큼 본문 패딩 확보 */
    #main-content {
        padding-top: 80px !important; /* 헤더 높이 + 여백 */
        padding-bottom: 100px !important; /* 네비바 높이 + 여백 */
    }
}

/* ================================================================== */
/* [NEW] Custom Checkbox & UI Elements (v18.1)
/* ================================================================== */

/* 커스텀 체크박스 컨테이너 */
.custom-checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    user-select: none;
    margin-bottom: 1.5rem;
    padding: 0.2rem 0; /* 터치 영역 확보 */
}

/* 실제 Input은 숨김 */
.custom-checkbox-input {
    display: none;
}

/* 체크박스 모양 (Box) */
.custom-checkbox-box {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 2px solid #e2e8f0; /* 평소: 연한 회색 */
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: white; /* 체크 아이콘 색상 */
    font-size: 0.8rem;
}

/* 체크되었을 때 스타일 */
.custom-checkbox-input:checked + .custom-checkbox-box {
    background: var(--accent-color); /* 브랜드 컬러 */
    border-color: var(--accent-color);
    transform: scale(1.05);
}

/* 라벨 텍스트 */
.custom-checkbox-label {
    font-size: 0.95rem;
    color: var(--text-sub);
    font-weight: 500;
    transition: color 0.2s;
}

/* 체크되었을 때 텍스트 진하게 */
.custom-checkbox-input:checked ~ .custom-checkbox-label {
    color: var(--text-main);
    font-weight: 600;
}

/* ================================================================== */
/* [NEW] Toss-Style Internal Content & Typography (v18.2)
/* ================================================================== */

/* 1. Typography Reset (모달 내부 전용) */
.modal-content {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
    color: #333d4b; /* Toss Dark Gray */
}

/* 제목 텍스트 보정 */
.modal-header span {
    font-size: 1.35rem;
    font-weight: 800;
    color: #191f28; /* Toss Black */
    letter-spacing: -0.015em;
}

/* 2. Form Layout & Labels */
.form-group {
    margin-bottom: 1.4rem; /* 간격 조금 더 넓게 */
    position: relative;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    color: #4e5968; /* 라벨은 조금 연하게 */
    margin-bottom: 0.5rem;
    transition: color 0.2s;
}

/* 입력창에 포커스 가면 라벨도 진하게 */
.form-group:focus-within label {
    color: #3182f6; /* Toss Blue */
}

/* 3. Premium Input Fields (핵심 디자인) */
.form-input {
    width: 100%;
    height: 52px; /* 터치하기 좋은 넉넉한 높이 */
    padding: 0 1.2rem;
    font-size: 1.05rem;
    font-weight: 500;
    color: #191f28;
    
    /* 토스 스타일: 테두리 없이 배경색으로 구분 */
    background-color: #f2f4f6; 
    border: 1px solid transparent; 
    border-radius: 14px;
    
    /* 부드러운 전환 효과 */
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    
    /* 텍스트 렌더링 최적화 */
    -webkit-font-smoothing: antialiased;
}

/* 입력창 포커스 (활성화) 상태 */
.form-input:focus {
    background-color: #ffffff;
    border-color: #3182f6; /* 파란색 라인 */
    box-shadow: 0 0 0 2px rgba(49, 130, 246, 0.1); /* 은은한 글로우 */
    transform: translateY(-1px); /* 살짝 떠오르는 느낌 */
}

/* 읽기 전용 (Readonly) 상태 - 텍스트처럼 보이게 */
.form-input:read-only {
    background-color: transparent;
    border-color: transparent;
    color: #8b95a1;
    padding-left: 0;
    font-weight: 600;
    cursor: default;
}
.form-input:read-only:focus {
    box-shadow: none;
    transform: none;
}

/* Select Box 커스텀 (화살표 교체) */
select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b95a1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.2em;
    padding-right: 2.5rem;
}

/* Placeholder 색상 보정 */
.form-input::placeholder {
    color: #b0b8c1;
    font-weight: 400;
}

/* 미리보기 박스 (템플릿 등) 디자인 */
#t_preview {
    background: #f9fafb !important;
    border: 1px solid #e5e8eb !important;
    border-radius: 14px !important;
    padding: 1.5rem !important;
    color: #333d4b;
    font-size: 1rem;
    line-height: 1.6;
}

/* 1. 뷰어 레이아웃: 가로 배치 -> 세로 배치로 변경하여 '찌그러짐' 방지 */
.cert-viewer-layout {
  flex-direction: column !important; /* 강제 세로 정렬 */
  align-items: center !important;
  gap: 2rem; /* 증명서와 버튼 사이 간격 */
  padding-bottom: 120px; /* 하단 버튼 바 공간 확보 */
}

/* 2. 하단 액션 바 (새로운 디자인) */
.cert-action-bar {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.8rem 1.2rem;
  
  /* Toss/Apple Style Glassmorphism */
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1), 0 4px 10px rgba(0,0,0,0.05);
  border-radius: 24px;
  z-index: 1000;
  
  /* 등장 애니메이션 */
  animation: slide-up-fade 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.5s backwards;
}

/* 액션 바 내부 버튼 스타일 재정의 */
.cert-action-bar .btn {
  height: 44px;
  border-radius: 14px;
  font-size: 0.95rem;
  padding: 0 1.2rem;
  box-shadow: none; /* 플랫하게 변경 */
}

.cert-action-bar .btn-primary {
  background: #3182f6;
  color: white;
}

.cert-action-bar .btn-secondary {
  background: rgba(0,0,0,0.05);
  color: #333;
}

/* 모바일 대응: 화면 꽉 차게 */
@media (max-width: 600px) {
  .cert-action-bar {
    bottom: 1.5rem;
    width: 90%;
    justify-content: center;
  }
  .cert-action-bar .btn {
    flex: 1; /* 버튼 등분 */
  }
}

@keyframes slide-up-fade {
  from { opacity: 0; transform: translate(-50%, 20px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ================================================================== */
/* [NEW] Mobile Navigation Revamp (Hamburger Side-Menu) - v18.3
/* ================================================================== */

/* 1. 하단 탭바 완전 제거 */
#mobile-nav {
    display: none !important;
}

/* 2. 모바일 헤더 내 햄버거 버튼 스타일 */
#mobile-menu-btn {
    display: none; /* PC 숨김 */
}

/* 3. 모바일 사이드바 오버레이 */
#sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(4px);
}
#sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* 4. 모바일 미디어 쿼리 (900px 미만) */
@media (max-width: 900px) {
    /* 헤더 햄버거 버튼 스타일 */
    #mobile-menu-btn {
        display: flex;
        align-items: center; justify-content: center;
        width: 44px; height: 44px;
        border-radius: 12px;
    }
    #mobile-menu-btn:active { background: rgba(0,0,0,0.05); }

    /* [Fix] 사이드바: 오버레이 없이 독립적으로 동작 */
    #sidebar {
        display: flex !important;
        position: fixed;
        top: 0; left: 0; bottom: 0;
        width: 280px;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        
        /* 최상위 계층 (방해 요소 없음) */
        z-index: 10000 !important; 
        
        /* 터치/클릭 이벤트 활성화 */
        pointer-events: auto !important;
        
        /* 디자인: 완전 불투명 흰색 배경 */
        background: #ffffff !important;
        box-shadow: 5px 0 15px rgba(0,0,0,0.08);
        
        /* 디자인: 상단 여백 8rem (로고와 메뉴 사이 간격 확보) */
        padding-top: 8rem !important; 
    }

    /* 사이드바 활성화 */
    #sidebar.active {
        transform: translateX(0);
    }
    
    /* [Fix] 오버레이 완전 삭제 (화면에서 물리적으로 제거) */
    #sidebar-overlay {
        display: none !important;
    }

    /* 사이드바 내부 닫기 버튼 (X 아이콘) 표시 */
    .mobile-close-btn {
        display: block !important;
    }
    
    /* 로고 위치 조정 */
    #sidebar .logo-header {
        position: absolute;
        top: 2rem; left: 1.5rem; 
        margin: 0;
    }

    /* 메인 컨텐츠 패딩 재조정 (수정됨) */
    #main-content {
        /* [Fix] 하단 여백 대폭 확장 */
        /* 기본 안전 영역(Safe Area)에 +80px을 더해 버튼이 바닥에 붙지 않고 공중에 떠 있는 듯한 여유를 줌 */
        padding-bottom: calc(env(safe-area-inset-bottom, 20px) + 80px) !important; 
        
        /* 좌우 패딩도 모바일에서는 조금 더 넓게 */
        padding-left: 1.5rem !important;
        padding-right: 1.5rem !important;
    }
}

@media (min-width: 901px) {
    .mobile-close-btn { display: none !important; }
}

/* =================================================================
   [Mobile Optimization] 증명서 뷰어 여백 및 레이아웃 최적화
   - 모바일(768px 이하)에서 불필요한 여백을 제거하여 가독성 확보
   ================================================================= */
@media (max-width: 768px) {
    /* 1. 뷰어 외부 컨테이너 여백 극한 축소 */
    .cert-viewer-layout {
        padding: 2px !important; /* [Fix] 기존 12px -> 5px로 줄여 화면 꽉 채움 */
        align-items: center !important; 
        padding-top: 10px !important; /* 헤더에 가리지 않도록 상단 여백 확보 */
        height: auto !important;
        min-height: 100vh;
        width: 100% !important;
    }

    /* 2. 증명서 종이(Paper) 크기 및 내부 여백 최적화 */
    .cert-paper {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important; /* 중앙 정렬 마진 제거하고 꽉 채움 */
        
        /* 종이 내부 여백도 줄여서 글자 공간 확보 */
        padding: 24px 12px !important; /* 좌우 패딩 16px로 축소 */
        
        /* 모바일용 그림자 조정 */
        box-shadow: 0 4px 15px rgba(0,0,0,0.08) !important;
        border-radius: 8px !important; /* 모서리 둥글기 살짝 줄여 공간 확보 */
    }

    /* 3. 폰트 크기 미세 조정 */
    .cert-title-text {
        font-size: 1.6rem !important; /* 제목이 두 줄로 깨지지 않게 조정 */
        margin-bottom: 0.5rem !important;
    }
    .cert-doc-id {
        font-size: 0.8rem !important;
        padding: 0.15rem 0.5rem !important;
    }
    .cert-body-text {
        font-size: 0.95rem !important; /* 본문 가독성 유지하며 크기 조정 */
        line-height: 1.8 !important;
        margin-bottom: 2.5rem !important;
    }
    
    /* 4. 하단 버튼바 위치 보정 */
    .cert-action-bar {
        width: 100% !important; /* 버튼바도 꽉 차게 */
        bottom: 1rem !important;
        padding: 0.6rem !important;
    }
}

/* =================================================================
   [PATCH v19.0] Mobile Interaction & UI Hotfixes
   ================================================================= */

/* 1. 증명서 뷰어 모드일 때 (JS에서 클래스 토글됨) */
body.viewer-mode #mobile-header {
    display: none !important; /* 헤더 강제 숨김 */
}

/* 헤더가 사라졌으므로, 뷰어 상단 여백도 재조정 (80px -> 20px) */
body.viewer-mode .cert-viewer-layout {
    padding-top: 10px !important; 
}

/* 2. 모바일 상세 정보 모달(3D Flip) 스크롤 문제 해결 */
@media (max-width: 768px) {
    /* 카드가 화면을 넘어가지 않도록 높이 제한 */
    .animating-card.expanded {
        max-height: 85vh !important; /* 화면 높이의 85%까지만 */
        top: 50% !important;
        transform: translate(-50%, -50%) rotateY(180deg) !important;
        display: flex !important;
        flex-direction: column !important;
    }

    /* 뒷면(정보창)이 카드 크기에 맞춰지도록 설정 */
    .anim-face.back {
        position: relative !important; /* absolute 해제 */
        height: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        border-radius: 1.2rem !important;
    }

    /* 내용물 영역에 스크롤바 생성 */
    .card-back-body {
        flex: 1 !important;
        overflow-y: auto !important; /* 내부 스크롤 활성화 */
        -webkit-overflow-scrolling: touch !important; /* 아이폰 부드러운 스크롤 */
        overscroll-behavior: contain; /* 배경 스크롤 방지 */
    }
}

/* =================================================================
   [PATCH v20.1] Mobile Modal Scroll & Flip Visual Fix (Final)
   ================================================================= */
@media (max-width: 768px) {
    /* 1. 카드 컨테이너: 터치 인식을 위해 평면(Flat) 모드 강제 */
    .animating-card.expanded {
        height: 70vh !important;
        max-height: 80vh !important;
        top: 50% !important;
        
        /* [핵심] 3D 효과를 끄고 평면으로 고정하여 터치 버그 해결 */
        transform-style: flat !important; 
        transform: translate(-50%, -50%) rotateY(180deg) !important;
    }

    /* 2. 뒷면(Back): 앞면보다 무조건 위에 오도록 Z-Index 격상 */
    .anim-face.back {
        display: flex !important;
        flex-direction: column !important;
        height: 100% !important;
        width: 100% !important;
        
        /* [Fix] 앞면(z-index:2)보다 높게 설정하여 가려짐 방지 */
        z-index: 100 !important; 
        
        /* [Fix] 평면 모드에서도 보이도록 설정 */
        backface-visibility: visible !important; 
        pointer-events: auto !important;
        background: #fff !important;
    }

    /* 3. 앞면(Front): 뒤집혔을 때 아예 숨겨서 잔상 방지 */
    .animating-card.expanded .anim-face.front {
        display: none !important;
    }

    /* 4. 스크롤 영역 (Body) 터치 활성화 */
    .card-back-body {
        flex: 1 1 auto !important; 
        height: 0 !important; 
        min-height: 0 !important; 
        
        overflow-y: scroll !important; 
        -webkit-overflow-scrolling: touch !important;
        touch-action: pan-y !important;
        
        padding-bottom: 2rem !important; 
        cursor: touch !important;
    }

    /* 헤더/푸터 고정 */
    .card-back-header, .card-back-footer {
        flex: 0 0 auto !important;
        position: relative;
        z-index: 101 !important; /* 뒷면 배경보다 더 위 */
    }
}

/* =========================================
   [Mobile UX FINAL BOOSTER] 텍스트 강제 확대 패치
   - 적용 대상: 모바일 화면 (768px 이하)
   - 해결: 상속 무시하고 폰트 크기 물리적(px) 강제 주입
   ========================================= */
@media (max-width: 768px) {
    
    /* 1. 사이드바 전체 레이아웃 (여유공간 확보) */
    .sidebar-nav {
        gap: 10px !important; 
        padding: 20px 10px !important;
    }

    /* 2. 버튼 껍데기 (터치 영역 확보) */
    .sidebar .nav-btn {
        display: flex !important;
        align-items: center !important; /* 수직 중앙 정렬 */
        justify-content: flex-start !important;
        padding: 18px 20px !important; /* 상하좌우 패딩 대폭 확대 */
        height: auto !important;       /* 고정 높이 해제 */
        border-radius: 16px !important;
        background: rgba(255, 255, 255, 0.05); /* 터치 영역 인지 돕기 */
    }

    /* 3. [핵심] 텍스트 사이즈 강제 (모든 하위 요소 타격) */
    /* span, div, 혹은 그냥 글자든 뭐든 다 22px로 키움 */
    .sidebar .nav-btn, 
    .sidebar .nav-btn span,
    .sidebar .nav-btn div {
        font-size: 22px !important;    /* [중요] px 단위로 고정 (매우 큼) */
        font-weight: 800 !important;   /* Extra Bold */
        letter-spacing: -0.5px !important; /* 자간 좁힘 */
        line-height: 1.0 !important;   /* 줄간격 좁힘 */
        font-family: inherit !important;
        color: #fff !important;        /* 색상도 흰색 강제 */
    }

    /* 4. 아이콘 사이즈 및 위치 보정 */
    .sidebar .nav-btn i {
        font-size: 26px !important;    /* 아이콘은 글자보다 더 크게 */
        width: 45px !important;        /* 아이콘 자리 확보 */
        min-width: 45px !important;    /* 찌그러짐 방지 */
        text-align: center !important;
        margin-right: 5px !important;  /* 글자와 간격 */
        padding: 0 !important;
        display: inline-flex !important;
        justify-content: center;
        align-items: center;
    }

    /* 5. 활성 상태 디자인 */
    .sidebar .nav-btn.active {
        background: rgba(255, 255, 255, 0.2) !important;
        box-shadow: 0 5px 15px rgba(0,0,0,0.2) !important;
    }

    /* 6. 하단 로그아웃/유저 영역도 동일하게 키움 */
    .user-profile-section {
        padding: 20px !important;
    }
    .user-info .user-name {
        font-size: 18px !important;
        font-weight: 700 !important;
        margin-bottom: 5px !important;
    }
    .logout-btn {
        font-size: 18px !important;
        padding: 15px !important;
        font-weight: 700 !important;
    }
}