:root{
  --green:#2f7d32;
  --green-dark:#1f5a22;
  --green-light:#8bc34a;
  --cream:#f7f5ea;
  --ink:#22331f;
  --line:#d9e2cf;
  --water:#4fc3f7;
}

*{box-sizing:border-box;}
html,body{margin:0;height:100%;}
button,input,select{font-family:inherit;}
button{-webkit-tap-highlight-color:transparent;touch-action:manipulation;}
body{
  -webkit-text-size-adjust:100%;
  font-family:'Noto Sans KR','Malgun Gothic',system-ui,-apple-system,sans-serif;
  background:linear-gradient(180deg,#eaf5e0,#f7f5ea);
  color:var(--ink);
  display:flex;
  justify-content:center;
}

.wrap{
  width:100%;
  max-width:720px;
  padding:clamp(8px,2.5vw,12px);
  display:flex;
  flex-direction:column;
  gap:12px;
  min-height:100%;
}

.topbar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  padding:10px 14px;
  background:var(--green);
  color:#fff;
  border-radius:12px;
}
.brand{display:flex;align-items:center;gap:6px;font-weight:800;letter-spacing:.5px;font-size:clamp(15px,4.4vw,17px);}
.progress{font-size:clamp(12px,3.5vw,13px);opacity:.95;text-align:right;}

.stage{flex:1;display:flex;flex-direction:column;}

.panel{
  background:#fff;
  border:1px solid var(--line);
  border-radius:14px;
  padding:16px;
  display:flex;
  flex-direction:column;
  gap:12px;
  box-shadow:0 2px 10px rgba(40,70,30,.06);
}

