/* 백스톱 공통 스타일: 색·글자·버튼·입력·배지·모달 */
:root {
  --p: #e8613c; /* 백스톱 오렌지 */
  --p-d: #c94f2e;
  --p-t: #fdefe9;
  --p-l: #f4a07f;
  --ink: #26221f;
  --sub: #6b645e;
  --mute: #9a928a;
  --line: #e9e4de;
  --bg: #fff;
  --bg2: #f6f4f1;
  --green: #2f8f6b;
  --green-t: #e9f4ef;
  --red: #c8443a;
  --red-t: #fbecea;
  --amber: #b7791f;
  --amber-t: #fbf3e0;
  --blue: #3b6fb6;
  --blue-t: #eaf1fa;
  --r: 14px;
  --r-s: 10px;
  --shadow: 0 1px 2px rgba(38, 34, 31, 0.05), 0 8px 24px rgba(38, 34, 31, 0.07);
  --font: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Noto Sans KR', 'Hiragino Sans',
    'PingFang SC', 'Microsoft JhengHei', 'Microsoft YaHei', 'Segoe UI', sans-serif;
}
*,
*::before,
*::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.55;
  -webkit-font-smoothing: antialiased; word-break: keep-all; overflow-wrap: anywhere;
}
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3 { line-height: 1.25; letter-spacing: -0.02em; }
a { color: inherit; text-decoration: none; }
img, svg { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
table { border-collapse: collapse; width: 100%; }
:focus-visible { outline: 2px solid var(--p); outline-offset: 2px; border-radius: 4px; }
.num { font-variant-numeric: tabular-nums; }
/* 워드마크: Bag + Stop(오렌지) */
.wm { font-weight: 800; letter-spacing: -0.03em; }
.wm em { font-style: normal; color: var(--p); }
.console-tag { margin-left: 6px; font-size: 13px; font-weight: 700; color: var(--p-d); background: var(--p-t); padding: 2px 8px; border-radius: 6px; }
.sub { color: var(--sub); }
.mute { color: var(--mute); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.b { font-weight: 700; }
.center { text-align: center; }
.right { text-align: right; }
.pre { white-space: pre-line; }
.row { display: flex; align-items: center; gap: 8px; }
.row.fw { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.top { align-items: flex-start; }
.col { display: flex; flex-direction: column; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.gap4 { gap: 4px; } .gap12 { gap: 12px; } .gap16 { gap: 16px; } .gap24 { gap: 24px; }
.mt4 { margin-top: 4px; } .mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; } .mt32 { margin-top: 32px; }
.hide { display: none !important; }

/* 버튼 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 18px;
  border-radius: 12px; font-weight: 700; font-size: 15px; border: 1px solid transparent; transition: background 0.15s, border-color 0.15s, transform 0.05s;
  white-space: nowrap; text-align: center;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--p); color: #fff; }
.btn.primary:hover { background: var(--p-d); }
.btn.dark { background: var(--ink); color: #fff; }
.btn.line { background: #fff; border-color: var(--line); color: var(--ink); }
.btn.line:hover { border-color: var(--mute); }
.btn.soft { background: var(--p-t); color: var(--p-d); }
.btn.ghost { color: var(--sub); padding: 0 10px; }
.btn.ghost:hover { background: var(--bg2); }
.btn.danger { background: #fff; border-color: #ecc9c5; color: var(--red); }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn.lg { min-height: 52px; font-size: 16px; padding: 0 24px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* 입력 */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--sub); }
.input, .select, .textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-s); background: #fff; font-size: 15px;
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--p); box-shadow: 0 0 0 3px var(--p-t); }
.input.sm, .select.sm { min-height: 36px; padding: 6px 10px; font-size: 14px; }
.hint { font-size: 12px; color: var(--mute); }
.check { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--p); flex: none; }
.err { color: var(--red); font-size: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }

