/* 연습장 뒷장 웹 - 공통 스타일 (앱 디자인 시스템과 같은 토큰: lib/core/theme/tokens.dart) */
:root {
  --paper: #fff9ee;
  --paper-deep: #fff1dc;
  --grid: #dce7f5;
  --margin: #f5b5b5;
  --ink: #24223a;
  --ink2: #5c5a70;
  --hint: #8a8799;
  --pencil: #9c9aab;
  --white: #fff;
  --butter: #ffe380;
  --strawberry: #ffbfd4;
  --mint: #a8e9cb;
  --sky: #b3d9ff;
  --lavender: #d6c6ff;
  --peach: #ffc9a8;
  --melon: #cdea9e;
  --butter-soft: #fff4c7;
  --strawberry-soft: #ffe6ee;
  --mint-soft: #ddf7ea;
  --sky-soft: #e1efff;
  --lavender-soft: #efe8ff;
  --peach-soft: #ffebdd;
  --hot: #ff5c9e;
  --yellow: #ffd84d;
  --sky-deep: #5aa9ff;
  --lavender-deep: #8f7bff;
  --red: #ff4d5e;
  --cinnabar: #e8343f;
  --error: #b5222f;
  --f-display: 'Bagel Fat One', 'Pretendard Variable', Pretendard, sans-serif;
  --f-hand: 'Gaegu', 'Pretendard Variable', Pretendard, sans-serif;
  --f-body: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  --line: 2.5px solid var(--ink);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 15px;
  line-height: 1.45;
  letter-spacing: -0.2px;
  word-break: keep-all;
  overflow-wrap: anywhere;
  background-color: var(--paper);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: -1px -1px;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
a { color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- 글꼴 ---------- */
.display { font-family: var(--f-display); font-weight: 400; letter-spacing: 0; line-height: 1.15; }
.hand { font-family: var(--f-hand); font-weight: 700; letter-spacing: -0.09em; line-height: 1.25; }
.ink2 { color: var(--ink2); }
.small { font-size: 13px; color: var(--ink2); }
.tiny { font-size: 11.5px; color: var(--ink2); font-weight: 600; }
.center { text-align: center; }
h1, h2, h3 { margin: 0; font-weight: 400; }

/* ---------- 레이아웃 ---------- */
.wrap { max-width: 440px; margin: 0 auto; padding: 0 16px 48px; }
.top { display: flex; align-items: center; justify-content: space-between; padding: 14px 0 10px; }
.logo { text-decoration: none; display: block; }
.logo .tag { display: block; font-size: 15px; color: var(--ink2); transform: rotate(-2.5deg); transform-origin: left; }
.logo .name { font-family: var(--f-display); font-size: 24px; line-height: 1.1; }
.hl { background: linear-gradient(transparent 52%, rgba(255, 227, 128, 0.85) 52%, rgba(255, 227, 128, 0.85) 92%, transparent 92%); padding: 0 2px; }
.hl-pink { background: linear-gradient(transparent 52%, rgba(255, 191, 212, 0.95) 52%, rgba(255, 191, 212, 0.95) 92%, transparent 92%); padding: 0 2px; }
.hl-sky { background: linear-gradient(transparent 52%, rgba(179, 217, 255, 0.95) 52%, rgba(179, 217, 255, 0.95) 92%, transparent 92%); padding: 0 2px; }
.stack > * + * { margin-top: 12px; }
.gap-s { height: 8px; } .gap-m { height: 16px; } .gap-l { height: 24px; } .gap-xl { height: 32px; }
.row { display: flex; align-items: center; gap: 10px; }
.row > .grow { flex: 1; min-width: 0; }

/* ---------- 스티커 상자 ---------- */
.sticker {
  position: relative;
  background: var(--white);
  border: var(--line);
  border-radius: 20px;
  box-shadow: 0 6px 0 var(--ink);
  padding: 16px;
}
.sticker.flat { box-shadow: 0 3px 0 var(--ink); }
.sticker.pink { background: var(--strawberry); }
.sticker.pink-soft { background: var(--strawberry-soft); }
.sticker.butter { background: var(--butter); }
.sticker.butter-soft { background: var(--butter-soft); }
.sticker.mint { background: var(--mint); }
.sticker.sky { background: var(--sky); }
.sticker.sky-soft { background: var(--sky-soft); }
.sticker.lavender { background: var(--lavender); }
.sticker.lavender-soft { background: var(--lavender-soft); }
.sticker.peach { background: var(--peach); }

/* ---------- 버튼 ---------- */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 56px;
  padding: 0 18px;
  border: var(--line);
  border-radius: 18px;
  background: var(--hot);
  color: var(--ink);
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.3px;
  text-decoration: none;
  box-shadow: 0 4px 0 var(--ink);
  transition: transform 0.09s ease-out, box-shadow 0.09s ease-out;
  user-select: none;
  -webkit-user-select: none;
}
.btn:active, .btn.pressed { transform: translateY(4px); box-shadow: 0 0 0 var(--ink); }
.btn.white { background: var(--white); }
.btn.lavender { background: var(--lavender); }
.btn.butter { background: var(--butter); }
.btn.mint { background: var(--mint); }
.btn.sky { background: var(--sky); }
.btn.ink { background: var(--ink); color: var(--white); }
.btn.sm { min-height: 44px; font-size: 15px; border-radius: 14px; box-shadow: 0 3px 0 var(--ink); }
.btn.sm:active { transform: translateY(3px); }
.btn[disabled] { opacity: 0.45; pointer-events: none; }
.btn-row { display: flex; gap: 10px; }
.btn-row > * { flex: 1; }
.linkbtn { background: none; border: 0; padding: 8px; font-weight: 800; font-size: 14px; text-decoration: underline; color: var(--ink); }
.round-btn {
  width: 44px; height: 44px; border-radius: 50%; border: var(--line); background: var(--white);
  box-shadow: 0 3px 0 var(--ink); display: grid; place-items: center; font-size: 18px; line-height: 1;
  transition: transform 0.09s, box-shadow 0.09s;
}
.round-btn:active { transform: translateY(3px); box-shadow: none; }

/* ---------- 알약 / 칩 ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border: 1.6px solid var(--ink); border-radius: 999px;
  background: var(--butter-soft); font-weight: 800; font-size: 12.5px; line-height: 1.2; white-space: nowrap;
}
.pill.white { background: var(--white); }
.pill.mint { background: var(--mint); }
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 9px 14px; border-radius: 999px;
  border: 1.5px solid rgba(36, 34, 58, 0.25); background: var(--white); font-weight: 600; font-size: 14.5px; color: var(--ink2);
}
.chip.on { border: 2px solid var(--ink); font-weight: 800; color: var(--ink); box-shadow: 0 2.5px 0 var(--ink); }

/* ---------- 마스코트 + 말풍선 ---------- */
.say { display: flex; align-items: flex-end; gap: 6px; }
.say img { width: 62px; height: 62px; flex: none; animation: bob 1.6s ease-in-out infinite alternate; transform-origin: bottom center; }
.bubble {
  background: var(--white); border: 2px solid var(--ink); border-radius: 18px 18px 18px 4px;
  padding: 10px 14px; font-family: var(--f-hand); font-weight: 700; font-size: 19px; letter-spacing: -0.09em; line-height: 1.25;
  white-space: pre-line;
}
@keyframes bob { from { transform: translateY(0); } to { transform: translateY(-3px) scaleY(0.99); } }

/* ---------- 입력칸 (연습장에 이름 쓰기) ---------- */
.field { display: block; background: var(--white); border: var(--line); border-radius: 20px; box-shadow: 0 4px 0 var(--ink); padding: 12px 16px 10px; }
.field .label {
  display: inline-block; padding: 2px 8px; border: 1.5px solid var(--ink); border-radius: 6px;
  background: var(--strawberry); font-size: 12px; font-weight: 800;
}
.field input {
  display: block; width: 100%; border: 0; outline: none; background: transparent; padding: 6px 0 2px;
  font-family: var(--f-hand); font-weight: 700; font-size: 30px; letter-spacing: -0.09em; line-height: 1.25;
}
.field input::placeholder { color: rgba(138, 135, 153, 0.6); }
.field .under { height: 1.6px; background: var(--grid); }
.field.err .under { background: var(--red); }
.field .err-msg { color: var(--error); font-size: 12.5px; font-weight: 700; margin-top: 6px; display: none; }
.field.err .err-msg { display: block; }

/* ---------- 마스킹테이프 / 낙서 ---------- */
.tape {
  position: absolute; width: 80px; height: 22px; opacity: 0.85; z-index: 2;
  background: repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.35) 0 4px, transparent 4px 11px), var(--mint);
  clip-path: polygon(3% 0, 97% 0, 100% 17%, 97% 33%, 100% 50%, 97% 67%, 100% 83%, 97% 100%, 3% 100%, 0 83%, 3% 67%, 0 50%, 3% 33%, 0 17%);
}
.tape.butter { background: repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.35) 0 4px, transparent 4px 11px), var(--butter); }
.tape.pink { background: repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.35) 0 4px, transparent 4px 11px), var(--strawberry); }
.tape.lavender { background: repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.35) 0 4px, transparent 4px 11px), var(--lavender); }
.sparkle { position: absolute; width: 20px; height: 20px; pointer-events: none; }

