@import url("https://fonts.googleapis.com/css2?family=Jua&family=Noto+Sans+KR:wght@400;500;600;700;800;900&display=swap");
:root {
  --paper: #fffaf1;
  --ink: #34352f;
  --muted: #777970;
  --orange: #f3704d;
  --orange-dark: #ce4828;
  --line: #e9e6da;
  --mint: #e5f1e9;
  --green: #4e8167;
  --yellow: #ffdb7b;
  --white: #fff;
  font-family: "Jua", "Noto Sans KR", sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input {
  font: inherit;
}
button,
a,
input {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
  transition:
    transform 0.15s,
    background 0.15s;
}
button:active {
  transform: translateY(2px);
}
button:disabled {
  cursor: default;
  opacity: 0.5;
}
button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid #6aa991;
  outline-offset: 4px;
}
button {
  border: 0;
}
a {
  color: inherit;
  text-decoration: none;
}
.header {
  max-width: 1260px;
  margin: auto;
  display: flex;
  align-items: center;
  padding: 28px 32px;
  gap: 24px;
}
.brand {
  display: flex;
  align-items: center;
  font-family: "Jua", "Noto Sans KR", sans-serif;
  font-size: 28px;
  gap: 9px;
}
.brand-icon {
  display: grid;
  place-items: center;
  background: var(--orange);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  font-size: 29px;
  transform: rotate(-8deg);
}
.brand-dot {
  color: var(--orange);
  margin-left: -8px;
}
.curriculum {
  font-size: 14px;
  color: var(--muted);
  border-left: 1px solid #dcdccf;
  padding-left: 24px;
}
.quiet {
  margin-left: auto;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 9px;
}
.quiet span {
  border: 1.5px solid #85867c;
  border-radius: 50%;
  width: 21px;
  height: 21px;
}
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 30px 24px;
  min-height: calc(100vh - 161px);
}
.home {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  align-items: center;
  gap: 70px;
  max-width: 1020px;
  margin: 25px auto 16px;
}
.intro {
  position: relative;
  padding-left: 22px;
}
.eyebrow {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.09em;
  color: var(--green);
}
h1 {
  font-family: "Jua", "Noto Sans KR", sans-serif;
  font-weight: 400;
  font-size: 68px;
  line-height: 1.16;
  margin: 20px 0 14px;
  letter-spacing: -2px;
}
h1 em {
  font-style: normal;
  color: var(--orange);
}
.spark {
  font-size: 45px;
  color: var(--yellow);
  display: inline-block;
  vertical-align: top;
  margin-left: 20px;
  transform: rotate(10deg);
}
.intro p {
  font-size: 18px;
  line-height: 1.85;
  color: #737568;
  margin: 0;
}
.hero-art {
  width: 290px;
  height: 255px;
  margin: -8px 0 0 150px;
  transform: rotate(5deg);
}
.hero-art img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  mix-blend-mode: multiply;
}
.hero-caption {
  font-family: "Jua", "Noto Sans KR", sans-serif;
  font-size: 16px;
  color: #7e826f;
  margin: 3px 0 0 100px;
  transform: rotate(-5deg);
}
.entry-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 34px 36px;
  box-shadow: 0 12px 0 #ece8da55;
}
.card-icon {
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: #fff1d0;
  width: 45px;
  height: 45px;
  color: #b58222;
  font-size: 30px;
}
h2 {
  font-family: "Jua", "Noto Sans KR", sans-serif;
  font-weight: 400;
  font-size: 28px;
  margin: 19px 0 10px;
}
.entry-card > p {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 25px;
}
.entry-card label {
  display: block;
  font-weight: 700;
  font-size: 14px;
  margin: 19px 0 10px;
}
input {
  width: 100%;
  height: 54px;
  border: 1.5px solid #e5e5dc;
  border-radius: 12px;
  padding: 0 16px;
  background: #fdfdfb;
  color: var(--ink);
  font-size: 16px;
}
input::placeholder {
  color: #a4a69a;
}
.primary {
  background: var(--orange);
  color: #fff;
  border-radius: 12px;
  padding: 16px 22px;
  font-weight: 800;
  font-size: 17px;
  box-shadow: 0 4px 0 #d55636;
}
.primary:hover {
  background: #e96140;
}
.entry-card .primary {
  width: 100%;
  margin: 19px 0 5px;
  display: flex;
  justify-content: space-between;
}
.or {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 25px 0 8px;
  color: #93958a;
  font-size: 13px;
}
.or:before,
.or:after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}
.join-row {
  display: flex;
  gap: 10px;
}
.join-row input {
  min-width: 0;
  text-transform: uppercase;
  letter-spacing: 2px;
}
.secondary {
  background: var(--mint);
  color: #36684e;
  border: 1px solid #d0e4d6;
  border-radius: 12px;
  padding: 14px 18px;
  font-weight: 700;
  white-space: nowrap;
}
.entry-card .small-note {
  font-size: 13px;
  margin: 20px 0 17px;
  text-align: center;
}
.practice {
  background: none;
  width: 100%;
  text-align: center;
  color: #7b7d70;
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 5px;
}
.error {
  color: #c74628 !important;
  min-height: 0;
  margin: 12px 0 0 !important;
}
.error:empty {
  display: none;
}
footer {
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px 32px 26px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  color: #949486;
  font-size: 13px;
}
footer span {
  letter-spacing: 9px;
  color: #bfbea9;
}
dialog {
  max-width: 560px;
  width: calc(100% - 32px);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 32px;
  color: var(--ink);
}
dialog::backdrop {
  background: #33372b70;
  backdrop-filter: blur(3px);
}
.dialog-close {
  float: right;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  font-size: 26px;
  background: #f3f2eb;
}
dialog ol {
  padding-left: 23px;
  line-height: 1.9;
  font-size: 16px;
}
dialog li {
  padding: 5px 0;
}
.rule-note {
  background: var(--paper);
  border-radius: 12px;
  padding: 16px;
  font-size: 14px;
  line-height: 1.8;
}
#toast {
  position: fixed;
  z-index: 20;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  border-radius: 14px;
  padding: 14px 25px;
  box-shadow: 0 6px 30px #0002;
  max-width: 90%;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
