:root {
  --bg: #f4f7f1;
  --ink: #172118;
  --muted: #66705f;
  --panel: #ffffff;
  --panel-strong: #e7efe3;
  --line: #d6dfd0;
  --accent: #2f7d46;
  --accent-dark: #205c33;
  --gold: #c98a20;
  --gold-dark: #9c6a12;
  --rose: #b65a68;
  --rose-dark: #8f3f4c;
  --teal: #1f7a8c;
  --teal-dark: #145562;
  --violet: #6d4bb0;
  --violet-dark: #513689;
  --shadow: 0 18px 42px rgba(31, 55, 35, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(120deg, rgba(47, 125, 70, 0.08), transparent 36%),
    linear-gradient(210deg, rgba(201, 138, 32, 0.13), transparent 30%), var(--bg);
  font-family: Arial, Helvetica, sans-serif;
}

button {
  border: 0;
  border-radius: 8px;
  font: inherit;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.app-header,
.app-footer,
.game-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 0 10px;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--accent-dark);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  line-height: 1;
}

h2 {
  margin-bottom: 0;
  font-size: 1.1rem;
}

h3 {
  margin-bottom: 8px;
  font-size: 1rem;
}

.dna-wallet {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.wallet-label,
.dna-wallet small {
  color: var(--muted);
  font-size: 0.82rem;
}

.dna-wallet strong {
  color: var(--accent-dark);
  font-size: 1.4rem;
}

.game-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}

.lab-panel,
.side-panel section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

.lab-panel {
  padding: 14px;
}

.side-panel {
  display: grid;
  gap: 12px;
}

