/* SaRuEm 홈페이지 공통 스타일 - 뜨개(니트) 느낌 : 크림색 바탕, 박음질 점선, 사(파랑) / 루(빨강) / 엠(초록) */
:root {
  --sa: #2f62c9;
  --ru: #d8354a;
  --em: #2e9b57;
  --cream: #f6eedd;
  --cream-2: #efe3cb;
  --ink: #3a2a1e;
  --muted: #7a6a5a;
  --purple: #6b3a96;
  --card: #fffaf0;
  --stitch: rgba(58, 42, 30, 0.35);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  color: var(--ink);
  background-color: var(--cream);
  background-image:
    radial-gradient(circle at 25% 25%, rgba(255,255,255,0.35) 0 2px, transparent 3px),
    radial-gradient(circle at 75% 75%, rgba(120,90,60,0.06) 0 2px, transparent 3px);
  background-size: 18px 18px;
  line-height: 1.65;
}
img { max-width: 100%; display: block; }
a { color: var(--sa); }

/* 언어 : <html data-lang="ko|en"> 에 맞는 것만 보임 */
html[data-lang="ko"] .en, html[data-lang="en"] .ko { display: none !important; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* 위 막대 */
.top {
  position: sticky; top: 0; z-index: 10;
  background: rgba(246, 238, 221, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 2px dashed var(--stitch);
}
.top .wrap { display: flex; align-items: center; gap: 18px; height: 64px; }
.brand { font-weight: 900; font-size: 26px; text-decoration: none; letter-spacing: 0.5px; }
.brand .s { color: var(--sa); } .brand .r { color: var(--ru); } .brand .e { color: var(--em); }
.nav { display: flex; gap: 16px; margin-left: auto; flex-wrap: wrap; }
.nav a { color: var(--ink); text-decoration: none; font-weight: 600; font-size: 15px; }
.nav a:hover { color: var(--purple); }
.lang {
  border: 2px solid var(--ink); background: var(--card); border-radius: 999px;
  padding: 4px 12px; font-weight: 700; cursor: pointer; font-size: 14px;
}

/* 첫 화면 */
.hero { text-align: center; padding: 56px 0 30px; }
.hero h1 { font-size: clamp(40px, 8vw, 76px); margin: 0; font-weight: 900; letter-spacing: 1px; }
.hero h1 .s { color: var(--sa); } .hero h1 .r { color: var(--ru); } .hero h1 .e { color: var(--em); }
.hero .meaning { color: var(--muted); font-size: 17px; margin-top: 6px; }
.hero .tag { font-size: clamp(19px, 3vw, 24px); margin: 18px auto 0; max-width: 720px; font-weight: 700; }
.dots { display: flex; justify-content: center; gap: 12px; margin-top: 18px; }
.dots i { width: 18px; height: 18px; border-radius: 50%; display: block; box-shadow: inset 0 -3px 0 rgba(0,0,0,0.18); }
.dots i:nth-child(1) { background: var(--sa); } .dots i:nth-child(2) { background: var(--ru); } .dots i:nth-child(3) { background: var(--em); }

/* 게임 카드 (박음질 테두리) */
.games { display: grid; gap: 28px; padding: 20px 0 50px; }
.game {
  background: var(--card);
  border-radius: var(--radius);
  padding: 26px;
  position: relative;
  box-shadow: 0 10px 0 rgba(58, 42, 30, 0.08), 0 2px 18px rgba(58, 42, 30, 0.08);
  border: 3px solid var(--edge, var(--purple));
}
.game::before {
  content: ""; position: absolute; inset: 8px; border-radius: calc(var(--radius) - 6px);
  border: 2px dashed var(--stitch); pointer-events: none;
}
.game.sapphire { --edge: var(--sa); }
.game.ruby { --edge: var(--ru); }
.game.emerald { --edge: var(--em); }
.game .logo { width: 100%; max-width: 560px; margin: 0 auto 10px; }
.game .row { display: grid; grid-template-columns: 1.1fr 1fr; gap: 26px; align-items: start; }
@media (max-width: 820px) { .game .row { grid-template-columns: 1fr; } }
.game h2 { margin: 0 0 6px; font-size: 26px; }
.game .sub { color: var(--muted); margin: 0 0 12px; font-weight: 600; }
.game ul { padding-left: 20px; margin: 8px 0 16px; }
.game li { margin: 4px 0; }
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 800;
  color: #fff; background: var(--edge, var(--purple)); margin-right: 6px;
}
.shots { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; }
.shots img {
  width: 180px; flex: 0 0 auto; border-radius: 16px; scroll-snap-align: start;
  border: 3px solid #fff; box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.stores { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.store {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 12px;
  background: #1d1d1f; color: #fff; text-decoration: none; font-weight: 700; font-size: 15px;
}
.store.soon { background: #8c8076; cursor: default; }
.notice {
  margin-top: 14px; padding: 12px 14px; border-radius: 12px;
  background: #fff1f1; border: 2px dashed rgba(216, 53, 74, 0.45); font-size: 14px;
}
.rules { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; margin: 10px 0 14px; }
.rules span { background: var(--cream-2); border-radius: 10px; padding: 6px 10px; font-size: 14px; font-weight: 600; }

/* 일반 문서 (방침 / 약관 / 문의) */
.doc { background: var(--card); border-radius: var(--radius); padding: 28px; margin: 30px auto 50px; max-width: 860px; border: 3px solid var(--purple); position: relative; }
.doc::before { content: ""; position: absolute; inset: 8px; border-radius: calc(var(--radius) - 6px); border: 2px dashed var(--stitch); pointer-events: none; }
.doc h1 { margin-top: 0; }
.doc h2 { font-size: 20px; margin-top: 28px; }
.doc table { border-collapse: collapse; width: 100%; font-size: 15px; }
.doc th, .doc td { border: 1px solid #d9ccb3; padding: 8px 10px; text-align: left; vertical-align: top; }
.doc th { background: var(--cream-2); }
.draft { background: #fff7d6; border: 2px dashed #d6a400; border-radius: 12px; padding: 10px 14px; font-size: 14px; }
pre.licenses { white-space: pre-wrap; font-size: 13px; background: #fff; border-radius: 12px; padding: 16px; border: 1px solid #e6dac3; }

form .field { margin: 12px 0; }
form label { display: block; font-weight: 700; margin-bottom: 4px; }
form input, form select, form textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 2px solid #d9ccb3; font: inherit; background: #fff;
}
form textarea { min-height: 140px; }
button.primary {
  background: var(--purple); color: #fff; border: 0; border-radius: 12px; padding: 12px 22px;
  font-weight: 800; font-size: 16px; cursor: pointer;
}
button.primary:disabled { opacity: 0.6; cursor: default; }
.result { margin-top: 12px; font-weight: 700; }

/* 소식 */
.news-item { border-bottom: 2px dashed var(--stitch); padding: 14px 0; }
.news-item h3 { margin: 0; font-size: 18px; }
.news-item .when { color: var(--muted); font-size: 14px; }

/* 아래 */
.foot { border-top: 2px dashed var(--stitch); padding: 26px 0 40px; font-size: 13px; color: var(--muted); }
.foot a { color: var(--muted); margin-right: 14px; }
.foot .biz { margin-top: 10px; line-height: 1.8; }

/* 휴대폰 : 가로로 넘치지 않게 (격자 칸이 내용 폭보다 줄어들 수 있게) */
.game .row > *, .games > * { min-width: 0; }
.rules { grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr)); }
@media (max-width: 560px) {
  .top .wrap { height: auto; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; gap: 10px; }
  .nav { gap: 12px; margin-left: 0; order: 3; width: 100%; }
  .lang { margin-left: auto; }
  .game { padding: 18px; }
  .doc { padding: 20px; }
  .shots img { width: 150px; }
}

/* ===== 2026-10-12 꾸미기 : 첫 화면 단추, 털실 공, 뜨개 띠, 특징 3칸, 나타나기, 크게 보기 ===== */
.hero { position: relative; overflow: hidden; }
.cta { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin-top: 26px; position: relative; z-index: 1; }
.btn {
  display: inline-block; padding: 12px 22px; border-radius: 999px; color: #fff; text-decoration: none;
  font-weight: 800; box-shadow: 0 5px 0 rgba(0,0,0,0.18); transition: transform .15s, box-shadow .15s;
  outline: 2px dashed rgba(255,255,255,0.55); outline-offset: -6px;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 7px 0 rgba(0,0,0,0.18); }
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0,0,0,0.18); }
.btn.sa { background: var(--sa); } .btn.ru { background: var(--ru); } .btn.em { background: var(--em); }

