/* ================================================================
   12띠별 운세 — Red Theme (#DC2626 / #991B1B)
   ================================================================ */

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

:root {
  --brand:       #DC2626;
  --brand-dark:  #991B1B;
  --brand-light: #FEE2E2;
  --bg:          #FEF2F2;
  --surface:     #FFFFFF;
  --surface2:    #FEF2F2;
  --border:      #E5E7EB;
  --text:        #1A1A1A;
  --text-muted:  #6B7280;
  --radius:      16px;
  --radius-sm:   10px;
  --shadow:      0 4px 20px rgba(0,0,0,.08);
  --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; background: none; }
a { text-decoration: none; color: inherit; }
input, select, textarea { font-family: 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; padding: 16px 12px 40px; }
  .app-sidebar { display: none; }
}
@media (max-width: 520px) {
  .hero-title { font-size: 20px; }
  .hero-desc { font-size: 13px; }
  .result-zname { font-size: 26px; }
  .result-score { font-size: 40px; }
}

/* ── Ad ─── */
.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: 16px 0; }
.bottom-ad { margin-top: 24px; padding: 16px 0; border-top: 1px solid var(--border); }

/* ── Header ─── */
.main-header {
  background: linear-gradient(135deg, #991B1B 0%, #DC2626 60%, #F87171 100%);
  padding: 16px 16px 28px; position: relative; overflow: hidden;
}
.main-header::before { content:''; position:absolute; top:-40px; right:-40px; width:160px; height:160px; border-radius:50%; background:rgba(255,255,255,.08); }
.main-header::after { content:''; position:absolute; bottom:-30px; left:20px; width:100px; height:100px; border-radius:50%; background:rgba(255,255,255,.06); }
.header-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  position: relative; z-index: 1;
}
.header-logo { display: flex; align-items: center; gap: 12px; }
.header-logo-icon {
  font-size: 28px; background: rgba(255,255,255,.2); border-radius: 12px;
  width: 48px; height: 48px; display: flex; align-items: center; justify-content: center;
}
.header-logo h1 { font-size: 22px; font-weight: 800; color: #fff; letter-spacing: -.5px; }
.header-logo h1 a { color: #fff; }
.header-logo p { font-size: 13px; color: rgba(255,255,255,.8); margin-top: 2px; }
.btn-share {
  font-size: 13px; color: rgba(255,255,255,.9);
  padding: 7px 14px; border-radius: 20px;
  background: rgba(255,255,255,.2); border: 1.5px solid rgba(255,255,255,.4);
  font-weight: 600; position: relative; z-index: 1; transition: background .15s;
}
.btn-share:hover { background: rgba(255,255,255,.3); }
.header-hero { max-width: 1100px; margin: 16px auto 0; position: relative; z-index: 1; }
.hero-title { font-size: 26px; font-weight: 900; color: #fff; letter-spacing: -.5px; }
.hero-desc { font-size: 15px; color: rgba(255,255,255,.85); margin-top: 4px; }

/* ── App Card ─── */
.app-card {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; margin-bottom: 16px;
}
.card-header {
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.card-header-icon { font-size: 18px; }
.card-header-title { font-size: 15px; font-weight: 700; }
.card-body { padding: 20px; }

/* ── Screen ─── */
.screen { display: none; }
.screen.active { display: block; }

/* ── Form ─── */
.field-row { display: flex; gap: 8px; margin-bottom: 12px; align-items: flex-end; }
.field { flex: 1; }
.field label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; font-weight: 600; padding-left: 2px; }
.field input {
  width: 100%; padding: 14px 14px;
  border: 2px solid var(--border); border-radius: 12px;
  font-size: 16px; font-weight: 700; outline: none; background: #fff;
  transition: border-color .2s;
}
.field input:focus { border-color: var(--brand); }
.field-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; padding-left: 2px; }

/* ── Buttons ─── */
.btn-primary {
  display: block; width: 100%; padding: 15px;
  background: var(--brand); color: #fff;
  border-radius: var(--radius-sm); font-size: 16px; font-weight: 800;
  box-shadow: 0 4px 16px rgba(220,38,38,.3); transition: opacity .15s, transform .1s;
}
.btn-primary:hover { opacity: .9; transform: translateY(-1px); }
.btn-primary:disabled { opacity: .4; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-share-result {
  display: block; width: 100%; padding: 14px; margin-top: 8px;
  background: var(--brand); color: #fff;
  border-radius: var(--radius-sm); font-size: 15px; font-weight: 700;
  transition: background .15s;
}
.btn-share-result:hover { background: var(--brand-dark); }
.btn-row { display: flex; gap: 8px; margin-top: 12px; }
.btn-row button { flex: 1; }
.btn-secondary {
  padding: 13px; border-radius: var(--radius-sm);
  background: #fff; color: var(--brand); border: 1.5px solid var(--brand);
  font-size: 14px; font-weight: 700;
}
.btn-secondary:hover { background: var(--brand-light); }

/* ── Result Hero ─── */
.result-hero {
  padding: 28px 20px; color: #fff; border-radius: var(--radius);
  margin-bottom: 16px; box-shadow: var(--shadow); text-align: center;
}
.result-emoji { font-size: 60px; line-height: 1; }
.result-zname { font-size: 32px; font-weight: 900; margin-top: 8px; letter-spacing: -.5px; }
.result-date { font-size: 13px; opacity: .85; margin-top: 4px; }
.result-badges { display: flex; justify-content: center; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.result-grade {
  display: inline-block; padding: 6px 18px; border-radius: 99px;
  font-size: 18px; font-weight: 900;
  background: rgba(255,255,255,.25); border: 1.5px solid rgba(255,255,255,.5);
}
.result-grade[data-grade="길"] { background: #fff; color: #DC2626; }
.result-grade[data-grade="중"] { background: #fff; color: #D97706; }
.result-grade[data-grade="흉"] { background: #fff; color: #6D28D9; }
.result-reltype {
  display: inline-block; padding: 6px 14px; border-radius: 99px;
  font-size: 13px; font-weight: 700;
  background: rgba(255,255,255,.2); border: 1.5px solid rgba(255,255,255,.4);
}
.result-score { font-size: 52px; font-weight: 900; margin-top: 10px; letter-spacing: -1px; }

.spring-advice {
  background: #FFFBEB; border: 1px solid #FDE68A; color: #92400E;
  padding: 10px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 14px; line-height: 1.6;
}

/* ── Category ─── */
.cat-row { padding: 12px 0; border-top: 1px solid #f3f4f6; }
.cat-row:first-child { border-top: none; padding-top: 0; }
.cat-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.cat-emoji { font-size: 18px; }
.cat-label { font-size: 14px; font-weight: 700; color: #333; flex: 1; }
.cat-grade {
  display: inline-block; padding: 3px 10px; border-radius: 99px;
  font-size: 12px; font-weight: 700;
}
.cat-grade[data-grade="길"] { background: #FEE2E2; color: #991B1B; }
.cat-grade[data-grade="중"] { background: #FEF3C7; color: #92400E; }
.cat-grade[data-grade="흉"] { background: #EDE9FE; color: #5B21B6; }
.cat-text { font-size: 14px; color: #374151; line-height: 1.75; padding-left: 26px; word-break: keep-all; }

/* ── Lucky ─── */
.lucky-row { display: flex; justify-content: space-between; padding: 10px 0; border-top: 1px solid #f3f4f6; }
.lucky-row:first-child { border-top: none; padding-top: 0; }
.lucky-key { font-size: 13px; color: #888; }
.lucky-val { font-size: 14px; font-weight: 700; color: #333; }
.lucky-lotto { margin-top: 14px; padding-top: 14px; border-top: 1px solid #f3f4f6; }
.lotto-label { font-size: 13px; color: #888; margin-bottom: 10px; }
.lotto-balls { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.lotto-ball {
  width: 42px; height: 42px; border-radius: 50%;
  background: linear-gradient(135deg, #FEE2E2 0%, #FCA5A5 100%);
  color: #991B1B; font-size: 15px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.08);
}
.lotto-ball.lucky {
  background: linear-gradient(135deg, #DC2626 0%, #991B1B 100%);
  color: #fff; transform: scale(1.08);
}
.lucky-match { margin-top: 14px; padding-top: 14px; border-top: 1px solid #f3f4f6; }
.match-row { display: flex; justify-content: space-between; padding: 8px 0; }
.match-label { font-size: 13px; color: #888; }
.match-value { font-size: 14px; font-weight: 700; color: #333; }

/* ── Tomorrow peek ─── */
.tomorrow-peek {
  background: var(--surface2); border: 1px dashed var(--brand-light);
  border-radius: 10px; padding: 12px 14px; margin-top: 12px;
}
.peek-label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.peek-value { font-size: 14px; color: #333; }
.peek-value [data-grade="길"] { color: #DC2626; }
.peek-value [data-grade="중"] { color: #D97706; }
.peek-value [data-grade="흉"] { color: #6D28D9; }

/* ── Info Card ─── */
.info-card {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 16px;
}
.info-card h2 { font-size: 16px; font-weight: 800; margin-bottom: 12px; }
.info-card p { font-size: 14px; color: #374151; line-height: 1.75; margin-bottom: 8px; }

/* ── Popular Tags ─── */
.popular-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; align-items: center; }
.tag-label { font-size: 12px; color: var(--text-muted); margin-right: 4px; width: 100%; margin-bottom: 2px; }
.tag {
  display: inline-block; padding: 6px 12px; border-radius: 99px;
  background: var(--brand-light); color: var(--brand-dark);
  font-size: 13px; font-weight: 600; transition: background .15s;
}
.tag:hover { background: #FECACA; }

/* ── Sidebar ─── */
.app-sidebar {
  position: sticky; top: 24px;
  max-height: calc(100vh - 48px); overflow-y: auto;
  scrollbar-width: none; -ms-overflow-style: 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 {
  border-top: 1px solid var(--border); padding: 20px;
  text-align: center; font-size: 12px; color: var(--text-muted);
}

/* ── Share Toast ─── */
.share-toast {
  position: fixed; bottom: 80px; left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: #1A1F36; color: #fff;
  padding: 12px 22px; border-radius: 99px;
  font-size: 14px; font-weight: 600; white-space: nowrap;
  opacity: 0; transition: opacity .2s, transform .2s;
  z-index: 9999; box-shadow: 0 4px 20px rgba(0,0,0,.25); pointer-events: none;
}
.share-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Random Example Links (SEO) ─── */
.example-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; margin: 6px 0;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 10px; transition: background .15s;
  text-decoration: none; color: var(--text);
}
.example-link:hover { background: var(--brand-light); }
.ex-icon { font-size: 20px; flex-shrink: 0; }
.ex-text { display: flex; flex-direction: column; min-width: 0; }
.ex-profile { font-size: 14px; font-weight: 700; color: var(--brand-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ex-detail { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
