/* =====================================================
   WURZELIMPERIUM – Stylesheet
   ===================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }

body {
  background-color: #2d5a1b;
  background-image:
    radial-gradient(ellipse at 20% 80%, rgba(0,0,0,0.25) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 10%, rgba(80,160,40,0.15) 0%, transparent 60%);
  color: #f5e6c8;
  font-family: 'Lato', sans-serif;
  min-height: 100vh;
  padding-bottom: 3rem;
}

/* ── Header ─────────────────────────────────── */
#main-header {
  background: linear-gradient(180deg, #6e4a16 0%, #4a2f0a 100%);
  border-bottom: 4px solid #3a2008;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  padding: 0.75rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

#header-inner {
  align-items: center;
  display: flex;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  flex-wrap: wrap;
  gap: 0.5rem;
}

#header-left {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

#game-title {
  color: #f5d98b;
  font-family: 'Cinzel', serif;
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-shadow: 2px 2px 6px rgba(0,0,0,0.6);
}

#header-level {
  background: rgba(0,0,0,0.4);
  border: 2px solid #f5d98b;
  border-radius: 20px;
  color: #f5d98b;
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 0.2rem 0.7rem;
}

/* ── Resource Badges ────────────────────────── */
#resources { display: flex; gap: 1rem; flex-wrap: wrap; }

.resource-badge {
  align-items: center;
  background: rgba(0,0,0,0.35);
  border: 2px solid #8b6914;
  border-radius: 8px;
  display: flex;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
}

.res-icon  { font-size: 1.3rem; line-height: 1; }
.res-label { color: #c8b077; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 1px; }
.res-value { color: #f5d98b; font-size: 1.25rem; font-weight: 700; min-width: 2ch; text-align: right; }
.res-regen { color: #a0c060; font-size: 0.72rem; margin-left: 0.2rem; }

/* ── Section Titles ─────────────────────────── */
.section-title {
  color: #f5d98b;
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  letter-spacing: 1px;
  margin-bottom: 0.75rem;
  text-shadow: 1px 1px 4px rgba(0,0,0,0.5);
}

/* ── Main Layout ────────────────────────────── */
#main-content {
  display: flex;
  gap: 1.25rem;
  max-width: 1200px;
  margin: 1.25rem auto 0;
  padding: 0 1rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

/* ── Garden Wrapper ─────────────────────────── */
#garden-wrapper {
  background: linear-gradient(135deg, #9b7820 0%, #7a5c10 100%);
  border: 3px solid #5c4010;
  border-radius: 10px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.08);
  flex: 0 0 auto;
  padding: 1rem;
}

/* ── Garden Grid ────────────────────────────── */
#garden {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(5, 90px);
  grid-template-rows: repeat(5, 90px);
}

/* ── Plot ───────────────────────────────────── */
.plot {
  align-items: center;
  background: linear-gradient(145deg, #7a5c18 0%, #5a4010 100%);
  border: 2px solid #4a3009;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  font-size: 2.4rem;
  justify-content: center;
  position: relative;
  transition: background-color 0.18s, transform 0.12s, box-shadow 0.18s;
  user-select: none;
}

.plot:hover          { background-color: #8a6820; box-shadow: 0 0 8px rgba(200,160,60,0.55); transform: scale(1.06); z-index: 2; }
.plot:active         { transform: scale(0.97); }
.plot.empty:hover::after { content: '+'; color: rgba(255,255,255,0.4); font-size: 1.6rem; font-weight: bold; pointer-events: none; position: absolute; }

.plot .plant-emoji   { display: block; line-height: 1; transition: opacity 0.3s, font-size 0.3s; }
.plot.phase-1 .plant-emoji { font-size: 1.5rem; opacity: 0.6; }
.plot.phase-2 .plant-emoji { font-size: 2rem;   opacity: 0.85; }
.plot.phase-3 .plant-emoji { font-size: 2.5rem; opacity: 1; }

.plot.ripe { animation: ripeGlow 1.8s ease-in-out infinite alternate; border-color: gold; }
@keyframes ripeGlow {
  from { box-shadow: 0 0 6px gold, 0 0 12px rgba(255,215,0,0.4); }
  to   { box-shadow: 0 0 16px gold, 0 0 28px rgba(255,215,0,0.6); }
}

.ripe-badge    { background: gold;    border-radius: 4px; color: #3a2008; font-size: 0.55rem; font-weight: 700; padding: 1px 4px; position: absolute; top: 4px; right: 4px; text-transform: uppercase; }
.watered-badge { background: #3a9fd4; border-radius: 4px; color: #fff;    font-size: 0.5rem;  font-weight: 700; padding: 1px 4px; position: absolute; top: 4px; left: 4px; }

.plot-progress       { background: rgba(0,0,0,0.35); border-radius: 3px; bottom: 5px; height: 5px; left: 6px; overflow: hidden; position: absolute; right: 6px; }
.plot-progress-inner { background: linear-gradient(90deg, #7ad44e, #c8e85a); border-radius: 3px; height: 100%; transition: width 0.5s; }

#garden-hint { color: #c8b077; font-size: 0.78rem; margin-top: 0.6rem; text-align: center; }

/* ── Sidebar ────────────────────────────────── */
#sidebar {
  background: linear-gradient(160deg, #6e4a16 0%, #4a2f0a 100%);
  border: 2px solid #3a2008;
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.4);
  flex: 1 1 240px;
  max-width: 300px;
  min-width: 220px;
  padding: 1rem;
}

/* ── Level Panel ────────────────────────────── */
#level-panel {
  background: rgba(0,0,0,0.3);
  border: 2px solid #8b6914;
  border-radius: 8px;
  padding: 0.9rem 1rem;
}

#level-badge {
  background: linear-gradient(135deg, #c8a020, #8b6914);
  border-radius: 20px;
  color: #fff;
  display: inline-block;
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 0.5rem;
  padding: 0.2rem 0.8rem;
}

#level-title {
  color: #f5d98b;
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}

#level-desc {
  color: #c8b077;
  font-size: 0.75rem;
  line-height: 1.5;
  margin-bottom: 0.5rem;
}

.level-divider {
  border-top: 1px solid #5c4010;
  margin: 0.6rem 0;
}

#level-task-label {
  color: #a0c060;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 0.3rem;
}

#level-task {
  color: #f5ede0;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
}

#level-progress-wrap {
  align-items: center;
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

#level-progress-bar {
  background: rgba(0,0,0,0.4);
  border-radius: 5px;
  flex: 1;
  height: 10px;
  overflow: hidden;
}