/* 털실 공 (줄무늬 원 + 감긴 실 느낌) */
.yarn {
  position: absolute; border-radius: 50%; opacity: 0.9; pointer-events: none;
  background:
    repeating-linear-gradient(35deg, rgba(255,255,255,0.28) 0 3px, transparent 3px 9px),
    repeating-linear-gradient(-55deg, rgba(0,0,0,0.12) 0 2px, transparent 2px 10px),
    radial-gradient(circle at 35% 30%, rgba(255,255,255,0.45), transparent 55%),
    var(--c);
  box-shadow: inset -6px -8px 0 rgba(0,0,0,0.15), 0 8px 18px rgba(58,42,30,0.15);
  animation: bob 6s ease-in-out infinite;
}
.yarn.y1 { --c: var(--sa); width: 86px; height: 86px; left: 6%; top: 60px; }
.yarn.y2 { --c: var(--ru); width: 64px; height: 64px; right: 8%; top: 40px; animation-delay: -2s; }
.yarn.y3 { --c: var(--em); width: 52px; height: 52px; left: 14%; bottom: 24px; animation-delay: -4s; }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-12px) rotate(12deg); } }
@media (max-width: 700px) { .yarn.y1 { width: 54px; height: 54px; left: 2%; top: 20px; } .yarn.y2 { width: 42px; height: 42px; right: 3%; top: 16px; } .yarn.y3 { display: none; } }

