/* ==========================================================================
   무료 웹도구 (tools.chatgpts.kr) 통합 스타일시트
   - 모바일 우선(Mobile-First) 반응형 디자인
   - 깔끔하고 신뢰감을 주는 블루/슬레이트 그레이 테마
   - 접근성 및 터치 친화적 UI (최소 터치 타깃 44px 이상)
   ========================================================================== */

:root {
  /* 색상 팔레트 */
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-border: #bfdbfe;
  
  --secondary: #475569;
  --secondary-hover: #334155;
  --secondary-light: #f1f5f9;

  --accent: #0284c7;
  --accent-light: #e0f2fe;

  --success: #16a34a;
  --success-light: #dcfce7;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --danger: #dc2626;
  --danger-light: #fee2e2;

  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-subtle: #f1f5f9;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-inverse: #ffffff;

  /* 레이아웃 & 간격 */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --container-max: 1040px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover {
  color: var(--primary-hover);
}

/* ==========================================================================
   헤더 & 네비게이션
   ========================================================================== */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.header-container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0.875rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text-main);
}
.brand-link:hover {
  color: var(--primary);
}
.brand-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--primary), #38bdf8);
  color: white;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ==========================================================================
   헤더 - 다른 놀자 서비스 이동 드롭다운
   (형제 서비스와 동일한 진입점을 헤더에 제공합니다)
   ========================================================================== */
.family-nav-wrap {
  position: relative;
}

.family-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.875rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-full, 999px);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.family-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary-border);
  color: var(--primary);
}
.family-btn .family-caret {
  font-size: 0.7rem;
  transition: transform 0.18s ease;
}
.family-nav-wrap.open .family-btn .family-caret {
  transform: rotate(180deg);
}

.family-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  min-width: 232px;
  padding: 0.375rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 60;
}
.family-nav-wrap.open .family-dropdown {
  display: block;
}
.family-dropdown-title {
  padding: 0.5rem 0.75rem 0.375rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  text-transform: uppercase;
}
.family-dropdown a,
.family-dropdown .family-current {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
  border-radius: var(--radius-sm);
  white-space: nowrap;
}
.family-dropdown a:hover {
  background: var(--surface-subtle);
  color: var(--primary);
}
.family-dropdown .family-current {
  background: var(--primary-light);
  color: var(--primary);
  cursor: default;
}
.family-dropdown .family-current::after {
  content: '현재';
  margin-left: auto;
  font-size: 0.68rem;
  font-weight: 700;
}

@media (max-width: 480px) {
  .family-btn { padding: 0.45rem 0.7rem; font-size: 0.84rem; }
  .family-dropdown { min-width: 200px; }
}

.nav-link {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--secondary);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}
.nav-link:hover {
  background-color: var(--secondary-light);
  color: var(--text-main);
}

/* ==========================================================================
   메인 컨테이너
   ========================================================================== */
.main-wrapper {
  flex: 1;
  max-width: var(--container-max);
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

/* 페이지 상단 헤더 (타이틀 & 설명) */
.page-header {
  text-align: center;
  margin-bottom: 2rem;
}
.page-badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  margin-bottom: 0.75rem;
}
.page-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}
.page-desc {
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto;
}

/* ==========================================================================
   카드 & 레이아웃 컴포넌트
   ========================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

/* 도구 메인 그리드 */
.tools-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  margin-top: 1.5rem;
}
@media (min-width: 640px) {
  .tools-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 960px) {
  .tools-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  position: relative;
  text-decoration: none;
  color: inherit;
}
.tool-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-border);
  color: inherit;
}
.tool-icon-wrapper {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 1rem;
  background: var(--primary-light);
  color: var(--primary);
}
.tool-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}
.tool-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  flex: 1;
  margin-bottom: 1rem;
}
.tool-action-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* ==========================================================================
   폼 & 컨트롤
   ========================================================================== */
.form-group {
  margin-bottom: 1.25rem;
}
.form-label {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.4rem;
}
.form-help {
  display: block;
  font-size: 0.825rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.form-control,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.75rem 0.875rem;
  font-size: 1rem;
  color: var(--text-main);
  background-color: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  font-family: inherit;
}
.form-control:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-textarea {
  min-height: 180px;
  resize: vertical;
  line-height: 1.6;
}

