/* ============================================
   もじおぼえ — 子ども向けパステルテーマ
   ============================================ */

:root {
  --pink: #ffb7d5;
  --pink-light: #ffe3f0;
  --pink-deep: #ff8fbf;
  --lavender: #c9b6f5;
  --lavender-light: #ece4ff;
  --sky: #a8dcff;
  --sky-light: #e0f3ff;
  --mint: #b3ecd4;
  --mint-light: #e2fbf0;
  --cream: #fff8e7;
  --yellow: #ffe9a8;
  --text: #6b5b6e;
  --text-strong: #574a5e;
  --white: #ffffff;
  --shadow: 0 6px 0 rgba(214, 155, 190, 0.35);
  --radius: 26px;
  --font: "Hiragino Maru Gothic ProN", "ヒラギノ丸ゴ ProN", "BIZ UDGothic",
    "Rounded Mplus 1c", "M PLUS Rounded 1c", "Yu Gothic", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(circle at 15% 20%, rgba(255, 255, 255, 0.7) 0 26px, transparent 27px),
    radial-gradient(circle at 85% 12%, rgba(255, 255, 255, 0.6) 0 20px, transparent 21px),
    radial-gradient(circle at 70% 85%, rgba(255, 255, 255, 0.55) 0 30px, transparent 31px),
    radial-gradient(circle at 25% 75%, rgba(255, 255, 255, 0.5) 0 18px, transparent 19px),
    linear-gradient(160deg, #ffe3f0 0%, #ece4ff 55%, #e0f3ff 100%);
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button {
  font-family: inherit;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
button:active { transform: translateY(3px); }

/* ---------- 画面切り替え ---------- */
.screen {
  display: none;
  position: fixed;
  inset: 0;
  flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.screen.active { display: flex; }

/* ---------- ヘッダー ---------- */
.screen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px 6px;
  flex: 0 0 auto;
}
.screen-title {
  font-size: clamp(20px, 3.4vw, 30px);
  color: var(--text-strong);
  letter-spacing: 0.12em;
}
.btn-back, .btn-header-action {
  background: var(--white);
  color: var(--pink-deep);
  font-size: clamp(15px, 2.2vw, 20px);
  font-weight: bold;
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: var(--shadow);
}
.btn-header-action { font-size: clamp(18px, 2.6vw, 24px); padding: 10px 16px; }
.header-spacer { width: 90px; }

/* ---------- ホーム ---------- */
.home-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 1.8vh, 20px);
  padding: 16px;
}
.app-title {
  display: flex;
  gap: 0.3em;
  font-size: clamp(36px, 7vw, 64px);
  letter-spacing: 0.1em;
}
.app-title span:nth-child(1) { color: var(--pink-deep); }
.app-title span:nth-child(2) { color: #9d7fe0; }
.app-title span {
  text-shadow: 3px 3px 0 var(--white);
  animation: title-bounce 2.4s ease-in-out infinite;
}
.app-title span:nth-child(2) { animation-delay: 0.25s; }
@keyframes title-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.home-mascot {
  height: clamp(120px, 24vh, 240px);
  animation: mascot-sway 3s ease-in-out infinite;
  filter: drop-shadow(0 8px 10px rgba(180, 140, 200, 0.3));
}
@keyframes mascot-sway {
  0%, 100% { transform: rotate(-2deg); }
  50% { transform: rotate(2deg) translateY(-6px); }
}
.home-hello {
  font-size: clamp(17px, 2.6vw, 24px);
  color: var(--text-strong);
  background: var(--white);
  padding: 8px 24px;
  border-radius: 999px;
  box-shadow: var(--shadow);
}

.category-cards {
  display: flex;
  gap: clamp(12px, 2.4vw, 28px);
  flex-wrap: wrap;
  justify-content: center;
}
.category-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: clamp(130px, 24vw, 210px);
  padding: clamp(14px, 2.4vh, 26px) 10px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 0.15s;
}
.cat-hiragana { background: linear-gradient(160deg, #ffd1e5, #ffb7d5); }
.cat-katakana { background: linear-gradient(160deg, #d9ccff, #c9b6f5); }
.cat-suuji    { background: linear-gradient(160deg, #bfe6ff, #a8dcff); }
.cat-icon { font-size: clamp(30px, 5vw, 48px); }
.cat-label {
  font-size: clamp(19px, 3vw, 28px);
  font-weight: bold;
  color: var(--white);
  text-shadow: 1px 2px 0 rgba(130, 90, 130, 0.35);
}
.cat-sample {
  font-size: clamp(13px, 1.8vw, 17px);
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.25);
  padding: 2px 14px;
  border-radius: 999px;
}

/* ---------- モード選択 ---------- */
.mode-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 2.4vh, 30px);
  padding: 16px;
}
.mode-mascot {
  height: clamp(100px, 20vh, 200px);
  animation: mascot-sway 3s ease-in-out infinite;
}
.mode-cards {
  display: flex;
  gap: clamp(14px, 3vw, 36px);
  flex-wrap: wrap;
  justify-content: center;
}
.mode-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: clamp(210px, 34vw, 320px);
  padding: clamp(18px, 3vh, 32px) 14px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.mode-read  { background: linear-gradient(160deg, #fff3c4, #ffe9a8); }
.mode-trace { background: linear-gradient(160deg, #ccf3e0, #b3ecd4); }
.mode-icon { font-size: clamp(34px, 5.4vw, 54px); }
.mode-label {
  font-size: clamp(19px, 2.8vw, 27px);
  font-weight: bold;
  color: var(--text-strong);
}
.mode-desc { font-size: clamp(12px, 1.7vw, 16px); color: var(--text); }

/* ---------- よんでおぼえる（五十音表） ---------- */
.read-grid-wrap {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px clamp(10px, 3vw, 40px) 24px;
}
.read-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: clamp(8px, 1.4vw, 16px);
  max-width: 720px;
  margin: 0 auto;
}
.read-grid.grid-suuji { grid-template-columns: repeat(5, 1fr); max-width: 720px; }
.read-cell {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: var(--white);
  border-radius: 22px;
  box-shadow: 0 5px 0 rgba(214, 155, 190, 0.3);
  font-family: inherit;
  transition: transform 0.12s;
}
.read-cell:active { transform: scale(0.94); }
.read-cell-char {
  font-size: clamp(26px, 5.4vw, 52px);
  font-weight: bold;
  color: var(--text-strong);
}
.read-cell-emoji { font-size: clamp(13px, 2.2vw, 22px); }
.read-cell.empty {
  background: transparent;
  box-shadow: none;
  pointer-events: none;
}

/* ---------- オーバーレイ共通 ---------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(120, 90, 140, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 16px;
}
.overlay.hidden { display: none; }

/* ---------- よみカード ---------- */
.read-card {
  position: relative;
  background: var(--white);
  border-radius: 34px;
  box-shadow: 0 12px 0 rgba(180, 120, 160, 0.35);
  padding: clamp(20px, 4vh, 40px) clamp(24px, 6vw, 60px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(6px, 1.4vh, 14px);
  max-width: min(92vw, 560px);
  max-height: 92vh;
  animation: card-pop 0.25s ease-out;
}
@keyframes card-pop {
  from { transform: scale(0.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.btn-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--pink-light);
  color: var(--pink-deep);
  font-size: 20px;
  font-weight: bold;
}
.read-card-char {
  font-size: clamp(90px, 22vh, 180px);
  font-weight: bold;
  line-height: 1.1;
  color: var(--pink-deep);
  text-shadow: 4px 4px 0 var(--pink-light);
}
.read-card-emoji { font-size: clamp(36px, 7vh, 64px); line-height: 1.2; word-break: break-all; text-align: center; white-space: pre-line; }
.read-card-emoji.many { font-size: clamp(20px, 3.6vh, 34px); line-height: 1.3; }
.read-card-word {
  font-size: clamp(22px, 4vh, 36px);
  font-weight: bold;
  color: var(--text-strong);
  text-align: center;
}
.btn-speak {
  background: var(--yellow);
  color: var(--text-strong);
  font-size: clamp(15px, 2.4vh, 20px);
  font-weight: bold;
  padding: 12px 26px;
  border-radius: 999px;
  box-shadow: 0 5px 0 rgba(200, 170, 90, 0.45);
}
.read-card-nav { display: flex; gap: 30px; margin-top: 4px; }
.btn-nav {
  width: clamp(54px, 9vh, 70px);
  height: clamp(54px, 9vh, 70px);
  border-radius: 50%;
  background: var(--lavender-light);
  color: #9d7fe0;
  font-size: clamp(20px, 3.4vh, 28px);
  box-shadow: 0 5px 0 rgba(160, 130, 210, 0.4);
}

/* ---------- なぞってかく ---------- */
.trace-layout {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(6px, 1.2vh, 14px);
  padding: 4px 14px calc(14px + env(safe-area-inset-bottom));
  min-height: 0;
}
.trace-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}
.trace-info {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--white);
  border-radius: 999px;
  padding: 8px 22px;
  box-shadow: var(--shadow);
}
.trace-info-emoji { font-size: clamp(20px, 3vh, 30px); }
.trace-info-word {
  font-size: clamp(15px, 2.4vh, 22px);
  font-weight: bold;
  color: var(--text-strong);
}
.trace-progress {
  width: min(70vw, 360px);
  height: 14px;
  background: var(--white);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(180, 140, 180, 0.25);
}
.trace-progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--pink), var(--lavender), var(--sky));
  transition: width 0.25s ease-out;
}
.trace-stars { font-size: clamp(13px, 2vh, 18px); min-height: 1.4em; letter-spacing: 2px; }
.trace-hint {
  font-size: clamp(13px, 2vh, 18px);
  font-weight: bold;
  color: #9d7fe0;
  background: rgba(255, 255, 255, 0.75);
  padding: 4px 16px;
  border-radius: 999px;
}

.trace-canvas-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  aspect-ratio: 1;
  max-width: 92vw;
  background: var(--white);
  border-radius: 30px;
  box-shadow: 0 10px 0 rgba(214, 155, 190, 0.3);
  overflow: hidden;
  /* 十字ガイド線 */
  background-image:
    linear-gradient(to right, transparent calc(50% - 1px), rgba(255, 183, 213, 0.5) calc(50% - 1px), rgba(255, 183, 213, 0.5) calc(50% + 1px), transparent calc(50% + 1px)),
    linear-gradient(to bottom, transparent calc(50% - 1px), rgba(255, 183, 213, 0.5) calc(50% - 1px), rgba(255, 183, 213, 0.5) calc(50% + 1px), transparent calc(50% + 1px));
}
.trace-canvas-wrap canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
#trace-draw { touch-action: none; }

.trace-controls {
  display: flex;
  gap: clamp(12px, 3vw, 30px);
  flex: 0 0 auto;
}
.btn-trace-nav, .btn-trace-clear {
  font-size: clamp(15px, 2.4vh, 21px);
  font-weight: bold;
  padding: 12px clamp(12px, 2.6vw, 22px);
  border-radius: 999px;
  box-shadow: var(--shadow);
}
.btn-trace-nav { background: var(--white); color: #9d7fe0; }
.btn-trace-clear { background: var(--mint); color: #3e8a68; }

/* ---------- お祝い ---------- */
.celebrate-card {
  position: relative;
  background: var(--white);
  border-radius: 34px;
  box-shadow: 0 12px 0 rgba(180, 120, 160, 0.35);
  padding: clamp(24px, 5vh, 44px) clamp(28px, 7vw, 70px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  animation: card-pop 0.3s ease-out;
}
/* キャラの円形フレーム（透過キャラはパステル背景、カード画像は全面表示） */
.celebrate-frame {
  width: clamp(130px, 24vh, 220px);
  height: clamp(130px, 24vh, 220px);
  border-radius: 34px;
  background:
    radial-gradient(circle at 50% 30%, #fff6fb 0%, #f3e8ff 55%, #e3d5fa 100%);
  box-shadow: inset 0 0 0 4px #ffffff, 0 6px 0 rgba(190, 150, 210, 0.3);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
}
.celebrate-mascot {
  height: 88%;
  animation: banzai 0.9s ease-in-out infinite;
  transform-origin: 50% 92%;
}
.celebrate-frame.is-card .celebrate-mascot {
  height: 100%;
  width: 100%;
  object-fit: cover;
}
/* バンザイ風モーション：しゃがみ→ジャンプ＋のけぞり */
@keyframes banzai {
  0%   { transform: translateY(0) rotate(0deg) scale(1, 1); }
  18%  { transform: translateY(3%) rotate(0deg) scale(1.06, 0.9); }
  40%  { transform: translateY(-13%) rotate(-7deg) scale(0.97, 1.06); }
  55%  { transform: translateY(-16%) rotate(6deg) scale(0.97, 1.06); }
  75%  { transform: translateY(0) rotate(0deg) scale(1.04, 0.94); }
  100% { transform: translateY(0) rotate(0deg) scale(1, 1); }
}
.celebrate-name {
  font-size: clamp(14px, 2.2vh, 19px);
  font-weight: bold;
  color: #9d7fe0;
  background: var(--lavender-light);
  padding: 5px 18px;
  border-radius: 999px;
}
.celebrate-text {
  font-size: clamp(28px, 5vh, 46px);
  font-weight: bold;
  color: var(--pink-deep);
  text-shadow: 2px 3px 0 var(--pink-light);
}
.celebrate-stars { font-size: clamp(24px, 4vh, 38px); animation: stars-blink 1s ease-in-out infinite; }
@keyframes stars-blink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.12); }
}
.celebrate-buttons { display: flex; gap: 16px; margin-top: 6px; flex-wrap: wrap; justify-content: center; }
.btn-celebrate-again, .btn-celebrate-next {
  font-size: clamp(15px, 2.4vh, 20px);
  font-weight: bold;
  padding: 13px 26px;
  border-radius: 999px;
  box-shadow: var(--shadow);
}
.btn-celebrate-again { background: var(--sky-light); color: #4a8ab8; }
.btn-celebrate-next { background: var(--pink); color: var(--white); }

/* 紙吹雪 */
.confetti { position: absolute; inset: 0; pointer-events: none; }
.confetti span {
  position: absolute;
  top: -12px;
  font-size: 18px;
  animation: confetti-fall linear forwards;
}
@keyframes confetti-fall {
  to { transform: translateY(110vh) rotate(720deg); opacity: 0.6; }
}

/* ---------- ホームのチップ＆シール帳ボタン ---------- */
.profile-chip, .sticker-book-btn {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top));
  z-index: 5;
  background: var(--white);
  font-weight: bold;
  font-size: clamp(14px, 2vw, 18px);
  color: var(--text-strong);
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: var(--shadow);
}
.profile-chip { left: 14px; }
.sticker-book-btn { right: 14px; color: #9d7fe0; }
.sticker-count {
  display: inline-block;
  min-width: 1.5em;
  background: var(--pink);
  color: var(--white);
  border-radius: 999px;
  padding: 1px 6px;
  margin-left: 4px;
  font-size: 0.85em;
}

/* ---------- プロフィール画面 ---------- */
.profile-inner {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(12px, 2.4vh, 24px);
  padding: 10px 20px calc(30px + env(safe-area-inset-bottom));
}
.profile-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  max-width: 640px;
}
.profile-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--white);
  border-radius: 999px;
  padding: 14px 26px;
  font-size: clamp(17px, 2.6vw, 22px);
  font-weight: bold;
  color: var(--text-strong);
  box-shadow: var(--shadow);
  border: 3px solid transparent;
}
.profile-item.active { border-color: var(--pink); }
.profile-item-age { font-size: 0.75em; color: #b9a8c9; }
.profile-form {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(18px, 3vh, 30px) clamp(20px, 4vw, 40px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: min(92vw, 480px);
}
.profile-form-title { font-weight: bold; color: var(--text-strong); font-size: clamp(16px, 2.4vw, 20px); }
.profile-input {
  font-family: inherit;
  font-size: clamp(18px, 2.8vw, 24px);
  font-weight: bold;
  text-align: center;
  color: var(--text-strong);
  background: var(--pink-light);
  border: 3px solid var(--pink);
  border-radius: 999px;
  padding: 12px 20px;
  width: 100%;
  outline: none;
}
.profile-input.shake { animation: shake 0.4s; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}
.age-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.age-chip {
  background: var(--lavender-light);
  color: #9d7fe0;
  font-weight: bold;
  font-size: clamp(13px, 2vw, 16px);
  padding: 8px 14px;
  border-radius: 999px;
}
.age-chip.selected {
  background: var(--lavender);
  color: var(--white);
  box-shadow: 0 3px 0 rgba(140, 110, 200, 0.4);
}
.profile-item.pressing { animation: press-wiggle 1.2s ease-in; }
@keyframes press-wiggle {
  0% { transform: scale(1); }
  60% { transform: scale(0.97); }
  100% { transform: scale(0.92); box-shadow: 0 2px 0 rgba(214, 155, 190, 0.35); }
}
.profile-tip {
  font-size: clamp(11px, 1.6vw, 14px);
  color: #b9a8c9;
  text-align: center;
}
.credits {
  margin-top: 6px;
  text-align: center;
  font-size: clamp(10px, 1.4vw, 12px);
  color: #c3b4d2;
  line-height: 1.7;
}
.credits a { color: #a58fd0; }
.delete-card { max-width: min(92vw, 480px); }
.delete-text {
  font-size: clamp(20px, 3.4vh, 30px);
  font-weight: bold;
  color: var(--text-strong);
  text-align: center;
}
.delete-sub {
  font-size: clamp(13px, 2vh, 16px);
  color: var(--text);
  text-align: center;
}
.btn-delete-confirm {
  background: #f28b9c;
  color: var(--white);
  font-size: clamp(15px, 2.4vh, 20px);
  font-weight: bold;
  padding: 13px 26px;
  border-radius: 999px;
  box-shadow: 0 5px 0 rgba(200, 90, 110, 0.4);
}

.btn-profile-create {
  background: linear-gradient(160deg, var(--pink), var(--pink-deep));
  color: var(--white);
  font-size: clamp(17px, 2.6vw, 22px);
  font-weight: bold;
  padding: 14px 40px;
  border-radius: 999px;
  box-shadow: 0 6px 0 rgba(214, 120, 165, 0.45);
}

/* ---------- シール帳 ---------- */
.sticker-book-wrap {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 6px 16px calc(28px + env(safe-area-inset-bottom));
}
.sticker-book {
  max-width: 700px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.sticker-section {
  background: rgba(255, 255, 255, 0.75);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}
.sticker-section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.sticker-cat-icon { font-size: clamp(20px, 3vw, 28px); }
.sticker-cat-label {
  font-size: clamp(17px, 2.6vw, 23px);
  font-weight: bold;
  color: var(--text-strong);
  flex: 1;
}
.sticker-cat-count {
  font-size: clamp(12px, 1.8vw, 15px);
  font-weight: bold;
  color: #9d7fe0;
  background: var(--lavender-light);
  padding: 4px 12px;
  border-radius: 999px;
}
.sticker-row {
  display: flex;
  gap: clamp(10px, 2.4vw, 22px);
  justify-content: center;
}
.sticker-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.sticker-cap { font-size: clamp(11px, 1.6vw, 14px); font-weight: bold; color: #b9a8c9; }

/* ぷくぷくシール（プレースホルダ／画像両対応） */
.sticker-slot {
  position: relative;
  width: clamp(58px, 11vw, 96px);
  height: clamp(58px, 11vw, 96px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sticker-puku {
  border: 4px solid var(--white);
  box-shadow:
    inset -5px -7px 12px rgba(120, 80, 130, 0.18),
    inset 5px 7px 12px rgba(255, 255, 255, 0.9),
    0 6px 10px rgba(180, 130, 180, 0.35);
  animation: puku-pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes puku-pop {
  from { transform: scale(0.3); }
  to { transform: scale(1); }
}
.sticker-emoji { font-size: clamp(26px, 5vw, 44px); filter: drop-shadow(0 2px 2px rgba(120,80,130,0.25)); }
.sticker-img {
  position: absolute;
  inset: -4px;
  width: calc(100% + 8px);
  height: calc(100% + 8px);
  object-fit: contain;
}
/* 画像シールが読み込めたら円形の飾り・絵文字を消して画像だけ見せる */
.sticker-puku.has-img {
  background: none;
  border-color: transparent;
  box-shadow: none;
}
.sticker-puku.has-img .sticker-emoji { visibility: hidden; }
.sticker-slot.locked {
  background: rgba(230, 222, 240, 0.7);
  border: 3px dashed #cfc0e0;
}
.sticker-q { font-size: clamp(22px, 4vw, 36px); font-weight: bold; color: #c3b2d6; }

/* シール獲得オーバーレイ */
.sticker-got .sticker-slot {
  width: clamp(110px, 20vh, 170px);
  height: clamp(110px, 20vh, 170px);
}
.sticker-got .sticker-emoji { font-size: clamp(52px, 10vh, 84px); }
.sticker-get-text {
  color: #f0a30a;
  text-shadow: 2px 3px 0 #fff3c4;
  font-size: clamp(24px, 6.5vw, 44px);
  white-space: nowrap;
}

/* ---------- シールまでの目標リング ---------- */
.trace-goal {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.75);
  border-radius: 999px;
  padding: 5px 16px 5px 8px;
}
.goal-ring { width: clamp(30px, 4.6vh, 40px); height: clamp(30px, 4.6vh, 40px); transform: rotate(-90deg); }
.goal-ring .ring-bg { fill: none; stroke: #eee4f5; stroke-width: 6; }
.goal-ring .ring-fg {
  fill: none;
  stroke: #ff8fbf;
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 0 999;
  transition: stroke-dasharray 0.4s ease-out;
}
.goal-text { font-size: clamp(12px, 1.9vh, 16px); font-weight: bold; color: var(--text-strong); }

/* ---------- ホームのフッター（クレジット / © LynxBase） ---------- */
.home-footer {
  position: absolute;
  bottom: calc(8px + env(safe-area-inset-bottom));
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 16px;
  pointer-events: none;
}
.credit-trigger, .lynxbase-mark {
  font-size: clamp(10px, 1.5vw, 13px);
  color: rgba(120, 100, 140, 0.55);
  font-weight: bold;
}
.credit-trigger {
  pointer-events: auto;
  -webkit-user-select: none;
  user-select: none;
}

/* ---------- クレジットまとめページ ---------- */
.credits-wrap {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 20px calc(30px + env(safe-area-inset-bottom));
}
.credits-page {
  max-width: 560px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.85);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(20px, 3.5vh, 34px) clamp(20px, 4vw, 36px);
  color: var(--text);
  font-size: clamp(13px, 1.9vw, 16px);
  line-height: 1.9;
}
.credits-page h3 {
  text-align: center;
  color: var(--text-strong);
  font-size: clamp(19px, 2.8vw, 24px);
  letter-spacing: 0.1em;
}
.credits-copyright {
  text-align: center;
  color: #9d7fe0;
  font-weight: bold;
  margin-bottom: 14px;
}
.credits-page h4 {
  color: var(--pink-deep);
  margin: 16px 0 4px;
  font-size: clamp(14px, 2.1vw, 17px);
}
.credits-page ul { list-style: none; }
.credits-page li { margin-bottom: 8px; }
.credits-url { color: #a58fd0; font-size: 0.9em; }

/* ---------- 横向き（タブレット・スマホ横） ---------- */
@media (orientation: landscape) and (max-height: 620px) {
  .home-mascot { height: clamp(90px, 26vh, 160px); }
  .mode-mascot { height: clamp(70px, 20vh, 130px); }
  .trace-layout {
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: clamp(10px, 2.5vw, 28px);
  }
  .trace-side { flex: 0 1 auto; max-width: 32vw; }
  .trace-progress { width: min(28vw, 260px); }
  .trace-canvas-wrap { height: 100%; max-height: 78vh; width: auto; }
  .trace-controls { flex-direction: column; }
}

/* スマホ縦：カードを縦積み */
@media (orientation: portrait) and (max-width: 540px) {
  .category-cards { flex-direction: column; width: 100%; align-items: center; }
  .category-card { width: min(84vw, 340px); flex-direction: row; justify-content: space-between; padding: 14px 22px; }
  .mode-cards { flex-direction: column; width: 100%; align-items: center; }
  .mode-card { width: min(86vw, 360px); }
  .header-spacer { width: 44px; }
}
