@import url('https://fonts.googleapis.com/css2?family=Gaegu:wght@400;700&family=Gowun+Batang:wght@400;700&family=Nanum+Pen+Script&display=swap');
@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css');

:root {
  --paper: #f6efe1;
  --paper-2: #efe5cf;
  --ink: #1b1b1b;
  --muted: #6b6457;
  --hot: #ff4d6d;
  --neon: #fff04a;
  --sky: #82d4ff;
  --mint: #6cc06b;
  --pink: #ffd6ec;
  --grape: #a06cd5;
  --orange: #ff8c42;
  --yellow: #ffd23f;
  --rainbow: linear-gradient(90deg, #ff4d6d, #ff8c42, #ffd23f, #6cc06b, #5cc8ff, #a06cd5);
  --display: "Gaegu", "Apple SD Gothic Neo", system-ui, sans-serif;
  --body: "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", system-ui, sans-serif;
  --pen: "Nanum Pen Script", var(--display);
  /* 테두리·그림자 토큰 (테마별로 바뀜) */
  --bw: 3px; --bw2: 2px; --bc: var(--ink);
  --shadow: 6px 6px 0 var(--ink); --shadow-sm: 4px 4px 0 var(--ink); --shadow-xs: 3px 3px 0 var(--ink); --shadow-press: 1px 1px 0 var(--ink);
}

/* ── 클린 테마: 테이블링 같은 앱 스타일 ── */
:root[data-theme="clean"] {
  --paper: #f4f5f7; --paper-2: #eceef1; --ink: #191f28; --muted: #8b95a1;
  --hot: #ff5b3c; --neon: #ffe9e3; --sky: #e8f1ff; --mint: #dcf5e4; --pink: #ffe9e3; --grape: #6b5bff; --orange: #ff8c42; --yellow: #ffd23f;
  --rainbow: var(--hot);
  --display: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
  --pen: var(--display);
  --bw: 1px; --bw2: 1px; --bc: #e5e8eb;
  --shadow: 0 4px 18px rgba(25,31,40,.07); --shadow-sm: 0 2px 8px rgba(25,31,40,.08); --shadow-xs: 0 1px 4px rgba(25,31,40,.08); --shadow-press: none;
}
:root[data-theme="clean"] body::before { display: none; }
:root[data-theme="clean"] .brand-sub { display: none; }
:root[data-theme="clean"] h1, :root[data-theme="clean"] h2, :root[data-theme="clean"] h3, :root[data-theme="clean"] .display,
:root[data-theme="clean"] .btn, :root[data-theme="clean"] .bignum, :root[data-theme="clean"] .stat b { letter-spacing: -0.02em; }
:root[data-theme="clean"] .btn:active { transform: scale(.98); box-shadow: var(--shadow-sm); }
:root[data-theme="clean"] .btn.neon { background: var(--neon); color: var(--hot); }
:root[data-theme="clean"] .btn.sky { background: var(--sky); color: #2f6fed; }
:root[data-theme="clean"] .btn.mint { background: var(--mint); color: #1f8a4c; }
:root[data-theme="clean"] .btn.grape { background: var(--grape); color: #fff; }
:root[data-theme="clean"] .tag { font-weight: 600; font-size: 13px; padding: 3px 10px; }
:root[data-theme="clean"] .tag.neon { color: var(--hot); } :root[data-theme="clean"] .tag.sky { color: #2f6fed; } :root[data-theme="clean"] .tag.mint { color: #1f8a4c; }
:root[data-theme="clean"] .stepper button { background: var(--paper-2); }
:root[data-theme="clean"] .numpad button { box-shadow: none; background: #fff; }
:root[data-theme="clean"] .numpad button:active { background: var(--paper-2); transform: none; }
:root[data-theme="clean"] .numpad button.fn { background: var(--paper-2); }
:root[data-theme="clean"] .card.neon, :root[data-theme="clean"] .card.pink { border-color: var(--hot); }
:root[data-theme="clean"] .card.sky { border-color: #2f6fed; }
:root[data-theme="clean"] .bignum { font-size: 96px; letter-spacing: -4px; }
:root[data-theme="clean"] .pen { font-weight: 600; }
:root[data-theme="clean"] .wiggle { animation: none; }
:root[data-theme="clean"] .btn.ghost { border-color: transparent; box-shadow: none; }

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body::before {
  content: ""; position: fixed; inset: 0 0 auto 0; height: 10px; background: var(--rainbow); z-index: 50;
}
h1, h2, h3, .display { font-family: var(--display); font-weight: 700; line-height: 1.15; margin: 0; }
.pen { font-family: var(--pen); font-weight: 400; }
.muted { color: var(--muted); }
.wrap { max-width: 960px; margin: 0 auto; padding: 28px 16px 48px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.center { text-align: center; }
.hidden { display: none !important; }

/* 스티커 카드 */
.card {
  background: #fff;
  border: var(--bw) solid var(--bc);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 20px;
}
.card.soft { background: var(--paper-2); box-shadow: none; }
.card.neon { background: var(--neon); }
.card.pink { background: var(--pink); }
.card.sky { background: var(--sky); }
.card.mint { background: var(--mint); }

.tag {
  display: inline-block; padding: 2px 12px; border: var(--bw2) solid var(--bc); border-radius: 999px;
  font-family: var(--display); font-weight: 700; font-size: 15px; background: #fff; line-height: 1.5;
}
.tag.pink { background: var(--pink); } .tag.neon { background: var(--neon); } .tag.sky { background: var(--sky); }
.tag.mint { background: var(--mint); } .tag.hot { background: var(--hot); color: #fff; } .tag.grape { background: var(--grape); color: #fff; }
.tag.gray { background: #ddd; }

/* 버튼 */
.btn {
  font-family: var(--display); font-weight: 700; font-size: 20px; line-height: 1;
  padding: 14px 22px; border: var(--bw) solid var(--bc); border-radius: 16px; background: #fff; color: var(--ink);
  box-shadow: var(--shadow-sm); cursor: pointer; transition: transform .06s, box-shadow .06s; user-select: none;
}
.btn:active { transform: translate(3px, 3px); box-shadow: var(--shadow-press); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--hot); color: #fff; }
.btn.neon { background: var(--neon); }
.btn.sky { background: var(--sky); }
.btn.mint { background: var(--mint); }
.btn.grape { background: var(--grape); color: #fff; }
.btn.ghost { box-shadow: none; background: transparent; }
.btn.sm { font-size: 16px; padding: 8px 14px; border-width: var(--bw2); border-radius: 12px; box-shadow: var(--shadow-xs); }
.btn.lg { font-size: 26px; padding: 20px 30px; }
.btn.block { display: block; width: 100%; }

/* 입력 */
label.field { display: block; font-family: var(--display); font-weight: 700; font-size: 19px; margin-bottom: 6px; }
input, select, textarea {
  font-family: var(--body); font-size: 20px; width: 100%; padding: 12px 14px;
  border: var(--bw) solid var(--bc); border-radius: 14px; background: #fff; color: var(--ink); outline: none;
}
input:focus, select:focus { box-shadow: 0 0 0 4px var(--sky); }
input.big { font-size: 30px; letter-spacing: 2px; text-align: center; font-family: var(--display); font-weight: 700; }
.stepper { display: inline-flex; align-items: center; border: var(--bw) solid var(--bc); border-radius: 16px; background: #fff; overflow: hidden; }
.stepper button { all: unset; cursor: pointer; width: 60px; height: 58px; text-align: center; font-family: var(--display); font-weight: 700; font-size: 30px; background: var(--neon); }
.stepper button:active { background: var(--yellow); }
.stepper output { min-width: 90px; text-align: center; font-family: var(--display); font-weight: 700; font-size: 28px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 17px; cursor: pointer; }
.check input { width: 26px; height: 26px; margin: 0; accent-color: var(--hot); }

/* 숫자패드 */
.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.numpad button {
  font-family: var(--display); font-weight: 700; font-size: 30px; height: 64px; border: var(--bw) solid var(--bc); border-radius: 14px;
  background: #fff; cursor: pointer; box-shadow: var(--shadow-xs);
}
.numpad button:active { transform: translate(2px, 2px); box-shadow: var(--shadow-press); }
.numpad button.fn { background: var(--paper-2); font-size: 22px; }

/* 큰 숫자 */
.bignum { font-family: var(--display); font-weight: 700; font-size: 112px; line-height: 1; letter-spacing: -2px; }
.bignum small { font-size: 40px; }

.stat { display: flex; flex-direction: column; gap: 2px; padding: 12px 16px; border: var(--bw) solid var(--bc); border-radius: 16px; background: #fff; min-width: 120px; }
.stat b { font-family: var(--display); font-size: 34px; line-height: 1; }
.stat span { font-size: 14px; color: var(--muted); }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 100;
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 999px; font-family: var(--display); font-weight: 700; font-size: 18px;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.toast.show { opacity: 1; }
.toast.err { background: var(--hot); }

@keyframes wiggle { 0%,100% { transform: rotate(-2deg); } 50% { transform: rotate(2deg); } }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.04); } }
@keyframes blink { 50% { opacity: .35; } }
.wiggle { animation: wiggle 1s ease-in-out infinite; }
.pulse { animation: pulse 1.2s ease-in-out infinite; }
.blink { animation: blink 1s step-end infinite; }

@media (max-width: 640px) {
  body { font-size: 16px; }
  .wrap { padding: 22px 16px 40px; }
  .card { padding: 16px; border-radius: 16px; box-shadow: var(--shadow-sm); }
  .bignum { font-size: 88px; }
}

/* Powered by 푸터 */
.powered { display: flex; justify-content: center; align-items: center; gap: 18px; margin-top: 40px; color: var(--muted); font-family: var(--display); font-size: 28px; }
.powered img { width: auto; display: block; }
.powered .logo-dera { height: 92px; }
.powered .logo-tf { height: 30px; }
.powered.corner { right: 28px; bottom: 20px; }
.powered.corner .logo-dera { height: 76px; }
.powered.corner .logo-tf { height: 24px; }
@media (max-width: 640px) { .powered { gap: 12px; font-size: 20px; } .powered .logo-dera { height: 64px; } .powered .logo-tf { height: 20px; } }
.powered.corner { position: fixed; right: 22px; bottom: 16px; margin: 0; }
