:root {
  --paper: #f6eedc;
  --paper-deep: #ead9b9;
  --ink: #2c2924;
  --muted: #6f6658;
  --blue: #1f4e79;
  --blue-dark: #163957;
  --blue-soft: #dce8f2;
  --terracotta: #b45f3c;
  --terracotta-dark: #8f452b;
  --gold: #c9973a;
  --green: #5f7f3f;
  --green-soft: #e1ebcf;
  --red: #a63f35;
  --white: #fffaf0;
  --shadow: 0 10px 30px rgba(54, 40, 20, 0.14);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Segoe UI", Tahoma, Verdana, sans-serif;
  background:
    radial-gradient(circle at 10% 20%, rgba(201, 151, 58, 0.14), transparent 28rem),
    radial-gradient(circle at 90% 80%, rgba(31, 78, 121, 0.1), transparent 26rem),
    linear-gradient(135deg, #faf3e4 0%, var(--paper) 45%, #efe1c6 100%);
}

h1, h2, h3, h4 {
  margin-top: 0;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.2;
}

h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
}

h2 {
  font-size: clamp(1.5rem, 3vw, 2.2rem);
}

p {
  line-height: 1.65;
}

a {
  color: var(--blue);
}

button, input, select {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.8rem clamp(1rem, 4vw, 2.5rem);
  color: var(--white);
  background: linear-gradient(120deg, var(--blue-dark), var(--blue));
  box-shadow: 0 6px 18px rgba(22, 57, 87, 0.28);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--white);
  font-family: Georgia, serif;
  font-size: 1.2rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  width: 2.1rem;
  height: 2.1rem;
  place-items: center;
  border: 1px solid rgba(255, 250, 240, 0.55);
  border-radius: 50%;
  color: var(--gold);
  font-size: 1.35rem;
}

.main-nav {
  display: flex;
  gap: 0.35rem;
  flex: 1;
}

.main-nav a {
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  color: rgba(255, 250, 240, 0.85);
  font-weight: 600;
  text-decoration: none;
}

.main-nav a:hover,
.main-nav a.active {
  color: var(--white);
  background: rgba(255, 255, 255, 0.14);
}

.user-box {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.user-name {
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.view {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.8rem;
  padding: 0.65rem 1.15rem;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--blue);
  color: var(--white);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}

.btn:hover {
  transform: translateY(-1px);
  background: var(--blue-dark);
  box-shadow: 0 8px 18px rgba(31, 78, 121, 0.2);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: var(--terracotta);
}

.btn-secondary:hover {
  background: var(--terracotta-dark);
}

.btn-ghost {
  border-color: currentColor;
  background: transparent;
  color: var(--blue);
}

.btn-ghost:hover {
  background: var(--blue-soft);
  color: var(--blue-dark);
}

.topbar .btn-ghost {
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.45);
}

.topbar .btn-ghost:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--white);
}

