  :root {
    --ink: #1a1a2e;
    --gold: #c9a84c;
    --gold-light: #e8d5a3;
    --crimson: #b8324a;
    --jade: #2d6a4f;
    --water: #264653;
    --earth: #8b6914;
    --fire: #c1121f;
    --wood: #40916c;
    --metal: #adb5bd;
    --bg: #f5f0e8;
    --bg-dark: #0d1117;
    --paper: #faf6ed;
  }

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

  body {
    font-family: 'Gowun Batang', serif;
    background: var(--bg);
    color: var(--ink);
    min-height: 100vh;
    overflow-x: hidden;
  }

  body.lang-en { font-family: 'Cormorant Garamond', serif; font-size: 17px; }
  .lang-en .header h1 { font-family: 'Playfair Display', serif; font-size: clamp(30px, 7vw, 52px); }
  .lang-en .form-title, .lang-en .saju-chart h3, .lang-en .results-title { font-family: 'Playfair Display', serif; }
  .lang-en .submit-btn { font-family: 'Playfair Display', serif; letter-spacing: 1px; }
  .lang-en .country-name { font-family: 'Playfair Display', serif; font-size: 24px; font-weight: 900; }

  .lang-toggle {
    position: fixed; top: 16px; right: 16px; z-index: 999;
    display: flex; background: var(--paper); border: 1.5px solid rgba(201,168,76,0.4);
    border-radius: 24px; overflow: hidden; box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  }
  .lang-btn {
    padding: 8px 16px; font-size: 14px; border: none; background: transparent;
    cursor: pointer; font-family: inherit; color: #888; transition: all 0.3s;
  }
  .lang-btn.active { background: var(--ink); color: #fff; }

  /* Background pattern */
  body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image:
      radial-gradient(circle at 20% 50%, rgba(201,168,76,0.06) 0%, transparent 50%),
      radial-gradient(circle at 80% 20%, rgba(184,50,74,0.04) 0%, transparent 50%),
      radial-gradient(circle at 50% 80%, rgba(45,106,79,0.04) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
  }

  .container {
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 24px;
  }

  /* Header */
  .header {
    text-align: center;
    margin-bottom: 50px;
    animation: fadeInDown 1s ease;
  }

  .header-hanja {
    font-family: 'Noto Serif KR', serif;
    font-size: 14px;
    letter-spacing: 12px;
    color: var(--gold);
    margin-bottom: 8px;
    opacity: 0.8;
  }

  .header h1 {
    font-family: 'Black Han Sans', sans-serif;
    font-size: clamp(36px, 8vw, 64px);
    color: var(--ink);
    line-height: 1.2;
    margin-bottom: 12px;
    background: linear-gradient(135deg, var(--ink) 0%, var(--crimson) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }

  .header p {
    font-size: 16px;
    color: #666;
    line-height: 1.8;
  }

  /* Decorative divider */
  .divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin: 32px 0;
  }

  .divider::before, .divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
  }

  .divider span {
    font-size: 20px;
    color: var(--gold);
  }

  /* Form Card */
  .form-card {
    background: var(--paper);
    border: 1px solid rgba(201,168,76,0.3);
    border-radius: 16px;
    padding: 40px;
    box-shadow:
      0 4px 30px rgba(0,0,0,0.06),
      inset 0 1px 0 rgba(255,255,255,0.8);
    animation: fadeInUp 0.8s ease 0.2s both;
  }

  .form-title {
    font-family: 'Noto Serif KR', serif;
    font-size: 22px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 32px;
    color: var(--ink);
  }

  .form-title small {
    display: block;
    font-size: 13px;
    font-weight: 400;
    color: #888;
    margin-top: 6px;
  }

  .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
  }

  .form-row.full {
    grid-template-columns: 1fr;
  }

  .form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .form-group label {
    font-size: 14px;
    font-weight: 700;
    color: var(--ink);
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .form-group label .element-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 400;
  }

  .form-group input, .form-group select {
    font-family: 'Gowun Batang', serif;
    font-size: 16px;
    padding: 14px 16px;
    border: 1.5px solid #ddd;
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
    transition: all 0.3s ease;
    outline: none;
  }

  .form-group input:focus, .form-group select:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(201,168,76,0.15);
  }

  .form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
  }

  /* Gender toggle */
  .gender-toggle {
    display: flex;
    gap: 12px;
  }

  .gender-btn {
    flex: 1;
    padding: 14px;
    border: 1.5px solid #ddd;
    border-radius: 10px;
    background: #fff;
    font-family: 'Gowun Batang', serif;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
  }

  .gender-btn:hover {
    border-color: var(--gold);
  }

  .gender-btn.active {
    border-color: var(--gold);
    background: linear-gradient(135deg, rgba(201,168,76,0.1), rgba(201,168,76,0.05));
    color: var(--earth);
    font-weight: 700;
  }

  /* Submit button */
  .submit-btn {
    width: 100%;
    margin-top: 28px;
    padding: 18px;
    font-family: 'Noto Serif KR', serif;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--ink) 0%, #2d2d4e 50%, var(--crimson) 100%);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
    letter-spacing: 2px;
  }

  .submit-btn::before {
    content: '';
    position: absolute;
    top: 0; left: -100%; width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
    transition: left 0.6s ease;
  }

  .submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(26,26,46,0.3);
  }

  .submit-btn:hover::before {
    left: 100%;
  }

  .submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
  }

  /* Loading */
  .loading-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(245,240,232,0.95);
    z-index: 100;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 24px;
  }

  .loading-overlay.active {
    display: flex;
  }

  .bagua-spinner {
    width: 80px; height: 80px;
    border: 3px solid var(--gold-light);
    border-top-color: var(--crimson);
    border-right-color: var(--gold);
    border-radius: 50%;
    animation: spin 1.5s linear infinite;
  }

  .loading-text {
    font-family: 'Noto Serif KR', serif;
    font-size: 18px;
    color: var(--ink);
    animation: pulse 1.5s ease infinite;
  }

  .loading-sub {
    font-size: 14px;
    color: #888;
  }

  /* Results */
  .results-section {
    display: none;
    animation: fadeInUp 0.8s ease;
  }

  .results-section.active {
    display: block;
  }

  .saju-chart {
    background: var(--paper);
    border: 1px solid rgba(201,168,76,0.3);
    border-radius: 16px;
    padding: 32px;
    margin-bottom: 28px;
    box-shadow: 0 4px 30px rgba(0,0,0,0.06);
  }

  .saju-chart h3 {
    font-family: 'Noto Serif KR', serif;
    font-size: 20px;
    text-align: center;
    margin-bottom: 24px;
  }

  .pillars-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 24px;
  }

  .pillar {
    text-align: center;
    padding: 16px 8px;
    border-radius: 12px;
    background: rgba(255,255,255,0.7);
    border: 1px solid rgba(201,168,76,0.2);
  }

  .pillar-label {
    font-size: 12px;
    color: #888;
    margin-bottom: 8px;
  }

  .pillar-hanja {
    font-family: 'Noto Serif KR', serif;
    font-size: 28px;
    font-weight: 900;
    line-height: 1.3;
  }

  .pillar-hangul {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
  }

  .pillar-meaning {
    font-size: 11px;
    color: #999;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed rgba(201,168,76,0.25);
    line-height: 1.5;
    word-break: keep-all;
  }

  .element-wood { color: var(--wood); }
  .element-fire { color: var(--fire); }
  .element-earth { color: var(--earth); }
  .element-metal { color: var(--metal); filter: brightness(0.6); }
  .element-water { color: var(--water); }

  .element-summary {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    padding-top: 16px;
    border-top: 1px solid rgba(201,168,76,0.2);
  }

  .element-tag {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    padding: 6px 14px;
    border-radius: 20px;
    background: rgba(255,255,255,0.8);
    border: 1px solid #eee;
  }

  .element-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
  }

  /* Country Result Card */
  .country-card {
    background: var(--paper);
    border: 1px solid rgba(201,168,76,0.3);
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: 0 4px 30px rgba(0,0,0,0.06);
    transition: all 0.4s ease;
    animation: fadeInUp 0.6s ease both;
  }

  .country-card:nth-child(2) { animation-delay: 0.1s; }
  .country-card:nth-child(3) { animation-delay: 0.2s; }

  .country-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.1);
  }

  .country-rank {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 28px 32px;
  }

  .rank-badge {
    width: 56px; height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Noto Serif KR', serif;
    font-size: 22px;
    font-weight: 900;
    color: #fff;
    flex-shrink: 0;
  }

  .rank-1 { background: linear-gradient(135deg, #c9a84c, #e8d5a3); }
  .rank-2 { background: linear-gradient(135deg, #8a8a8a, #bbb); }
  .rank-3 { background: linear-gradient(135deg, #b8324a, #d4687a); }

  .country-info {
    flex: 1;
  }

  .country-flag-name {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
  }

  .country-flag {
    font-size: 36px;
    line-height: 1;
  }

  .country-name {
    font-family: 'Black Han Sans', sans-serif;
    font-size: 26px;
    color: var(--ink);
  }

  .country-name-en {
    font-size: 13px;
    color: #999;
    font-family: 'Gowun Batang', serif;
  }

  .match-score {
    font-family: 'Noto Serif KR', serif;
    font-size: 28px;
    font-weight: 900;
    color: var(--crimson);
    text-align: right;
    flex-shrink: 0;
  }

  .match-score small {
    display: block;
    font-size: 12px;
    font-weight: 400;
    color: #888;
  }

  .country-details {
    padding: 0 32px 28px;
  }

  .detail-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 0;
    font-size: 15px;
    line-height: 1.7;
    color: #444;
  }

  .detail-row .icon {
    flex-shrink: 0;
    font-size: 16px;
    margin-top: 3px;
  }

  .element-bar {
    display: flex;
    gap: 4px;
    margin-top: 12px;
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
  }

  .element-bar div {
    border-radius: 3px;
    transition: width 0.6s ease;
  }

  /* Retry button */
  .retry-btn {
    display: block;
    margin: 40px auto 0;
    padding: 14px 36px;
    font-family: 'Gowun Batang', serif;
    font-size: 16px;
    background: transparent;
    border: 2px solid var(--gold);
    color: var(--gold);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
  }

  .retry-btn:hover {
    background: var(--gold);
    color: #fff;
  }

  /* SNS Share */
  .share-bar { display: flex; justify-content: center; gap: 10px; margin: 28px 0 8px; flex-wrap: wrap; }
  .share-btn {
    display: inline-flex; align-items: center; gap: 6px; padding: 10px 18px; border-radius: 24px;
    font-size: 13px; font-family: inherit; border: none; cursor: pointer; color: #fff;
    transition: all .3s; text-decoration: none;
  }
  .share-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 14px rgba(0,0,0,.2); }
  .share-btn.kakao { background: #FEE500; color: #3C1E1E; }
  .share-btn.twitter { background: #000; }
  .share-btn.facebook { background: #1877F2; }
  .share-btn.link-copy { background: #555; }
  .share-btn svg { width: 16px; height: 16px; fill: currentColor; flex-shrink: 0; }
  .share-label { font-size: 13px; color: #888; text-align: center; margin-bottom: 8px; }
  .toast {
    position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
    background: var(--ink); color: #fff; padding: 12px 28px; border-radius: 24px;
    font-size: 14px; z-index: 999; opacity: 0; transition: opacity .3s; pointer-events: none;
  }
  .toast.show { opacity: 1; }
  @keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
  }

  @keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
  }

  @keyframes spin {
    to { transform: rotate(360deg); }
  }

  @keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
  }

  /* ===== Footer ===== */
  .site-footer {
    text-align: center; padding: 40px 0 20px; font-size: 13px; color: #999;
    border-top: 1px solid rgba(201,168,76,.2); margin-top: 40px;
  }
  .footer-nav {
    display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; margin-bottom: 12px;
  }
  .footer-nav a { color: var(--gold); text-decoration: none; }
  .footer-nav a:hover { text-decoration: underline; }

  /* ===== Category Tabs ===== */
  .cat-tabs {
    display: none; flex-wrap: wrap; gap: 8px; justify-content: center;
    margin: 32px 0 4px; animation: fadeInUp 0.5s ease;
  }
  .cat-tabs.active { display: flex; }
  .cat-tab {
    padding: 10px 20px; border: 1.5px solid rgba(201,168,76,0.4); border-radius: 24px;
    background: var(--paper); font-family: 'Gowun Batang', serif; font-size: 14px;
    color: #888; cursor: pointer; transition: all 0.3s ease; white-space: nowrap;
  }
  .cat-tab:hover { border-color: var(--gold); color: var(--earth); }
  .cat-tab.active { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 700; }
  .lang-en .cat-tab { font-family: 'Cormorant Garamond', serif; font-size: 15px; }
  .rank-4 { background: linear-gradient(135deg, #5c9e6b, #7fc47a); }
  .rank-5 { background: linear-gradient(135deg, #5b7fad, #7f9fc7); }

  /* ===== Responsive: Tablet ===== */
  @media (max-width: 768px) {
    .container { padding: 28px 18px; }
    .header { margin-bottom: 36px; }
    .header h1 { font-size: clamp(28px, 9vw, 48px); }
    .header p { font-size: 14px; }
    .form-card { padding: 28px 22px; }
    .form-row { grid-template-columns: 1fr; gap: 14px; }
    .form-title { font-size: 20px; margin-bottom: 24px; }
    .pillars-grid { gap: 8px; }
    .pillar { padding: 12px 6px; }
    .pillar-hanja { font-size: 24px; }
    .pillar-label { font-size: 11px; }
    .pillar-meaning { font-size: 10px; }
    .country-rank { gap: 14px; padding: 22px 24px; }
    .country-name { font-size: 22px; }
    .country-flag { font-size: 30px; }
    .match-score { font-size: 24px; }
    .country-details { padding: 0 24px 22px; }
    .detail-row { font-size: 14px; }
    .lang-toggle { top: 12px; right: 12px; }
    .lang-btn { padding: 6px 14px; font-size: 13px; }
    .saju-chart { padding: 24px 18px; }
    .element-summary { gap: 10px; }
    .element-tag { font-size: 13px; padding: 5px 10px; }
    .submit-btn { font-size: 16px; padding: 16px; letter-spacing: 1px; }
  }

  /* ===== Responsive: Mobile ===== */
  @media (max-width: 480px) {
    .container { padding: 20px 14px; }
    .header { margin-bottom: 28px; }
    .header-hanja { font-size: 12px; letter-spacing: 8px; }
    .header h1 { font-size: clamp(24px, 10vw, 36px); }
    .header p { font-size: 13px; line-height: 1.7; }
    .header p br { display: none; }
    .form-card { padding: 22px 16px; }
    .form-title { font-size: 18px; margin-bottom: 20px; }
    .form-title small { font-size: 12px; }
    .form-group input, .form-group select { font-size: 15px; padding: 12px; }
    .form-group label { font-size: 13px; }
    .gender-toggle { gap: 8px; }
    .gender-btn { padding: 11px 8px; font-size: 14px; }
    .submit-btn { font-size: 15px; padding: 15px; letter-spacing: 1px; margin-top: 20px; }
    .divider { margin: 20px 0; }
    .saju-chart { padding: 20px 14px; }
    .saju-chart h3 { font-size: 17px; margin-bottom: 16px; }
    .pillars-grid { gap: 6px; }
    .pillar { padding: 10px 4px; border-radius: 10px; }
    .pillar-label { font-size: 10px; margin-bottom: 4px; }
    .pillar-hanja { font-size: 20px; }
    .pillar-hangul { font-size: 11px; }
    .pillar-meaning { font-size: 9px; margin-top: 5px; padding-top: 5px; }
    .element-summary { gap: 6px; padding-top: 12px; }
    .element-tag { font-size: 12px; padding: 4px 8px; gap: 4px; }
    .element-dot { width: 8px; height: 8px; }
    .results-title { font-size: 18px !important; margin-bottom: 16px !important; }
    .country-card { margin-bottom: 14px; border-radius: 14px; }
    .country-rank { flex-direction: column; text-align: center; padding: 20px 16px; gap: 12px; }
    .rank-badge { width: 44px; height: 44px; font-size: 18px; }
    .country-flag-name { justify-content: center; }
    .country-flag { font-size: 28px; }
    .country-name { font-size: 20px; }
    .lang-en .country-name { font-size: 18px; }
    .country-name-en { font-size: 12px; }
    .match-score { font-size: 24px; text-align: center; }
    .match-score small { font-size: 11px; }
    .country-details { padding: 0 16px 18px; }
    .detail-row { font-size: 13px; padding: 6px 0; gap: 6px; line-height: 1.6; }
    .detail-row .icon { font-size: 14px; }
    .element-bar { height: 5px; margin-top: 8px; }
    .retry-btn { font-size: 14px; padding: 12px 28px; margin-top: 28px; }
    .lang-toggle { top: 8px; right: 8px; }
    .lang-btn { padding: 6px 10px; font-size: 12px; }
    .loading-text { font-size: 15px; }
    .loading-sub { font-size: 13px; }
    .bagua-spinner { width: 60px; height: 60px; }
    .share-bar { gap: 8px; }
    .share-btn { padding: 9px 14px; font-size: 12px; }
    .cat-tab { padding: 8px 14px; font-size: 13px; }
  }

  /* ===== Responsive: Very Small ===== */
  @media (max-width: 360px) {
    .container { padding: 16px 10px; }
    .header h1 { font-size: 22px; }
    .form-card { padding: 18px 12px; }
    .gender-toggle { flex-direction: column; }
    .pillar-hanja { font-size: 18px; }
    .pillar-meaning { display: none; }
    .country-name { font-size: 18px; }
    .submit-btn { font-size: 14px; }
  }

.browse-all-link { display: inline-block; margin: 4px 0 20px; font-size: 13px; color: var(--gold); text-decoration: none; opacity: 0.8; transition: opacity .2s; letter-spacing: .02em; }
.browse-all-link:hover { opacity: 1; }

/* ===== 광고 슬롯 ===== */
.ad-slot { text-align: center; margin: 28px auto; overflow: hidden; max-width: 100%; }
.ad-slot ins { display: block; }