.side-panel section {
  padding: 12px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.section-heading.compact {
  margin-bottom: 8px;
}

.primary-button,
.buy-button {
  min-height: 34px;
  padding: 0 14px;
  color: #fff;
  background: var(--accent);
}

.primary-button:hover,
.buy-button:hover {
  background: var(--accent-dark);
}

.ghost-button {
  padding: 9px 12px;
  color: var(--accent-dark);
  background: transparent;
  border: 1px solid var(--line);
}

.plot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.plot-card,
.shop-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.plot-card {
  position: relative;
  min-height: 190px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.plot-main {
  display: flex;
  align-items: center;
  gap: 8px;
}

.plot-info {
  flex: 1;
  min-width: 0;
}

.plot-card.fresh {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(201, 138, 32, 0.35);
}

.plot-card.full {
  border-color: var(--rose);
}

.fresh-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 3px 8px;
  border-radius: 999px;
  color: #fff;
  background: var(--gold);
  font-size: 0.75rem;
  font-weight: 700;
}

.remove-button {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  background: var(--panel);
  font-size: 0.7rem;
  line-height: 1;
}

.remove-button:hover {
  border-color: var(--rose);
  color: var(--rose);
}

.storage-row {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.plot-card.full .storage-row {
  color: var(--rose);
}

.plant-visual {
  flex-shrink: 0;
  width: 76px;
}

.flask {
  display: block;
  width: 100%;
  height: auto;
}

.flask-glass {
  stroke: #aeb9c2;
  stroke-width: 2.5;
}

.flask-liquid {
  fill: var(--plant-leaf, var(--accent));
  opacity: 0.3;
}

.flask-stem {
  fill: var(--plant-stem, var(--accent-dark));
}

.flask-leaf {
  fill: var(--plant-leaf, var(--accent));
  transform-box: fill-box;
  transform-origin: center bottom;
  animation: leaf-sway 3.2s ease-in-out infinite alternate;
}

.leaf-b {
  fill: var(--plant-leaf2, #7aa83c);
  animation-delay: -1.6s;
}

.leaf-c {
  fill: var(--plant-leaf2, #7aa83c);
  animation-duration: 2.6s;
}

.bubble {
  fill: #ffffff;
  opacity: 0.7;
  animation: bubble-rise 2.8s ease-in infinite;
}

.bubble-2 {
  animation-delay: -1.4s;
}

@keyframes leaf-sway {
  from {
    transform: rotate(-6deg);
  }
  to {
    transform: rotate(6deg);
  }
}

@keyframes bubble-rise {
  0% {
    transform: translateY(6px);
    opacity: 0;
  }
  30% {
    opacity: 0.7;
  }
  100% {
    transform: translateY(-26px);
    opacity: 0;
  }
}

.plot-card.empty .plant-visual {
  opacity: 0.4;
}

.plot-card.empty .flask-plant,
.plot-card.empty .bubble {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .flask-leaf,
  .bubble {
    animation: none;
  }
}

.plot-status {
  min-height: 30px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.progress-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--panel-strong);
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--gold);
  transition: width 0.25s ease;
}

.shop-list {
  display: grid;
  gap: 8px;
}

.shop-card {
  padding: 8px 10px;
}

.shop-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.shop-top h3 {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 0;
}

.shop-icon {
  font-size: 1.1rem;
}

.section-hint {
  margin: -4px 0 8px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.3;
}

.shop-card p {
  margin-bottom: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.3;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.shop-meta {
  display: flex;
  gap: 6px 10px;
  flex-wrap: wrap;
  margin-top: 4px;
  color: var(--accent-dark);
  font-size: 0.76rem;
  font-weight: 700;
}

.buy-button {
  flex-shrink: 0;
  min-height: 28px;
  font-size: 0.82rem;
}

.message-bar {
  flex: 1;
  max-width: 460px;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: 0.9rem;
  font-weight: 700;
}

.message-bar.error {
  color: var(--rose);
  border-color: var(--rose);
}

.message-bar.success {
  color: var(--accent-dark);
  border-color: var(--accent);
}

.message-bar.success.bonus {
  color: var(--gold);
  border-color: var(--gold);
}

.message-bar.info {
  color: var(--muted);
}

.rules-hint {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.collection-heading {
  margin-top: 12px;
}

.collection {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.collection-group h3 {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.badge.unlocked {
  color: #fff;
  background: var(--accent);
}

.badge.locked {
  color: var(--muted);
  background: var(--panel-strong);
}

.shop-card.highlight {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(47, 125, 70, 0.25);
}

/* Farbige Bereichs-Label, damit das Spiel nicht komplett grün ist. */
.eyebrow-lab {
  color: var(--teal-dark);
}

.eyebrow-research {
  color: var(--violet-dark);
}

.eyebrow-collection {
  color: var(--gold-dark);
}

.eyebrow-board {
  color: var(--rose-dark);
}

/* DNA-Zahl in Gold statt Grün. */
.dna-wallet strong {
  color: var(--gold-dark);
}

/* Upgrades in Violett, damit sie sich von der grünen Zucht abheben. */
.upgrade-card .buy-button {
  background: var(--violet);
}

.upgrade-card .buy-button:hover {
  background: var(--violet-dark);
}

.upgrade-card.highlight {
  border-color: var(--violet);
  box-shadow: 0 0 0 2px rgba(109, 75, 176, 0.25);
}

/* Untere Hälfte des Labors: Sammlung und Bestenliste nebeneinander. */
.lab-lower {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 16px;
  margin-top: 12px;
}

.scoreboard {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 4px;
}

.score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  font-size: 0.82rem;
}

.score-row.current {
  border-color: var(--gold);
  background: var(--panel-strong);
  font-weight: 700;
}

.score-name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.score-dna {
  flex-shrink: 0;
  color: var(--gold-dark);
  font-weight: 700;
}

.login-note {
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

.app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0 4px;
  color: var(--muted);
  font-size: 0.82rem;
}

.ghost-button {
  padding: 5px 10px;
}

.footer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.login-shell {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 20px;
}

.login-card {
  max-width: 420px;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  text-align: center;
}

.login-text {
  margin: 14px 0 20px;
  color: var(--muted);
  line-height: 1.5;
}

.login-error {
  margin: 0 0 16px;
  color: var(--rose);
  font-weight: 700;
}

.login-button {
  display: inline-block;
  padding: 12px 18px;
  border-radius: 8px;
  text-decoration: none;
}

/* Fußzeilen-Buttons sind teils Links (a) statt echter Buttons. */
a.ghost-button {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.board-shell {
  display: grid;
  place-items: start center;
  min-height: 100vh;
  padding: 24px 16px;
}

.board-card {
  width: min(640px, 100%);
  padding: 24px 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.board-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.board-hint {
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.4;
}

.board-table {
  width: 100%;
  border-collapse: collapse;
}

.board-table th,
.board-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.board-table th {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.board-table td:last-child,
.board-table th:last-child {
  text-align: right;
  font-weight: 700;
  color: var(--accent-dark);
}

.board-current {
  background: var(--panel-strong);
}

/* Kompakt-Stufe für die meisten Laptop-Bildschirme (bis 1000px Höhe),
   damit das komplette Spiel ohne Scrollen sichtbar bleibt. */
@media (max-height: 1000px) {
  .app-header {
    padding: 6px 0;
  }

  h1 {
    font-size: 1.4rem;
  }

  .plant-visual {
    width: 58px;
  }

  .plot-card {
    min-height: 132px;
  }

  .shop-card p {
    display: none;
  }

  .section-hint {
    margin: 0 0 4px;
    font-size: 0.72rem;
  }

  .lab-panel {
    padding: 10px 14px;
  }

  .side-panel {
    gap: 10px;
  }

  .side-panel section {
    padding: 10px 12px;
  }

  .side-panel .section-heading.compact {
    margin-bottom: 6px;
  }

  .shop-list {
    gap: 5px;
  }

  .shop-card {
    padding: 5px 10px;
  }

  .shop-meta {
    margin-top: 2px;
    gap: 2px 8px;
  }

  .shop-top {
    margin-bottom: 2px;
  }
}

@media (max-width: 860px) {
  .app-header {
    align-items: stretch;
    flex-direction: column;
  }

  .game-shell {
    grid-template-columns: 1fr;
  }

  .app-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  .app-header,
  .app-footer,
  .game-shell {
    width: min(100% - 20px, 1180px);
  }

  .section-heading,
  .shop-card {
    align-items: stretch;
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .buy-button,
  .primary-button {
    width: 100%;
  }
}