#toast.show {
  opacity: 1;
}
.panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 28px;
}
.lobby {
  max-width: 850px;
  margin: 35px auto;
}
.lobby-heading {
  text-align: center;
}
.lobby-heading h1 {
  font-size: 44px;
  letter-spacing: -1px;
  margin: 10px;
}
.lobby-heading p {
  color: var(--muted);
  line-height: 1.7;
}
.room-ticket {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 26px;
  background: #fff1cf;
  border: 1px dashed #d9bb6c;
  border-radius: 18px;
  padding: 20px;
  margin: 26px auto;
  max-width: 480px;
}
.room-ticket small {
  display: block;
  font-size: 13px;
  color: #8a743c;
}
.code {
  font-size: 32px;
  letter-spacing: 6px;
  font-weight: 900;
}
.copy {
  background: white;
  border-radius: 10px;
  padding: 12px;
  font-size: 14px;
}
.players {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 24px 0;
}
.player-seat {
  border: 1px solid var(--line);
  background: white;
  border-radius: 20px;
  min-height: 174px;
  padding: 22px 10px;
  text-align: center;
}
.avatar {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  background: #fff1d4;
  border-radius: 22px;
  margin: 0 auto 12px;
  font-size: 32px;
}
.player-seat strong {
  display: block;
  font-size: 16px;
  overflow-wrap: anywhere;
}
.player-seat small {
  display: block;
  color: var(--muted);
  margin-top: 8px;
}
.player-seat.empty {
  border: 2px dashed var(--line);
  background: transparent;
  color: #a0a28f;
}
.lobby-bottom {
  display: flex;
  align-items: center;
  gap: 20px;
  justify-content: center;
  margin-top: 30px;
}
.lobby-bottom p {
  font-size: 14px;
  color: var(--muted);
}
.text-button {
  background: none;
  text-decoration: underline;
  text-underline-offset: 4px;
  color: #858676;
  font-size: 14px;
  padding: 14px;
}
.game-top {
  display: flex;
  align-items: center;
  gap: 20px;
  margin: 5px 0 20px;
}
.round-label {
  font-size: 14px;
  color: var(--green);
  font-weight: 800;
  letter-spacing: 0.08em;
}
.game-top h2 {
  margin: 5px 0 0;
  font-size: 29px;
}
.round-dots {
  display: flex;
  gap: 8px;
  margin-left: 12px;
}
.round-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #e6e5da;
}
.round-dot.active {
  background: var(--orange);
  outline: 4px solid #ffe6d9;
}
.round-dot.done {
  background: #85b89d;
}
.timer {
  margin-left: auto;
  min-width: 146px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 12px 19px;
}
.timer small {
  font-size: 12px;
  color: var(--muted);
  display: block;
}
.timer strong {
  font-size: 28px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.timer.low {
  color: #cc462b;
  background: #fff0e9;
}
.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 245px;
  gap: 22px;
}
.board-panel {
  padding: 0;
  overflow: hidden;
  position: relative;
}
.board-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 17px 22px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.board-heading strong {
  display: flex;
  align-items: center;
  gap: 9px;
}
.board-heading strong:before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--orange);
}
.board-heading span {
  color: var(--muted);
  font-size: 13px;
}
.board-wrap {
  background: #fcfcf7;
  position: relative;
}
.board {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
  user-select: none;
}
.piece {
  cursor: grab;
  outline: none;
}
.piece polygon {
  stroke: #fff;
  stroke-width: 2.5;
  stroke-linejoin: round;
  filter: drop-shadow(0 3px 1px #39412a20);
}
.piece.selected polygon {
  stroke: #333d32;
  stroke-width: 3.5;
}
.piece:focus-visible polygon {
  stroke: #333d32;
  stroke-width: 4;
}
.piece.locked {
  cursor: default;
}
.piece.locked polygon {
  stroke: #fff;
  stroke-width: 1.5;
  filter: none;
}
.piece text {
  pointer-events: none;
  font-weight: 700;
  font-size: 16px;
  fill: #ffffffee;
}
.target polygon {
  fill: #e3e8dc;
  stroke: #e3e8dc;
  stroke-width: 1;
}
.hint polygon {
  fill: #ffdb7b88;
  stroke: #c39a38;
  stroke-width: 2;
  stroke-dasharray: 6 4;
}
.board-tools {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 15px 18px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}
.tool {
  padding: 11px 13px;
  border-radius: 10px;
  border: 1px solid #e3e5d9;
  background: #fff;
  font-size: 14px;
  font-weight: 700;
}
.tool:hover {
  background: var(--paper);
}
.board-tools .tool:last-child {
  margin-left: auto;
}
.tool-label {
  color: var(--muted);
  font-size: 13px;
  margin-right: 5px;
}
.side-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.mini-panel {
  border-radius: 20px;
  border: 1px solid var(--line);
  background: white;
  padding: 20px;
}
.mini-panel h3 {
  font-size: 15px;
  margin: 0 0 15px;
}
.hint-button {
  background: #fff1cd;
  color: #805c15;
  border: 1px solid #f1d791;
  border-radius: 12px;
  padding: 12px;
  width: 100%;
  font-weight: 800;
}
.mini-panel p {
  font-size: 13px;
  line-height: 1.8;
  color: var(--muted);
  margin: 13px 0 0;
}
.score-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 0;
  border-bottom: 1px solid #f0f0e8;
  font-size: 14px;
}
.score-row:last-child {
  border-bottom: 0;
}
.score-row .name {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.score-row .medal {
  font-size: 21px;
}
.score-row .points {
  font-weight: 800;
  color: var(--green);
  white-space: nowrap;
}
.score-row.me .name {
  font-weight: 800;
}
.connection {
  font-size: 12px;
  color: var(--green);
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.connection:before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6aaa85;
}
.connection.offline {
  color: #bd4729;
}
.connection.offline:before {
  background: #bd4729;
}
.progress-box {
  background: #eaf3e9;
  border: 1px solid #d4e7d5;
  border-radius: 18px;
  padding: 18px;
  color: #48754f;
  font-size: 14px;
  line-height: 1.7;
}
.progress-box strong {
  font-size: 21px;
}
.submit {
  margin-top: 4px;
  width: 100%;
}
.game-bottom {
  font-size: 13px;
  text-align: center;
  color: var(--muted);
  padding-top: 15px;
}
.feedback {
  padding: 14px 20px;
  background: #fff2d8;
  border-top: 1px solid #f0dfba;
  font-size: 15px;
  line-height: 1.6;
}
.feedback.success {
  background: #e6f2e7;
  color: #32613a;
}
.finish-overlay {
  position: absolute;
  inset: 0;
  background: #fcfcf7ee;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  padding: 20px;
  z-index: 5;
}
.finish-overlay .big-icon {
  font-size: 66px;
}
.finish-overlay h2 {
  margin: 15px 0 5px;
}
.finish-overlay p {
  line-height: 1.9;
  color: var(--muted);
}
.results {
  max-width: 760px;
  margin: 20px auto;
  text-align: center;
}
.result-crown {
  font-size: 67px;
}
.results h1 {
  font-size: 42px;
  letter-spacing: -1px;
  margin: 10px 0 15px;
  line-height: 1.4;
}
.results > p {
  color: var(--muted);
  line-height: 1.7;
}
.result-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  margin: 0;
}
.result-table td,
.result-table th {
  padding: 17px 13px;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}
