/* 子ども画面（小学生・iPad向け：大きな文字とボタン） */
/* テーマ（色は背景と文字を必ずペアで持つ） */
body.kid {
  --page-bg: linear-gradient(160deg, #fff6dc 0%, #ffeef4 45%, #e6f4ff 100%); --page-fg: #2b2233;
  --head-bg: rgba(255, 248, 234, .95); --head-fg: #2b2233; --head-line: #f0e1c4;
  --card-bg: #ffffff; --card-fg: #2b2233; --card-line: #f0e1c4; --card-shadow: rgba(222, 196, 150, .35); --muted: #574e62;
  --tab-bg: #ffffff; --tab-fg: #4e4659; --tab-on-bg: #ffe7a6; --tab-on-fg: #2b2233;
  background: var(--page-bg) fixed; color: var(--page-fg); font-size: 19px; min-height: 100vh;
}
body.kid.theme-sky {
  --page-bg: linear-gradient(160deg, #e3f2ff 0%, #e6fbf4 100%); --page-fg: #15293d;
  --head-bg: rgba(236, 246, 255, .95); --head-fg: #15293d; --head-line: #c9e0f5;
  --card-bg: #ffffff; --card-fg: #15293d; --card-line: #cfe3f5; --card-shadow: rgba(120, 170, 220, .25); --muted: #3f5266;
  --tab-bg: #ffffff; --tab-fg: #3f5266; --tab-on-bg: #d6ecff; --tab-on-fg: #15293d;
}
body.kid.theme-dream {
  --page-bg: linear-gradient(160deg, #fbe9ff 0%, #ffeaf3 50%, #e7efff 100%); --page-fg: #3a2346;
  --head-bg: rgba(252, 240, 255, .95); --head-fg: #3a2346; --head-line: #ecd5f5;
  --card-bg: #ffffff; --card-fg: #3a2346; --card-line: #ecd5f5; --card-shadow: rgba(200, 150, 220, .3); --muted: #5d4a6a;
  --tab-bg: #ffffff; --tab-fg: #5d4a6a; --tab-on-bg: #f3dcff; --tab-on-fg: #3a2346;
}
body.kid.theme-night {
  --page-bg: linear-gradient(160deg, #141833 0%, #221a3d 100%); --page-fg: #f4f1ff;
  --head-bg: rgba(20, 24, 51, .95); --head-fg: #f4f1ff; --head-line: #343a66;
  --card-bg: #23284d; --card-fg: #f4f1ff; --card-line: #3a4070; --card-shadow: rgba(0, 0, 0, .35); --muted: #cdc8e6;
  --tab-bg: #1a1e3d; --tab-fg: #cdc8e6; --tab-on-bg: #ffcf3f; --tab-on-fg: #2b2233;
}
ruby rt { font-size: .5em; font-weight: 700; letter-spacing: 0; }

.btn-go, .btn-main { background: #ffcf3f; color: #2b2233; border: none; border-bottom: 5px solid #d29b00; border-radius: 18px; padding: 12px 20px; font-weight: 800; font-size: 19px; min-height: 52px; transition: transform .08s; }
.btn-go:active, .btn-main:active { transform: translateY(3px); border-bottom-width: 2px; }
.btn-go:disabled, .btn-main:disabled { opacity: .55; }
.btn-go.big, .btn-main.big { width: 100%; font-size: 22px; min-height: 62px; margin-top: 14px; }
.btn-sub { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: #ffffff; color: #2b2233; border: 3px solid #e2d6ea; border-radius: 18px; padding: 10px 18px; font-weight: 800; font-size: 18px; min-height: 52px; text-decoration: none; }
.btn-sub.small { font-size: 15px; min-height: 40px; padding: 6px 14px; }
.btn-sub.wide { width: 100%; margin-top: 10px; }
.btn-mini { background: #ffffff; color: #3d3548; border: 2px solid #e2d6ea; border-radius: 999px; padding: 6px 14px; font-weight: 700; font-size: 15px; }
.btn-round { width: 52px; height: 52px; border-radius: 50%; border: 3px solid #e2d6ea; background: #ffffff; color: #2b2233; font-size: 26px; flex: none; }

.card { background: var(--card-bg); color: var(--card-fg); border: 3px solid var(--card-line); border-radius: 26px; padding: 18px; box-shadow: 0 6px 0 var(--card-shadow); }
.sec-title { font-size: 22px; margin: 0 0 12px; }
.hint { color: var(--muted); font-size: 16px; margin: 6px 0; }
.empty { color: var(--muted); text-align: center; padding: 18px 8px; }
.loading { color: var(--muted); text-align: center; padding: 30px; }
.big-emoji { font-size: 72px; text-align: center; line-height: 1.1; }
.center { text-align: center; }
.row2 { display: flex; gap: 12px; margin-top: 16px; }
.row2 > * { flex: 1; }
.tag { display: inline-block; border-radius: 999px; padding: 6px 12px; font-size: 15px; font-weight: 800; white-space: nowrap; background: #ece9f3; color: #463f52; }
.tag.ok { background: #d3f5df; color: #14532d; }
.tag.wait { background: #ece9f3; color: #463f52; }
.tag.bad { background: #ffe2df; color: #8a1c12; }

/* はじめの画面 */
.center-msg { max-width: 520px; margin: 12vh auto 0; text-align: center; padding: 20px; }
.center-msg h1 { font-size: 30px; margin: 8px 0; }
.center-msg p { line-height: 1.8; }
.title { text-align: center; font-size: 30px; margin: 28px 0 20px; }
.picker { padding: 16px; max-width: 900px; margin: 0 auto; text-align: center; }
.picker-grid { display: flex; flex-wrap: wrap; gap: 18px; justify-content: center; margin-bottom: 30px; }
.pick { background: #ffffff; color: #2b2233; border: 4px solid var(--kc, #f0e1c4); border-radius: 28px; padding: 14px 18px 16px; display: flex; flex-direction: column; align-items: center; width: 200px; box-shadow: 0 6px 0 rgba(0, 0, 0, .08); }
.pick-egg { font-size: 90px; line-height: 140px; }
.pick-name { font-size: 24px; font-weight: 800; margin-top: 6px; }
.pin-modal { max-width: 380px; text-align: center; }
.pin-dots { display: flex; gap: 16px; justify-content: center; margin: 6px 0 18px; }
.pin-dots span { width: 22px; height: 22px; border-radius: 50%; border: 3px solid #8a7f96; background: #ffffff; }
.pin-dots span.on { background: #2b2233; border-color: #2b2233; }
.pin-dots.shake { animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(-10px); } 75% { transform: translateX(10px); } }
.pin-keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.pin-key { height: 68px; border-radius: 20px; border: 3px solid #e2d6ea; background: #faf6fc; color: #2b2233; font-size: 28px; font-weight: 800; }

/* ペットを えらぶ */
.create { max-width: 640px; margin: 0 auto; padding: 16px; text-align: center; }
.create-preview { display: flex; justify-content: center; }
.choice-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 12px 0; }
.choice { background: #ffffff; color: #2b2233; border: 3px solid #e2d6ea; border-radius: 999px; padding: 10px 20px; font-weight: 800; font-size: 19px; }
.choice.on { border-color: #2b2233; background: #ffe7a6; }
.swatch { width: 52px; height: 52px; border-radius: 50%; border: 4px solid #ffffff; box-shadow: 0 0 0 2px #d9cfe2; }
.swatch.on { box-shadow: 0 0 0 4px #2b2233; }
.field { display: block; text-align: left; margin: 14px 0; }
.field > span { display: block; font-weight: 800; margin-bottom: 6px; }
.field input, .kid textarea { width: 100%; border: 3px solid #e2d6ea; border-radius: 16px; padding: 12px 14px; font-size: 20px; background: #ffffff; color: #2b2233; }
.kid textarea { line-height: 1.7; resize: vertical; }
.field input::placeholder, .kid textarea::placeholder, .composer input::placeholder { color: #6a6175; opacity: 1; }

/* 画面のわく */
.kid-shell { min-height: 100vh; padding-bottom: calc(92px + env(safe-area-inset-bottom)); }
.kid-head { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px; padding: max(10px, env(safe-area-inset-top)) 16px 10px; background: var(--head-bg); color: var(--head-fg); backdrop-filter: blur(8px); border-bottom: 2px solid var(--head-line); }
.who { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 20px; }
.who .dot { width: 18px; height: 18px; border-radius: 50%; background: var(--kc); border: 2px solid #ffffff; box-shadow: 0 0 0 2px #d9cfe2; }
.coins { margin-left: auto; background: #ffffff; color: #2b2233; border: 3px solid #ffcf3f; border-radius: 999px; padding: 4px 16px; font-size: 22px; }
.coins b { font-size: 24px; }
.kid-main { max-width: 1180px; margin: 0 auto; padding: 16px; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: center; gap: 4px; background: var(--tab-bg); border-top: 2px solid var(--head-line); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); }
.tab { position: relative; flex: 1; max-width: 150px; display: flex; flex-direction: column; align-items: center; gap: 2px; background: transparent; color: var(--tab-fg); border: none; border-radius: 18px; padding: 6px 4px; }
.tab .ti { font-size: 30px; line-height: 1.1; }
.tab .tl { font-size: 14px; font-weight: 800; white-space: nowrap; }
.tab.on { background: var(--tab-on-bg); color: var(--tab-on-fg); }
.tab .badge { position: absolute; top: 2px; right: 18%; min-width: 24px; height: 24px; border-radius: 12px; background: #c4261d; color: #ffffff; font-size: 14px; font-weight: 800; display: flex; align-items: center; justify-content: center; padding: 0 6px; }

/* ホーム */
.home-grid, .bag-grid, .diary-grid { display: grid; gap: 16px; }
@media (min-width: 820px) {
  .home-grid { grid-template-columns: minmax(340px, 1fr) 1.15fr; align-items: start; }
  .bag-grid, .diary-grid { grid-template-columns: 1fr 1fr; align-items: start; }
}
.pet-card { text-align: center; position: relative; }
.bubble { display: inline-block; position: relative; background: #fff4d6; color: #3a2d12; border: 3px solid #ffcf3f; border-radius: 20px; padding: 8px 18px; font-weight: 800; margin-top: 4px; }
.bubble::after { content: ""; position: absolute; left: 50%; bottom: -12px; transform: translateX(-50%); border: 10px solid transparent; border-top-color: #ffcf3f; border-bottom: 0; }
.pet-stage { background: none; border: none; padding: 0; margin: 6px auto 0; display: block; }
.pet-stage .pet { width: min(260px, 62vw); height: auto; }
.pet-name { font-size: 24px; font-weight: 800; margin: 2px 0 10px; }
.lv { font-size: 15px; background: #2b2233; color: #ffffff; border-radius: 999px; padding: 3px 10px; vertical-align: middle; }
.bar-row { display: flex; align-items: center; gap: 10px; margin: 8px 4px; text-align: left; }
.bar-row > span { width: 96px; font-weight: 800; font-size: 16px; flex: none; }
.bar { flex: 1; height: 18px; background: #f1ebf4; border-radius: 9px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 9px; transition: width .6s ease; }
.pet-actions { display: flex; gap: 12px; justify-content: center; margin-top: 14px; }
.pet-actions > * { flex: 1; max-width: 200px; }
.ticket-live { background: #dbeafe; color: #1e3a8a; border-radius: 16px; padding: 10px 14px; font-weight: 800; margin-bottom: 10px; }
.ticket-timer { font-variant-numeric: tabular-nums; }

.tasks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.task { display: flex; align-items: center; gap: 12px; background: #fffaf0; color: #2b2233; border: 3px solid #f3e6cc; border-radius: 20px; padding: 12px 14px; }
.task.done { background: #effbf3; border-color: #bfe8cc; }
.t-icon { font-size: 40px; width: 52px; text-align: center; flex: none; }
.t-body { flex: 1; min-width: 0; }
.t-title { font-size: 21px; font-weight: 800; }
.count { font-size: 15px; background: #ece9f3; color: #463f52; border-radius: 999px; padding: 2px 8px; vertical-align: middle; }
.t-coin { font-size: 16px; color: #5c4200; font-weight: 800; }
.t-state { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; flex: none; }
.reply { font-size: 15px; border-radius: 10px; padding: 4px 10px; margin-top: 4px; display: inline-block; }
.reply.bad { background: #ffe2df; color: #8a1c12; }
.reply.good { background: #e6f4ea; color: #14532d; }
.report { text-align: center; }
.photo-btn { display: inline-flex; align-items: center; gap: 6px; background: #ffffff; color: #2b2233; border: 3px dashed #cbbfd6; border-radius: 16px; padding: 10px 18px; font-weight: 800; cursor: pointer; margin-top: 4px; }
.food-grid, .shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.food { display: flex; flex-direction: column; align-items: center; gap: 4px; background: #fffaf0; color: #2b2233; border: 3px solid #f3e6cc; border-radius: 20px; padding: 14px 8px; font-weight: 800; }
.f-icon { font-size: 48px; }
.f-qty { font-size: 15px; color: #574e62; }

/* おみせ */
.seg { display: flex; gap: 6px; background: #f6f1f9; border-radius: 18px; padding: 5px; margin-bottom: 12px; }
.seg-b { flex: 1; background: transparent; color: #4e4659; border: none; border-radius: 14px; padding: 10px 6px; font-weight: 800; font-size: 17px; }
.seg-b.on { background: #ffffff; color: #2b2233; box-shadow: 0 2px 6px rgba(0, 0, 0, .1); }
.shop-item { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; background: #fffaf0; color: #2b2233; border: 3px solid #f3e6cc; border-radius: 22px; padding: 14px 10px; }
.s-icon { font-size: 52px; line-height: 1.1; }
.s-name { font-weight: 800; font-size: 18px; }
.s-eff { font-size: 14px; color: #574e62; }
.s-price { font-weight: 800; color: #5c4200; font-size: 18px; margin-bottom: 4px; }
.s-have { font-size: 14px; color: #14532d; font-weight: 700; }

/* もちもの */
.tickets { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ticket { display: flex; align-items: center; gap: 10px; border-radius: 18px; padding: 10px 12px; border: 3px solid #ece9f3; background: #ffffff; color: #2b2233; }
.ticket.ready { border-color: #ffcf3f; background: #fff8e0; }
.ticket.live { border-color: #93c5fd; background: #eff6ff; }
.ticket.ok, .ticket.bad { opacity: .8; }
.t-sub { font-size: 15px; color: #574e62; }
.dress { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: center; }
.acc-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; flex: 1; min-width: 220px; }
.acc { display: flex; flex-direction: column; align-items: center; gap: 2px; background: #ffffff; color: #2b2233; border: 3px solid #e2d6ea; border-radius: 18px; padding: 8px; font-weight: 800; }
.acc span { font-size: 34px; }
.acc small { font-size: 13px; color: #574e62; }
.acc.on { border-color: #ec4899; background: #fff0f6; }

/* てがみ */
.chat-card { display: flex; flex-direction: column; height: calc(100vh - 210px); min-height: 380px; }
.chat-card .chat { flex: 1; }
.composer { display: flex; gap: 8px; align-items: center; border-top: 2px solid var(--card-line); padding-top: 10px; }
.composer input { flex: 1; min-width: 0; border: 3px solid #e2d6ea; border-radius: 16px; padding: 12px; font-size: 19px; background: #ffffff; color: #2b2233; }

/* にっき */
.mood-row { display: flex; gap: 8px; justify-content: space-between; margin-bottom: 10px; }
.mood { flex: 1; font-size: 38px; background: #ffffff; border: 3px solid #e2d6ea; border-radius: 18px; padding: 6px 0; }
.mood.on { border-color: #2b2233; background: #ffe7a6; }
.share-row { display: flex; gap: 6px; background: #f6f1f9; border-radius: 18px; padding: 5px; margin-top: 12px; }

/* チャットの名前・時刻はカードの色に合わせる */
.kid .b-who, .kid .b-time { color: var(--muted); }
.kid .center-msg, .kid .title { color: var(--page-fg); }

/* ホーム：アバターとペットが並ぶ */
.home-col { display: flex; flex-direction: column; gap: 16px; }
.stage { display: flex; align-items: flex-end; justify-content: center; gap: 0; margin-top: 4px; }
.stage-av, .pet-stage { background: none; border: none; padding: 0; margin: 0; }
.stage-av .avatar { width: min(150px, 34vw); height: auto; display: block; }
.pet-stage .pet { width: min(200px, 44vw); height: auto; }
.goal-row { display: flex; align-items: center; gap: 12px; }
.g-icon { font-size: 44px; }
.g-main { flex: 1; }
.g-main .bar { margin: 6px 0; }
.g-left { font-weight: 800; color: var(--card-fg); }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.wd { display: flex; flex-direction: column; align-items: center; gap: 2px; background: #fffaf0; color: #2b2233; border: 2px solid #f3e6cc; border-radius: 14px; padding: 6px 2px; }
.wd.today { border-color: #f5b301; background: #fff4d6; }
.wd-l { font-weight: 800; font-size: 15px; }
.wd-s { font-size: 13px; min-height: 18px; letter-spacing: -2px; }
.wd-n { font-size: 13px; color: #574e62; }
.news { text-align: left; line-height: 1.8; padding-left: 1.2em; }
.emo-c { font-size: 26px; padding: 6px 12px; }

/* おみせ：ファッション */
.s-av { height: 118px; display: flex; align-items: flex-end; justify-content: center; }
.s-av .avatar { width: 92px; height: auto; }
.goal-b { margin-top: 6px; }
.goal-b.on { background: #fff4d6; border-color: #f5b301; }
.pick-art { display: flex; align-items: flex-end; }
.pick-art .avatar { width: 96px; height: auto; }
.pick-art .pet { width: 84px; height: auto; }

/* クローゼット */
.closet { display: grid; gap: 16px; }
@media (min-width: 820px) { .closet { grid-template-columns: 340px 1fr; align-items: start; } .cl-stage { position: sticky; top: 84px; } }
.cl-stage { text-align: center; }
.cl-av { display: flex; justify-content: center; background: radial-gradient(circle at 50% 70%, #fff4d6 0%, #ffffff 70%); border-radius: 20px; }
.cl-av .avatar { width: 210px; height: auto; }
.cl-h { font-size: 17px; margin: 16px 0 8px; text-align: left; }
.looks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.look-slot { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.look-b, .look-empty { width: 76px; height: 86px; border-radius: 16px; border: 3px solid #e2d6ea; background: #faf6fc; color: #574e62; display: flex; align-items: flex-end; justify-content: center; overflow: hidden; padding: 0; }
.look-empty { align-items: center; font-weight: 800; font-size: 22px; }
.look-b .avatar { width: 58px; height: auto; }
.cl-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.cl-tab { display: inline-flex; align-items: center; gap: 4px; background: #ffffff; color: #2b2233; border: 3px solid #e2d6ea; border-radius: 999px; padding: 6px 12px; font-weight: 800; font-size: 16px; }
.cl-tab.on { background: #ffe7a6; border-color: #2b2233; }
.cl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.cl-item { display: flex; flex-direction: column; align-items: center; gap: 4px; background: #ffffff; color: #2b2233; border: 3px solid #e2d6ea; border-radius: 18px; padding: 10px 6px; font-weight: 800; font-size: 15px; }
.cl-item.on { border-color: #ec4899; background: #fff0f6; }
.cl-ic { font-size: 38px; line-height: 1.1; }
.cl-none { font-size: 30px; color: #8a7f96; line-height: 1.3; }
.cl-done { margin-top: 14px; background: #d3f5df; color: #14532d; border-radius: 18px; padding: 14px; font-weight: 800; font-size: 20px; }
.cl-colors { display: flex; flex-wrap: wrap; gap: 10px; }
.sw { width: 46px; height: 46px; border-radius: 50%; border: 3px solid #ffffff; box-shadow: 0 0 0 2px #cbbfd6; }
.sw.on { box-shadow: 0 0 0 4px #2b2233; }

/* テーマ選択 */
.theme-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tp { display: flex; align-items: center; gap: 10px; border: 3px solid #e2d6ea; border-radius: 18px; padding: 12px; font-weight: 800; background: #ffffff; color: #2b2233; }
.tp.on { border-color: #2b2233; }
.tp-sw { width: 36px; height: 36px; border-radius: 10px; flex: none; }
.tp-sunny .tp-sw { background: linear-gradient(135deg, #fff6dc, #ffcf3f); }
.tp-sky .tp-sw { background: linear-gradient(135deg, #e3f2ff, #3e9ef5); }
.tp-dream .tp-sw { background: linear-gradient(135deg, #fbe9ff, #c3a6ff); }
.tp-night .tp-sw { background: linear-gradient(135deg, #141833, #5560b0); }

/* 段階ごとの大きさ */
body.tier-wakaba { font-size: 18px; }
body.tier-wakaba .t-title { font-size: 20px; }
body.tier-tsubasa { font-size: 16px; }
body.tier-tsubasa .btn-go, body.tier-tsubasa .btn-main { font-size: 17px; min-height: 46px; padding: 10px 16px; border-radius: 14px; }
body.tier-tsubasa .btn-sub { font-size: 16px; min-height: 46px; border-radius: 14px; }
body.tier-tsubasa .card { border-radius: 20px; padding: 16px; border-width: 2px; }
body.tier-tsubasa .t-title { font-size: 18px; }
body.tier-tsubasa .t-icon { font-size: 32px; width: 44px; }
body.tier-tsubasa .task { padding: 10px 12px; border-radius: 16px; border-width: 2px; }
body.tier-tsubasa .sec-title { font-size: 19px; }
body.tier-tsubasa .tab .ti { font-size: 24px; }
body.tier-tsubasa .tab .tl { font-size: 13px; }
body.tier-tsubasa .who { font-size: 18px; }
body.tier-tsubasa .coins { font-size: 19px; }

/* ダイアログは白い板＋暗い文字で固定（テーマの変数を明るい側に戻す） */
body.kid .modal { --muted: #574e62; --card-bg: #ffffff; --card-fg: #2b2233; --card-line: #f0e1c4; --page-fg: #2b2233; background: #ffffff; color: #2b2233; }