h2{margin:0;font-size:clamp(17px,4.4vw,19px);color:var(--green-dark);line-height:1.4;}
.season{
  font-size:11px;font-weight:500;color:#fff;
  background:var(--green-light);
  padding:2px 8px;border-radius:999px;margin-left:6px;vertical-align:middle;
}
.desc{margin:0;font-size:14px;line-height:1.65;color:#41503c;}
.desc b{color:var(--green-dark);}

.hero{gap:14px;}
.hero h2{font-size:clamp(24px,7vw,30px);text-align:center;line-height:1.25;}
.hero-title{display:flex;align-items:center;justify-content:center;gap:8px;}
.hero .desc{text-align:center;font-size:clamp(14px,4vw,15px);}
.hero .actions{justify-content:center;}
.hero .actions button{flex:1 1 0;min-width:0;}
.hero button.primary{
  width:100%;padding:15px 22px;font-size:clamp(16px,5vw,18px);
  border-radius:12px;box-shadow:0 3px 0 var(--green-dark);
}
.hero button.primary:hover{box-shadow:0 2px 0 var(--green-dark);}

/* 시작 화면 단계 카드 */
.step-view{display:flex;flex-direction:column;gap:10px;}
.step-card{
  display:flex;flex-direction:column;justify-content:center;gap:10px;
  padding:clamp(16px,4.5vw,22px);border-radius:16px;
  background:#fff;border:2px solid var(--line);
  box-shadow:0 3px 0 rgba(40,70,30,.10);
  min-height:clamp(185px,32vh,235px);
}
.step-head{display:flex;align-items:center;gap:10px;}
.step-icon{margin-left:auto;flex:0 0 auto;font-size:clamp(28px,8vw,34px);line-height:1;}
.step-month{
  flex:0 0 auto;font-size:clamp(12px,3.6vw,14px);font-weight:800;color:#fff;
  background:var(--green-light);padding:4px 12px;border-radius:999px;white-space:nowrap;
}
.step-name{font-size:clamp(20px,5.6vw,24px);font-weight:800;color:var(--green-dark);line-height:1.3;}
.step-sub{margin:0;font-size:clamp(14px,4vw,16px);line-height:1.6;color:#41503c;}
.step-count{font-size:clamp(12px,3.4vw,13px);font-weight:700;color:#7c8a76;text-align:right;}
.step-dots{display:flex;justify-content:center;gap:7px;}
.step-dot{width:9px;height:9px;border-radius:50%;background:#cfdcc4;transition:transform .15s,background .15s;}
.step-dot.on{background:var(--green);transform:scale(1.3);}

.step-card.tone-winter{border-color:#a9cde6;}
.step-card.tone-winter .step-month{background:#7fb2d6;}
.step-card.tone-spring{border-color:#9fd0c5;}
.step-card.tone-spring .step-month{background:#5fb3a1;}
.step-card.tone-sprout{border-color:#bfdda0;}
.step-card.tone-sprout .step-month{background:#8bc34a;}
.step-card.tone-water{border-color:#a5d3ea;}
.step-card.tone-water .step-month{background:#5ab0d8;}
.step-card.tone-harvest{border-color:#eed49a;}
.step-card.tone-harvest .step-month{background:#e0a93b;}

.statbar{
  display:flex;gap:14px;flex-wrap:wrap;font-size:14px;
  background:var(--cream);padding:8px 12px;border-radius:10px;
}
.statbar b{color:var(--green-dark);}

.tools{display:flex;gap:8px;flex-wrap:wrap;}
.tool{
  padding:9px 12px;border-radius:10px;border:1px solid var(--line);
  background:#fff;cursor:pointer;font-size:13px;color:#33422e;font-family:inherit;
}
.tool.active{background:var(--green);color:#fff;border-color:var(--green);}

.actions{display:flex;gap:10px;flex-wrap:wrap;}
button.primary{
  padding:11px 20px;border-radius:10px;border:none;
  background:var(--green);color:#fff;font-weight:700;cursor:pointer;
  font-size:clamp(14px,4vw,15px);min-height:44px;font-family:inherit;
}
button.primary:hover{background:var(--green-dark);}
button.primary:disabled{background:#c3cdbb;cursor:not-allowed;}
button.retry{
  padding:11px 20px;border-radius:10px;border:1px solid var(--line);
  background:#fff;color:#33422e;font-weight:700;cursor:pointer;
  font-size:clamp(14px,4vw,15px);min-height:44px;font-family:inherit;
}
button.retry:hover{background:#eef4e6;border-color:var(--green-light);}
button.retry:disabled{background:#f1f2ee;color:#9aa394;border-color:#e2e6dc;cursor:not-allowed;}

.msg{margin:0;font-size:13px;color:#8a5a00;min-height:18px;line-height:1.5;}

/* 논 격자 */
.paddy-grid{display:grid;gap:clamp(5px,1.8vw,8px);user-select:none;-webkit-user-select:none;}
.tile{
  aspect-ratio:1/1;border:2px solid rgba(0,0,0,.08);border-radius:8px;
  font-size:14px;font-weight:700;color:#20301c;cursor:pointer;
  display:flex;align-items:center;justify-content:center;
  transition:background .15s,transform .08s;font-family:inherit;padding:0;
}
.tile:active{transform:scale(.95);}
.tile.ok{box-shadow:inset 0 0 0 2px rgba(47,125,50,.6);}

.cell{
  aspect-ratio:1/1;border-radius:8px;border:2px dashed #cfd8c4;
  background:#eef4e6;cursor:pointer;display:flex;
  align-items:center;justify-content:center;font-size:20px;
  transition:background .15s;padding:0;font-family:inherit;
}
.cell.show{border-style:solid;border-color:#6aa32f;background:#bfe08a;box-shadow:inset 0 0 0 3px rgba(255,255,255,.55);}
.cell.planted{border-style:solid;border-color:#6aa32f;background:#c9e8a3;}
.cell.planted::after{content:'🌱';font-size:18px;}

/* 품종 카드 */
.cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(132px,1fr));gap:10px;}
.card{
  padding:14px;border-radius:12px;border:2px solid var(--line);background:#fff;
  cursor:pointer;text-align:left;display:flex;flex-direction:column;gap:4px;
  font-family:inherit;transition:border-color .15s,transform .08s;
}
.card:hover{border-color:var(--green-light);}
.card:active{transform:scale(.98);}
.card-name{font-weight:700;font-size:16px;color:var(--green-dark);}
.card-info{font-size:13px;color:#556150;}

/* 게이지 */
.meter{
  position:relative;height:clamp(22px,6vw,26px);background:#e6efe0;
  border-radius:13px;overflow:hidden;border:1px solid var(--line);
}
.meter-fill{
  height:100%;width:0;
  background:linear-gradient(90deg,#a5d6a7,#66bb6a);
  transition:width .08s linear;
}
.meter-band{
  position:absolute;top:0;bottom:0;
  background:rgba(255,193,7,.5);
  border-left:2px solid #f9a825;border-right:2px solid #f9a825;
  pointer-events:none;
}
.meter-band.harvest{background:rgba(76,175,80,.45);border-color:#388e3c;}

/* 슬라이더 */
.slider-row{display:flex;align-items:center;gap:12px;flex-wrap:wrap;}
input[type=range]{
  -webkit-appearance:none;appearance:none;
  flex:1 1 140px;min-width:0;height:36px;margin:0;
  background:transparent;cursor:pointer;touch-action:none;
}
input[type=range]::-webkit-slider-runnable-track{
  height:10px;border-radius:5px;background:#e0eadb;border:1px solid var(--line);
}
input[type=range]::-webkit-slider-thumb{
  -webkit-appearance:none;appearance:none;
  width:26px;height:26px;margin-top:-9px;border-radius:50%;
  background:var(--green);border:3px solid #fff;
  box-shadow:0 1px 4px rgba(30,60,20,.3);
}
input[type=range]::-moz-range-track{
  height:10px;border-radius:5px;background:#e0eadb;border:1px solid var(--line);
}
input[type=range]::-moz-range-thumb{
  width:22px;height:22px;border-radius:50%;
  background:var(--green);border:3px solid #fff;
  box-shadow:0 1px 4px rgba(30,60,20,.3);
}
.readout{font-size:13px;color:#3d4c38;line-height:1.6;}
.readout b{color:var(--green-dark);}

/* 씨앗 물통 */
.tank{
  position:relative;height:clamp(200px,32vh,230px);border-radius:12px;
  background:linear-gradient(180deg,#d4edfd,#9fd8f7);
  border:2px solid #8fc9e8;overflow:hidden;
}
.seed{
  position:absolute;width:24px;height:28px;padding:0;
  border-radius:50% 50% 45% 45%;
  background:radial-gradient(circle at 35% 30%,#ffe082,#f0b429);
  border:1px solid #d99e14;cursor:pointer;
  transition:top 1s ease,opacity .3s,transform .3s;
}
.seed.caught{opacity:0;transform:scale(.3);pointer-events:none;}
.seed.misclick{background:#e57373;border-color:#c62828;opacity:.55;}

/* 물높이 게이지(세로) */
.waterbar{
  position:relative;width:100%;height:clamp(130px,26vh,170px);
  background:linear-gradient(180deg,#f2f7ee,#e3ecdb);
  border-radius:12px;overflow:hidden;border:1px solid var(--line);
}
.wb-fill{
  position:absolute;left:0;right:0;bottom:0;height:0;
  background:linear-gradient(180deg,#7fd0f5,#38a3d1);
}
.wb-band{
  position:absolute;left:0;right:0;
  background:rgba(139,195,74,.35);
  border-top:2px solid #7cb342;border-bottom:2px solid #7cb342;
  pointer-events:none;
}
.phase-label{
  font-size:14px;font-weight:700;color:var(--green-dark);
  background:#eef6e4;border-left:4px solid var(--green-light);
  padding:8px 12px;border-radius:8px;
}

/* 결과 */
.result-panel{align-items:stretch;text-align:center;}
.grade{font-size:clamp(48px,15vw,64px);font-weight:900;color:var(--green);line-height:1;}
.bigscore{font-size:23px;font-weight:800;color:var(--green-dark);}
.scorelist{list-style:none;padding:0;margin:0;display:flex;flex-direction:column;gap:6px;text-align:left;}
.scorelist li{
  display:flex;justify-content:space-between;gap:10px;
  font-size:14px;padding:8px 12px;background:var(--cream);border-radius:8px;
}
.scorelist b{color:var(--green-dark);white-space:nowrap;}

/* 휴대폰 · 좁은 화면 */
@media (max-width:480px){
  .topbar{padding:8px 12px;border-radius:10px;}
  .brand{font-size:15px;}
  .progress{font-size:12px;}
  .panel{padding:12px;gap:10px;border-radius:12px;}
  .hero h2{font-size:clamp(19px,5.4vw,22px);}
  .desc{font-size:13px;line-height:1.6;}
  .step-view{gap:8px;}
  .step-card{padding:14px;gap:8px;border-radius:14px;min-height:170px;}
  .step-month{font-size:12px;padding:3px 10px;}
  .step-name{font-size:19px;}
  .step-icon{font-size:26px;}
  .step-sub{font-size:13.5px;line-height:1.55;}
  .step-count{font-size:12px;}
  .statbar{gap:8px 14px;font-size:13px;padding:7px 10px;}
  .tools{gap:6px;}
  .tool{flex:1 1 auto;font-size:12px;padding:9px 10px;}
  .actions{gap:8px;}
  .actions button{flex:1 1 0;min-width:0;padding-left:10px;padding-right:10px;}
  .cards{grid-template-columns:1fr 1fr;gap:8px;}
  .card{padding:11px;}
  .card-name{font-size:15px;}
  .card-info{font-size:12px;}
  .tile{font-size:13px;border-radius:7px;}
  .cell{border-radius:7px;}
  .cell.planted::after{font-size:16px;}
  .readout{font-size:13px;}
  .phase-label{font-size:13px;padding:7px 10px;}
  .bigscore{font-size:20px;}
  .scorelist li{font-size:13px;padding:7px 10px;}
}

@media (max-width:360px){
  .cards{grid-template-columns:1fr;}
}

/* 가로 보기 · 낮은 높이 */
@media (max-height:520px){
  .tank{height:190px;}
  .waterbar{height:120px;}
  .grade{font-size:44px;}
}
