/* ===================================================================
   ToolBox Standard Framework Core CSS (framework/core.css)
   Unified Theme, Typography, Responsive Containers & Components
   =================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Noto+Sans+KR:wght@400;500;700;900&display=swap');

:root {
  --font-display: 'Plus Jakarta Sans', 'Pretendard', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --color-primary: #0ea5e9;
  --color-primary-hover: #0284c7;
  --color-primary-light: #e0f2fe;
  --color-bg-light: #f8fafc;
  --color-card-light: #ffffff;
  --color-border-light: #e2e8f0;
  --color-text-main-light: #0f172a;
  --color-text-muted-light: #64748b;
  
  --color-bg-dark: #0f172a;
  --color-card-dark: #1e293b;
  --color-border-dark: #334155;
  --color-text-main-dark: #f8fafc;
  --color-text-muted-dark: #94a3b8;
}

/* Global Reset & Viewport Safeguard */
html {
  font-family: var(--font-display);
  scroll-behavior: smooth;
  max-width: 100vw;
  overflow-x: hidden;
  font-size: 16px;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--color-bg-light);
  color: var(--color-text-main-light);
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 1.6;
  max-width: 100vw;
  overflow-x: hidden;
  transition: background-color 0.2s ease, color 0.2s ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html.dark body {
  background-color: var(--color-bg-dark);
  color: var(--color-text-main-dark);
}

/* ===================================================================
   Typography System & Readability Safeguard (Minimum 14px Guarantee)
   =================================================================== */
.text-xs,
.text-2xs,
[class*="text-[8px]"],
[class*="text-[9px]"],
[class*="text-[10px]"],
[class*="text-[11px]"],
[class*="text-[12px]"],
[class*="text-[13px]"] {
  font-size: 14px !important;
  line-height: 1.5 !important;
}

.text-sm {
  font-size: 14px !important;
  line-height: 1.55 !important;
}

input, select, textarea, button {
  font-family: inherit;
  font-size: 14px;
}

/* ===================================================================
   Standardized 3-Tier Container Architecture (Linear & Vercel Spec)
   =================================================================== */

/* Tier 1: Hub & Portal (Index, Categories, Sitemap) */
.container-portal,
.fw-container-portal {
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

/* Tier 2: Tool Workspace (Utility Tools, Workspaces, Games) */
.container-tool,
.fw-container-tool,
.fw-container {
  width: 100%;
  max-width: 860px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

/* Tier 3: Reading & Guides (Articles, Documentation, Terms) */
.container-guide,
.fw-container-guide {
  width: 100%;
  max-width: 860px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

@media (min-width: 640px) {
  .container-portal, .fw-container-portal,
  .container-tool, .fw-container-tool, .fw-container,
  .container-guide, .fw-container-guide {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

@media (min-width: 1024px) {
  .container-portal, .fw-container-portal,
  .container-tool, .fw-container-tool, .fw-container,
  .container-guide, .fw-container-guide {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

/* Standardized Card Styles */
.fw-card {
  background-color: var(--color-card-light);
  border: 1px solid var(--color-border-light);
  border-radius: 1.25rem;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.05), 0 8px 10px -6px rgba(15, 23, 42, 0.03);
  padding: 1.5rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

@media (min-width: 640px) {
  .fw-card {
    border-radius: 1.5rem;
    padding: 2rem;
  }
}

html.dark .fw-card {
  background-color: var(--color-card-dark);
  border-color: var(--color-border-dark);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

.fw-card-hover:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.05);
}

html.dark .fw-card-hover:hover {
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4);
}

/* Standard Buttons */
.fw-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-weight: 700;
  font-size: 0.95rem;
  border-radius: 0.875rem;
  background-color: var(--color-primary);
  color: #ffffff;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

.fw-btn-primary:hover {
  background-color: var(--color-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(14, 165, 233, 0.4);
}

.fw-btn-primary:active {
  transform: translateY(0);
}

.fw-btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: 0.875rem;
  background-color: #f1f5f9;
  color: #334155;
  border: 1px solid var(--color-border-light);
  cursor: pointer;
  transition: all 0.15s ease;
}

html.dark .fw-btn-secondary {
  background-color: #334155;
  color: #f1f5f9;
  border-color: #475569;
}

.fw-btn-secondary:hover {
  background-color: #e2e8f0;
  color: #0f172a;
}

html.dark .fw-btn-secondary:hover {
  background-color: #475569;
  color: #ffffff;
}

/* Standard Badge */
.fw-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.3rem 0.85rem;
  font-size: 0.875rem;
  font-weight: 700;
  border-radius: 9999px;
  background-color: var(--color-primary-light);
  color: var(--color-primary-hover);
}

html.dark .fw-badge {
  background-color: rgba(14, 165, 233, 0.2);
  color: #38bdf8;
}

/* Dropdown & Nav Safe Rules */
.fw-dropdown {
  position: relative;
  display: inline-block;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
}

header nav,
header nav a,
header nav button {
  white-space: nowrap !important;
  flex-shrink: 0 !important;
}

.fw-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  z-index: 100;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  padding: 0.5rem;
}

html.dark .fw-dropdown-menu {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4);
}

.fw-dropdown-menu.is-active {
  display: block;
}

/* 1000+ Character Guide Section Standard */
.fw-guide-section {
  margin-top: 3rem;
  border-top: 1px solid var(--color-border-light);
  padding-top: 2.5rem;
}

html.dark .fw-guide-section {
  border-color: var(--color-border-dark);
}

.fw-guide-content h2 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
  color: inherit;
}

.fw-guide-content h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  color: inherit;
}