.result-table th {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}
.result-table td:last-child {
  text-align: right;
  font-weight: 800;
  color: var(--green);
  font-size: 20px;
}
.result-table th:last-child {
  text-align: right;
}
.result-table tr:last-child td {
  border-bottom: 0;
}
.result-panel {
  margin: 25px 0;
}
.round-score {
  display: block;
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
  margin-top: 4px;
}
.winner-row {
  background: #fff6df;
}
.results .primary {
  margin: 12px;
}
.result-hint {
  font-size: 14px !important;
}
.banner {
  padding: 12px;
  background: #fff0da;
  border: 1px solid #eed7a9;
  border-radius: 12px;
  font-size: 14px;
  margin-bottom: 15px;
}
.waiting-note {
  text-align: center;
  font-size: 14px;
  color: var(--muted);
}
@media (min-width: 1400px) {
  .home {
    margin-top: 50px;
    gap: 90px;
  }
  .hero-art {
    width: 310px;
    height: 280px;
  }
  .entry-card {
    padding: 40px;
  }
  h1 {
    font-size: 76px;
  }
}
@media (max-width: 900px) {
  .home {
    gap: 30px;
  }
  .hero-art {
    margin-left: 60px;
    width: 240px;
    height: 240px;
  }
  .intro {
    padding-left: 0;
  }
  h1 {
    font-size: 58px;
  }
  .entry-card {
    padding: 26px;
  }
  .game-layout {
    grid-template-columns: minmax(0, 1fr) 210px;
    gap: 14px;
  }
  .mini-panel {
    padding: 15px;
  }
  .board-heading span {
    display: none;
  }
  .tool-label {
    display: none;
  }
  .board-tools {
    gap: 7px;
    padding: 12px;
  }
  .tool {
    padding: 11px 9px;
  }
}
@media (max-width: 680px) {
  .header {
    padding: 20px;
    gap: 8px;
  }
  .brand {
    font-size: 25px;
  }
  .curriculum {
    display: none;
  }
  main {
    padding: 12px 16px 25px;
  }
  .home {
    display: flex;
    flex-direction: column;
    gap: 22px;
    margin: 10px auto;
    align-items: stretch;
  }
  .intro {
    padding: 5px 10px 0;
    min-height: 160px;
  }
  .intro .eyebrow {
    font-size: 12px;
  }
  h1 {
    font-size: 46px;
    margin: 13px 0 9px;
  }
  .intro p {
    font-size: 14px;
    line-height: 1.8;
  }
  .hero-art {
    position: absolute;
    width: 170px;
    height: 180px;
    right: 0;
    top: 30px;
    margin: 0;
    z-index: -1;
  }
  .hero-caption {
    display: none;
  }
  .spark {
    font-size: 26px;
    margin-left: 10px;
  }
  .entry-card {
    padding: 25px;
  }
  .entry-card h2 {
    font-size: 26px;
  }
  .players {
    grid-template-columns: repeat(2, 1fr);
  }
  .lobby {
    margin-top: 10px;
  }
  .lobby-heading h1 {
    font-size: 35px;
  }
  .room-ticket {
    gap: 12px;
    padding: 15px;
  }
  .code {
    font-size: 27px;
    letter-spacing: 4px;
  }
  .lobby-bottom {
    flex-direction: column;
    gap: 10px;
  }
  .game-top {
    gap: 8px;
    flex-wrap: wrap;
  }
  .game-top h2 {
    font-size: 24px;
  }
  .round-dots {
    display: none;
  }
  .timer {
    min-width: 120px;
    padding: 10px 12px;
  }
  .timer strong {
    font-size: 24px;
  }
  .game-layout {
    grid-template-columns: 1fr;
  }
  .side-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .side-panel .ranking-panel {
    grid-column: 1/-1;
    order: 4;
  }
  .side-panel .submit {
    align-self: center;
  }
  .progress-box {
    padding: 12px;
  }
  .board-tools {
    gap: 6px;
  }
  .tool {
    font-size: 12px;
    padding: 12px 9px;
  }
  .board-heading {
    padding: 13px 16px;
  }
  .game-bottom {
    font-size: 12px;
  }
  .mini-panel h3 {
    font-size: 14px;
  }
  .mini-panel p {
    font-size: 12px;
  }
  .results h1 {
    font-size: 30px;
  }
  .result-table td,
  .result-table th {
    padding: 13px 8px;
  }
  footer {
    font-size: 11px;
    padding: 16px;
  }
  footer span {
    letter-spacing: 3px;
  }
  .result-panel {
    padding: 13px;
  }
}
.board-panel:fullscreen {
  background: var(--paper);
  border-radius: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: auto;
}
.board-panel:fullscreen .board-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  width: 100%;
  justify-content: center;
}
.board-panel:fullscreen .board {
  width: auto;
  height: 100%;
  max-width: 100%;
}
.board-panel:fullscreen .board-heading,
.board-panel:fullscreen .board-tools {
  width: 100%;
  justify-content: center;
}
.board-panel:fullscreen .feedback {
  width: 100%;
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

/* Larger classroom type, unobstructed introduction, and independent practice bank. */
:root {
  font-size: 18px;
}
.intro {
  min-width: 0;
}
.intro p {
  position: relative;
  z-index: 2;
  font-size: 20px;
  line-height: 1.9;
  overflow: visible;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.hero-art {
  position: relative;
  z-index: 0;
  margin: 24px 0 0 100px;
  max-width: calc(100% - 100px);
  transform: rotate(3deg);
}
.home {
  gap: 48px;
}
.curriculum,
.quiet,
.eyebrow {
  font-size: 16px;
}
.entry-card > p,
.entry-card label {
  font-size: 17px;
}
.entry-card .small-note {
  font-size: 16px;
  line-height: 1.8;
}
.or {
  font-size: 15px;
}
input {
  font-size: 18px;
  min-height: 58px;
}
.primary,
.secondary {
  font-size: 19px;
  min-height: 54px;
}
.practice {
  font-size: 19px;
  font-weight: 800;
  min-height: 58px;
  line-height: 1.6;
  background: #f2f6ed;
  border-radius: 12px;
  text-decoration: none;
  color: #41664b;
  padding: 12px;
}
.hero-caption {
  font-size: 19px;
  margin-top: 16px;
}
.board-heading {
  gap: 14px;
  flex-wrap: wrap;
  font-size: 17px;
}
.board-heading span {
  font-size: 16px;
}
.tool {
  font-size: 16px;
  min-height: 49px;
  padding: 12px;
}
.tool-label {
  font-size: 16px;
}
.board-tools .tool:last-child {
  margin-left: 0;
}
.mini-panel h3 {
  font-size: 18px;
}
.mini-panel p,
.game-bottom,
.waiting-note,
.lobby-bottom p {
  font-size: 16px;
}
.score-row {
  font-size: 17px;
  gap: 7px;
}
.score-row .points {
  text-align: right;
}
.last-points {
  display: block;
  font-size: 13px;
  line-height: 1.5;
  font-weight: 500;
  color: #7f806f;
}
.game-layout {
  grid-template-columns: minmax(0, 1fr) 265px;
}
.round-label {
  font-size: 17px;
}
.game-top h2 {
  font-size: 32px;
}
.timer small {
  font-size: 16px;
}
.timer strong {
  font-size: 32px;
}
.progress-box {
  font-size: 17px;
}
.progress-box strong {
  font-size: 26px;
}
.connection {
  font-size: 14px;
  line-height: 1.7;
}
.exit-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #fff0e7;
  border: 2px solid #d98b6b;
  border-radius: 13px;
  color: #8b4028;
  font-size: 19px;
  font-weight: 800;
  min-height: 58px;
  padding: 14px 22px;
  white-space: nowrap;
}
.exit-button:hover {
  background: #ffe1d0;
}
.lobby-exit {
  margin-top: 24px;
  text-align: center;
}
.game-bottom {
  line-height: 1.9;
  padding-top: 20px;
}
.answer-dialog {
  text-align: center;
  padding: 38px;
  max-width: 580px;
}
.answer-dialog h2 {
  font-size: 32px;
  line-height: 1.55;
  word-break: keep-all;
}
.answer-dialog p {
  font-size: 20px;
  line-height: 1.8;
}
.answer-icon {
  font-size: 60px;
}
.answer-dialog::backdrop {
  background: #29352c85;
}
.answer-dialog .primary {
  margin-top: 15px;
  min-width: 210px;
}
.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
}
dialog ol {
  font-size: 19px;
}
.rule-note {
  font-size: 19px;
  line-height: 1.9;
}
.dialog-close {
  width: 44px;
  height: 44px;
  font-size: 30px;
}
#toast {
  font-size: 18px;
  line-height: 1.6;
  bottom: 24px;
}
.finish-overlay {
  gap: 14px;
}
.finish-overlay h2 {
  font-size: 36px;
}
.finish-overlay p {
  font-size: 20px;
  margin: 0 0 12px;
}
.finish-overlay .secondary {
  margin-top: 5px;
}
.bank-return {
  margin-left: auto;
}
.practice-note .secondary {
  margin-top: 18px;
  width: 100%;
  white-space: normal;
}
.bank-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 25px;
  margin: 20px 0 28px;
}
.bank-heading h1 {
  font-size: 40px;
  letter-spacing: -1px;
  margin: 14px 0;
}
.bank-heading p {
  font-size: 19px;
  color: var(--muted);
  line-height: 1.8;
  word-break: keep-all;
}
.bank-controls {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  align-items: center;
}
.category-tabs {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  width: 100%;
}
.category {
  font-size: 18px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: white;
  padding: 12px 21px;
  min-height: 50px;
  font-weight: 700;
}
.category.active {
  background: #48775d;
  border-color: #48775d;
  color: white;
}
.search-label {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 17px;
}
.search-label input {
  width: 260px;
}
.bank-count {
  font-size: 17px;
  color: #777e6e;
  margin: 25px 0 18px;
}
.puzzle-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}
.puzzle-card {
  display: flex;
  align-items: center;
  flex-direction: column;
  text-align: center;
  background: white;
  border: 2px solid var(--line);
  border-radius: 22px;
  padding: 20px 15px;
  gap: 14px;
  min-width: 0;
  box-shadow: 0 4px 0 #e9e7da77;
}
.puzzle-card:hover {
  border-color: #f5a780;
  background: #fffdf7;
  transform: translateY(-3px);
}
.puzzle-preview {
  height: 145px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.puzzle-preview svg {
  width: 100%;
  height: 100%;
  fill: #557c65;
  stroke: #557c65;
  stroke-width: 0.015;
}
.puzzle-card:nth-child(4n + 2) svg {
  fill: #c98450;
  stroke: #c98450;
}
.puzzle-card:nth-child(4n + 3) svg {
  fill: #7a83ab;
  stroke: #7a83ab;
}
.puzzle-card:nth-child(4n) svg {
  fill: #af7891;
  stroke: #af7891;
}
.puzzle-name {
  font-size: 21px;
  font-family: "Jua", "Noto Sans KR", sans-serif;
  line-height: 1.45;
}
.puzzle-status {
  font-size: 16px;
  color: #7b8375;
}
.bank-empty {
  grid-column: 1/-1;
  text-align: center;
  padding: 60px 10px;
  font-size: 20px;
}
.result-table td {
  font-size: 18px;
}
.result-table th {
  font-size: 16px;
}
.round-score {
  font-size: 15px;
}
.results .result-hint {
  font-size: 18px !important;
}
@media (max-width: 1050px) {
  .game-layout {
    grid-template-columns: minmax(0, 1fr) 230px;
  }
  .home {
    gap: 30px;
  }
  .entry-card {
    padding: 28px;
  }
  .puzzle-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .board-heading span {
    display: none;
  }
  .board-tools {
    gap: 7px;
  }
  .tool {
    font-size: 16px;
    padding: 10px;
  }
  .hero-art {
    margin-left: 45px;
    max-width: calc(100% - 45px);
  }
}
@media (max-width: 760px) {
  .game-layout {
    grid-template-columns: 1fr;
  }
  .side-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }
  .side-panel .ranking-panel {
    grid-column: 1/-1;
    order: 4;
  }
  .side-panel .exit-button {
    grid-column: 1/-1;
    order: 5;
  }
  .side-panel .submit {
    margin: 0;
    align-self: stretch;
  }
  .practice-note {
    grid-column: 1/-1;
  }
  .game-top {
    flex-wrap: wrap;
  }
  .board-heading {
    font-size: 18px;
  }
  .tool-label {
    display: none;
  }
  .puzzle-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .bank-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
  .bank-heading h1 {
    font-size: 34px;
  }
  .category {
    font-size: 16px;
    padding: 11px 15px;
  }
  .bank-controls {
    gap: 14px;
  }
  .search-label {
    width: 100%;
  }
  .search-label input {
    flex: 1;
    min-width: 0;
  }
  .bank-controls > .secondary {
    width: 100%;
  }
  .puzzle-preview {
    height: 130px;
  }
  .puzzle-name {
    font-size: 20px;
  }
  .puzzle-card {
    padding: 16px 10px;
    gap: 12px;
  }
}
@media (max-width: 680px) {
  .intro {
    padding: 5px 8px 0;
  }
  .intro h1 {
    font-size: 45px;
    max-width: calc(100% - 118px);
    line-height: 1.2;
  }
  .intro .eyebrow {
    font-size: 15px;
  }
  .intro p {
    font-size: 18px;
    margin-top: 35px;
    line-height: 1.9;
    max-width: 100%;
  }
  .hero-art {
    position: absolute;
    z-index: 0;
    width: 132px;
    height: 150px;
    max-width: 132px;
    right: 0;
    top: 35px;
    margin: 0;
  }
  .entry-card > p,
  .entry-card label {
    font-size: 17px;
  }
  .entry-card .small-note {
    font-size: 15px;
  }
  .game-top h2 {
    font-size: 28px;
  }
  .round-label {
    font-size: 16px;
  }
  .timer strong {
    font-size: 28px;
  }
  .timer small {
    font-size: 14px;
  }
  .mini-panel p {
    font-size: 16px;
  }
  .mini-panel h3 {
    font-size: 18px;
  }
  .tool {
    font-size: 15px;
    min-height: 50px;
  }
  .game-bottom {
    font-size: 16px;
  }
  .answer-dialog {
    padding: 28px 22px;
  }
  .answer-dialog h2 {
    font-size: 28px;
  }
  .answer-dialog p {
    font-size: 19px;
  }
  .exit-button {
    font-size: 19px;
  }
  .bank-heading h1 {
    font-size: 30px;
  }
  .bank-heading p {
    font-size: 18px;
  }
  .bank-return {
    font-size: 17px;
    padding: 12px;
  }
  .progress-box {
    font-size: 17px;
  }
  footer {
    font-size: 14px;
    line-height: 1.7;
  }
  .puzzle-status {
    font-size: 15px;
  }
  .finish-overlay .big-icon {
    font-size: 44px;
  }
  .finish-overlay h2 {
    font-size: 28px;
  }
  .finish-overlay p {
    font-size: 18px;
  }
  .finish-overlay {
    gap: 8px;
    padding: 15px;
  }
  .finish-overlay .primary,
  .finish-overlay .secondary {
    font-size: 17px;
    padding: 12px;
    min-height: 48px;
  }
}