/* 뜨개 띠 : V 자 코 무늬, 파랑 / 빨강 / 초록 줄 */
.knitband {
  height: 42px; margin: 10px 0 6px; border-radius: 14px;
  background:
    linear-gradient(135deg, transparent 50%, rgba(255,255,255,0.25) 50%) 0 0 / 14px 14px,
    linear-gradient(45deg, rgba(0,0,0,0.12) 50%, transparent 50%) 0 0 / 14px 14px,
    linear-gradient(var(--sa) 0 33.3%, var(--ru) 33.3% 66.6%, var(--em) 66.6%);
  box-shadow: inset 0 0 0 3px rgba(255,255,255,0.35), 0 4px 0 rgba(58,42,30,0.08);
}

/* 특징 3칸 */
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; padding: 24px 0 6px; }
@media (max-width: 820px) { .features { grid-template-columns: 1fr; } }
.feat {
  background: var(--card); border-radius: 18px; padding: 18px 20px; text-align: center;
  border: 2px dashed var(--stitch); box-shadow: 0 6px 0 rgba(58,42,30,0.06);
}
.feat .ic { font-size: 34px; }
.feat h3 { margin: 6px 0 4px; font-size: 19px; }
.feat p { margin: 0; color: var(--muted); font-size: 15px; }

/* 스크롤하면 살짝 떠오르며 나타남 (JS 가 없거나 움직임 줄이기 설정이면 그냥 보임) */
.js .reveal { opacity: 0; transform: translateY(24px); transition: opacity .6s ease, transform .6s ease; }
.js .reveal.shown { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .yarn { animation: none; }
  html { scroll-behavior: auto; }
}

