/* core.css — 공용 기본 스타일 (서비스별 색은 style.css에서 --accent 등으로 덮어씀) */
:root {
  --bg: #f6f6f8;
  --fg: #16161a;
  --muted: #6b6b76;
  --line: #e3e3ea;
  --card: #ffffff;
  --accent: #3b5bfd;
  --accent-fg: #ffffff;
  --accent-soft: #e8edff;
  --danger: #e5484d;
  --ok: #2f9e6b;
  --radius: 16px;
  --shadow: 0 6px 24px rgba(20, 20, 40, .08);
  --font: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--fg); font-family: var(--font);
  font-size: 16px; line-height: 1.55; word-break: keep-all; overflow-wrap: anywhere;
}
img, canvas, video, svg { max-width: 100%; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }

.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.top .logo { font-weight: 800; text-decoration: none; letter-spacing: -.02em; font-size: 17px; }
.top .spacer { flex: 1; }
.top .nav { display: flex; gap: 4px; }
.top .nav a { text-decoration: none; font-size: 14px; color: var(--muted); padding: 6px 10px; border-radius: 999px; }
.top .nav a:hover { background: var(--card); color: var(--fg); }
/* 좁은 화면: 머리글 글자가 세로로 쪼개지지 않게 */
.top .logo { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.top .nav a { white-space: nowrap; }
.mobile .top { gap: 6px; }
.mobile .top .nav { gap: 0; flex: none; }
.mobile .top .nav a { padding: 6px 7px; }
.mobile .top:has(.nav a:nth-child(3)) { flex-wrap: wrap; row-gap: 4px; }
.mobile .top .nav:has(a:nth-child(3)) { order: 3; flex-basis: 100%; overflow-x: auto; scrollbar-width: none; margin: 0 -8px; }

main { flex: 1; width: 100%; max-width: 640px; margin: 0 auto; padding: 20px 16px 48px; }
main.wide { max-width: 1040px; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 20px 16px 28px; }

h1 { font-size: clamp(26px, 7vw, 38px); line-height: 1.2; letter-spacing: -.03em; margin: 8px 0 12px; }
h2 { font-size: 21px; letter-spacing: -.02em; margin: 24px 0 10px; }
h3 { font-size: 17px; margin: 16px 0 8px; }
p { margin: 8px 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.hidden { display: none !important; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 46px; padding: 10px 18px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); font-weight: 700; cursor: pointer; text-decoration: none;
  transition: transform .08s ease, background .15s ease; white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; white-space: normal; }
.row > .btn:not(.grow) { flex: none; }
.btn.big { min-height: 56px; font-size: 18px; border-radius: 14px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 7px 13px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); font-size: 14px; cursor: pointer; user-select: none;
}
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }

label.field { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
input[type=text], input[type=tel], input[type=email], input[type=url], input[type=search], input[type=password], select, textarea {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 120px; }
input[type=range] { width: 100%; accent-color: var(--accent); }

.bar { height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .3s ease; }

.notice { font-size: 13px; color: var(--muted); background: var(--card); border: 1px dashed var(--line); border-radius: 12px; padding: 10px 12px; }

#toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: #1c1c22; color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 14px; z-index: 100;
  transition: all .2s ease; max-width: calc(100% - 32px); text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* 화면 모드 버튼 */
.viewtoggle { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--card); flex: none; }
.viewtoggle button { border: none; background: none; padding: 5px 10px; font-size: 13px; cursor: pointer; color: var(--muted); line-height: 1.2; }
.pc .viewtoggle [data-view=pc], .mobile .viewtoggle [data-view=mobile] { background: var(--accent); color: var(--accent-fg); }
.viewtoggle .lbl { display: none; }
.pc .viewtoggle .lbl { display: inline; }
.foot .autoview { display: block; margin: 0 auto 6px; border: none; background: none; color: var(--muted); text-decoration: underline; cursor: pointer; font-size: 12px; }
.embedded .viewtoggle, .embedded .autoview { display: none !important; }

/* 공용 2단 배치: 모바일에서는 위아래, PC에서는 좌우 */
.split > * + * { margin-top: 16px; }

/* ---------- PC 화면 ---------- */
.pc body { font-size: 16.5px; }
.pc .top { padding: 14px 32px; }
.pc main { max-width: 1120px; padding: 36px 32px 72px; }
.pc main.wide { max-width: 1180px; }
.pc h1 { font-size: 46px; }
.pc h2 { font-size: 24px; }
.pc .split { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; align-items: start; }
.pc .split.s73 { grid-template-columns: 1.35fr 1fr; }
.pc .split.s37 { grid-template-columns: 1fr 1.35fr; }
.pc .split.center { align-items: center; }
.pc .split > * + * { margin-top: 0; }
.pc .sticky { position: sticky; top: 92px; }
.pc .narrow { max-width: 760px; margin-left: auto; margin-right: auto; }
.pc .grid2 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* PC 브라우저에서 모바일 화면을 고른 경우: 가운데 휴대폰 폭으로 */
.force-mobile body { background: #e6e6ec; }
.force-mobile .top, .force-mobile main, .force-mobile .foot { max-width: 430px; margin-left: auto; margin-right: auto; width: 100%; }
.force-mobile main { background: var(--bg); box-shadow: 0 0 0 1px var(--line); }
.force-mobile .top { background: var(--bg); }

/* 허브 안에 들어갔을 때 */
.embedded .foot { display: none; }
.embedded main { padding-top: 14px; }

/* 키보드 포커스 표시 (마우스 클릭 때는 안 보임) */
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn:focus-visible, .chip:focus-visible, .viewtoggle button:focus-visible, .sfxbtn:focus-visible { box-shadow: 0 0 0 6px var(--accent-soft); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }
:focus:not(:focus-visible) { outline: none; }

/* 효과음 버튼 */
.sfxbtn { flex: none; border: 1px solid var(--line); background: var(--card); border-radius: 999px; width: 34px; height: 30px; padding: 0; font-size: 15px; line-height: 1; cursor: pointer; }
.mobile .sfxbtn { width: 30px; }

/* 화면 그리기 실패 안내 */
.crash h2 { margin-top: 8px; }

/* 동작 줄이기: 시스템 설정을 따름 */
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