/* Child-friendly instructions and deliberate sentence breaks. */
#rulesDialog {
  max-width: 1100px;
  padding: 32px 42px;
}
#rulesDialog li,
#rulesDialog .rule-note {
  word-break: keep-all;
  overflow-wrap: break-word;
}
#answerText,
#answerDetail {
  white-space: pre-line;
  text-align: center;
}
.music-button {
  white-space: nowrap;
  margin-left: auto;
}
@media (max-width: 640px) {
  #rulesDialog {
    padding: 24px;
  }
  .header {
    flex-wrap: wrap;
    gap: 10px;
  }
  .music-button {
    font-size: 15px;
    padding: 9px;
  }
}
/* A gentle picture-book playground: decoration never covers the puzzle. */
:root {
  --paper: #fffaf3;
  --ink: #493f3b;
  --line: #efdfcd;
  --mint: #edf6ec;
  --orange: #ec815c;
}
body {
  background:
    radial-gradient(circle at 8% 16%, #ffe9d060, transparent 25%),
    radial-gradient(circle at 95% 55%, #e4f0e970, transparent 30%), var(--paper);
}
h1,
h2,
h3,
.primary,
.secondary,
.tool,
.hint-button,
.category,
.exit-button {
  font-family: "Jua", "Noto Sans KR", sans-serif;
  font-weight: 400;
}
.brand-icon {
  background: #f3a06c;
  border-radius: 13px 13px 16px 16px;
  box-shadow: 0 3px 0 #e0b084;
}
.entry-card,
.mini-panel,
.panel {
  border-color: #efdfcd;
  border-radius: 28px;
}
.entry-card {
  box-shadow: 0 8px 0 #eadfcb66;
}
.card-icon {
  background: #fff0c9;
  border-radius: 18px;
  transform: rotate(-7deg);
}
.hero-art {
  transform: rotate(-3deg);
}
.hero-art img {
  border-radius: 45px;
  mix-blend-mode: multiply;
}
.hero-caption {
  color: #93654c;
}
.primary {
  background: #ed825e;
  box-shadow: 0 5px 0 #cb6546;
  border-radius: 19px;
}
.primary:hover {
  background: #e77853;
}
.secondary,
.practice,
.hint-button,
.tool {
  border-radius: 17px;
}
.category {
  border-radius: 17px;
}
.category.active {
  background: #668f78;
  border-color: #668f78;
}
.puzzle-card {
  border: 2px solid #e9ddca;
  border-radius: 26px;
  background: #fffefa;
}
.puzzle-preview {
  border-radius: 20px;
  background: #f2f6ef;
  padding: 15px;
}
.puzzle-card:nth-child(4n + 2) .puzzle-preview {
  background: #fff0df;
}
.puzzle-card:nth-child(4n + 3) .puzzle-preview {
  background: #f0eef9;
}
.puzzle-card:nth-child(4n) .puzzle-preview {
  background: #fceef2;
}
.puzzle-status {
  background: #f5f0e6;
  padding: 5px 12px;
  border-radius: 20px;
}
.board-heading {
  background: #fff9e8;
  border-bottom: 1px dashed #e9d8b9;
}
.board-tools {
  background: #fffaf0;
}
.progress-box {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 14px 12px;
  border: 2px solid #dbe9d8;
  border-radius: 25px;
  background: #f1f8ef;
}
.buddy {
  width: 68px;
  height: 78px;
  flex-shrink: 0;
  object-fit: contain;
  mix-blend-mode: multiply;
}
.piece-stickers {
  display: flex;
  gap: 3px;
  line-height: 1.4;
}
.piece-stickers span {
  color: #d4decf;
  font-size: 18px;
}
.piece-stickers .filled {
  color: #b77916;
}
.success-mascot {
  width: clamp(95px, 20vw, 160px);
  height: auto;
  border-radius: 35px;
  mix-blend-mode: multiply;
}
.finish-overlay {
  background: #fffdf4f5;
}
.snap-ring {
  fill: none;
  stroke: #e9b853;
  stroke-width: 3;
  transform-box: fill-box;
  transform-origin: center;
  animation: snap-ring 0.5s ease-out forwards;
}
.snap-star {
  fill: #b97b13;
  font-size: 19px;
  animation: snap-spark 0.55s ease-out forwards;
}
.snap-word {
  fill: #567653;
  font-size: 26px;
  font-family: "Jua", "Noto Sans KR", sans-serif;
  paint-order: stroke;
  stroke: #fffefa;
  stroke-width: 4px;
  animation: snap-spark 0.55s ease-out forwards;
}
@keyframes snap-ring {
  from {
    opacity: 0.8;
    transform: scale(0.7);
  }
  to {
    opacity: 0;
    transform: scale(2.1);
  }
}
@keyframes snap-spark {
  0% {
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}
@media (max-width: 640px) {
  .buddy {
    width: 52px;
    height: 62px;
  }
  .progress-box {
    justify-content: center;
  }
}
@media (prefers-reduced-motion: reduce) {
  .snap-ring,
  .snap-star {
    display: none;
  }
  .snap-word {
    animation: none;
  }
  button {
    transition: none;
  }
}

/* Compact primary controls retain comfortable touch targets. */
.primary,
.answer-dialog .primary,
.finish-overlay .primary {
  padding: 9px 20px;
  min-height: 46px;
  line-height: 1.3;
}
.primary {
  box-shadow: 0 3px 0 #cb6546;
}
#rulesButton span {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  line-height: 1;
  padding: 0;
}
.brand-name {
  white-space: nowrap;
}
@media (max-width: 760px) {
  .header {
    flex-wrap: wrap;
    gap: 12px;
  }
  .brand {
    font-size: 24px;
  }
  .brand-name {
    letter-spacing: -0.5px;
  }
  .curriculum {
    display: none;
  }
}
@media (max-width: 460px) {
  .brand {
    flex-basis: 100%;
  }
  #musicButton {
    margin-left: 0;
  }
  #rulesButton {
    margin-left: auto;
  }
}