/* 스크린샷 크게 보기 */
.shots img { cursor: zoom-in; transition: transform .2s; }
.shots img:hover { transform: translateY(-4px) rotate(-1deg); }
.lightbox {
  position: fixed; inset: 0; z-index: 50; display: none; align-items: center; justify-content: center;
  background: rgba(30, 20, 12, 0.82); cursor: zoom-out; padding: 20px;
}
.lightbox.open { display: flex; }
.lightbox img { max-height: 92vh; max-width: 92vw; border-radius: 18px; border: 4px solid #fff; }

/* 방문 통계 동의 막대 (GA4 를 켰을 때만 나옴) */
.consent {
  position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 40; max-width: 760px; margin: 0 auto;
  background: var(--card); border: 3px solid var(--purple); border-radius: 16px; padding: 12px 16px;
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap; box-shadow: 0 8px 24px rgba(0,0,0,0.18); font-size: 14px;
}
.consent p { margin: 0; flex: 1 1 280px; }
.consent button { border: 0; border-radius: 10px; padding: 8px 14px; font-weight: 800; cursor: pointer; }
.consent .yes { background: var(--purple); color: #fff; }
.consent .no { background: var(--cream-2); color: var(--ink); }

/* 준비 중 게임 (비활성 카드 : 흐리게, 누를 수 없음) */
.upcoming { padding: 6px 0 0; }
.up-title { margin: 0; font-size: 24px; }
.up-sub { margin: 4px 0 14px; color: var(--muted); }
.up-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 1000px) { .up-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .up-grid { grid-template-columns: 1fr; } }
/* 순서 화살표 (넓은 화면) */
@media (min-width: 1001px) { .up-card + .up-card::before { content: "→"; position: absolute; left: -15px; top: 42px; font-size: 18px; font-weight: 900; color: var(--muted); } }
.up-card {
  position: relative; background: #f1ebe0; border-radius: 18px; padding: 18px 20px;
  border: 2px dashed rgba(58,42,30,0.25); filter: grayscale(0.85); opacity: 0.72;
  cursor: not-allowed; user-select: none;
}
.up-card .up-ic { font-size: 36px; }
.up-card h3 { margin: 6px 0 4px; font-size: 19px; }
.up-card p { margin: 0; font-size: 14.5px; color: var(--muted); }
.up-badge {
  position: absolute; top: 14px; right: 14px; padding: 2px 10px; border-radius: 999px;
  background: #8c8076; color: #fff; font-size: 12px; font-weight: 800;
}

/* [레벨 순위 페이지] ranks.html (2026-10-18) - 박음질 테두리 카드, 큰 글씨 */
.ranks .rk-head { text-align: center; padding: 40px 0 10px; }
.ranks .rk-head h1 { font-size: clamp(32px, 6vw, 52px); margin: 0; }
.rk-sub { color: var(--muted); max-width: 760px; margin: 10px auto 0; font-size: 18px; }
.rk-pick { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; align-items: center; margin: 22px 0 8px; }
.rk-ed button, .rk-step { border: 2px dashed var(--stitch); background: var(--card); border-radius: 999px; padding: 8px 18px; font-size: 18px; font-weight: 800; cursor: pointer; color: var(--ink); }
.rk-ed button.on { background: var(--sa); color: #fff; border-color: #fff; }
.rk-lv { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 800; }
.rk-lv input { width: 96px; font-size: 22px; font-weight: 800; padding: 6px 10px; border-radius: 12px; border: 2px dashed var(--stitch); background: var(--card); text-align: center; }
.rk-status { text-align: center; color: var(--muted); font-size: 18px; min-height: 28px; }
.rk-list { list-style: none; padding: 0; margin: 10px auto 30px; max-width: 760px; display: grid; gap: 12px; }
.rk-row { background: var(--card); border-radius: var(--radius); padding: 14px 18px; outline: 2px dashed var(--stitch); outline-offset: -8px; }
.rk-row.top { padding: 18px 20px; }
.rk-line { display: flex; align-items: center; gap: 14px; font-size: 22px; }
.rk-rank { width: 44px; text-align: center; font-size: 28px; font-weight: 900; }
.rk-name { flex: 1; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rk-score { font-weight: 900; color: var(--ru); font-size: 24px; }
.rk-play { font-size: 17px; padding: 8px 14px; }
.rk-video { margin-top: 12px; }
.rk-video:empty { display: none; }
.rk-video iframe, .rk-thumb { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 14px; display: block; }
.rk-thumb { position: relative; padding: 0; cursor: pointer; background: #000; overflow: hidden; }
.rk-thumb img { width: 100%; height: 100%; object-fit: cover; opacity: 0.9; }
.rk-thumb i { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-style: normal; font-size: 56px; color: #fff; text-shadow: 0 2px 10px rgba(0,0,0,0.6); }
.rk-how { max-width: 760px; margin: 0 auto 50px; background: var(--card); border-radius: var(--radius); padding: 18px 24px; outline: 2px dashed var(--stitch); outline-offset: -8px; font-size: 17px; }
@media (max-width: 640px) {
  .top .wrap { height: auto; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; gap: 10px; }
  .nav { margin-left: 0; order: 3; width: 100%; }
  .rk-line { flex-wrap: wrap; font-size: 20px; }
  .rk-name { min-width: 0; }
  .rk-play { margin-left: auto; }
  .rk-sub { font-size: 16px; }
}
html, body { overflow-x: hidden; }