/* 배지·칩 */
.badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 700; background: var(--bg2); color: var(--sub); white-space: nowrap; }
.badge.p { background: var(--p-t); color: var(--p-d); }
.badge.g { background: var(--green-t); color: var(--green); }
.badge.r { background: var(--red-t); color: var(--red); }
.badge.a { background: var(--amber-t); color: var(--amber); }
.badge.b { background: var(--blue-t); color: var(--blue); }
.badge.k { background: var(--ink); color: #fff; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-size: 14px; font-weight: 600; color: var(--sub); white-space: nowrap; }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip:hover:not(.on) { border-color: var(--mute); }

/* 카드·구분 */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.card.flat { border: 0; background: var(--bg2); }
.card.tint { border: 0; background: var(--p-t); }
.hr { height: 1px; background: var(--line); border: 0; margin: 16px 0; }
.kv { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; padding: 5px 0; }
.kv > :first-child { color: var(--sub); flex: none; }
.kv > :last-child { text-align: right; font-weight: 600; }
.note { border-radius: var(--r-s); padding: 12px 14px; font-size: 14px; background: var(--bg2); color: var(--sub); }
.note.p { background: var(--p-t); color: #8a3a22; }
.note.g { background: var(--green-t); color: #1f6048; }
.note.r { background: var(--red-t); color: #8f2f28; }
.note.a { background: var(--amber-t); color: #7a5214; }

/* 수량 조절 */
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.stepper button { width: 36px; height: 36px; font-size: 18px; font-weight: 600; color: var(--ink); }
.stepper button:disabled { color: var(--line); }
.stepper span { width: 30px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }

/* 모달·토스트 */
.modal-bg { position: fixed; inset: 0; background: rgba(38, 34, 31, 0.45); z-index: 900; display: flex; align-items: flex-end; justify-content: center; animation: fade 0.15s; }
.modal { background: #fff; width: 100%; max-width: 480px; max-height: 92vh; overflow: auto; border-radius: 20px 20px 0 0; padding: 20px; animation: up 0.2s; }
.modal.wide { max-width: 760px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.modal-head h3 { font-size: 18px; }
.modal-x { width: 36px; height: 36px; border-radius: 50%; font-size: 22px; line-height: 1; color: var(--sub); }
.modal-x:hover { background: var(--bg2); }
@media (min-width: 640px) { .modal-bg { align-items: center; padding: 24px; } .modal { border-radius: 20px; } }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(16px); opacity: 0; } }
#toasts { position: fixed; left: 0; right: 0; bottom: 24px; z-index: 1000; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow); animation: up 0.2s; max-width: 420px; }
.toast.err { background: var(--red); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--p); border-radius: 50%; animation: spin 0.7s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; padding: 40px 16px; color: var(--sub); }
.empty img { width: 120px; margin: 0 auto 12px; }

/* 탭 */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 10px 14px; font-weight: 700; font-size: 14px; color: var(--mute); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab.on { color: var(--ink); border-color: var(--p); }

/* 별점 */
.stars { display: inline-flex; gap: 2px; color: var(--p); font-size: 15px; letter-spacing: 1px; }
.star-pick button { font-size: 30px; color: var(--line); line-height: 1; padding: 2px; }
.star-pick button.on { color: var(--p); }

/* 사진 올리기 */
.photos { display: flex; gap: 8px; flex-wrap: wrap; }
.photos .ph { position: relative; width: 84px; height: 84px; border-radius: 10px; overflow: hidden; background: var(--bg2); border: 1px solid var(--line); }
.photos .ph img { width: 100%; height: 100%; object-fit: cover; }
.photos .ph button { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; background: rgba(38, 34, 31, 0.7); color: #fff; font-size: 14px; line-height: 1; }
.photos .add { width: 84px; height: 84px; border-radius: 10px; border: 1.5px dashed var(--mute); color: var(--sub); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 12px; gap: 2px; cursor: pointer; }
.photos .add b { font-size: 22px; line-height: 1; font-weight: 400; }

/* 일본어·중국어는 띄어쓰기가 없어서 keep-all을 쓰면 줄바꿈이 어색해집니다. */
:lang(ja) body, :lang(zh) body { word-break: normal; line-break: strict; }