#level-progress-fill {
  background: linear-gradient(90deg, #7ad44e, #f5d98b);
  border-radius: 5px;
  height: 100%;
  transition: width 0.4s ease;
}

#level-progress-text {
  color: #f5d98b;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

#level-reward {
  color: #f5d98b;
  font-size: 0.75rem;
  text-align: right;
}

/* ── Level-Schrittliste ─────────────────────── */
#level-steps { margin-top: 0.5rem; }

#level-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.level-step {
  align-items: flex-start;
  border-radius: 6px;
  display: flex;
  gap: 0.5rem;
  padding: 0.45rem 0.6rem;
  font-size: 0.72rem;
  transition: background 0.2s;
}

.level-step.step-done    { background: rgba(122,212,78,0.12); color: #a0c060; }
.level-step.step-current { background: rgba(245,217,139,0.18); border: 1px solid #8b6914; color: #f5d98b; }
.level-step.step-locked  { background: rgba(0,0,0,0.2);  color: #6b5030; }

.level-step.step-done .step-num    { background: #3a7d22; }
.level-step.step-current .step-num { background: #8b6914; }
.level-step.step-locked .step-num  { background: #3a2008; }

.step-num {
  border-radius: 50%;
  color: #fff;
  flex-shrink: 0;
  font-weight: 700;
  font-size: 0.7rem;
  height: 1.4rem;
  line-height: 1.4rem;
  text-align: center;
  width: 1.4rem;
}

.step-info em { color: inherit; opacity: 0.75; font-style: normal; }
.step-done .step-num::after { content: '✓'; }

/* ── Shop ───────────────────────────────────── */
#shop {
  background: linear-gradient(160deg, #6e4a16 0%, #4a2f0a 100%);
  border-top: 3px solid #3a2008;
  box-shadow: 0 -4px 14px rgba(0,0,0,0.35);
  margin-top: 1.25rem;
  padding: 1rem 1.5rem 1.5rem;
}

#shop .section-title { max-width: 1200px; margin-left: auto; margin-right: auto; }
#shop-cards { display: flex; flex-wrap: wrap; gap: 0.75rem; max-width: 1200px; margin: 0 auto; }

.plant-card {
  background: #f5ede0;
  border: 2px solid #5c3d11;
  border-radius: 9px;
  color: #3a2008;
  cursor: pointer;
  flex: 0 0 auto;
  min-width: 115px;
  padding: 0.65rem 0.75rem;
  position: relative;
  text-align: center;
  transition: border-color 0.15s, background 0.15s, transform 0.12s, box-shadow 0.15s;
  user-select: none;
}

.plant-card:hover:not(.locked) { border-color: #3a7d22; box-shadow: 0 0 8px rgba(60,160,40,0.45); transform: translateY(-3px); }
.plant-card.selected { background: #2e7d32; border-color: #1b5e20; box-shadow: 0 0 12px rgba(60,160,40,0.7); color: #f5ede0; }
.plant-card.locked   { cursor: not-allowed; opacity: 0.55; filter: grayscale(0.4); }

.plant-card .card-emoji { display: block; font-size: 2rem; line-height: 1.1; margin-bottom: 0.25rem; }
.plant-card .card-name  { font-family: 'Cinzel', serif; font-size: 0.78rem; font-weight: 700; margin-bottom: 0.35rem; }
.plant-card .card-stats { font-size: 0.7rem; line-height: 1.6; }
.plant-card.selected .card-stats { color: #c8e8a0; }

.stat-row   { display: flex; justify-content: space-between; gap: 0.4rem; }
.stat-label { color: #6b4f12; font-weight: 700; }
.plant-card.selected .stat-label { color: #a8d880; }
.stat-value { font-weight: 700; }
.card-afford-hint { color: #c0392b; font-size: 0.65rem; margin-top: 0.3rem; }

.lock-overlay {
  background: rgba(30,10,0,0.78);
  border-radius: 7px;
  bottom: 0;
  color: #c8b077;
  font-size: 0.65rem;
  font-weight: 700;
  left: 0;
  line-height: 1.5;
  padding: 0.3rem;
  position: absolute;
  right: 0;
  text-align: center;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

/* ── Toast ──────────────────────────────────── */
#toast-container { pointer-events: none; position: fixed; right: 1.25rem; top: 5.5rem; z-index: 9999; }

#toast {
  background: #3a2008;
  border: 2px solid #8b6914;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  color: #f5d98b;
  font-size: 0.88rem;
  font-weight: 700;
  max-width: 260px;
  opacity: 0;
  padding: 0.6rem 1rem;
  text-align: center;
  transform: translateX(30px);
  transition: opacity 0.28s ease, transform 0.28s ease;
}

#toast.show { opacity: 1; transform: translateX(0); }

/* ── Coin-Flash ─────────────────────────────── */
@keyframes coinFlash {
  0%   { color: #f5d98b; }
  40%  { color: #ffe040; transform: scale(1.35); }
  100% { color: #f5d98b; transform: scale(1); }
}
.coin-flash { animation: coinFlash 0.45s ease forwards; display: inline-block; }

/* ── Level-Up Modal ─────────────────────────── */
#level-modal-overlay {
  align-items: center;
  background: rgba(0,0,0,0.75);
  bottom: 0;
  display: none;
  justify-content: center;
  left: 0;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 9000;
}

#level-modal-overlay.active { display: flex; }

#level-modal {
  animation: modalPop 0.35s cubic-bezier(.34,1.56,.64,1);
  background: linear-gradient(160deg, #6e4a16 0%, #3a2008 100%);
  border: 3px solid #f5d98b;
  border-radius: 14px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.7), 0 0 30px rgba(245,217,139,0.2);
  max-width: 420px;
  padding: 2rem 2.5rem;
  text-align: center;
  width: 90%;
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.75); }
  to   { opacity: 1; transform: scale(1); }
}

#level-modal-title {
  color: #f5d98b;
  font-family: 'Cinzel', serif;
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

#level-modal-body {
  color: #f5ede0;
  font-size: 0.95rem;
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

#level-modal-body p { margin-bottom: 0.4rem; }
.modal-reward { color: #7ad44e; font-weight: 700; font-size: 1.1rem; }

#level-modal-btn {
  background: linear-gradient(135deg, #3a7d22, #1b5e20);
  border: 2px solid #7ad44e;
  border-radius: 8px;
  box-shadow: 0 0 12px rgba(122,212,78,0.4);
  color: #f5ede0;
  cursor: pointer;
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 0.7rem 2rem;
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
}

#level-modal-btn:hover  { background: linear-gradient(135deg, #4a9d32, #2b7e30); box-shadow: 0 0 20px rgba(122,212,78,0.6); transform: translateY(-2px); }
#level-modal-btn:active { transform: translateY(0); }

/* ── Responsive ─────────────────────────────── */
@media (max-width: 700px) {
  #garden { grid-template-columns: repeat(5, 62px); grid-template-rows: repeat(5, 62px); }
  .plot { font-size: 1.6rem; }
  .plot.phase-1 .plant-emoji { font-size: 1rem; }
  .plot.phase-2 .plant-emoji { font-size: 1.3rem; }
  .plot.phase-3 .plant-emoji { font-size: 1.6rem; }
  #sidebar { max-width: 100%; min-width: 0; width: 100%; }
  #game-title { font-size: 1.25rem; }
}