/* 체크박스 & 라디오 래퍼 */
.checkbox-group,
.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin-top: 0.5rem;
}
.checkbox-label,
.radio-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  cursor: pointer;
  user-select: none;
}
.checkbox-input,
.radio-input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* ==========================================================================
   버튼 시스템 (모바일 터치 44px 이상)
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.4rem;
  min-height: 48px;
  font-size: 1rem;
  /* 형제 서비스(한자야/역사야 놀자)와 톤을 맞추기 위해 두께·라운드·그림자를 올렸습니다 */
  font-weight: 700;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
  text-decoration: none;
  user-select: none;
}
.btn:active {
  transform: scale(0.98);
}
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background-color: var(--primary);
  color: var(--text-inverse);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.28);
}
.btn-primary:hover:not(:disabled) {
  background-color: var(--primary-hover);
  color: var(--text-inverse);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.34);
}

.btn-secondary {
  background-color: var(--secondary-light);
  color: var(--secondary-hover);
  border-color: var(--border-strong);
}
.btn-secondary:hover:not(:disabled) {
  background-color: #e2e8f0;
  color: var(--text-main);
}

.btn-outline {
  background-color: transparent;
  border-color: var(--border-strong);
  color: var(--text-main);
}
.btn-outline:hover:not(:disabled) {
  background-color: var(--secondary-light);
}

.btn-danger {
  background-color: var(--danger-light);
  color: var(--danger);
  border-color: #fca5a5;
}
.btn-danger:hover:not(:disabled) {
  background-color: #fecaca;
}

.btn-sm {
  min-height: 36px;
  padding: 0.4rem 0.75rem;
  font-size: 0.875rem;
}
.btn-block {
  width: 100%;
}
.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

/* ==========================================================================
   결과 표시 영역 (하이라이트 박스)
   ========================================================================== */
.result-box {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-top: 1.5rem;
}
.result-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* 통계 그리드 (글자수 세기 등) */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}
@media (min-width: 640px) {
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.875rem 1rem;
  text-align: center;
}
.stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
}
.stat-label {
  font-size: 0.825rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* ==========================================================================
   보안 & 면책 안내 배너 (지정 문구)
   ========================================================================== */
.notice-banner {
  border-radius: var(--radius-sm);
  padding: 0.875rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.875rem;
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  line-height: 1.5;
}

.notice-security {
  background-color: var(--success-light);
  border: 1px solid #86efac;
  color: #14532d;
}
.notice-disclaimer {
  background-color: var(--warning-light);
  border: 1px solid #fde68a;
  color: #78350f;
  margin-top: 1.5rem;
}

.notice-icon {
  font-size: 1.15rem;
  flex-shrink: 0;
}

/* ==========================================================================
   드래그 & 드롭 파일 업로더
   ========================================================================== */
.dropzone {
  border: 2px dashed var(--primary-border);
  background: var(--primary-light);
  border-radius: var(--radius-md);
  padding: 2.25rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}
.dropzone:hover,
.dropzone.dragover {
  border-color: var(--primary);
  background: #dbeafe;
}
.dropzone-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  color: var(--primary);
}
.dropzone-text {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}
.dropzone-sub {
  font-size: 0.825rem;
  color: var(--text-muted);
}
.dropzone-input {
  display: none;
}

/* 파일 목록 리스트 */
.file-list {
  list-style: none;
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  gap: 0.75rem;
}
.file-info {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  overflow: hidden;
  flex: 1;
}
.file-name {
  font-size: 0.925rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-size {
  font-size: 0.8rem;
  color: var(--text-muted);
  flex-shrink: 0;
}
.file-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

/* ==========================================================================
   광고
   - 애드센스 자동광고(<head>의 adsbygoogle.js)만 사용합니다.
     구글이 페이지를 분석해 알아서 자리를 잡으므로 별도 슬롯 마크업이 없습니다.
     (다른 형제 서비스와 동일한 방식)
   ========================================================================== */

/* ==========================================================================
   푸터 & 패밀리 서비스 링크
   ========================================================================== */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 2.5rem 1.25rem 2rem;
  margin-top: auto;
}
.footer-container {
  max-width: var(--container-max);
  margin: 0 auto;
}
.footer-section-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 1rem;
}
.family-services-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.625rem 1rem;
  margin-bottom: 2rem;
}
@media (min-width: 640px) {
  .family-services-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (min-width: 860px) {
  .family-services-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}
.family-link {
  font-size: 0.875rem;
  color: var(--secondary);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0;
}
.family-link:hover {
  color: var(--primary);
  text-decoration: underline;
}
.family-link.current {
  font-weight: 700;
  color: var(--primary);
}

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
  text-align: center;
  font-size: 0.825rem;
  color: var(--text-muted);
}

/* ==========================================================================
   토스트 알림
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: #0f172a;
  color: #ffffff;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: auto;
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
}