.fw-guide-content p {
  line-height: 1.75;
  color: var(--color-text-muted-light);
  margin-bottom: 1rem;
}

html.dark .fw-guide-content p {
  color: var(--color-text-muted-dark);
}

/* Bilingual Helper */
html[lang="ko"] .lang-en { display: none !important; }
html[lang="en"] .lang-ko { display: none !important; }


/* ===================================================================
   ToolBox Global Floating Quick Nav Dock & Related Tools Switcher
   =================================================================== */

/* 1. Global Floating Quick Nav Dock */
.fw-floating-dock {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 30px);
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 10px 30px -5px rgba(15, 23, 42, 0.15), 0 4px 6px -2px rgba(15, 23, 42, 0.05);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

html.dark .fw-floating-dock {
  background: rgba(15, 23, 42, 0.9);
  border-color: rgba(51, 65, 85, 0.9);
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
}

.fw-floating-dock.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

.fw-dock-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 40px;
  padding: 0 14px;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 700;
  color: #334155;
  background: transparent;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  white-space: nowrap;
  user-select: none;
}

html.dark .fw-dock-btn {
  color: #e2e8f0;
}

.fw-dock-btn:hover {
  background: rgba(14, 165, 233, 0.12);
  color: #0ea5e9;
  transform: translateY(-1px);
}

.fw-dock-btn:active {
  transform: translateY(0);
}

.fw-dock-btn.is-active {
  background: #0ea5e9;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.4);
}

@media (max-width: 640px) {
  .fw-floating-dock {
    bottom: 16px;
    padding: 4px 8px;
    gap: 3px;
    max-width: 96vw;
  }
  .fw-dock-btn {
    height: 36px;
    padding: 0 8px;
    font-size: 0.8125rem;
    gap: 3px;
  }
  .fw-dock-divider {
    height: 14px;
  }
}

.fw-dock-divider {
  width: 1px;
  height: 18px;
  background-color: rgba(203, 213, 225, 0.8);
}

html.dark .fw-dock-divider {
  background-color: rgba(71, 85, 105, 0.8);
}

/* Quick Launcher Popover */
.fw-quick-launcher-popover {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) scale(0.95);
  width: 90vw;
  max-width: 480px;
  max-height: 70vh;
  overflow-y: auto;
  z-index: 50;
  border-radius: 1.25rem;
  padding: 1.25rem;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(226, 232, 240, 0.95);
  box-shadow: 0 20px 40px -10px rgba(15, 23, 42, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

html.dark .fw-quick-launcher-popover {
  background: rgba(15, 23, 42, 0.96);
  border-color: rgba(51, 65, 85, 0.95);
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.7);
}