.brand-accent {color:var(--orange);}
.music-button {border:1.5px solid #dbe8d8;background:#f1f7ed;border-radius:16px;padding:8px 12px;gap:8px;min-height:48px;}
.sound-icon {width:30px;height:30px;flex-shrink:0;color:#4c785b;}
.music-button[aria-pressed="false"] {background:#f6f0ee;border-color:#e6d7d1;}
.music-button[aria-pressed="false"] .sound-icon {color:#b15743;}
.music-button .sound-label {width:auto;height:auto;border:0;border-radius:0;line-height:1.4;}
/* Keep help and sound together at the right, at identical touch-target sizes. */
.header-actions {margin-left:auto;display:flex;align-items:center;gap:10px;flex-shrink:0;}
.header-actions #rulesButton,.header-actions #musicButton {margin:0;box-sizing:border-box;min-height:44px;height:44px;min-width:116px;padding:8px 12px;font-size:16px;line-height:1;gap:7px;justify-content:center;border-radius:14px;}
.header-actions #rulesButton {border:1.5px solid #dbe8d8;background:#f1f7ed;}
.header-actions .sound-icon {width:24px;height:24px;}
.puzzle-preview path {stroke:none;}
@media(max-width:460px){.header-actions {margin-left:auto;} .header-actions #rulesButton,.header-actions #musicButton {min-width:110px;font-size:15px;}}
/* Apricot sound control and lavender help, paired with the cream background. */
.header-actions #musicButton {background:#fff0e2;border-color:#edd3bc;color:#785139;}
.header-actions #musicButton .sound-icon {color:#b27448;}
.header-actions #musicButton[aria-pressed="false"] {background:#f4ece7;border-color:#decfc5;color:#78665c;}
.header-actions #musicButton[aria-pressed="false"] .sound-icon {color:#987568;}
.header-actions #rulesButton {background:#f0ebf8;border-color:#dcd1eb;color:#665281;}
.header-actions #rulesButton span {border-color:#a38cbf;}
.header-actions #musicButton:hover {background:#ffe7cf;}
.header-actions #rulesButton:hover {background:#e7ddf3;}
:root { --rotation-blue: #e8f1ff; }
/* Large, reachable rotation controls; the board stays usable during recap. */
.board-tools { position: sticky; bottom: 10px; z-index: 5; display: flex; gap: 10px; background: #fffcf7; box-shadow: 0 -4px 18px #6b524017; border: 2px solid #eadfce; border-radius: 18px; margin: 0 10px 12px; padding: 12px; }
.rotation-caption { width: 100%; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 18px; }
.rotation-caption small { color: #77706b; font-size: 14px; margin-left: auto; }
.selection-dot { width: 18px; height: 18px; border-radius: 6px; flex-shrink: 0; border: 1px solid #0001; }
.rotation-buttons { display: flex; gap: 8px; flex: 1; }
.board-tools .rotate-tool { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 56px; flex: 1; padding: 10px 14px; font-size: 19px; color: #395779; border: 2px solid #ccdcf0; background: #e8f1ff; border-radius: 14px; white-space: nowrap; }
.board-tools #rotateRight { color: #a3522c; background: #fff0df; border-color: #f3cfad; }
.rotate-tool svg { width: 32px; height: 32px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.board-tools .tool:disabled { opacity: .45; cursor: default; }
.board-tools .other-tools { display: flex; gap: 8px; }
.board-tools .tool:last-child { margin-left: 0; }
.hint-button[hidden], #hintWait[hidden], #hintDescription[hidden] { display: none; }
.hint-wait { background: #f6f1e8; padding: 14px; border-radius: 12px; text-align: center; }
.solve-receipt { display: grid; gap: 8px; background: #fff3da; color: #775321; border: 2px solid #ecd08e; border-radius: 20px; padding: 16px 26px; font-size: 23px; }
.solve-receipt b { color: #c86829; font-size: 30px; }
.round-recap { margin: 0 0 22px; padding: 20px 24px; background: #fff8e9; border: 2px solid #ead4a4; border-radius: 24px; animation: recap-enter .35s ease-out; }
.recap-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.recap-title h3 { margin: 0; font-size: 23px; }
.recap-close { background: white; border: 1px solid #e0ccaa; border-radius: 12px; padding: 8px 14px; min-height: 44px; font-size: 17px; white-space: nowrap; }
.my-round-result { font-size: 22px; margin: 12px 0; }
.my-round-result strong { color: #ad582e; }
.recap-ranks { display: grid; grid-template-columns: repeat(auto-fit,minmax(170px,1fr)); gap: 10px; }
.recap-player { display: grid; gap: 5px; padding: 12px; background: #fffdf8; border: 1px solid #e9dfce; border-radius: 14px; font-size: 17px; }
.recap-player.me { border: 2px solid #d4a35f; background: #fff2d5; }
.rank-change { display: block; font-size: 15px; color: #82766b; font-weight: normal; white-space: nowrap; }
.rank-change.up { color: #bc5f27; } .rank-change.down { color: #5b78a1; }
.recap-note { margin: 12px 0 0; font-size: 16px; color: #817362; }
@keyframes recap-enter { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@media (max-width: 650px) {
  .board-tools { bottom: 4px; padding: 10px; margin: 0 4px 8px; gap: 7px; }
  .rotation-caption { font-size: 16px; }
  .rotation-caption small { font-size: 12px; }
  .rotation-buttons { flex-basis: 100%; }
  .board-tools .rotate-tool { padding: 8px; font-size: 16px; gap: 5px; min-height: 52px; }
  .rotate-tool svg { width: 25px; height: 25px; }
  .rotation-buttons #flipPiece { padding: 8px; font-size: 15px; }
  .other-tools { width: 100%; justify-content: flex-end; }
  .other-tools .tool { padding: 6px 12px; min-height: 44px; font-size: 15px; }
  .round-recap { padding: 16px; }
  .recap-title h3 { font-size: 19px; }
  .recap-ranks { grid-template-columns: 1fr 1fr; }
  .recap-player { font-size: 15px; min-width: 0; overflow-wrap: anywhere; }
  .solve-receipt { font-size: 18px; padding: 10px 16px; }
}
@media (prefers-reduced-motion: reduce) { .round-recap { animation: none; } }

.board-panel { overflow: visible; }
.board-heading { border-radius: 22px 22px 0 0; }
.board-tools { top: 8px; bottom: auto; margin-top: 10px; }
.board-wrap { border-radius: 0 0 22px 22px; }
/* Keep the silhouette unobstructed. A nearby shortcut follows the selected piece. */
.board-tools { position: static; }
.quick-rotate { position: absolute; z-index: 3; transform: translate(-50%,-50%); width: 48px; height: 48px; min-width: 48px; padding: 0; border-radius: 50%; border: 2px solid #e6aa78; background: #fff1dd; color: #925226; font-size: 32px; line-height: 1; box-shadow: 0 3px 8px #79532826; touch-action: manipulation; }
.quick-rotate[hidden] { display: none; }
.quick-rotate:hover { background: #ffe0ad; }

/* Center the label and arrow together as one action, with identical vertical alignment. */
.entry-card #createButton {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 52px;
  min-height: 52px;
  margin: 16px 0 5px;
  padding: 0 16px;
  text-align: center;
  font-family: "Jua", "Noto Sans KR", sans-serif;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}
#createButton .create-label { display:block; white-space:nowrap; }
#createButton .create-arrow {
  display:block; width:22px; height:22px; flex:0 0 22px;
  fill:none; stroke:currentColor; stroke-width:2;
  stroke-linecap:round; stroke-linejoin:round;
}
