@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@600;700;800&display=swap');

:root {
  --bg: #0b1420;
  --bg-2: #0e1c2b;
  --bg-elevated: #142433;
  --bg-elevated-2: #1c3245;
  --border: #2b4256;
  --text: #eef3f6;
  --text-dim: #93a7b8;
  --accent: #d7a24e;
  --accent-strong: #f3c877;
  --accent-2: #4fa593;
  --accent-2-strong: #6fc4b1;
  --danger: #e2695c;
  --ok: #5fc283;
  --food: #dd9452;
  --wood: #7fae6b;
  --stone: #9aa8b8;
  --special: #6fa0d6;
  --radius: 12px;
  --max-width: 1120px;
  --shadow: 0 10px 30px rgba(0,0,0,0.35);
}

:root[data-theme="light"] {
  --bg: #f2e9d8;
  --bg-2: #ece0c8;
  --bg-elevated: #fffdf8;
  --bg-elevated-2: #f2e8d2;
  --border: #ddceac;
  --text: #2a2013;
  --text-dim: #71624a;
  --accent: #9a6a1e;
  --accent-strong: #7a5314;
  --accent-2: #2f7d6f;
  --accent-2-strong: #1f5c51;
  --danger: #b8382a;
  --ok: #2f8f4d;
  --food: #a35a17;
  --wood: #47702f;
  --stone: #5f6c78;
  --special: #2f5f92;
  --shadow: 0 10px 24px rgba(90,70,30,0.12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  color: var(--text);
  font-family: -apple-system, "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo", Roboto, sans-serif;
  line-height: 1.6;
}

body {
  background:
    radial-gradient(ellipse 900px 500px at 15% -10%, color-mix(in srgb, var(--accent-2) 14%, transparent), transparent),
    radial-gradient(ellipse 800px 500px at 100% 0%, color-mix(in srgb, var(--accent) 12%, transparent), transparent),
    var(--bg);
  background-attachment: fixed;
}

a { color: var(--accent-2-strong); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, .brand-title {
  font-family: 'Cinzel', 'Malgun Gothic', serif;
  letter-spacing: 0.01em;
}

/* ---------- 헤더 / 내비게이션 ---------- */
.site-header {
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #101f2c, #0b1420);
  position: sticky;
  top: 0;
  z-index: 40;
}
:root[data-theme="light"] .site-header {
  background: linear-gradient(180deg, #241a0d, #1a130a);
  border-bottom-color: #3a2a14;
}

.site-header .inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}
.brand .brand-icon {
  font-size: 1.5rem;
  filter: drop-shadow(0 0 6px rgba(215,162,78,0.5));
}
.brand-title {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--accent-strong);
  line-height: 1.15;
}
.brand-title small { display: block; font-family: -apple-system, sans-serif; font-weight: 400; font-size: 0.66rem; color: #b9c3cc; letter-spacing: 0; }

nav.main-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 0.88rem;
  flex-wrap: wrap;
}
nav.main-nav > a {
  color: #c7d2da;
  padding: 8px 12px;
  border-radius: 8px;
  white-space: nowrap;
}
nav.main-nav > a:hover { background: rgba(255,255,255,0.08); color: #fff; text-decoration: none; }
nav.main-nav > a.active { background: rgba(215,162,78,0.16); color: var(--accent-strong); }

.nav-dropdown { position: relative; }
.nav-dropdown > summary {
  list-style: none;
  cursor: pointer;
  color: #c7d2da;
  padding: 8px 12px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  user-select: none;
}
.nav-dropdown > summary::-webkit-details-marker { display: none; }
.nav-dropdown > summary::after { content: '▾'; font-size: 0.65em; opacity: 0.7; }
.nav-dropdown > summary:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-dropdown.has-active > summary { color: var(--accent-strong); }
.nav-dropdown[open] > summary { background: rgba(255,255,255,0.1); color: #fff; }

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 220px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 50;
}
.dropdown-menu a {
  color: var(--text);
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 0.87rem;
  white-space: nowrap;
}
.dropdown-menu a:hover { background: var(--bg-elevated-2); text-decoration: none; }
.dropdown-menu a.active { color: var(--accent-strong); font-weight: 600; }

.theme-toggle {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--text);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  margin-left: auto;
}
.theme-toggle:hover { border-color: var(--accent); }

.lang-switch {
  width: auto;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.82rem;
  cursor: pointer;
  flex-shrink: 0;
}
.lang-switch:hover { border-color: var(--accent); }
.lang-switch option { color: #1c2430; }

.i18n-loading {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 35;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 1.1rem;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.i18n-loading.active { opacity: 1; animation: i18n-spin 1.2s linear infinite; }
@keyframes i18n-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ---------- 레이아웃 ---------- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 28px 20px 72px;
}

h1 { font-size: 1.6rem; margin: 0 0 6px; }
h1 .icon { margin-right: 8px; }
.page-desc { color: var(--text-dim); margin: 0 0 22px; font-size: 0.95rem; max-width: 68ch; }

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}

.section-label {
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: var(--accent-2-strong);
  font-weight: 700;
  margin: 32px 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-label::before { content: ''; width: 3px; height: 14px; background: var(--accent); border-radius: 2px; }

/* ---------- 홈 히어로 ---------- */
.hero {
  position: relative;
  border-radius: 18px;
  padding: 40px 32px;
  margin-bottom: 32px;
  overflow: hidden;
  background:
    radial-gradient(ellipse 500px 260px at 90% 0%, color-mix(in srgb, var(--accent) 30%, transparent), transparent),
    radial-gradient(ellipse 500px 300px at 0% 100%, color-mix(in srgb, var(--accent-2) 24%, transparent), transparent),
    var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.hero h1 { font-size: 2rem; margin-bottom: 10px; }
.hero .page-desc { font-size: 1.02rem; max-width: 62ch; }
.hero .hero-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }

.grid-nav {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}
.nav-tile {
  display: block;
  position: relative;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 18px 18px 52px;
  color: var(--text);
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.nav-tile::before {
  content: attr(data-icon);
  position: absolute;
  left: 14px;
  top: 16px;
  font-size: 1.4rem;
}
.nav-tile:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-3px); box-shadow: var(--shadow); }
.nav-tile .tile-title { font-weight: 700; color: var(--accent-strong); margin-bottom: 4px; }
.nav-tile .tile-desc { font-size: 0.83rem; color: var(--text-dim); }

/* ---------- 폼 ---------- */
label { display: block; font-size: 0.82rem; color: var(--text-dim); margin-bottom: 4px; }
select, input[type=number], input[type=text], input[type=password], textarea {
  background: var(--bg-elevated-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 0.95rem;
  width: 100%;
  font-family: inherit;
}
select:focus, input:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 1px; }
.field-row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.field { flex: 1; min-width: 140px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: #1a1204;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
}
.btn:hover { background: var(--accent-strong); }
.btn.btn-outline {
  background: var(--bg-elevated-2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn.btn-outline:hover { border-color: var(--accent); }
.btn.btn-danger { background: transparent; color: var(--danger); }

/* ---------- 표 ---------- */
table { border-collapse: collapse; width: 100%; font-size: 0.88rem; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
th { color: var(--text-dim); font-weight: 700; font-size: 0.76rem; text-transform: uppercase; letter-spacing: .04em; background: var(--bg-elevated-2); }
tr:hover td { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); }
.table-wrap table { border: none; }
.table-wrap tr:last-child td { border-bottom: none; }

.res-food { color: var(--food); font-weight: 600; }
.res-wood { color: var(--wood); font-weight: 600; }
.res-stone { color: var(--stone); font-weight: 600; }
.res-special { color: var(--special); font-weight: 600; }

.stat-row { display: flex; gap: 14px; flex-wrap: wrap; margin: 16px 0; }
.stat-box {
  background: var(--bg-elevated-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px 18px;
  min-width: 150px;
  flex: 1;
}
.stat-box .stat-label { font-size: 0.76rem; color: var(--text-dim); margin-bottom: 4px; }
.stat-box .stat-value { font-size: 1.4rem; font-weight: 700; font-family: 'Cinzel', serif; }

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}
.badge-ok { background: color-mix(in srgb, var(--ok) 20%, transparent); color: var(--ok); }
.badge-danger { background: color-mix(in srgb, var(--danger) 20%, transparent); color: var(--danger); }
.badge-legendary { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent-strong); }
.badge-epic { background: color-mix(in srgb, var(--special) 22%, transparent); color: var(--special); }
.badge-rare { background: color-mix(in srgb, var(--stone) 22%, transparent); color: var(--stone); }
.badge-pending { background: color-mix(in srgb, var(--text-dim) 22%, transparent); color: var(--text-dim); }

.status-msg { color: var(--text-dim); font-size: 0.88rem; padding: 10px 0; }
.status-msg.error { color: var(--danger); }

.search-box { margin-bottom: 14px; }

/* ---------- 방명록 ---------- */
.guestbook-entry {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  background: var(--bg-elevated);
}
.guestbook-entry .gb-meta { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 6px; }
.guestbook-entry .gb-desc { margin: 0; }

/* ---------- 푸터 ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 22px 20px;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.82rem;
}
.site-footer a { color: var(--text-dim); text-decoration: underline; }
.site-footer .footer-links { margin-top: 6px; }
.site-footer .footer-links a { margin: 0 8px; color: var(--accent-2-strong); text-decoration: none; }
.site-footer .footer-links a:hover { text-decoration: underline; }

.source-note {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 10px;
}

.report-fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 30;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: #1a1204;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 10px 16px;
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.35);
  text-decoration: none;
}
.report-fab:hover { background: var(--accent-strong); text-decoration: none; }

@media (max-width: 640px) {
  .site-header .inner { flex-wrap: wrap; }
  nav.main-nav { order: 3; width: 100%; }
  .dropdown-menu { position: static; box-shadow: none; margin-top: 4px; border: none; padding-left: 10px; }
  .report-fab span { display: none; }
  .report-fab { padding: 12px; }
  .hero { padding: 28px 20px; }
  .hero h1 { font-size: 1.5rem; }
}

/* ---------- 자원 요약 카드 (총 필요 자원 + 보유량 입력) ---------- */
.resource-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin: 16px 0;
}
@media (min-width: 700px) {
  .resource-grid { grid-template-columns: repeat(var(--res-cols, 3), 1fr); }
}
.resource-card {
  background: var(--bg-elevated-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: opacity .3s ease;
}
.resource-card.fading { opacity: 0.35; }
.resource-card .rc-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-weight: 700; }
.resource-card .rc-icon { font-size: 1.3rem; }
.resource-card .rc-need { font-size: 1.3rem; font-weight: 700; font-family: 'Cinzel', serif; margin-bottom: 10px; }
.resource-card label { margin-top: 8px; }
.resource-card .rc-status { margin-top: 8px; font-weight: 700; font-size: 0.88rem; }
.resource-card .rc-status.short { color: var(--danger); }
.resource-card .rc-status.enough { color: var(--ok); }

.resource-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-elevated);
  border: 1px dashed var(--accent);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-top: 4px;
}
.resource-total .rt-value { font-size: 1.5rem; font-weight: 700; font-family: 'Cinzel', serif; color: var(--accent-strong); transition: opacity .3s ease; }

