:root {
  --ink: #17382f;
  --leaf: #1d7354;
  --leaf-dark: #15513e;
  --lime: #a8d86e;
  --sun: #ffd45c;
  --soil: #7b4b31;
  --cream: #fffaf0;
  --sky: #dff5ed;
  --line: rgba(23, 56, 47, .16);
  font-family: "Yu Gothic", "Hiragino Kaku Gothic ProN", system-ui, sans-serif;
  color: var(--ink);
  background: #eff9f3;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: #eff9f3; }
body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 10% 2%, rgba(255, 212, 92, .38), transparent 24rem),
    radial-gradient(circle at 90% 32%, rgba(99, 190, 151, .28), transparent 28rem),
    linear-gradient(180deg, #e5f7ef 0, #fffaf0 54%, #f2e8d8 100%);
  touch-action: manipulation;
}

button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
button:focus-visible, a:focus-visible { outline: 4px solid #ffb92e; outline-offset: 3px; }

.topbar {
  max-width: 1060px;
  margin: auto;
  padding: 14px clamp(16px, 4vw, 36px);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand { color: var(--ink); text-decoration: none; font-weight: 900; letter-spacing: .08em; font-size: .84rem; }
.brand b { color: var(--leaf); }
.small-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 14px;
  background: rgba(255,255,255,.78);
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

main { width: min(100% - 24px, 980px); margin: 0 auto 42px; }
.hero { display: flex; gap: 24px; align-items: end; justify-content: space-between; padding: 20px 10px 22px; }
.eyebrow { margin: 0 0 8px; color: var(--leaf); font-size: .8rem; font-weight: 900; letter-spacing: .12em; }
h1 { margin: 0; line-height: .92; font-size: clamp(2.4rem, 9vw, 5.25rem); letter-spacing: -.06em; }
h1 span { color: var(--leaf); }
.lead { max-width: 660px; margin: 16px 0 0; line-height: 1.75; font-weight: 600; }
.records { flex: 0 0 auto; display: grid; gap: 8px; }
.records span { border-radius: 12px; padding: 10px 14px; background: rgba(255,255,255,.82); box-shadow: 0 6px 20px rgba(21,81,62,.08); font-size: .82rem; font-weight: 700; }
.records strong { color: var(--leaf); font-size: 1.1rem; }

.science-note {
  position: relative;
  overflow: hidden;
  padding: 16px;
  border: 1px solid rgba(29,115,84,.22);
  border-radius: 20px;
  background: rgba(255,255,255,.88);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  box-shadow: 0 14px 36px rgba(23,56,47,.08);
}
.science-note::before { content: ""; position: absolute; inset: auto -24px -30px auto; width: 100px; height: 100px; border-radius: 50%; background: rgba(168,216,110,.25); }
.science-note div { display: flex; align-items: center; gap: 12px; padding: 11px 13px; border-radius: 14px; background: var(--sky); }
.science-note div b { white-space: nowrap; color: var(--leaf-dark); }
.science-note div span { font-size: .9rem; }
.science-note p { grid-column: 1 / -1; margin: 0 4px; font-size: .82rem; line-height: 1.6; }

.game-shell {
  position: relative;
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid rgba(23,56,47,.14);
  border-radius: 26px;
  background: rgba(255,250,240,.94);
  box-shadow: 0 22px 60px rgba(23,56,47,.16);
}
.hud { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--ink); color: #fff; }
.hud div { padding: 14px 12px; text-align: center; border-right: 1px solid rgba(255,255,255,.14); }
.hud div:last-child { border: 0; }
.hud small { display: block; color: #bfe6d3; font-size: .66rem; font-weight: 900; letter-spacing: .11em; }
.hud b { display: block; margin-top: 3px; font-size: 1.05rem; }

.weather-board { margin: 16px; padding: 14px 16px; display: flex; align-items: center; gap: 14px; border-radius: 18px; background: linear-gradient(135deg, #dff6ff, #f5fff7); border: 1px solid #bce2d3; }
#weatherIcon { font-size: 3rem; filter: drop-shadow(0 5px 5px rgba(23,56,47,.12)); }
.weather-board small { color: #54726a; font-size: .7rem; font-weight: 900; }
.weather-board h2 { margin: 1px 0 2px; font-size: 1.18rem; }
.weather-board p { margin: 0; font-size: .8rem; line-height: 1.45; }
.forecast { margin-left: auto; min-width: 66px; text-align: center; padding-left: 12px; border-left: 1px solid var(--line); }
.forecast b { display: block; margin-top: 3px; font-size: 1.8rem; }
.phase-hint { margin: 0 16px 14px; padding: 9px 13px; border-radius: 12px; background: #fff0b8; font-size: .82rem; font-weight: 800; text-align: center; }

.garden { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 0 16px 16px; }
.plant-card {
  position: relative;
  border: 2px solid transparent;
  border-radius: 18px;
  padding: 12px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(23,56,47,.09);
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.plant-card:hover { transform: translateY(-2px); }
.plant-card.selected { border-color: var(--leaf); box-shadow: 0 8px 24px rgba(29,115,84,.2); }
.plant-card.selected::after { content: "お世話する鉢"; position: absolute; top: -9px; right: 10px; padding: 3px 8px; border-radius: 999px; background: var(--leaf); color: #fff; font-size: .62rem; font-weight: 900; }
.plant-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.plant-name { font-weight: 900; }
.health { letter-spacing: -3px; font-size: .88rem; }
.plant-visual {
  position: relative;
  height: 112px;
  margin: 8px 0 10px;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(#dff6ff 0 58%, #a97854 59% 100%);
  display: grid;
  place-items: center;
}
.plant-visual::before { content: ""; position: absolute; inset: auto 12% 25% 12%; height: 11px; border-radius: 50%; background: rgba(57,32,18,.25); }
.plant-icon { position: relative; z-index: 1; font-size: 3.8rem; transform-origin: bottom; animation: bob 2.8s ease-in-out infinite; filter: drop-shadow(0 7px 5px rgba(38,63,47,.22)); }
.plant-stage { position: absolute; z-index: 2; left: 7px; bottom: 7px; padding: 3px 7px; border-radius: 8px; background: rgba(255,255,255,.88); font-size: .66rem; font-weight: 900; }
.growth-track { height: 7px; overflow: hidden; border-radius: 99px; background: #dce8e1; }
.growth-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--lime), var(--leaf)); transition: width .5s ease; }
.stats { margin-top: 10px; display: grid; gap: 5px; }
.stat { display: grid; grid-template-columns: 30px 1fr 12px; align-items: center; gap: 4px; font-size: .7rem; }
.stat-track { height: 5px; border-radius: 99px; background: #e8ece9; overflow: hidden; }
.stat-fill { height: 100%; border-radius: inherit; background: #63b995; }
.stat.warning .stat-fill { background: #eb7e50; }

.care-panel { margin: 0 16px 16px; padding: 15px; border-radius: 18px; background: #f5eddf; border: 1px solid rgba(123,75,49,.16); }
.care-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.care-heading small { display: block; color: #796b5d; font-size: .67rem; font-weight: 900; }
.care-heading b { color: var(--leaf-dark); }
.care-heading p { margin: 0; font-size: .77rem; text-align: right; }
.care-buttons { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.care-button { min-height: 62px; border: 1px solid rgba(23,56,47,.16); border-radius: 13px; background: #fff; color: var(--ink); font-weight: 900; cursor: pointer; }
.care-button span { display: block; font-size: 1.35rem; }
.care-button small { display: block; margin-top: 3px; color: #66766f; font-size: .62rem; font-weight: 700; }
.care-button:disabled { opacity: .42; cursor: not-allowed; }
.care-button:not(:disabled):active { transform: scale(.97); }
.primary-button { width: 100%; margin-top: 12px; border: 0; border-radius: 14px; padding: 14px 18px; background: linear-gradient(135deg, var(--leaf), var(--leaf-dark)); color: #fff; font-weight: 900; box-shadow: 0 7px 0 #0c3c2d; cursor: pointer; }
.primary-button:active { transform: translateY(3px); box-shadow: 0 4px 0 #0c3c2d; }
.primary-button:disabled { opacity: .44; box-shadow: none; cursor: not-allowed; }

.log-panel { margin: 0 16px 18px; padding: 13px 15px; border-left: 4px solid var(--sun); border-radius: 0 12px 12px 0; background: rgba(255,255,255,.72); }
.log-panel h2 { margin: 0 0 6px; font-size: .86rem; }
.log-panel ul { margin: 0; padding-left: 1.2rem; font-size: .74rem; line-height: 1.55; }

.overlay { position: absolute; z-index: 10; inset: 0; min-height: 100%; padding: 22px; display: grid; place-items: center; background: rgba(11,45,35,.82); backdrop-filter: blur(5px); }
.overlay[hidden] { display: none; }
.overlay-card { width: min(100%, 600px); max-height: calc(100vh - 44px); overflow-y: auto; border-radius: 24px; padding: clamp(20px, 5vw, 32px); background: var(--cream); text-align: center; box-shadow: 0 24px 70px rgba(0,0,0,.25); }
.overlay-icon { font-size: 3.3rem; }
.overlay-card h2 { margin: 8px 0; font-size: clamp(1.5rem, 5vw, 2.2rem); }
.overlay-card > p { margin: 0; line-height: 1.75; font-size: .92rem; }
.result-details { margin-top: 14px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.result-details div { padding: 10px 6px; border-radius: 12px; background: #e8f4ed; }
.result-details small { display: block; font-size: .62rem; color: #557067; }
.result-details b { display: block; margin-top: 2px; color: var(--leaf-dark); }
#rankingWrap { margin-top: 18px; text-align: left; }

footer { padding: 0 16px 30px; color: #6a776f; font-size: .68rem; font-weight: 900; letter-spacing: .18em; text-align: center; }
.growing .plant-icon { animation: grow-pop .8s cubic-bezier(.2,.8,.2,1); }

@keyframes bob { 50% { transform: translateY(-4px) rotate(1deg); } }
@keyframes grow-pop { 0% { transform: scale(.7); } 55% { transform: scale(1.18); } 100% { transform: scale(1); } }

@media (max-width: 700px) {
  main { width: min(100% - 16px, 980px); }
  .hero { align-items: stretch; flex-direction: column; gap: 14px; }
  .records { grid-template-columns: 1fr 1fr; }
  .science-note { grid-template-columns: 1fr; }
  .science-note p { grid-column: auto; }
  .garden { grid-template-columns: 1fr; }
  .plant-card { display: grid; grid-template-columns: 112px 1fr; gap: 11px; }
  .plant-top { grid-column: 1 / -1; }
  .plant-visual { height: 94px; margin: 0; }
  .stats { margin: 0; align-self: center; }
  .care-buttons { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 430px) {
  .topbar { padding-inline: 12px; }
  .brand { font-size: .7rem; }
  .small-button { padding: 8px 10px; font-size: .75rem; }
  h1 { font-size: clamp(2.2rem, 13vw, 3.5rem); }
  .lead { font-size: .88rem; }
  .science-note div { align-items: flex-start; flex-direction: column; gap: 3px; }
  .hud b { font-size: .83rem; }
  .weather-board { margin: 10px; padding: 11px; }
  #weatherIcon { font-size: 2.35rem; }
  .weather-board p { font-size: .7rem; }
  .phase-hint { margin-inline: 10px; }
  .garden { padding: 0 10px 10px; gap: 9px; }
  .plant-card { grid-template-columns: 96px 1fr; padding: 10px; }
  .care-panel, .log-panel { margin-inline: 10px; }
  .care-heading { align-items: flex-start; flex-direction: column; gap: 4px; }
  .care-heading p { text-align: left; }
  .overlay { padding: 10px; }
  .overlay-card { max-height: calc(100vh - 20px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
