/* ===== 기본 ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --cream: #fff8ec;
  --brown: #6b4a32;
  --brown-dark: #4a3226;
  --green: #7bc26a;
  --green-dark: #4f9a44;
  --soil: #a9744f;
  --soil-dark: #7d5233;
  --line: #e3cfae;
  --plot: clamp(46px, 13vmin, 84px);
}

html, body { height: 100%; }

body {
  font-family: 'Jua', 'Gaegu', sans-serif;
  background: #2b2118;
  color: var(--brown);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

#app {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #bfe9ff;
}

[hidden] { display: none !important; }

/* ===== 화면 ===== */
.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.screen.active { display: flex; }

/* ===== 배경 세계 ===== */
.world {
  position: relative;
  overflow: hidden;
  background: linear-gradient(#bfe9ff 0%, #e6f6ff 62%, #eefaff 100%);
}
.title-world { position: absolute; inset: 0; }
.world-soft { background: linear-gradient(#d9f0ff, #f4fbff); }

#screen-farm { align-items: stretch; }

.farm-scene {
  flex: 1;
  min-height: 0;
  width: 100%;
  position: relative;
  transition: background 0.8s ease;
}

.ground {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 60%;
  background: linear-gradient(#8fd06f, #6fb556 55%, #5da34a);
  transition: background 0.8s ease;
}
.ground::before,
.ground::after {
  content: '';
  position: absolute;
  border-radius: 50% 50% 0 0;
}
.ground::before {
  left: -20%; top: -13%; width: 92%; height: 26%;
  background: #9bd97a;
}
.ground::after {
  right: -22%; top: -10%; width: 86%; height: 22%;
  background: #86c96a;
}

.sun {
  position: absolute;
  top: 6%; right: 8%;
  width: 12vmin; height: 12vmin;
  max-width: 90px; max-height: 90px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 35%, #fff6c9, #ffd95e 65%, #ffc93c);
  box-shadow: 0 0 6vmin rgba(255, 214, 94, 0.7);
  animation: sunPulse 5s ease-in-out infinite;
}
@keyframes sunPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.cloud {
  position: absolute;
  background: #ffffff;
  border-radius: 50%;
  opacity: 0.92;
  filter: drop-shadow(0 4px 0 rgba(160, 200, 230, 0.25));
}
.cloud::before, .cloud::after {
  content: ''; position: absolute; background: #fff; border-radius: 50%;
}
.cloud.c1 { width: 15vmin; height: 7vmin; top: 12%; left: -25%; animation: drift 42s linear infinite; }
.cloud.c2 { width: 11vmin; height: 5.5vmin; top: 26%; left: -25%; animation: drift 58s linear infinite 6s; }
.cloud.c3 { width: 18vmin; height: 8vmin; top: 5%; left: -25%; animation: drift 72s linear infinite 14s; }
.cloud::before { width: 60%; height: 130%; top: -55%; left: 8%; }
.cloud::after { width: 45%; height: 110%; top: -40%; right: 8%; }
@keyframes drift {
  from { transform: translateX(0); }
  to { transform: translateX(160vw); }
}

.tree { position: absolute; bottom: 34%; width: 70px; height: 96px; }
.tree .trunk {
  position: absolute; left: 50%; bottom: 0; width: 11px; height: 38px;
  margin-left: -5.5px; background: #8a5a3b; border-radius: 5px;
}
.tree .leaf {
  position: absolute; left: 50%; bottom: 24px; width: 66px; height: 66px;
  margin-left: -33px; border-radius: 50%;
  background: #6fbb5c;
  box-shadow: inset -7px -9px 0 rgba(0, 0, 0, 0.08);
}
.tree .leaf::before, .tree .leaf::after { content: ''; position: absolute; border-radius: 50%; }
.tree .leaf::before { left: -16px; top: 20px; width: 44px; height: 44px; background: #7cc96a; }
.tree .leaf::after { right: -16px; top: 16px; width: 42px; height: 42px; background: #63ad52; }
.tree.t1 { left: 3%; }
.tree.t2 { right: 6%; bottom: 30%; transform: scale(0.78); }

/* ===== 계절별 색 ===== */
.world.season-spring { background: linear-gradient(#bfe9ff, #e6f6ff); }
.world.season-summer { background: linear-gradient(#9fdcff, #d8f3ff); }
.world.season-autumn { background: linear-gradient(#ffe0b0, #fff2dc); }
.world.season-winter { background: linear-gradient(#cfe2f2, #f2f8ff); }
.world.season-autumn .ground { background: linear-gradient(#e5b95e, #cf9a45 55%, #b98736); }
.world.season-autumn .ground::before { background: #efc873; }
.world.season-autumn .ground::after { background: #d9a94f; }
.world.season-winter .ground { background: linear-gradient(#f4fbff, #e2eef8 55%, #d5e6f4); }
.world.season-winter .ground::before { background: #ffffff; }
.world.season-winter .ground::after { background: #eef7ff; }
.world.season-autumn .tree .leaf { background: #e08b3e; }
.world.season-autumn .tree .leaf::before { background: #eda552; }
.world.season-autumn .tree .leaf::after { background: #c9752f; }
.world.season-winter .tree .leaf { background: #cfe0ea; }
.world.season-winter .tree .leaf::before { background: #e2eef6; }
.world.season-winter .tree .leaf::after { background: #bcd2e0; }
.world.season-winter .sun { background: radial-gradient(circle at 38% 35%, #ffffff, #e9f4ff 65%, #d3e6f5); box-shadow: 0 0 6vmin rgba(220, 240, 255, 0.8); }

/* ===== 날씨 ===== */
.weather-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 4; }
.drop {
  position: absolute; top: -12%;
  width: 2px; height: 14px;
  background: linear-gradient(rgba(150, 200, 240, 0), #7cb7e8);
  border-radius: 2px;
  animation: fall linear infinite;
}
.flake {
  position: absolute; top: -8%;
  width: 7px; height: 7px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 4px rgba(255, 255, 255, 0.9);
  animation: fall linear infinite;
}
@keyframes fall {
  from { transform: translateY(0) translateX(0); }
  to { transform: translateY(115vh) translateX(-18px); }
}
.world.weather-hot { filter: saturate(1.12) brightness(1.04); }
.world.weather-cloudy { filter: brightness(0.96); }

/* ===== 버튼 ===== */
.btn {
  font-family: inherit;
  font-size: clamp(14px, 2.1vmin, 17px);
  color: var(--brown-dark);
  background: var(--cream);
  border: 3px solid #d9bf95;
  border-radius: 16px;
  padding: 10px 18px;
  cursor: pointer;
  box-shadow: 0 4px 0 #d9bf95;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.2s ease;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 0 #d9bf95; }
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 #d9bf95; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: 0 4px 0 #d9bf95; }
.btn-primary { background: #ffe08a; border-color: #e0b64e; box-shadow: 0 4px 0 #e0b64e; }
.btn-primary:hover:not(:disabled) { box-shadow: 0 6px 0 #e0b64e; }
.btn-primary:active:not(:disabled) { box-shadow: 0 1px 0 #e0b64e; }
.btn-big { font-size: clamp(18px, 2.8vmin, 24px); padding: 14px 38px; border-radius: 22px; }
.btn-small { font-size: clamp(12px, 1.8vmin, 14px); padding: 7px 12px; border-radius: 12px; }

/* ===== 1. 시작 화면 ===== */
/* 노란 테두리 안의 초록 들판에 제목과 흰 울타리·갈아 놓은 밭을 배치합니다. */
#screen-title {
  background: #fad94a;
  padding: clamp(6px, 1.8vmin, 16px);
}
.title-frame {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: clamp(14px, 2.6vmin, 28px);
  overflow: hidden;
  background: linear-gradient(#b7ea6a 0%, #95da51 38%, #7bc941 68%, #63b232 100%);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.55), 0 8px 22px rgba(140, 100, 10, 0.28);
}
.title-scene {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: repeating-linear-gradient(97deg, rgba(255, 255, 255, 0.13) 0 9px, rgba(255, 255, 255, 0) 9px 32px);
}
.title-scene .sun {
  top: 5%; right: 6%;
  width: clamp(42px, 9vmin, 86px); height: clamp(42px, 9vmin, 86px);
}
.title-hill {
  position: absolute;
  left: -12%; right: -12%; bottom: -22%;
  height: 56%;
  border-radius: 50% 50% 0 0 / 94% 94% 0 0;
  background: radial-gradient(ellipse at 50% 120%, #a8e866 0%, #8ad44a 45%, #70bf38 100%);
}
.title-fence {
  position: absolute;
  left: 4%; right: 4%;
  bottom: 43%;
  height: 14%;
  filter: drop-shadow(0 3px 0 rgba(90, 130, 60, 0.22));
}
.title-fence svg { display: block; width: 100%; height: 100%; }
/* 갈아 놓은 밭: 고랑이 진 흙을 코드로 그립니다. */
.title-field-plot {
  position: absolute;
  left: 5%; right: 5%; bottom: 5%;
  height: 40%;
  border-radius: 44% 44% 14% 14% / 22% 22% 12% 12%;
  background:
    repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.07) 0 4px, rgba(255, 255, 255, 0) 4px 26px),
    repeating-linear-gradient(180deg, rgba(78, 46, 22, 0) 0 20px, rgba(78, 46, 22, 0.5) 20px 28px),
    linear-gradient(#b07a4e, #946139 48%, #7a4c2b);
  box-shadow:
    inset 0 14px 0 rgba(255, 255, 255, 0.1),
    inset 0 -14px 0 rgba(0, 0, 0, 0.2),
    0 10px 0 rgba(74, 116, 44, 0.2);
}
/* 흙덩이 결 (코드로 그린 얼룩) */
.title-field-plot::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(circle at 16% 26%, rgba(214, 172, 126, 0.55) 0 4.5%, transparent 5.5%),
    radial-gradient(circle at 58% 58%, rgba(62, 38, 20, 0.42) 0 4%, transparent 5%),
    radial-gradient(circle at 84% 20%, rgba(214, 172, 126, 0.45) 0 3.5%, transparent 4.5%),
    radial-gradient(circle at 34% 76%, rgba(62, 38, 20, 0.36) 0 3.5%, transparent 4.5%),
    radial-gradient(circle at 72% 84%, rgba(214, 172, 126, 0.4) 0 3%, transparent 4%);
}
.title-inner {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: clamp(12px, 3.6vmin, 40px) 12px;
  text-align: center;
  animation: fadeUp 0.9s ease both;
}
.game-title {
  font-family: 'Jua', sans-serif;
  font-size: clamp(40px, 10.5vmin, 88px);
  line-height: 1.08;
  letter-spacing: 2px;
  color: #ffd93c;
  -webkit-text-stroke: 0.07em #7d4a13;
  text-shadow: 0 0.05em 0 #c0781d, 0 0.1em 0 rgba(120, 70, 10, 0.28);
  filter:
    drop-shadow(2px 0 0 #fff) drop-shadow(-2px 0 0 #fff)
    drop-shadow(0 2px 0 #fff) drop-shadow(0 -2px 0 #fff)
    drop-shadow(0 8px 6px rgba(90, 60, 10, 0.3));
}
.game-sub {
  margin-top: clamp(8px, 1.8vmin, 18px);
  font-family: 'Jua', sans-serif;
  font-size: clamp(14px, 2.6vmin, 22px);
  color: #fffbe0;
  background: linear-gradient(#7fcd4a, #56a72c);
  border: 3px solid #ffffff;
  border-radius: 999px;
  padding: 7px 22px;
  display: inline-block;
  max-width: 100%;
  text-shadow: 0 2px 0 #3f7a1c;
  box-shadow: 0 5px 0 rgba(60, 110, 30, 0.35);
}
#btn-start {
  margin-top: clamp(14px, 3.2vmin, 32px);
  font-size: clamp(19px, 3.2vmin, 28px);
  padding: clamp(12px, 2.4vmin, 18px) clamp(32px, 7vmin, 58px);
  border-radius: 999px;
  border-color: #e08a2c;
  background: linear-gradient(#fff0a8, #ffc93c);
  box-shadow: 0 7px 0 #d98a22, 0 12px 20px rgba(120, 70, 10, 0.25);
}
#btn-start:hover:not(:disabled) { box-shadow: 0 9px 0 #d98a22, 0 14px 22px rgba(120, 70, 10, 0.28); }
#btn-start:active:not(:disabled) { box-shadow: 0 2px 0 #d98a22, 0 6px 10px rgba(120, 70, 10, 0.25); }
.title-links { margin-top: clamp(10px, 2vmin, 20px); }

@media (max-height: 620px) {
  .title-inner { padding-top: clamp(8px, 2vmin, 20px); }
  .title-fence { bottom: 46%; height: 12%; }
  .title-field-plot { height: 34%; }
}
.btn-link {
  font-family: inherit;
  font-size: clamp(13px, 2.1vmin, 16px);
  color: #3f6b1c;
  background: rgba(255, 255, 255, 0.92);
  border: 3px solid #ffffff;
  border-radius: 999px;
  padding: 7px 18px;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(70, 110, 45, 0.28);
  transition: background 0.2s ease, transform 0.12s ease, box-shadow 0.12s ease;
}
.btn-link:hover { background: #ffffff; transform: translateY(-2px); box-shadow: 0 6px 0 rgba(70, 110, 45, 0.28); }
.btn-link:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(70, 110, 45, 0.28); }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== 2. 오프닝 ===== */
#screen-opening { background: radial-gradient(circle at 50% 40%, #3b2f52, #17121f 70%); }
.opening-box {
  position: relative; z-index: 3;
  width: min(90%, 620px);
  background: rgba(255, 248, 236, 0.96);
  border: 4px solid #d9bf95;
  border-radius: 24px;
  padding: 26px 26px 20px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.4);
  text-align: center;
  animation: fadeUp 0.5s ease both;
}
.opening-text {
  font-family: 'Gaegu', cursive;
  font-weight: 700;
  font-size: clamp(17px, 3.2vmin, 26px);
  line-height: 1.6;
  color: var(--brown-dark);
  min-height: 3.2em;
}
.opening-dots { display: flex; gap: 6px; justify-content: center; margin-bottom: 14px; }
.opening-dots i {
  width: 8px; height: 8px; border-radius: 50%;
  background: #ddc9a6; display: block;
}
.opening-dots i.on { background: #e39a4a; transform: scale(1.25); }
.opening-actions {
  display: flex; flex-wrap: wrap; gap: 10px;
  align-items: center; justify-content: center;
  margin-top: 18px;
}

.wormhole {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: #0b0813;
  z-index: 20;
}
.wh-ring {
  position: absolute;
  border-radius: 50%;
  border: 6px solid rgba(160, 120, 255, 0.55);
  animation: spin 1.4s linear infinite;
}
.wh-ring.r1 { width: 62vmin; height: 62vmin; border-color: rgba(150, 110, 255, 0.35); border-style: dashed; }
.wh-ring.r2 { width: 44vmin; height: 44vmin; border-color: rgba(255, 160, 240, 0.5); animation-duration: 1s; animation-direction: reverse; }
.wh-ring.r3 { width: 28vmin; height: 28vmin; border-color: rgba(120, 220, 255, 0.6); animation-duration: 0.7s; }
@keyframes spin { to { transform: rotate(360deg); } }
.wh-core {
  width: 12vmin; height: 12vmin; border-radius: 50%;
  background: radial-gradient(circle, #fff 0%, #b79cff 35%, #4b2fa8 70%, transparent 72%);
  animation: corePulse 0.9s ease-in-out infinite;
}
@keyframes corePulse {
  0%, 100% { transform: scale(1); opacity: 0.95; }
  50% { transform: scale(1.35); opacity: 1; }
}
.wh-text {
  position: absolute; bottom: 12%;
  color: #e8dcff; font-family: 'Gaegu', cursive; font-size: clamp(16px, 3vmin, 24px);
  animation: fadeUp 0.8s ease both;
}
.wormhole.on { animation: zoomOut 2.8s ease-in forwards; }
@keyframes zoomOut {
  0% { opacity: 1; transform: scale(1); }
  70% { opacity: 1; transform: scale(1.15); }
  100% { opacity: 0; transform: scale(2.4); }
}

/* ===== 3. 성별 선택 ===== */
.gender-inner { position: relative; z-index: 5; text-align: center; padding: 20px; }
.screen-title {
  font-size: clamp(24px, 5vmin, 40px);
  color: var(--brown-dark);
  text-shadow: 0 2px 0 #fff;
}
.screen-sub { font-family: 'Gaegu', cursive; font-size: clamp(14px, 2.4vmin, 19px); color: #8a6b4d; margin-top: 6px; }
.gender-row { display: flex; gap: clamp(14px, 3vmin, 34px); margin-top: 24px; justify-content: center; flex-wrap: wrap; }
.gender-card {
  font-family: inherit;
  background: rgba(255, 248, 236, 0.95);
  border: 4px solid #e0cba6;
  border-radius: 26px;
  padding: 18px 26px 12px;
  cursor: pointer;
  box-shadow: 0 8px 0 #d9bf95;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.2s;
}
.gender-card:hover { transform: translateY(-6px); box-shadow: 0 14px 0 #d9bf95; border-color: #f0b85a; }
.gender-card:active { transform: translateY(2px); box-shadow: 0 4px 0 #d9bf95; }
.gender-label { display: block; margin-top: 10px; font-size: clamp(16px, 2.6vmin, 22px); color: var(--brown-dark); }
.farmer-holder { display: flex; justify-content: center; }
.gender-card .farmer { font-size: clamp(16px, 2.6vmin, 22px); }

/* ===== 캐릭터 ===== */
.farmer { position: relative; width: 6em; height: 8em; font-size: 16px; animation: bob 2.6s ease-in-out infinite; }
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-0.35em); }
}
.farmer-shadow {
  position: absolute; bottom: 0; left: 50%; margin-left: -1.6em;
  width: 3.2em; height: 0.7em; background: rgba(60, 40, 20, 0.18); border-radius: 50%;
}
.farmer-body { position: absolute; left: 50%; bottom: 0.55em; margin-left: -1.6em; width: 3.2em; height: 3.2em; }
.farmer-body .torso {
  position: absolute; inset: 0;
  background: linear-gradient(#7bbf6a, #5ea84e);
  border-radius: 1.2em 1.2em 0.7em 0.7em;
  box-shadow: inset 0 -0.45em 0 rgba(0, 0, 0, 0.08);
}
.farmer-body .torso::before {
  content: ''; position: absolute; left: 50%; top: 0.9em; margin-left: -0.35em;
  width: 0.7em; height: 0.7em; border-radius: 50%; background: #ffe08a;
}
.farmer-body .arm {
  position: absolute; top: 0.3em; width: 0.85em; height: 2.3em;
  background: #ffdcb8; border-radius: 0.45em;
  transform-origin: top center;
  animation: armSwing 2.6s ease-in-out infinite;
}
.farmer-body .arm-left { left: -0.65em; }
.farmer-body .arm-right { right: -0.65em; animation-direction: reverse; }
@keyframes armSwing {
  0%, 100% { transform: rotate(6deg); }
  50% { transform: rotate(-8deg); }
}
.farmer-head { position: absolute; left: 50%; top: 1.1em; margin-left: -1.85em; width: 3.7em; height: 3.7em; }
.farmer-head .face {
  position: absolute; inset: 0; z-index: 2;
  background: radial-gradient(circle at 40% 35%, #ffe6c9, #ffd7b0);
  border-radius: 50%;
}
.farmer-head .eye {
  position: absolute; top: 1.55em; width: 0.34em; height: 0.42em;
  background: #4a3226; border-radius: 50%;
}
.farmer-head .eye-left { left: 0.95em; }
.farmer-head .eye-right { right: 0.95em; }
.farmer-head .blush {
  position: absolute; top: 2.05em; width: 0.62em; height: 0.38em;
  background: #ffb0a8; border-radius: 50%; opacity: 0.8;
}
.farmer-head .blush-left { left: 0.42em; }
.farmer-head .blush-right { right: 0.42em; }
.farmer-head .mouth {
  position: absolute; left: 50%; top: 2.15em; margin-left: -0.28em;
  width: 0.56em; height: 0.3em;
  border-bottom: 0.16em solid #8a5a3b;
  border-radius: 0 0 0.4em 0.4em;
}
.farmer-head .hair-front {
  position: absolute; left: -0.05em; top: -0.1em; width: 3.8em; height: 1.5em; z-index: 3;
  background: #4a3226; border-radius: 1.9em 1.9em 0.5em 0.5em;
}
.farmer-head .hair-back { display: none; }
.farmer[data-gender="girl"] .hair-back {
  display: block;
  position: absolute; left: -0.45em; top: 0.5em; width: 4.6em; height: 3.6em; z-index: 1;
  background: #4a3226; border-radius: 2.3em 2.3em 1.6em 1.6em;
}
.farmer[data-gender="girl"] .hair-back::before,
.farmer[data-gender="girl"] .hair-back::after {
  content: ''; position: absolute; bottom: -1.5em; width: 1.5em; height: 1.5em;
  background: #4a3226; border-radius: 50%;
}
.farmer[data-gender="girl"] .hair-back::before { left: 0.1em; }
.farmer[data-gender="girl"] .hair-back::after { right: 0.1em; }
.farmer-head .hat { position: absolute; left: 50%; top: -0.55em; margin-left: -2.95em; width: 5.9em; height: 1.4em; z-index: 5; }

/* 주인공 그림 (남자아이·여자아이 공통: boy-farmer-sprite.webp · girl-farmer-sprite.webp) */
.farmer-sprite {
  position: absolute; left: 50%; bottom: 0.5em;
  width: 5.6em; height: 7.5em; margin-left: -2.8em;
  object-fit: contain;
  z-index: 1;
}
.farmer-head .hat-top {
  position: absolute; left: 1.15em; top: -0.85em; width: 3.6em; height: 1.5em;
  background: linear-gradient(#f7e0a0, #eccb72);
  border-radius: 1.8em 1.8em 0.25em 0.25em;
}
.farmer-head .hat-brim {
  position: absolute; inset: 0;
  background: linear-gradient(#f2d47e, #e0b64e);
  border-radius: 50%;
  box-shadow: inset 0 -0.18em 0 rgba(160, 110, 30, 0.35);
}

/* ===== 4. 농장 HUD ===== */
.hud {
  display: flex; flex-wrap: wrap; gap: 6px 10px;
  align-items: center;
  padding: 8px 12px;
  background: rgba(255, 252, 240, 0.95);
  border-bottom: 3px solid var(--line);
  z-index: 6;
}
.hud-item {
  font-size: clamp(12px, 1.9vmin, 16px);
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
  color: var(--brown-dark);
}
.hud-season { background: #ffeec9; border-color: #e9cf9c; }
/* 기기에 없는 이모지(🪙 등) 대신 코드로 그린 코인 그림 */
.coin-icon {
  width: 1em; height: 1em;
  vertical-align: -0.15em;
  filter: drop-shadow(0 1px 1px rgba(80, 50, 20, 0.18));
}

/* ===== 밭 ===== */
.plot-area {
  position: absolute; left: 0; right: 0; bottom: 8px;
  display: flex; justify-content: center; padding: 0 8px; z-index: 3;
}
.plot-grid {
  display: grid;
  grid-template-columns: repeat(4, var(--plot));
  gap: calc(var(--plot) * 0.14);
  justify-content: center;
}
/* 새 밭을 만들어 칸이 많아지면 줄 수를 늘리고 칸 크기를 줄여 화면 안에 들어오게 합니다. */
.plot-grid.many {
  grid-template-columns: repeat(5, var(--plot));
  --plot: clamp(40px, 11vmin, 70px);
}
.plot-grid.many-more {
  grid-template-columns: repeat(6, var(--plot));
  --plot: clamp(34px, 9vmin, 58px);
}
.plot {
  position: relative;
  width: var(--plot); height: var(--plot);
  padding: 0; border: none; background: transparent;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.12s ease;
}
.plot:hover { transform: translateY(-3px); }
.plot:active { transform: translateY(1px); }
.plot .soil {
  position: absolute; inset: 0;
  border-radius: 40% 42% 38% 44% / 44% 40% 42% 38%;
  background:
    radial-gradient(circle at 28% 32%, rgba(190, 140, 95, 0.85) 0 18%, transparent 19%),
    radial-gradient(circle at 68% 64%, rgba(110, 72, 44, 0.5) 0 15%, transparent 16%),
    linear-gradient(#ab7550, #855537);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.16), 0 3px 0 #6d452c;
}
.plot.empty .soil { background: linear-gradient(#a06c48, #7d5233); opacity: 0.92; }
.plot.empty .plus {
  position: relative; z-index: 2;
  font-size: calc(var(--plot) * 0.42);
  color: rgba(255, 245, 225, 0.85);
  line-height: 1;
}
.plot-sprite {
  position: relative; z-index: 2;
  font-size: calc(var(--plot) * 0.5);
  line-height: 1;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.25));
  transition: font-size 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: bottom center;
}
.plot-sprite.seed { font-size: calc(var(--plot) * 0.22); }
.plot-sprite.sprout { font-size: calc(var(--plot) * 0.42); }
.plot-sprite.growing { font-size: calc(var(--plot) * 0.5); opacity: 0.92; }
.plot-sprite.ripe { font-size: calc(var(--plot) * 0.68); animation: ripePop 1.5s ease-in-out infinite; }
/* 이미지로 표시되는 작물 */
.plot-sprite.plot-img {
  object-fit: contain;
  transition: width 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), height 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.plot-sprite.plot-img.growing { width: calc(var(--plot) * 0.5); height: calc(var(--plot) * 0.5); }
.plot-sprite.plot-img.planted { width: calc(var(--plot) * 0.94); height: calc(var(--plot) * 0.94); }
.plot-sprite.plot-img.ripe { width: calc(var(--plot) * 0.68); height: calc(var(--plot) * 0.68); }
.crop-icon { object-fit: contain; vertical-align: middle; }
.crop-icon.seed-emoji { width: 30px; height: 30px; }
.seed-icon { width: 30px; height: 30px; flex: none; vertical-align: middle; filter: drop-shadow(0 1px 1px rgba(80, 50, 20, 0.18)); }
.seed-icon.shop-emoji { width: 20px; height: 20px; }
.toast .seed-icon.toast-seed { width: 20px; height: 20px; vertical-align: -4px; }
.crop-icon.shop-emoji { width: 20px; height: 20px; }
.crop-icon.plot-detail-emoji { width: clamp(44px, 9vmin, 66px); height: clamp(44px, 9vmin, 66px); }

/* 코드로 그린 작물 그림 (자라는 모습 / 다 자란 모습) */
.crop-art {
  position: relative; z-index: 2;
  display: inline-flex; align-items: flex-end; justify-content: center;
  line-height: 0;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.22));
}
.crop-art svg, .crop-art .crop-photo { display: block; width: 100%; height: 100%; }
.crop-art .crop-photo { object-fit: contain; }
.plot .crop-art.plot-art {
  transition: width 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), height 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.plot .crop-art.plot-art.sprout { width: calc(var(--plot) * 0.44); height: calc(var(--plot) * 0.44); }
.plot .crop-art.plot-art.growing { width: calc(var(--plot) * 0.58); height: calc(var(--plot) * 0.58); opacity: 0.94; }
.plot .crop-art.plot-art.ripe { width: calc(var(--plot) * 0.78); height: calc(var(--plot) * 0.78); animation: ripePop 1.5s ease-in-out infinite; }
.crop-art.detail { width: clamp(44px, 9vmin, 66px); height: clamp(44px, 9vmin, 66px); animation: ripePop 2s ease-in-out infinite; }
.crop-art.shop-emoji { width: 20px; height: 20px; }
.toast .crop-art.toast-crop { width: 20px; height: 20px; vertical-align: -4px; }
@keyframes ripePop {
  0%, 100% { transform: scale(1) translateY(0); }
  50% { transform: scale(1.08) translateY(-4%); }
}
.plot-badge {
  position: absolute; z-index: 3;
  font-size: calc(var(--plot) * 0.26);
  line-height: 1;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.3));
}
.plot-badge.water { top: -2%; right: -2%; }
.plot-badge.ready { top: -8%; right: -6%; animation: sparkle 1.1s ease-in-out infinite; }
@keyframes sparkle {
  0%, 100% { transform: scale(1) rotate(-6deg); opacity: 1; }
  50% { transform: scale(1.25) rotate(8deg); opacity: 0.75; }
}
.farm-farmer { position: absolute; left: 2%; bottom: 4%; z-index: 2; }
.farm-farmer .farmer { font-size: clamp(11px, 2.1vmin, 17px); }

/* ===== 툴바 ===== */
.toolbar {
  display: flex; flex-wrap: wrap; gap: 8px;
  justify-content: center; align-items: center;
  padding: 10px 12px;
  background: rgba(255, 252, 240, 0.96);
  border-top: 3px solid var(--line);
  z-index: 6;
}

/* ===== 7. 계절 화면 ===== */
#screen-season { background: rgba(30, 22, 12, 0.55); }
.season-card {
  width: min(90%, 520px);
  text-align: center;
  padding: 30px 26px;
  border-radius: 28px;
  border: 4px solid #e0cba6;
  background: var(--cream);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  animation: fadeUp 0.45s ease both;
}
.season-card.s-spring { background: linear-gradient(#fff6f8, #eaf9ff); }
.season-card.s-summer { background: linear-gradient(#eafaff, #d9f3ff); }
.season-card.s-autumn { background: linear-gradient(#fff6e4, #ffe6c9); }
.season-card.s-winter { background: linear-gradient(#f4fbff, #e4effa); }
.season-emoji { font-size: clamp(48px, 10vmin, 82px); line-height: 1; animation: ripePop 2s ease-in-out infinite; }
.season-name { font-size: clamp(26px, 6vmin, 44px); color: var(--brown-dark); margin-top: 6px; }
.season-desc { font-family: 'Gaegu', cursive; font-size: clamp(15px, 2.6vmin, 20px); line-height: 1.6; color: #6b4a32; margin-top: 12px; }
.season-crop { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.seed-icon.season-seed-icon { width: 1.15em; height: 1.15em; vertical-align: middle; }
.season-crops { margin-top: 14px; font-size: clamp(13px, 2.2vmin, 17px); color: #4f9a44; background: #eaf7e4; border-radius: 14px; padding: 10px; }
#btn-season-next { margin-top: 22px; }

/* ===== 8. 엔딩 ===== */
.ending-card {
  position: relative; z-index: 5;
  width: min(92%, 620px);
  text-align: center;
  padding: 28px 24px;
  border-radius: 28px;
  border: 4px solid #e0cba6;
  background: rgba(255, 248, 236, 0.97);
  box-shadow: 0 18px 40px rgba(80, 50, 20, 0.3);
  animation: fadeUp 0.6s ease both;
  max-height: 92%;
  overflow: auto;
}
.ending-emoji { font-size: clamp(44px, 9vmin, 72px); animation: ripePop 2.4s ease-in-out infinite; }
.ending-title { font-size: clamp(24px, 5vmin, 38px); color: var(--brown-dark); }
.ending-story { font-family: 'Gaegu', cursive; font-size: clamp(15px, 2.6vmin, 21px); line-height: 1.8; color: #6b4a32; margin-top: 14px; }
.ending-stats { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 18px; }
.ending-stats li {
  font-size: clamp(13px, 2.1vmin, 16px);
  background: #fff3d6; border: 2px solid #e9cf9c;
  border-radius: 999px; padding: 6px 14px; color: var(--brown-dark);
}
#btn-restart { margin-top: 22px; }

/* ===== 오버레이 / 패널 ===== */
.overlay {
  position: absolute; inset: 0; z-index: 30;
  display: flex; align-items: center; justify-content: center;
  background: rgba(40, 28, 16, 0.5);
  padding: 16px;
  animation: fadeIn 0.2s ease both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.panel {
  position: relative;
  width: min(94%, 420px);
  max-height: 90%;
  overflow: auto;
  background: var(--cream);
  border: 4px solid #e0cba6;
  border-radius: 24px;
  padding: 22px 20px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35);
  text-align: center;
  animation: fadeUp 0.3s ease both;
}
.panel-wide { width: min(96%, 640px); }
.panel-close {
  position: absolute; top: 10px; right: 12px;
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid #e0cba6; background: #fff;
  color: var(--brown-dark); font-size: 15px; cursor: pointer; font-family: inherit;
}
.panel-close:hover { background: #ffe9c9; }
.panel-title { font-size: clamp(19px, 3.4vmin, 26px); color: var(--brown-dark); }
.panel-sub { font-family: 'Gaegu', cursive; font-size: clamp(14px, 2.3vmin, 18px); color: #8a6b4d; margin-top: 6px; }
.panel-actions { display: flex; gap: 10px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }

.seed-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 16px; }
.seed-card {
  font-family: inherit; cursor: pointer;
  background: #fff; border: 3px solid #e0cba6; border-radius: 18px;
  padding: 12px 8px; display: flex; flex-direction: column; align-items: center; gap: 3px;
  box-shadow: 0 4px 0 #e0cba6;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.seed-card:hover:not(:disabled) { transform: translateY(-3px); box-shadow: 0 7px 0 #e0cba6; border-color: #f0b85a; }
.seed-card:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 #e0cba6; }
.seed-card:disabled { opacity: 0.42; cursor: not-allowed; }
.seed-emoji { font-size: 30px; line-height: 1; }
.seed-name { font-size: clamp(14px, 2.2vmin, 17px); color: var(--brown-dark); }
.seed-days { font-size: 12px; color: #4f9a44; background: #eaf7e4; border-radius: 999px; padding: 1px 8px; }
.seed-have { font-size: 12px; color: #9b7c5c; }

.plot-detail-emoji { font-size: clamp(44px, 9vmin, 66px); line-height: 1; animation: ripePop 2s ease-in-out infinite; }
.growth-bar {
  height: 18px; background: #efe0c6; border-radius: 999px;
  border: 3px solid #e0cba6; overflow: hidden; margin-top: 14px;
}
.growth-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #a8e08a, #5fbb4c);
  border-radius: 999px;
  transition: width 0.45s ease;
}

.shop-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 16px; text-align: left; }
.shop-col { background: #fff; border: 3px solid #e0cba6; border-radius: 18px; padding: 10px; }
.shop-head { font-size: clamp(14px, 2.2vmin, 17px); color: var(--brown-dark); margin-bottom: 8px; text-align: center; }
.shop-row {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 2px; border-bottom: 2px dashed #f0e2c8;
  font-size: clamp(12px, 1.9vmin, 15px);
}
.shop-row:last-child { border-bottom: none; }
.shop-emoji { font-size: 20px; }
.shop-name { flex: 1; color: var(--brown-dark); }
.shop-count { font-size: 12px; color: #9b7c5c; white-space: nowrap; }
.empty-note { font-size: 13px; color: #a98f72; text-align: center; padding: 10px 0; }

/* ===== 토스트 ===== */
.toast {
  position: absolute; left: 50%; top: 72px; transform: translateX(-50%);
  z-index: 60;
  background: rgba(74, 50, 38, 0.94);
  color: #fff8ec;
  font-family: 'Gaegu', cursive;
  font-size: clamp(14px, 2.4vmin, 19px);
  padding: 10px 20px;
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
  max-width: 90%;
  text-align: center;
  animation: toastIn 0.25s ease both;
  pointer-events: none;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ===== 좁은 화면 ===== */
@media (max-width: 560px) {
  :root { --plot: clamp(40px, 16vw, 70px); }
  .hud { gap: 5px 6px; padding: 6px 8px; }
  .hud-item { padding: 3px 9px; }
  .toolbar { gap: 6px; padding: 8px; }
  .seed-list { grid-template-columns: 1fr 1fr; }
  .shop-columns { grid-template-columns: 1fr; }
}

@media (max-height: 520px) {
  .hud { padding: 4px 8px; }
  .toolbar { padding: 6px 8px; }
  .btn { padding: 7px 12px; }
}
