:root {
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #1e293b;
  --text-light: #64748b;
  --border: #e2e8f0;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --accent-personality: #8b5cf6;
  --accent-health: #22c55e;
  --accent-finance: #3b82f6;
  --accent-life: #10b981;
  --accent-education: #f97316;
  --selected-bg: #e0e7ff;
  --selected-border: #6366f1;
  --radius: 12px;
  --shadow: 0 2px 8px rgba(0,0,0,.06);
  --max-width: 960px;
}

[data-theme="dark"] {
  --bg: #0f172a; --card: #1e293b; --text: #f1f5f9; --text-light: #94a3b8;
  --border: #334155; --shadow: 0 2px 8px rgba(0,0,0,.3);
  --primary: #818cf8; --primary-hover: #6366f1;
  --selected-bg: #312e81; --selected-border: #818cf8;
}
[data-theme="navy"] {
  --bg: #0c1222; --card: #162032; --text: #e2e8f0; --text-light: #8892a8;
  --border: #253040; --shadow: 0 2px 8px rgba(0,0,0,.3);
  --primary: #6366f1; --primary-hover: #4f46e5;
  --selected-bg: #1e1b4b; --selected-border: #818cf8;
}
[data-theme="green"] {
  --bg: #f0fdf4; --card: #fff; --text: #14532d; --text-light: #166534;
  --border: #bbf7d0; --shadow: 0 2px 8px rgba(0,0,0,.04);
  --primary: #16a34a; --primary-hover: #15803d;
  --selected-bg: #dcfce7; --selected-border: #16a34a;
}
[data-theme="warm"] {
  --bg: #fffbeb; --card: #fff; --text: #451a03; --text-light: #92400e;
  --border: #fde68a; --shadow: 0 2px 8px rgba(0,0,0,.04);
  --primary: #d97706; --primary-hover: #b45309;
  --selected-bg: #fef3c7; --selected-border: #d97706;
}
[data-theme="purple"] {
  --bg: #faf5ff; --card: #fff; --text: #3b0764; --text-light: #6b21a8;
  --border: #e9d5ff; --shadow: 0 2px 8px rgba(0,0,0,.04);
  --primary: #7c3aed; --primary-hover: #6d28d9;
  --selected-bg: #ede9fe; --selected-border: #7c3aed;
}
[data-theme="rose"] {
  --bg: #fff1f2; --card: #fff; --text: #4c0519; --text-light: #9f1239;
  --border: #fecdd3; --shadow: 0 2px 8px rgba(0,0,0,.04);
  --primary: #e11d48; --primary-hover: #be123c;
  --selected-bg: #ffe4e6; --selected-border: #e11d48;
}

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

html { font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; line-height: 1.6; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }

body { min-height: 100vh; display: flex; flex-direction: column; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; }

h1 { font-size: 1.8rem; font-weight: 800; line-height: 1.3; }
h2 { font-size: 1.3rem; font-weight: 700; margin: 24px 0 12px; }
h3 { font-size: 1.1rem; font-weight: 600; }

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 16px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 12px 24px; border: none; border-radius: 8px;
  font-size: 1rem; font-weight: 600; cursor: pointer;
  transition: all .2s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); text-decoration: none; }
.btn-outline { background: var(--card); border: 2px solid var(--border); color: var(--text); display:block; }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; background: var(--selected-bg); }

/* 선택 상태 강화 (select, input) */
select, input[type="text"], input[type="number"], input[type="password"], input[type="date"] {
  background: var(--card); color: var(--text); border: 2px solid var(--border);
}
select:focus, input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(99,102,241,.15); }

/* 버튼 기본 */
button { color: var(--text); }

/* ===== 그리드 ===== */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 48px;
}

/* ===== 모바일 반응형 ===== */
@media (max-width: 768px) {
  h1 { font-size: 1.4rem !important; }
  h2 { font-size: 1.1rem !important; }
  h3 { font-size: 1rem !important; }
  .container { padding: 0 12px; }
  .tool-grid { grid-template-columns: 1fr !important; }
}

@media (max-width: 480px) {
  h1 { font-size: 1.2rem !important; }
  body { font-size: .93rem; }
  .btn { padding: 10px 16px; font-size: .9rem; }
  .btn-outline { padding: 10px !important; font-size: .85rem !important; }
  .share-bar { justify-content: center; }
  .share-btn { font-size: .78rem !important; padding: 6px 10px !important; }
}