/* ---------- 도장 (참 잘했어요) ---------- */
.stamp {
  --rot: 12deg;
  position: relative; width: 86px; height: 86px; border-radius: 50%; border: 5px solid var(--red); color: var(--red);
  display: grid; place-items: center; text-align: center; font-family: var(--f-display); line-height: 1.05;
  transform: rotate(var(--rot)); mix-blend-mode: multiply; opacity: 0.95;
}
.stamp::after { content: ''; position: absolute; inset: 6px; border-radius: 50%; border: 2px solid var(--red); }
.stamp span { display: block; position: relative; z-index: 1; }
.stamp.slam { animation: slam 0.42s cubic-bezier(0.2, 0.9, 0.3, 1.2) both; }
@keyframes slam {
  0% { transform: scale(1.9) rotate(var(--rot)); opacity: 0; }
  60% { transform: scale(0.92) rotate(var(--rot)); opacity: 1; }
  100% { transform: scale(1) rotate(var(--rot)); opacity: 0.95; }
}

/* ---------- OMR ---------- */
.omr-b {
  position: relative; flex: none; width: 22px; height: 28px; border-radius: 14px; border: 1.6px solid rgba(255, 77, 94, 0.75);
  color: rgba(255, 77, 94, 0.85); font-size: 11px; font-weight: 700; display: grid; place-items: center;
}
.omr-b::after { content: ''; position: absolute; inset: 2px; border-radius: 12px; background: var(--ink); transform: scale(0); transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1); }
.omr-b.on::after { transform: scale(1); }
.opt {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 10px 14px 10px 10px;
  background: var(--white); border: 1.6px solid var(--ink); border-radius: 16px; font-size: 16px; font-weight: 600;
  transition: background 0.15s, box-shadow 0.15s, transform 0.09s;
}
.opt + .opt { margin-top: 10px; }
.opt:active { transform: scale(0.98); }
.opt.on { background: var(--lavender); border-width: 2.5px; font-weight: 800; box-shadow: 0 3px 0 var(--ink); }

