/* ── Reset & Variables ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brand: #0EA5E9;
  --brand-dark: #0284C7;
  --brand-light: #E0F2FE;
  --bg: #F0F9FF;
  --surface: #FFFFFF;
  --surface2: #F0F9FF;
  --border: #BAE6FD;
  --text: #1A1A1A;
  --text-muted: #64748B;
  --safe-bg: #D1FAE5; --safe-color: #065F46;
  --caution-bg: #FEF3C7; --caution-color: #92400E;
  --banned-bg: #FEE2E2; --banned-color: #991B1B;
  --info-bg: #E0F2FE; --info-color: #0369A1;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 20px rgba(13,148,136,.10);
  --shadow-sm: 0 2px 8px rgba(0,0,0,.06);
  font-family: "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body { background: var(--bg); color: var(--text); min-height: 100dvh; overflow-x: hidden; font-size: 16px; line-height: 1.6; }
button { cursor: pointer; border: none; font-family: inherit; }
a { text-decoration: none; color: inherit; }

/* ── Layout ────────────────────────────────────────────── */
.layout-container {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 24px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}
@media (max-width: 800px) {
  .layout-container { grid-template-columns: 1fr; }
  .app-sidebar { display: none; }
}

/* ── Ad containers ─────────────────────────────────────── */
.ad-container { display: block; width: 100%; text-align: center; }
.top-ad { background: #f9f9f9; padding: 8px 0; border-bottom: 1px solid var(--border); }
.middle-ad { margin: 20px 0; }
.bottom-ad { margin-top: 24px; padding: 16px 0; border-top: 1px solid var(--border); }

/* ── Header ────────────────────────────────────────────── */
.main-header {
  background: var(--brand);
  padding: 20px 20px 24px;
  position: relative;
  overflow: hidden;
}
.main-header::before {
  content: '';
  position: absolute; top: -20px; right: -20px;
  width: 120px; height: 120px;
  border-radius: 50%; background: rgba(255,255,255,0.1);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; max-width: 1100px; margin: 0 auto; }
.header-logo { display: flex; align-items: center; gap: 12px; }
.header-logo-icon { width: 48px; height: 48px; background: rgba(255,255,255,0.2); border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 24px; }
.header-logo h1 { color: #fff; font-size: 20px; font-weight: 800; line-height: 1.2; }
.header-logo h1 a { color: inherit; }
.header-logo p { color: rgba(255,255,255,0.8); font-size: 12px; }
.header-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.header-tag { background: rgba(255,255,255,0.2); color: #fff; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 99px; }
.btn-share { background: rgba(255,255,255,0.2); color: #fff; font-size: 13px; font-weight: 600; padding: 8px 14px; border-radius: 99px; border: 1px solid rgba(255,255,255,0.3); white-space: nowrap; }
.btn-share:hover { background: rgba(255,255,255,0.3); }

/* ── App Card ──────────────────────────────────────────── */
.app-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }

/* ── Home Screen ───────────────────────────────────────── */
.home-inner { padding: 20px; display: flex; flex-direction: column; gap: 16px; }

/* ── Search ────────────────────────────────────────────── */
.search-wrap { }
.search-box {
  background: var(--surface); border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); display: flex; align-items: center;
  padding: 0 16px; box-shadow: var(--shadow-sm);
}
.search-icon { font-size: 18px; margin-right: 10px; color: var(--text-muted); }
#search-input {
  flex: 1; border: none; background: transparent;
  font-size: 15px; padding: 14px 0; color: var(--text); font-family: inherit;
  outline: none;
}
.search-clear { background: none; color: var(--text-muted); font-size: 20px; padding: 0 4px; line-height: 1; }

/* ── Quick Buttons ─────────────────────────────────────── */
.tip-card { background: var(--surface); border-radius: var(--radius-sm); padding: 16px; border: 1px solid var(--border); }
.tip-title { font-size: 13px; font-weight: 700; color: var(--brand); margin-bottom: 12px; }
.quick-btn {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; background: var(--bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 14px; margin-bottom: 8px;
  font-size: 14px; font-weight: 600; color: var(--text); text-align: left;
}
.quick-btn:last-child { margin-bottom: 0; }
.quick-btn span { font-size: 12px; color: var(--text-muted); font-weight: 400; }
.quick-btn:hover { background: var(--brand-light); }

/* ── Legend ────────────────────────────────────────────── */
.legend-card { background: var(--surface); border-radius: var(--radius-sm); padding: 16px; border: 1px solid var(--border); }
.legend-title { font-size: 13px; font-weight: 700; color: var(--text-muted); margin-bottom: 12px; }
.legend-row { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; font-size: 13px; color: var(--text-muted); }
.legend-row:last-of-type { margin-bottom: 0; }
.legend-note { font-size: 11px; color: var(--text-muted); margin-top: 12px; line-height: 1.5; }
.badge { font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 6px; white-space: nowrap; }
.badge.safe { background: var(--safe-bg); color: var(--safe-color); }
.badge.caution { background: var(--caution-bg); color: var(--caution-color); }
.badge.banned { background: var(--banned-bg); color: var(--banned-color); }
.badge.info { background: var(--info-bg); color: var(--info-color); }

/* ── Result List ───────────────────────────────────────── */
.result-count { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }
.result-item {
  display: block; width: 100%; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px 16px; margin-bottom: 10px; text-align: left;
  box-shadow: var(--shadow-sm); cursor: pointer;
}
.result-item:hover { border-color: var(--brand); background: var(--bg); }
.result-item-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.result-item-name { font-size: 15px; font-weight: 700; color: var(--text); }
.result-item-name-en { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.result-item-summary { font-size: 13px; color: var(--text); line-height: 1.4; }

/* ── Empty State ───────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-title { font-size: 15px; font-weight: 700; margin-bottom: 6px; color: var(--text); }
.empty-desc { font-size: 13px; line-height: 1.6; }

/* ── Detail Screen ─────────────────────────────────────── */
#detail-screen { }
.detail-header { padding: 16px 20px; }
.back-btn { background: none; font-size: 14px; font-weight: 700; padding: 0; margin-bottom: 12px; display: flex; align-items: center; gap: 4px; }
.detail-title-row { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.detail-names { flex: 1; }
.detail-names h2 { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.detail-names p { font-size: 13px; opacity: 0.8; }
.detail-badge { font-size: 14px; font-weight: 700; padding: 8px 14px; border-radius: 12px; color: #fff; white-space: nowrap; }
.detail-summary { font-size: 14px; font-weight: 600; background: rgba(255,255,255,0.6); border-radius: 10px; padding: 8px 12px; line-height: 1.5; }

.detail-body { padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.category-tag { display: inline-block; background: var(--brand-light); border-radius: 10px; padding: 6px 14px; font-size: 13px; color: var(--brand-dark); font-weight: 600; }

.detail-card { background: var(--surface); border-radius: var(--radius-sm); padding: 18px; border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.detail-card h3 { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 10px; }
.detail-card p { font-size: 14px; color: var(--text); line-height: 1.7; }

.tip-section.banned { background: #FEF2F2; border-color: #FECACA; }
.tip-section.tip { background: #FFF7ED; border-color: #FED7AA; }
.tip-section h3 { }
.tip-section p { }

.source-card p { font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.source-note { font-size: 11px; margin-top: 8px; }

.btn-row { display: flex; flex-direction: column; gap: 10px; }
.btn-share-result {
  width: 100%; padding: 14px; border-radius: var(--radius);
  background: var(--brand); color: #fff; font-size: 15px; font-weight: 700;
}
.btn-share-result:hover { background: var(--brand-dark); }
.btn-back-search {
  width: 100%; padding: 14px; border-radius: var(--radius);
  background: var(--surface); color: var(--text); font-size: 15px; font-weight: 600;
  border: 1.5px solid var(--border);
}
.btn-back-search:hover { border-color: var(--brand); }

/* ── Guide Section ─────────────────────────────────────── */
.guide-section { margin-top: 24px; }
.guide-section h2, .faq-section h2 { font-size: 18px; font-weight: 800; color: var(--text); margin-bottom: 16px; }
.guide-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (max-width: 500px) { .guide-grid { grid-template-columns: 1fr; } }
.guide-card { background: var(--surface); border-radius: var(--radius-sm); padding: 16px; border: 1px solid var(--border); }
.guide-card h3 { font-size: 14px; font-weight: 700; margin-bottom: 8px; color: var(--text); }
.guide-card p { font-size: 13px; color: var(--text-muted); line-height: 1.6; }
.guide-card strong { color: var(--text); }

/* ── FAQ ───────────────────────────────────────────────── */
.faq-section { margin-top: 24px; }
.faq-item { background: var(--surface); border-radius: var(--radius-sm); padding: 16px; margin-bottom: 10px; border: 1px solid var(--border); }
.faq-q { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.faq-a { font-size: 13px; color: var(--text-muted); line-height: 1.6; }

/* ── Sidebar ───────────────────────────────────────────── */
.app-sidebar { position: sticky; top: 24px; max-height: calc(100vh - 48px); overflow-y: auto; scrollbar-width: none; }
.app-sidebar::-webkit-scrollbar { display: none; }
.sidebar-card { background: var(--surface); border-radius: var(--radius-sm); padding: 16px; margin-bottom: 16px; box-shadow: var(--shadow-sm); border: 1px solid var(--border); }
.sidebar-card h3 { font-size: 14px; font-weight: 700; margin-bottom: 12px; padding-left: 8px; border-left: 3px solid var(--brand); color: var(--text); }
.sidebar-list { list-style: none; padding: 0; margin: 0; }
.sidebar-list li { margin-bottom: 6px; }
.sidebar-list a { display: flex; align-items: flex-start; text-decoration: none; color: var(--text); padding: 7px 8px; border-radius: 8px; transition: background .15s; }
.sidebar-list a:hover { background: var(--brand-light); }
.link-icon { margin-right: 8px; font-size: 15px; flex-shrink: 0; margin-top: 1px; }
.link-content { flex: 1; min-width: 0; }
.link-title { display: block; font-size: 13px; font-weight: 600; color: var(--brand); margin-bottom: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-desc { display: block; font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Footer ────────────────────────────────────────────── */
.main-footer { text-align: center; padding: 20px; font-size: 12px; color: var(--text-muted); border-top: 1px solid var(--border); margin-top: 24px; }

/* ── Toast ─────────────────────────────────────────────── */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(40px); background: #1A1A1A; color: #fff; padding: 10px 20px; border-radius: 99px; font-size: 14px; font-weight: 600; opacity: 0; transition: all .3s; z-index: 999; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