.fw-quick-launcher-popover.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) scale(1);
}

/* 2. Top Related Tools Strip (inside tool pages) */
.fw-related-strip {
  width: 100%;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 30;
  transition: all 0.2s ease;
}

html.dark .fw-related-strip {
  background: rgba(15, 23, 42, 0.85);
  border-bottom-color: rgba(51, 65, 85, 0.8);
}

.fw-chips-scroll {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-behavior: smooth;
  padding: 2px 0;
}

.fw-chips-scroll::-webkit-scrollbar {
  display: none;
}

.fw-tool-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  background: rgba(241, 245, 249, 0.8);
  color: #475569;
  border: 1px solid rgba(226, 232, 240, 0.6);
  transition: all 0.15s ease;
  user-select: none;
}

html.dark .fw-tool-chip {
  background: rgba(30, 41, 59, 0.8);
  color: #94a3b8;
  border-color: rgba(51, 65, 85, 0.6);
}

.fw-tool-chip:hover {
  background: rgba(14, 165, 233, 0.15);
  color: #0ea5e9;
  border-color: #0ea5e9;
  transform: translateY(-1px);
}

.fw-tool-chip.is-current {
  background: #0ea5e9;
  color: #ffffff;
  border-color: #0ea5e9;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.35);
}

/* 3. Floating Sidebar Trigger & Slide Drawer */
.fw-floating-trigger {
  position: fixed;
  right: 20px;
  bottom: 85px;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 9999px;
  background: #0ea5e9;
  color: #ffffff;
  border: none;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.4);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.fw-floating-trigger:hover {
  background: #0284c7;
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 20px rgba(14, 165, 233, 0.5);
}

@media (max-width: 768px) {
  .fw-floating-trigger {
    display: none !important;
  }
}

.fw-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 55;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.fw-drawer-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.fw-side-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 90vw;
  max-width: 380px;
  background: #ffffff;
  z-index: 60;
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.15);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

html.dark .fw-side-drawer {
  background: #0f172a;
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.6);
  border-left: 1px solid rgba(51, 65, 85, 0.6);
}

.fw-side-drawer.is-open {
  transform: translateX(0);
}

/* 3. Floating Fullscreen Exit Pill (Mobile & Desktop) */
.fw-fullscreen-exit-pill {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 99999;
  display: none;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 9999px;
  background: rgba(15, 23, 42, 0.88);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  transition: opacity 0.35s ease, transform 0.35s ease, background 0.2s ease;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
}

.fw-fullscreen-exit-pill.is-active {
  display: inline-flex;
  opacity: 0.95;
  transform: translateY(0);
  pointer-events: auto;
}

.fw-fullscreen-exit-pill.is-active.is-faded {
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
}

.fw-fullscreen-exit-pill:hover {
  opacity: 1;
  background: rgba(15, 23, 42, 0.98);
  transform: translateY(0) scale(1.04);
}

@media (max-width: 640px) {
  .fw-fullscreen-exit-pill {
    top: 10px;
    right: 10px;
    padding: 5px 12px;
    font-size: 12px;
    gap: 4px;
  }
}

/* 4. Universal CSS Fullscreen Mode (Essential for iPhone Safari & Mobile Browsers) */
body.fw-fullscreen-mode {
  overflow: hidden !important;
}

body.fw-fullscreen-mode #header-placeholder,
body.fw-fullscreen-mode header:not(#standby-hud),
body.fw-fullscreen-mode #footer-placeholder,
body.fw-fullscreen-mode footer:not(#standby-footer),
body.fw-fullscreen-mode .fw-floating-trigger,
body.fw-fullscreen-mode .tool-guide-container,
body.fw-fullscreen-mode .container-guide {
  display: none !important;
}

body.fw-fullscreen-mode main {
  padding-top: 48px !important;
  padding-bottom: 24px !important;
  min-height: 100dvh !important;
  justify-content: center !important;
}