/* ---------- 진행 바 ---------- */
.bar { height: 12px; border: 2px solid var(--ink); border-radius: 999px; background: var(--white); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: var(--lavender-deep); transition: width 0.3s cubic-bezier(0.22, 1, 0.36, 1); }
.bar.thick { height: 16px; }

/* ---------- 앱 안내 카드 ---------- */
.app-cta { text-align: center; }
.app-cta .emojis { font-size: 22px; letter-spacing: 4px; margin: 6px 0 12px; }
.footer { text-align: center; padding: 26px 0 8px; }
.footer a { color: var(--ink2); font-size: 12.5px; }

/* ---------- 토스트 ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: var(--ink); color: var(--white); padding: 12px 18px; border-radius: 999px; font-weight: 700; font-size: 14px;
  box-shadow: 0 6px 18px rgba(36, 34, 58, 0.25); opacity: 0; transition: opacity 0.2s, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 100; max-width: calc(100% - 40px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 색종이 ---------- */
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 90; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 6px; border: 1.4px solid var(--ink); animation: fall var(--d) cubic-bezier(0.2, 0.6, 0.4, 1) forwards; }
@keyframes fall {
  0% { transform: translate(0, 0) rotate(0); opacity: 1; }
  100% { transform: translate(var(--dx), 105vh) rotate(var(--r)); opacity: 0.9; }
}

/* ---------- 등장 애니메이션 ---------- */
.pop { animation: pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
@keyframes pop { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.fade { animation: fade 0.3s ease-out both; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.shake { animation: shake 0.35s; }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

/* ---------- 오류 ---------- */
.oops { text-align: center; padding: 28px 18px; }
.oops img { width: 110px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
@media (min-width: 600px) {
  .wrap { padding-top: 12px; }
}