/* ---------- 공유 버튼 ---------- */
.share-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0; }
.share-row .btn { font-size: 0.85rem; padding: 9px 16px; }
.share-msg { font-size: 0.82rem; color: var(--ok); margin-left: 4px; align-self: center; }

/* ---------- 광고 자리 ---------- */
.ad-placeholder {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin: 28px 0;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: repeating-linear-gradient(45deg, transparent, transparent 10px, color-mix(in srgb, var(--text-dim) 4%, transparent) 10px, color-mix(in srgb, var(--text-dim) 4%, transparent) 20px);
}

/* ---------- 가이드 아티클 ---------- */
.guide-article h2 { margin-top: 0; }
.guide-article h3 { font-size: 1.05rem; color: var(--accent-strong); margin: 22px 0 8px; }
.guide-article p { margin: 0 0 12px; color: var(--text); }
.guide-article p:last-child { margin-bottom: 0; }

/* ---------- FAQ ---------- */
.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
  background: var(--bg-elevated);
}
.faq-item summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '+'; margin-left: auto; font-size: 1.2rem; color: var(--accent); }
.faq-item[open] summary::after { content: '−'; }
.faq-item .faq-answer { padding: 0 16px 16px; color: var(--text-dim); }

/* ---------- 데이터 정보 푸터 ---------- */
.data-info {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
  padding-top: 14px;
  margin-top: 24px;
}
.data-info strong { color: var(--text); }

@media (max-width: 640px) {
  .resource-grid { grid-template-columns: 1fr; }
}
