/* 냥이 꼬리기차: 화면 전체를 쓰는 게임이라 공통 body 여백을 없앤다. */
body.cattrain {
  max-width: none;
  padding: 0;
  overflow: hidden;
  background: #6fb56b;
  font-family: "Jua", -apple-system, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}

#canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  display: block;
  touch-action: none;
}



/* 시작 화면 */
.start {
  position: fixed;
  inset: 0;
  overflow-y: auto;
  padding: calc(12px + env(safe-area-inset-top)) 24px calc(24px + env(safe-area-inset-bottom));
  background: linear-gradient(#ffd9a0e8, #ffeccfe8);
  color: #8a4a12;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.start[hidden] { display: none; }

.start > * { width: 100%; max-width: 360px; }

.start .home {
  align-self: flex-start;
  color: #8a4a12;
  text-decoration: none;
  font-size: 17px;
  width: auto;
}

.start .site { margin: 0; font-size: 15px; color: #b8651b; }

.start h1 {
  margin: 4px 0 0;
  font-size: 56px;
  line-height: 1.05;
  font-weight: 400;
  display: flex;
  flex-direction: column;
  color: #fff;
  -webkit-text-stroke: 3px #8a4a12;
  paint-order: stroke fill;
  text-shadow: 0 4px 0 #8a4a12;
}

.start h1 .yellow { color: #ffcf3f; }

.start .lead { margin: 14px 0; font-size: 17px; }

.start .mode-note { margin: -6px 0 12px; font-size: 15px; color: #2f7a3f; }
.start .mode-note[hidden] { display: none; }
.start .go:disabled { opacity: 0.7; }

.panel {
  background: rgba(255, 255, 255, 0.75);
  border-radius: 20px;
  padding: 10px 8px 12px;
}

.panel .label { margin: 0 0 6px; font-size: 15px; }

.furs { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 6px; }

.furs button {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 4px solid transparent;
  background: none center / 42px no-repeat;
  padding: 0;
}

.furs button[aria-checked="true"] { border-color: #ff7a00; background-color: #fff; }

.name {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  background: #fff;
  border: 2px solid #e6b98a;
  border-radius: 14px;
  padding: 6px 14px;
  font-size: 18px;
}

.name input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  font: inherit;
  color: #3b2a20;
  background: none;
}

.rules {
  list-style: none;
  margin: 12px 0;
  padding: 0;
  font-size: 15px;
  text-align: left;
  display: grid;
  gap: 4px;
}

.start .go {
  margin-top: auto;
  border: 0;
  border-radius: 22px;
  padding: 14px 0;
  background: #ff8a2a;
  box-shadow: 0 6px 0 #e36d0e;
  color: #fff;
  font: inherit;
  font-size: 30px;
  text-shadow: 0 2px 0 #b4500a;
}

.start .go:active { transform: translateY(3px); box-shadow: 0 3px 0 #e36d0e; }

/* 결과 창 */
#result {
  border: 0;
  border-radius: 28px;
  padding: 20px;
  width: min(340px, calc(100% - 32px));
  background: #fff8ee;
  color: #8a4a12;
  text-align: center;
  font-family: inherit;
}

#result::backdrop { background: rgba(30, 20, 10, 0.55); }

.result-title { margin: 0; font-size: 19px; color: #b4500a; }
.result-cat { width: 80px; height: 80px; display: block; margin: 6px auto 0; }
.result-sub { margin: 2px 0 10px; font-size: 14px; color: #9a7a5a; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

.stats div {
  background: #ffe9c7;
  border-radius: 14px;
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
}

.stats small { font-size: 12px; color: #9a7a5a; }
.stats b { font-size: 18px; font-weight: 400; color: #e36d0e; }

.result-best { margin: 10px 0; font-size: 14px; min-height: 1em; }
.result-best.new { background: #fff1a8; border-radius: 12px; padding: 8px; color: #8a5a00; }

#result button {
  width: 100%;
  border: 0;
  border-radius: 18px;
  padding: 12px 0;
  margin-top: 8px;
  background: #ff8a2a;
  color: #fff;
  font: inherit;
  font-size: 20px;
}

#result button.continue { background: #4cb86b; font-size: 18px; line-height: 1.2; }
#result button.continue small { display: block; font-size: 12px; color: #e8ffe8; }
#result button.continue[hidden] { display: none; }

#result .other {
  display: block;
  margin-top: 8px;
  padding: 10px 0;
  border-radius: 16px;
  background: #f0dcc0;
  color: #8a4a12;
  text-decoration: none;
  font-size: 16px;
}


/* 꾸미기 */
.shop-btn {
  display: block;
  width: 100%;
  margin-top: 8px;
  border: 0;
  border-radius: 14px;
  padding: 8px 0;
  background: #ffe0ec;
  color: #b0306a;
  font: inherit;
  font-size: 17px;
}
.shop-btn small { font-size: 12px; color: #c0628c; margin-left: 4px; }
.pc-tip { margin: -4px 0 10px; font-size: 14px; color: #6a4a8a; background: rgba(255, 255, 255, 0.7); border-radius: 12px; padding: 6px 8px; }
.pc-tip[hidden] { display: none; }

#shop {
  position: fixed;
  inset: 0;
  margin: auto;
  z-index: 50;
  overflow-y: auto;
  box-shadow: 0 0 0 100vmax rgba(30, 20, 10, 0.55);
  border: 0;
  border-radius: 26px;
  padding: 16px 12px 14px;
  width: min(440px, calc(100% - 20px));
  max-height: calc(100% - 24px);
  background: #fff8ee;
  color: #6a3a12;
  font-family: inherit;
}
.shop-head { display: flex; align-items: center; justify-content: space-between; }
.shop-title { margin: 0; font-size: 24px; color: #b4500a; }
.shop-close { border: 0; background: #f0dcc0; color: #8a4a12; width: 36px; height: 36px; border-radius: 50%; font-size: 16px; }
.shop-sub { margin: 2px 0 8px; font-size: 13px; color: #9a7a5a; }
.shop-preview { background: #8fd18a; border: 3px solid #fff; border-radius: 18px; display: flex; justify-content: center; box-shadow: 0 3px 10px rgba(80, 50, 20, 0.15); }
.shop-preview canvas { max-width: 100%; height: auto; }
#shop h3 { margin: 16px 0 8px; font-size: 18px; font-weight: 400; color: #8a4a12; text-align: left; }
#shop .items { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
#shop .items li {
  position: relative;
  background: #fff;
  border: 2px solid #f3dcc4;
  border-radius: 16px;
  padding: 6px 4px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
#shop .items li.locked::after { content: '🔒'; position: absolute; top: 4px; right: 6px; font-size: 13px; }
#shop .items canvas { max-width: 100%; height: auto; }
#shop .items b { font-weight: 400; font-size: 14px; }
#shop .tag { font-size: 11px; color: #fff; border-radius: 8px; padding: 0 7px; }
#shop .items button { width: 100%; border: 0; border-radius: 10px; padding: 6px 0; font: inherit; font-size: 13px; margin-top: 2px; }
#shop .items button.ad { background: #22a35a; color: #fff; }
#shop .items button.use { background: #f1e6da; color: #6a3a12; }
#shop .items button.on { background: #ff8a2a; color: #fff; }
#shop .items button:disabled { opacity: 0.6; }
.shop-note { margin: 12px 0 6px; font-size: 12px; color: #9a7a5a; text-align: left; }
.shop-done { width: 100%; border: 0; border-radius: 16px; padding: 12px 0; background: #ff8a2a; color: #fff; font: inherit; font-size: 19px; }