.btn-small {
  min-height: 2.2rem;
  padding: 0.4rem 0.8rem;
  font-size: 0.9rem;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.card {
  padding: clamp(1.2rem, 3vw, 2rem);
  border: 1px solid rgba(96, 74, 40, 0.16);
  border-radius: var(--radius);
  background: rgba(255, 250, 240, 0.9);
  box-shadow: var(--shadow);
}

.auth-wrap {
  display: grid;
  min-height: calc(100vh - 8rem);
  place-items: center;
}

.auth-card {
  width: min(470px, 100%);
}

.auth-title {
  margin-bottom: 0.35rem;
  color: var(--blue-dark);
}

.auth-subtitle {
  margin-top: 0;
  color: var(--muted);
}

.tabs {
  display: flex;
  gap: 0.5rem;
  margin: 1.3rem 0;
  padding: 0.3rem;
  border-radius: 999px;
  background: var(--paper-deep);
}

.tab {
  flex: 1;
  padding: 0.6rem 0.9rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.tab.active {
  background: var(--white);
  color: var(--blue-dark);
  box-shadow: 0 3px 12px rgba(54, 40, 20, 0.12);
}

.field {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.field label {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.field input,
.field select {
  width: 100%;
  min-height: 2.8rem;
  padding: 0.6rem 0.85rem;
  border: 1px solid #c9b795;
  border-radius: 12px;
  background: var(--white);
  color: var(--ink);
}

.field input:focus,
.field select:focus {
  outline: 3px solid rgba(31, 78, 121, 0.2);
  border-color: var(--blue);
}

.form-note {
  margin: 0.35rem 0 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.alert {
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: #f8e4dc;
  color: var(--red);
  font-weight: 600;
}

.alert-info {
  background: var(--blue-soft);
  color: var(--blue-dark);
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.page-head p {
  margin: 0;
  color: var(--muted);
}

.hub-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(240px, 0.65fr);
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.hub-hero .card {
  position: relative;
  overflow: hidden;
}

.hub-hero h1 {
  margin-bottom: 0.5rem;
  color: var(--blue-dark);
}

.hub-hero p {
  margin-bottom: 0;
  color: var(--muted);
}

.progress-card {
  display: grid;
  gap: 0.9rem;
  align-content: center;
}

.progress-number {
  color: var(--blue-dark);
  font-family: Georgia, serif;
  font-size: 2.8rem;
  font-weight: 700;
  line-height: 1;
}

.progress-label {
  color: var(--muted);
  font-weight: 600;
}

.hub-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.1rem;
}

.game-card {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: 1.25rem;
  border: 1px solid rgba(96, 74, 40, 0.16);
  border-radius: var(--radius);
  background: rgba(255, 250, 240, 0.92);
  box-shadow: var(--shadow);
}

.game-card.is-locked {
  opacity: 0.72;
}

.game-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.8rem;
}

.paragraph-badge {
  display: inline-flex;
  padding: 0.28rem 0.6rem;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue-dark);
  font-size: 0.82rem;
  font-weight: 800;
}

.type-badge {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.game-card h3 {
  margin-bottom: 0.35rem;
  color: var(--blue-dark);
  font-size: 1.35rem;
}

.game-card .subtitle {
  margin: 0 0 0.6rem;
  color: var(--terracotta-dark);
  font-size: 0.9rem;
  font-weight: 700;
}

.game-card p {
  flex: 1;
  margin-bottom: 1rem;
  color: var(--muted);
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.best-line {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.stars {
  color: var(--gold);
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.stars-empty {
  color: #c8bfae;
}

.game-shell {
  display: grid;
  gap: 1.1rem;
}

.game-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.game-top h1 {
  margin-bottom: 0.2rem;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
}

.game-top p {
  margin: 0;
  color: var(--muted);
}

.game-progress {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  color: var(--muted);
  font-weight: 700;
}

.progress-track {
  width: min(240px, 35vw);
  height: 0.65rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--paper-deep);
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--terracotta), var(--gold));
  transition: width 0.25s ease;
}

.puzzle-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 1rem;
}

.tool-panel {
  display: grid;
  gap: 0.7rem;
  align-content: start;
}

.tool-btn {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.7rem 0.8rem;
  border: 1px solid #c9b795;
  border-radius: 12px;
  background: var(--white);
  color: var(--ink);
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.tool-btn:hover {
  border-color: var(--blue);
}

.tool-btn.active {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.tool-symbol {
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border-radius: 50%;
  background: var(--paper-deep);
  color: var(--blue-dark);
  font-size: 1.2rem;
}

.nile-map {
  position: relative;
  min-height: 360px;
  overflow: hidden;
  border: 1px solid #c9b795;
  border-radius: var(--radius);
  background: #f0dfba;
}

.map-river {
  position: absolute;
  inset: 0 auto 0 0;
  width: 20%;
  background: linear-gradient(180deg, #7fb6d8, #2f76a6 50%, #7fb6d8);
  box-shadow: inset -10px 0 18px rgba(0, 0, 0, 0.12);
}

.map-river::after {
  content: "Нил";
  position: absolute;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  color: var(--white);
  font-family: Georgia, serif;
  font-weight: 700;
  letter-spacing: 0.08em;
  writing-mode: vertical-rl;
}

.map-desert {
  position: absolute;
  inset: 0 0 0 68%;
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.35) 0 8%, transparent 9%),
    linear-gradient(160deg, #efd49a, #d9b575);
}

.map-fields {
  position: absolute;
  left: 20%;
  top: 43%;
  width: 48%;
  height: 40%;
  border-radius: 22px;
  background:
    repeating-linear-gradient(90deg, transparent 0 26px, rgba(255, 255, 255, 0.18) 26px 28px),
    linear-gradient(140deg, #9fbe66, #678b42);
  box-shadow: inset 0 0 20px rgba(30, 60, 20, 0.18);
}

.map-upper {
  position: absolute;
  left: 48%;
  top: 8%;
  width: 20%;
  height: 22%;
  border-radius: 18px;
  background: linear-gradient(150deg, #b7cf7c, #7fa14e);
  box-shadow: inset 0 0 18px rgba(30, 60, 20, 0.16);
}

.map-delta {
  position: absolute;
  left: 20%;
  bottom: 4%;
  width: 30%;
  height: 20%;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  background: rgba(93, 157, 94, 0.5);
}

.hotspot {
  position: absolute;
  display: grid;
  min-width: 8.5rem;
  min-height: 4.2rem;
  padding: 0.5rem 0.65rem;
  place-items: center;
  border: 2px dashed rgba(31, 78, 121, 0.55);
  border-radius: 14px;
  background: rgba(255, 250, 240, 0.88);
  color: var(--blue-dark);
  font-size: 0.82rem;
  font-weight: 800;
  text-align: center;
  cursor: pointer;
}

.hotspot:hover {
  border-color: var(--blue);
  background: var(--white);
}

.hotspot.filled {
  border-style: solid;
  border-color: var(--green);
  background: var(--green-soft);
}

.hotspot .placed-symbol {
  display: block;
  color: var(--green);
  font-size: 1.4rem;
  line-height: 1;
}

.hotspot .placed-name {
  display: block;
  margin-top: 0.2rem;
}

.hotspot .hotspot-hint {
  display: block;
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
}

.hotspot-riverbank {
  left: 21%;
  top: 36%;
}

.hotspot-fields {
  left: 39%;
  top: 54%;
}

.hotspot-upper {
  left: 49%;
  top: 12%;
}

.hotspot-desert {
  left: 77%;
  top: 40%;
}

.question-card .question-text {
  margin-bottom: 1.1rem;
  font-size: clamp(1.15rem, 2.2vw, 1.45rem);
  font-weight: 700;
  line-height: 1.45;
}

.options {
  display: grid;
  gap: 0.7rem;
}

.option-btn {
  width: 100%;
  padding: 0.9rem 1rem;
  border: 1px solid #c9b795;
  border-radius: 14px;
  background: var(--white);
  color: var(--ink);
  font-size: 1rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.option-btn:hover:not(:disabled) {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.option-btn:disabled {
  cursor: default;
}

.option-btn.correct {
  border-color: var(--green);
  background: var(--green-soft);
}

.option-btn.wrong {
  border-color: var(--red);
  background: #f8e4dc;
}

.feedback {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border-radius: 14px;
  background: var(--blue-soft);
}

.feedback.ok {
  background: var(--green-soft);
}

.feedback.no {
  background: #f8e4dc;
}

.feedback p {
  margin: 0.35rem 0 0;
}

.result-card {
  text-align: center;
}

.result-score {
  margin: 0.4rem 0;
  color: var(--blue-dark);
  font-family: Georgia, serif;
  font-size: clamp(3rem, 8vw, 5rem);
  font-weight: 700;
  line-height: 1;
}

.result-stars {
  margin-bottom: 1rem;
  font-size: 2rem;
}

.result-breakdown {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
  margin: 1.2rem 0;
}

.breakdown-box {
  padding: 0.9rem;
  border-radius: 14px;
  background: var(--paper-deep);
}

.breakdown-box strong {
  display: block;
  color: var(--blue-dark);
  font-size: 1.5rem;
}

.review-list {
  display: grid;
  gap: 0.7rem;
  margin: 1.2rem 0;
  text-align: left;
}

.review-item {
  padding: 0.85rem 1rem;
  border-left: 4px solid var(--green);
  border-radius: 10px;
  background: var(--white);
}

.review-item.no {
  border-left-color: var(--red);
}

.review-item p {
  margin: 0.25rem 0 0;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid rgba(96, 74, 40, 0.16);
  border-radius: var(--radius);
  background: rgba(255, 250, 240, 0.92);
  box-shadow: var(--shadow);
}

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

th, td {
  padding: 0.8rem 0.9rem;
  border-bottom: 1px solid rgba(96, 74, 40, 0.12);
  text-align: left;
  vertical-align: middle;
}

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

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr.is-me {
  background: var(--blue-soft);
}

.rank {
  color: var(--terracotta-dark);
  font-weight: 800;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.9rem;
}

.teacher-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.teacher-tabs .tab {
  flex: 0 0 auto;
  border: 1px solid rgba(96, 74, 40, 0.18);
  background: rgba(255, 250, 240, 0.8);
}

.teacher-tabs .tab.active {
  border-color: var(--blue);
  background: var(--blue);
  color: var(--white);
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.7rem;
  margin-bottom: 1rem;
}

.inline-form .field {
  min-width: 180px;
  margin-bottom: 0;
}

.switch-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border-radius: 14px;
  background: var(--paper-deep);
}

.switch {
  position: relative;
  display: inline-flex;
  width: 3.2rem;
  height: 1.8rem;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #b9ae9b;
  cursor: pointer;
  transition: background 0.2s ease;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 0.2rem;
  left: 0.2rem;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  background: var(--white);
  transition: transform 0.2s ease;
}

.switch input:checked + .switch-track {
  background: var(--green);
}

.switch input:checked + .switch-track::after {
  transform: translateX(1.4rem);
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 50;
  max-width: min(360px, calc(100% - 2rem));
  padding: 0.9rem 1rem;
  border-radius: 14px;
  background: var(--blue-dark);
  color: var(--white);
  box-shadow: var(--shadow);
  font-weight: 600;
}

.toast.error {
  background: var(--red);
}

.empty {
  padding: 2rem;
  color: var(--muted);
  text-align: center;
}

.hidden {
  display: none !important;
}

@media (max-width: 900px) {
  .hub-hero,
  .hub-grid {
    grid-template-columns: 1fr;
  }

  .hub-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .puzzle-layout {
    grid-template-columns: 1fr;
  }

  .tool-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .topbar {
    flex-wrap: wrap;
    gap: 0.6rem;
  }

  .main-nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
  }

  .user-box {
    margin-left: auto;
  }

  .hub-grid {
    grid-template-columns: 1fr;
  }

  .result-breakdown {
    grid-template-columns: 1fr;
  }

  .nile-map {
    min-height: 300px;
  }

  .hotspot {
    min-width: 6.8rem;
    min-height: 3.4rem;
    font-size: 0.72rem;
  }

  .hotspot .hotspot-hint {
    display: none;
  }

  .hotspot-riverbank {
    left: 21%;
    top: 30%;
  }

  .hotspot-fields {
    left: 34%;
    top: 53%;
  }

  .hotspot-upper {
    left: 45%;
    top: 8%;
  }

  .hotspot-desert {
    left: 72%;
    top: 38%;
  }
}

.society-board {
  display: grid;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.society-level {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  padding: 0.8rem 1rem;
  border: 1px dashed #c9b795;
  border-radius: 14px;
  background: rgba(255, 250, 240, 0.75);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.society-level:nth-child(1) {
  width: 46%;
  margin: 0 auto;
  border-color: var(--gold);
  background: #f7e9c9;
}

.society-level:nth-child(2) {
  width: 70%;
  margin: 0 auto;
}

.society-level:nth-child(3) {
  width: 82%;
  margin: 0 auto;
}

.society-level.filled {
  border-style: solid;
  border-color: var(--green);
  background: var(--green-soft);
}

.society-level-title {
  min-width: 10rem;
  color: var(--blue-dark);
  font-weight: 800;
}

.society-level-hint {
  color: var(--muted);
  font-size: 0.8rem;
}

.society-level-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-left: auto;
}

.placed-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  background: var(--white);
  color: var(--green);
  font-size: 0.8rem;
  font-weight: 800;
}

.society-tray,
.battle-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding: 0.8rem;
  border-radius: 14px;
  background: var(--paper-deep);
}

.society-card,
.battle-card {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 9rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid #c9b795;
  border-radius: 12px;
  background: var(--white);
  color: var(--ink);
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.society-card:hover,
.battle-card:hover {
  border-color: var(--blue);
}

.society-card.active,
.battle-card.active {
  border-color: var(--blue);
  background: var(--blue-soft);
  box-shadow: 0 0 0 3px rgba(31, 78, 121, 0.12);
}

.society-card.placed,
.battle-card.placed {
  opacity: 0.55;
}

.society-card-symbol {
  color: var(--gold);
  font-size: 1.2rem;
}

.society-card span:last-child,
.battle-card span {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.stat-box {
  padding: 0.7rem 0.8rem;
  border: 1px solid #d8c9ad;
  border-radius: 12px;
  background: var(--white);
}

.stat-box span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.stat-box strong {
  color: var(--terracotta-dark);
  font-size: 1.15rem;
}

.stat-box.ok {
  border-color: var(--green);
  background: var(--green-soft);
}

.stat-box.ok strong {
  color: var(--green);
}

.farmer-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
}

.action-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid #c9b795;
  border-radius: 12px;
  background: var(--white);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.action-card span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.action-card:hover:not(:disabled) {
  border-color: var(--blue);
}

.action-card.selected {
  border-color: var(--green);
  background: var(--green-soft);
}

.action-card:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.battle-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.battle-slot {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-height: 7rem;
  padding: 0.75rem;
  border: 2px dashed rgba(31, 78, 121, 0.5);
  border-radius: 14px;
  background: rgba(255, 250, 240, 0.85);
  color: var(--blue-dark);
  text-align: left;
  cursor: pointer;
}

.battle-slot.filled {
  border-style: solid;
  border-color: var(--green);
  background: var(--green-soft);
}

.battle-slot-name {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.battle-slot-content {
  color: var(--blue-dark);
  font-weight: 800;
}

@media (max-width: 900px) {
  .stats-grid,
  .battle-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .farmer-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .society-level,
  .society-level:nth-child(1),
  .society-level:nth-child(2),
  .society-level:nth-child(3) {
    width: 100%;
  }

  .society-level-cards {
    margin-left: 0;
  }

  .stats-grid,
  .farmer-actions,
  .battle-board {
    grid-template-columns: 1fr;
  }
}




