/* コードタウン フェーズ1 スタイル：温かい絵本風・パステル。基準 1366×768 */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Hiragino Maru Gothic ProN", "Hiragino Sans", "Noto Sans JP", sans-serif;
  background: #fdf6e3; color: #4a3721; font-size: 16px;
}
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }
.bigbtn {
  background: #58b368; color: #fff; border: none; border-radius: 12px;
  font-size: 19px; font-weight: bold; padding: 12px 22px; min-height: 48px;
  box-shadow: 0 3px 0 #3d8b4f;
}
.bigbtn:disabled { background: #b9c9b4; box-shadow: none; cursor: default; }
.subbtn {
  background: #fff7dd; border: 2px solid #d9b36a; border-radius: 10px;
  font-size: 15px; padding: 8px 14px; min-height: 44px;
}
.mini-btn { background: #fff; border: 2px solid #d9b36a; border-radius: 8px; font-size: 14px; padding: 6px 12px; min-height: 36px; }
.card { background: #fffdf5; border: 3px solid #e8cf9a; border-radius: 16px; padding: 14px; }
.card-title { font-weight: bold; font-size: 17px; margin-bottom: 10px; color: #6b4423; }
.demo-note { background: #fff3cd; border: 2px dashed #d9b36a; border-radius: 10px; padding: 8px 12px; font-size: 13px; margin-bottom: 12px; }

/* 入場 */
#screen-join { display: flex; justify-content: center; padding: 28px 16px; }
.join-card { background: #fffdf5; border: 3px solid #e8cf9a; border-radius: 20px; padding: 26px 34px; width: 480px; max-width: 94vw; }
.join-card h1 { margin: 0 0 4px; font-size: 32px; color: #6b4423; text-align: center; }
.join-sub { text-align: center; margin: 0 0 14px; color: #8a6d3b; font-size: 14px; }
.join-card label { display: block; font-size: 14px; font-weight: bold; margin: 10px 0; }
.join-card input { display: block; width: 100%; font-size: 19px; padding: 10px; margin-top: 4px; border: 2px solid #d9c9a3; border-radius: 10px; background: #fff; }
.join-card .bigbtn { width: 100%; margin-top: 10px; }
.join-card .subbtn { width: 100%; margin-top: 12px; }
.join-msg { min-height: 22px; color: #c0392b; font-size: 14px; margin-top: 8px; text-align: center; }

/* 共通レイアウト */
.statusbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: #ffe9b8; border-bottom: 3px solid #e8cf9a; padding: 8px 16px; font-size: 16px;
}
.status-mid { font-weight: bold; color: #6b4423; }
.home-main { display: grid; grid-template-columns: 58% 1fr; gap: 14px; padding: 14px; }
.side-col { display: flex; flex-direction: column; gap: 14px; }
.town-svg { width: 100%; height: auto; border-radius: 12px; }
.town-under { display: flex; align-items: flex-end; gap: 10px; margin-top: 6px; min-height: 54px; }
.balloon {
  background: #fff; border: 2px solid #d9c9a3; border-radius: 14px; padding: 10px 14px;
  font-size: 15px; line-height: 1.6; position: relative; flex: 1;
}
.flag-wave { transform-origin: 200px 90px; animation: wave 1.6s ease-in-out infinite; }
.flag-wave.delay { animation-delay: .5s; }
@keyframes wave { 0%,100% { transform: rotate(-2deg); } 50% { transform: rotate(3deg); } }

.quest-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: #fff; border: 2px solid #e8cf9a; border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; font-size: 16px; min-height: 48px;
}
.quest-item.next { border-color: #58b368; background: #eefaf0; font-weight: bold; }
.quest-item.locked { opacity: .55; }
.quest-item .qst { margin-left: auto; font-size: 13px; color: #8a6d3b; white-space: nowrap; }
.progress-line { font-size: 14px; color: #6b4423; margin-top: 4px; }
.build-card .bigbtn { width: 100%; margin-top: 8px; }
#buildInfo { font-size: 15px; line-height: 1.7; }

.inventory-bar {
  display: flex; align-items: center; gap: 14px; background: #ffe9b8; border-top: 3px solid #e8cf9a; padding: 10px 16px;
}
.inv-title { font-weight: bold; }
.inv-items { display: flex; gap: 10px; flex: 1; flex-wrap: wrap; }
.inv-chip { background: #fffdf5; border: 2px solid #d9b36a; border-radius: 999px; padding: 5px 14px; font-size: 15px; }
.inv-chip.gain { animation: pop .6s ease; }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.25); } 100% { transform: scale(1); } }

/* ミッション */
.mission-main { display: grid; grid-template-columns: 46% 1fr; gap: 14px; padding: 14px; }
.stage-scene { display: flex; align-items: flex-end; justify-content: center; gap: 8px; margin-top: 12px; min-height: 190px; }
.char-svg { width: 120px; height: 150px; transition: transform .3s; }
.char-svg.pose-walk { animation: walk .5s ease-in-out infinite; }
.char-svg.pose-work #charArmR { transform-origin: 90px 66px; animation: work .45s ease-in-out infinite; }
.char-svg.pose-fall { transform: rotate(-64deg) translateY(26px); }
.char-svg.pose-happy { animation: happy .5s ease-in-out infinite; }
@keyframes walk { 0%,100% { transform: translateX(0); } 50% { transform: translateX(10px) translateY(-3px); } }
@keyframes work { 0%,100% { transform: rotate(0deg); } 50% { transform: rotate(-38deg); } }
@keyframes happy { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
.sign-svg { width: 220px; height: 150px; }
.stage-caption { text-align: center; font-size: 15px; color: #6b4423; min-height: 24px; margin-top: 6px; }
.output-box { background: #2e4053; color: #d5f5d5; border-radius: 12px; padding: 10px 14px; margin-top: 10px; }
.output-title { font-size: 12px; color: #9fc2e8; }
.output-box pre { margin: 4px 0 2px; font-size: 18px; white-space: pre-wrap; }

.q-meta { font-size: 13px; color: #8a6d3b; }
.panel h2 { margin: 4px 0 10px; font-size: 21px; color: #6b4423; }
.codebox { background: #2e4053; border-radius: 12px; padding: 12px 8px; margin-bottom: 12px; }
.codebox pre { margin: 0; font-family: "SF Mono", Consolas, monospace; font-size: 19px; line-height: 1.75; color: #f5f5f5; }
.cline { display: block; padding: 0 10px; border-radius: 6px; }
.cline .ln { display: inline-block; width: 26px; color: #8fa8c8; user-select: none; }
.cline.hl { background: #f7c948; color: #333; }
.cline.hl .ln { color: #333; }
.cline.clickable { cursor: pointer; }
.cline.clickable:hover { background: #486581; }
.cline.picked { background: #c0392b; color: #fff; }
.blank { display: inline-block; min-width: 30px; text-align: center; background: #f7c948; color: #333; border-radius: 6px; padding: 0 6px; font-weight: bold; }
.choices { display: flex; flex-direction: column; gap: 8px; }
.choice { background: #fff; border: 2px solid #d9c9a3; border-radius: 10px; padding: 10px 14px; font-size: 17px; text-align: left; min-height: 46px; }
.choice.sel { border-color: #58b368; background: #eefaf0; font-weight: bold; }
.pieces { display: flex; gap: 10px; flex-wrap: wrap; }
.pchip { background: #fff7dd; border: 2px solid #d9b36a; border-radius: 10px; font-size: 20px; font-family: Consolas, monospace; padding: 8px 20px; min-height: 46px; }
.pchip.sel { background: #f7c948; font-weight: bold; }
.varbadge { display: inline-block; background: #eef4ff; border: 2px solid #9fc2e8; border-radius: 999px; padding: 4px 14px; font-size: 15px; margin-bottom: 10px; }
#editor {
  width: 100%; height: 190px; font-family: Consolas, monospace; font-size: 18px; line-height: 1.7;
  border: 2px solid #9fc2e8; border-radius: 12px; padding: 12px; background: #fdfefe; tab-size: 4;
}
.checklist { margin: 10px 0; font-size: 15px; line-height: 1.9; }
.checklist .ok { color: #2e7d32; }
.checklist .ng { color: #c0392b; }
.checklist .wait { color: #999; }
.feedback { border-radius: 12px; padding: 12px 14px; font-size: 16px; line-height: 1.7; margin-top: 12px; }
.feedback.good { background: #e8f8e8; border: 2px solid #58b368; }
.feedback.bad { background: #fdecea; border: 2px solid #e57373; }
.mission-footer { display: flex; align-items: center; gap: 14px; margin-top: 14px; }
.mission-footer .bigbtn { margin-left: auto; }
.confidence button { background: none; border: none; font-size: 22px; color: #e57373; padding: 2px; min-width: 30px; min-height: 36px; }

/* 先生用 */
.teacher-card { margin: 14px; }
.class-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.class-tab { background: #fff; border: 2px solid #d9b36a; border-radius: 10px 10px 0 0; padding: 8px 18px; font-size: 16px; min-height: 44px; }
.class-tab.sel { background: #ffe9b8; font-weight: bold; }
table.roster { width: 100%; border-collapse: collapse; font-size: 15px; }
table.roster th, table.roster td { border: 1px solid #e8cf9a; padding: 8px 10px; text-align: left; }
table.roster th { background: #ffe9b8; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: #4a3721; color: #fff; border-radius: 999px; padding: 12px 26px; font-size: 17px; z-index: 50;
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
}
@media (max-width: 900px) {
  .home-main, .mission-main { grid-template-columns: 1fr; }
}
