:root {
  color-scheme: dark;
  --ink: #f3f1df;
  --muted: #abc2b5;
  --muted-strong: #cbd9d0;
  --night: #061813;
  --night-2: #0a241c;
  --panel: rgba(13, 43, 33, 0.88);
  --panel-solid: #102e25;
  --panel-light: rgba(236, 241, 214, 0.08);
  --line: rgba(205, 231, 199, 0.15);
  --mint: #a5e3a3;
  --lime: #d7ef7e;
  --amber: #ffc96b;
  --coral: #ff8b74;
  --sky: #8fd4d1;
  --purple: #c5b1e8;
  --forest: #66c08a;
  --grassland: #d9c462;
  --wilderness: #bd8b62;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.33);
  --radius-lg: 30px;
  --radius-md: 20px;
  --radius-sm: 13px;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--night);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 22% 0%, rgba(57, 126, 83, 0.27), transparent 36rem),
    radial-gradient(circle at 92% 35%, rgba(201, 165, 82, 0.09), transparent 30rem),
    linear-gradient(145deg, #071b15 0%, #071510 58%, #0d251c 100%);
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
}

button,
select,
input[type="radio"] {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(215, 239, 126, 0.72);
  outline-offset: 3px;
}

button[disabled] {
  cursor: not-allowed;
  opacity: 0.45;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 10px;
  left: 10px;
  padding: 10px 14px;
  color: #10261e;
  background: var(--lime);
  border-radius: 10px;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.forest-atmosphere {
  position: fixed;
  z-index: -1;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.orb {
  position: absolute;
  display: block;
  width: 32rem;
  height: 32rem;
  border: 1px solid rgba(195, 224, 174, 0.06);
  border-radius: 52% 48% 45% 55%;
  filter: blur(1px);
  animation: drift 18s ease-in-out infinite alternate;
}

.orb::before,
.orb::after {
  position: absolute;
  content: "";
  inset: 12%;
  border: inherit;
  border-radius: inherit;
  transform: rotate(28deg);
}

.orb::after {
  inset: 25%;
  transform: rotate(64deg);
}

.orb-one {
  top: -15rem;
  right: -8rem;
}

.orb-two {
  bottom: -19rem;
  left: -10rem;
  width: 40rem;
  height: 40rem;
  animation-delay: -7s;
}

.grain {
  position: absolute;
  inset: 0;
  opacity: 0.18;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.22'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

.site-header,
.site-footer,
.app-shell {
  width: min(1180px, calc(100% - 40px));
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 88px;
  padding: 18px 0;
}

.brand {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(215, 239, 126, 0.25);
  border-radius: 15px 15px 20px 15px;
  background: linear-gradient(145deg, rgba(216, 242, 139, 0.18), rgba(93, 173, 112, 0.1));
  transform: rotate(-4deg);
}

.brand-leaf {
  position: absolute;
  display: block;
  width: 13px;
  height: 23px;
  background: linear-gradient(var(--lime), var(--forest));
  border-radius: 100% 0 100% 0;
}

.leaf-left {
  top: 12px;
  left: 9px;
  transform: rotate(-28deg);
}

.leaf-right {
  top: 8px;
  right: 8px;
  transform: scaleX(-1) rotate(-18deg);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 22px;
  letter-spacing: 0.16em;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.28em;
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.round-chip,
.status-pill,
.season-token,
.metric-pill,
.weather-pill,
.role-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted-strong);
  background: rgba(6, 24, 19, 0.62);
  font-size: 12px;
  white-space: nowrap;
}

.round-chip {
  border-color: rgba(215, 239, 126, 0.18);
  color: var(--lime);
}

.ghost-button,
.text-button,
.icon-button,
.primary-button,
.secondary-button,
.mode-button,
.habitat-card,
.game-card {
  border: 0;
}

.ghost-button,
.secondary-button {
  color: var(--ink);
  border: 1px solid var(--line);
  background: rgba(236, 241, 214, 0.05);
  transition: 180ms ease;
}

.ghost-button:hover,
.secondary-button:hover {
  border-color: rgba(215, 239, 126, 0.34);
  background: rgba(215, 239, 126, 0.09);
  transform: translateY(-1px);
}

.compact {
  min-height: 40px;
  padding: 8px 13px;
  border-radius: 12px;
}

.app-shell {
  min-height: calc(100vh - 160px);
  padding: 24px 0 52px;
}

.loading-card {
  display: grid;
  place-items: center;
  min-height: 60vh;
  color: var(--muted);
}

.loading-ring {
  width: 48px;
  height: 48px;
  border: 2px solid rgba(165, 227, 163, 0.15);
  border-top-color: var(--mint);
  border-radius: 50%;
  animation: spin 900ms linear infinite;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 18px 0 28px;
  color: #769386;
  border-top: 1px solid rgba(205, 231, 199, 0.08);
  font-size: 12px;
}

.text-button {
  padding: 6px 0;
  color: var(--muted);
  background: transparent;
  text-decoration: underline;
  text-decoration-color: rgba(171, 194, 181, 0.35);
  text-underline-offset: 4px;
}

.home-view {
  animation: appear 500ms ease both;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(340px, 0.75fr);
  gap: clamp(28px, 5vw, 76px);
  align-items: center;
  min-height: 570px;
}

.hero-copy {
  position: relative;
  padding: clamp(20px, 3vw, 48px) 0;
}

.eyebrow {
  display: block;
  margin-bottom: 15px;
  color: var(--mint);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.28em;
}

.hero-copy h1 {
  max-width: 720px;
  margin: 0;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: clamp(48px, 8vw, 96px);
  font-weight: 800;
  line-height: 0.94;
  letter-spacing: -0.035em;
}

.hero-copy h1 span,
.hero-copy h1 em {
  display: block;
}

.hero-copy h1 span {
  color: #f2f0df;
  font-size: 0.47em;
  line-height: 1.1;
  letter-spacing: 0.12em;
}

.hero-copy h1 em {
  margin-top: 8px;
  color: transparent;
  background: linear-gradient(100deg, #f5f0cb 2%, var(--lime) 52%, var(--mint));
  -webkit-background-clip: text;
  background-clip: text;
  font-style: normal;
}

.hero-lede {
  max-width: 610px;
  margin: 28px 0 0;
  color: var(--muted-strong);
  font-size: clamp(15px, 2vw, 18px);
  line-height: 1.85;
}

.season-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 30px;
}

.season-token {
  gap: 6px;
  min-width: 74px;
  border-color: rgba(215, 239, 126, 0.12);
}

.season-token b {
  color: var(--ink);
}

.setup-panel,
.stage-card,
.progress-card,
.score-panel,
.result-summary,
.final-card {
  border: 1px solid var(--line);
  background:
    linear-gradient(150deg, rgba(232, 245, 218, 0.09), rgba(232, 245, 218, 0.025)),
    rgba(9, 31, 24, 0.8);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.setup-panel {
  position: relative;
  padding: 30px;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.setup-panel::before {
  position: absolute;
  top: -68px;
  right: -68px;
  width: 180px;
  height: 180px;
  content: "";
  border: 1px solid rgba(215, 239, 126, 0.12);
  border-radius: 44% 56% 62% 38%;
  box-shadow: 0 0 0 28px rgba(215, 239, 126, 0.025), 0 0 0 58px rgba(215, 239, 126, 0.018);
}

.setup-panel h2,
.stage-card h2,
.result-summary h2,
.final-card h2 {
  margin: 0;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: clamp(26px, 4vw, 38px);
  letter-spacing: 0.04em;
}

.setup-panel > p {
  margin: 10px 0 26px;
  color: var(--muted);
  line-height: 1.65;
}

.field-label,
.difficulty-title {
  display: block;
  margin: 0 0 9px;
  color: var(--muted-strong);
  font-size: 13px;
  font-weight: 700;
}

.text-input {
  width: 100%;
  min-height: 50px;
  padding: 0 15px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: none;
  background: rgba(3, 17, 13, 0.45);
  transition: 180ms ease;
}

.text-input:focus {
  border-color: rgba(215, 239, 126, 0.48);
  box-shadow: 0 0 0 4px rgba(215, 239, 126, 0.07);
}

.difficulty-title {
  margin-top: 22px;
}

.difficulty-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.difficulty-option {
  position: relative;
}

.difficulty-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.difficulty-option span {
  display: grid;
  min-height: 64px;
  place-items: center;
  padding: 8px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.025);
  font-size: 13px;
  text-align: center;
  transition: 170ms ease;
}

.card-main {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  color: inherit;
  border: 0;
  outline: 0;
  background: transparent;
  text-align: left;
}

.card-main:focus-visible {
  border-radius: 10px;
  outline: 3px solid rgba(215, 239, 126, 0.7);
  outline-offset: 4px;
}

.difficulty-option span small {
  display: block;
  margin-top: 2px;
  font-size: 9px;
  opacity: 0.7;
}

.difficulty-option input:checked + span {
  color: #18291d;
  border-color: transparent;
  background: linear-gradient(130deg, var(--lime), var(--mint));
  box-shadow: 0 10px 26px rgba(149, 205, 119, 0.2);
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 12px 20px;
  border-radius: 15px;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.primary-button {
  color: #10251b;
  background: linear-gradient(120deg, var(--lime), var(--mint));
  box-shadow: 0 15px 36px rgba(152, 209, 123, 0.19);
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.primary-button:hover:not([disabled]) {
  filter: brightness(1.05);
  box-shadow: 0 18px 42px rgba(152, 209, 123, 0.28);
  transform: translateY(-2px);
}

.wide {
  width: 100%;
}

.setup-panel .primary-button {
  margin-top: 24px;
}

.resume-button {
  width: 100%;
  margin-top: 10px;
}

.habitat-preview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 10px;
}

.habitat-mini {
  position: relative;
  min-height: 150px;
  padding: 21px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(12, 39, 30, 0.55);
  overflow: hidden;
}

.habitat-mini::after {
  position: absolute;
  right: -28px;
  bottom: -46px;
  width: 132px;
  height: 132px;
  content: "";
  border-radius: 50% 12% 50% 50%;
  background: var(--habitat-color);
  opacity: 0.08;
  transform: rotate(34deg);
}

.habitat-mini.forest,
.habitat-card.forest,
.habitat-result.forest {
  --habitat-color: var(--forest);
}

.habitat-mini.grassland,
.habitat-card.grassland,
.habitat-result.grassland {
  --habitat-color: var(--grassland);
}

.habitat-mini.wilderness,
.habitat-card.wilderness,
.habitat-result.wilderness {
  --habitat-color: var(--wilderness);
}

.habitat-mini .mini-icon {
  display: block;
  margin-bottom: 24px;
  color: var(--habitat-color);
  font-size: 26px;
}

.habitat-mini strong {
  display: block;
  margin-bottom: 5px;
  font-size: 18px;
}

.habitat-mini p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.game-view,
.result-view,
.final-view {
  animation: appear 400ms ease both;
}

.progress-card {
  display: grid;
  grid-template-columns: minmax(240px, 0.55fr) minmax(0, 1.45fr);
  gap: 24px;
  align-items: center;
  padding: 20px 22px;
  border-radius: 20px;
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.18);
}

.round-meta {
  display: flex;
  gap: 13px;
  align-items: center;
}

.season-emblem {
  display: grid;
  flex: 0 0 54px;
  width: 54px;
  height: 54px;
  place-items: center;
  color: #14251b;
  border-radius: 18px;
  background: linear-gradient(145deg, var(--amber), var(--lime));
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 26px;
  font-weight: 900;
}

.round-meta strong,
.round-meta small {
  display: block;
}

.round-meta strong {
  font-size: 17px;
}

.round-meta small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.season-track {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.season-track::before {
  position: absolute;
  z-index: 0;
  top: 17px;
  right: 10%;
  left: 10%;
  height: 1px;
  content: "";
  background: var(--line);
}

.season-step {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 7px;
  justify-items: center;
  color: #6f8f7f;
  font-size: 11px;
}

.season-step i {
  display: grid;
  width: 35px;
  height: 35px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #0b241b;
  font-style: normal;
}

.season-step.done,
.season-step.current {
  color: var(--ink);
}

.season-step.done i {
  border-color: rgba(165, 227, 163, 0.38);
  color: var(--mint);
}

.season-step.current i {
  color: #173022;
  border-color: transparent;
  background: var(--lime);
  box-shadow: 0 0 0 5px rgba(215, 239, 126, 0.09);
}

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

.stage-card {
  padding: clamp(20px, 4vw, 34px);
  border-radius: var(--radius-lg);
}

.stage-heading {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
}

.stage-heading p {
  max-width: 680px;
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.stage-number {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  color: var(--mint);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.stage-number::before {
  width: 24px;
  height: 1px;
  content: "";
  background: currentColor;
}

.habitat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.habitat-card {
  position: relative;
  min-height: 230px;
  padding: 20px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 20px;
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--habitat-color) 13%, transparent), transparent 54%),
    rgba(4, 22, 16, 0.45);
  text-align: left;
  overflow: hidden;
  transition: 190ms ease;
}

.habitat-card:hover:not([disabled]) {
  border-color: color-mix(in srgb, var(--habitat-color) 58%, transparent);
  transform: translateY(-3px);
}

.habitat-card.selected {
  border-color: var(--habitat-color);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--habitat-color) 16%, transparent);
}

.habitat-card.blocked {
  filter: grayscale(0.5);
}

.habitat-card .choice-check {
  position: absolute;
  top: 15px;
  right: 15px;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: #10241b;
  border-radius: 50%;
  background: var(--habitat-color);
  opacity: 0;
  transform: scale(0.7);
  transition: 180ms ease;
}

.habitat-card.selected .choice-check {
  opacity: 1;
  transform: scale(1);
}

.habitat-icon {
  display: block;
  margin-bottom: 24px;
  color: var(--habitat-color);
  font-size: 32px;
}

.habitat-card h3 {
  margin: 0 0 5px;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 25px;
}

.habitat-card > p {
  min-height: 40px;
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.habitat-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.habitat-metric {
  padding: 9px 10px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.04);
}

.habitat-metric small,
.habitat-metric b {
  display: block;
}

.habitat-metric small {
  color: var(--muted);
  font-size: 9px;
}

.habitat-metric b {
  margin-top: 2px;
  color: var(--habitat-color);
  font-size: 14px;
}

.blocked-note {
  position: absolute;
  right: 12px;
  bottom: 12px;
  left: 12px;
  padding: 8px;
  color: #f3d9b2;
  border-radius: 10px;
  background: rgba(85, 43, 21, 0.66);
  font-size: 10px;
  text-align: center;
}

.stage-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 22px;
}

.score-panel {
  position: sticky;
  top: 14px;
  padding: 20px;
  border-radius: 22px;
  box-shadow: 0 16px 46px rgba(0, 0, 0, 0.2);
}

.score-panel h3 {
  margin: 0 0 15px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.16em;
}

.score-list,
.final-ranking {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.score-row,
.ranking-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.028);
}

.score-row.human,
.ranking-row.human {
  border-color: rgba(215, 239, 126, 0.17);
  background: rgba(215, 239, 126, 0.06);
}

.animal-avatar {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.07);
  font-size: 18px;
}

.score-name strong,
.score-name small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-name strong {
  font-size: 12px;
}

.score-name small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.score-value {
  color: var(--lime);
  font-size: 18px;
  font-weight: 900;
}

.hand-overview {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 15px 0 0;
}

.metric-pill {
  min-height: 28px;
  padding: 5px 9px;
  background: rgba(255, 255, 255, 0.035);
  font-size: 10px;
}

.action-banner {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: -4px 0 22px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.13);
}

.action-banner strong {
  margin-right: auto;
  color: var(--lime);
}

.hand-section + .hand-section {
  margin-top: 26px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.hand-heading {
  display: flex;
  gap: 18px;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 13px;
}

.hand-heading h3 {
  margin: 0;
  font-size: 15px;
}

.hand-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.game-card {
  position: relative;
  min-height: 138px;
  padding: 14px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(3, 19, 14, 0.46);
  text-align: left;
  transition: 170ms ease;
}

.game-card:hover {
  border-color: color-mix(in srgb, var(--card-color, var(--mint)) 46%, transparent);
  transform: translateY(-2px);
}

.game-card.selected {
  border-color: var(--card-color, var(--mint));
  background: color-mix(in srgb, var(--card-color, var(--mint)) 11%, rgba(3, 19, 14, 0.86));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--card-color, var(--mint)) 10%, transparent);
}

.game-card.carnivore {
  --card-color: var(--coral);
}

.game-card.herbivore {
  --card-color: var(--mint);
}

.game-card.scavenger {
  --card-color: var(--purple);
}

.game-card.x {
  --card-color: var(--amber);
}

.game-card.sunny {
  --card-color: var(--amber);
}

.game-card.storm {
  --card-color: var(--sky);
}

.game-card.drought {
  --card-color: #df9c69;
}

.card-symbol {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  margin-bottom: 15px;
  color: #10231a;
  border-radius: 12px;
  background: var(--card-color);
  font-size: 18px;
}

.game-card strong,
.game-card small {
  display: block;
}

.game-card strong {
  font-size: 13px;
}

.game-card small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.4;
}

.card-select-mark {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  color: #10231a;
  border-radius: 50%;
  background: var(--card-color);
  font-size: 12px;
  opacity: 0;
  transform: scale(0.5);
  transition: 150ms ease;
}

.game-card.selected .card-select-mark {
  opacity: 1;
  transform: scale(1);
}

.mode-row,
.weather-target-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.mode-button,
.target-select {
  min-height: 34px;
  width: 100%;
  padding: 6px 8px;
  color: var(--muted-strong);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 9px;
}

.mode-button.active {
  color: #10231a;
  border-color: transparent;
  background: var(--card-color);
}

.target-select {
  grid-column: 1 / -1;
  color: var(--ink);
}

.selection-dock {
  position: sticky;
  z-index: 4;
  bottom: 12px;
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  margin-top: 24px;
  padding: 14px;
  border: 1px solid rgba(215, 239, 126, 0.2);
  border-radius: 17px;
  background: rgba(7, 29, 22, 0.94);
  box-shadow: 0 14px 46px rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(16px);
}

.dock-copy strong,
.dock-copy small {
  display: block;
}

.dock-copy strong {
  color: var(--lime);
  font-size: 13px;
}

.dock-copy small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.result-view,
.final-view {
  max-width: 1020px;
  margin-inline: auto;
}

.result-summary,
.final-card {
  padding: clamp(24px, 5vw, 46px);
  border-radius: var(--radius-lg);
}

.result-hero,
.final-hero {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  justify-content: space-between;
  padding-bottom: 25px;
  border-bottom: 1px solid var(--line);
}

.result-hero p,
.final-hero p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.round-gain {
  min-width: 112px;
  padding: 14px;
  border: 1px solid rgba(215, 239, 126, 0.18);
  border-radius: 17px;
  background: rgba(215, 239, 126, 0.06);
  text-align: center;
}

.round-gain small,
.round-gain strong {
  display: block;
}

.round-gain small {
  color: var(--muted);
  font-size: 10px;
}

.round-gain strong {
  margin-top: 2px;
  color: var(--lime);
  font-size: 30px;
}

.habitat-result-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 11px;
  margin-top: 22px;
}

.habitat-result {
  padding: 17px;
  border: 1px solid var(--line);
  border-top-color: color-mix(in srgb, var(--habitat-color) 70%, transparent);
  border-radius: 17px;
  background: rgba(0, 0, 0, 0.12);
}

.habitat-result h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 14px;
  font-size: 15px;
}

.habitat-result h3 span {
  color: var(--habitat-color);
}

.result-facts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px;
}

.result-fact {
  padding: 9px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
}

.result-fact small,
.result-fact b {
  display: block;
}

.result-fact small {
  color: var(--muted);
  font-size: 9px;
}

.result-fact b {
  margin-top: 3px;
  font-size: 13px;
}

.result-fact .alive {
  color: var(--mint);
}

.result-fact .dead {
  color: var(--coral);
}

.weather-line,
.event-line {
  margin-top: 9px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.event-line b {
  color: var(--habitat-color);
}

.round-ranking {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.55fr);
  gap: 18px;
  margin-top: 24px;
}

.round-ranking h3 {
  margin: 0 0 12px;
  font-size: 13px;
}

.score-breakdown {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(0, 0, 0, 0.12);
}

.breakdown-list {
  display: grid;
  gap: 8px;
  margin: 0;
}

.breakdown-list div {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
}

.breakdown-list dt,
.breakdown-list dd {
  margin: 0;
}

.breakdown-list dd {
  color: var(--ink);
  font-weight: 800;
}

.final-card {
  max-width: 780px;
  margin: 20px auto 0;
}

.final-hero {
  align-items: center;
}

.winner-emblem {
  display: grid;
  flex: 0 0 104px;
  width: 104px;
  height: 104px;
  place-items: center;
  border: 1px solid rgba(215, 239, 126, 0.24);
  border-radius: 36px 36px 50% 36px;
  background: linear-gradient(145deg, rgba(215, 239, 126, 0.18), rgba(165, 227, 163, 0.04));
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
  font-size: 52px;
  transform: rotate(-3deg);
}

.final-ranking {
  margin-top: 26px;
}

.ranking-row {
  grid-template-columns: 34px 42px minmax(0, 1fr) auto;
  padding: 13px 15px;
}

.ranking-row:first-child {
  border-color: rgba(255, 201, 107, 0.28);
  background: rgba(255, 201, 107, 0.07);
}

.rank-number {
  color: var(--muted);
  font-family: Georgia, serif;
  font-size: 17px;
  font-weight: 800;
  text-align: center;
}

.ranking-score {
  text-align: right;
}

.ranking-score strong,
.ranking-score small {
  display: block;
}

.ranking-score strong {
  color: var(--lime);
  font-size: 20px;
}

.ranking-score small {
  color: var(--muted);
  font-size: 9px;
}

.final-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 26px;
}

.rules-dialog {
  width: min(780px, calc(100% - 26px));
  max-height: min(860px, calc(100vh - 32px));
  padding: 0;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 25px;
  background: #0c281f;
  box-shadow: 0 35px 110px rgba(0, 0, 0, 0.58);
}

.rules-dialog::backdrop {
  background: rgba(1, 9, 7, 0.76);
  backdrop-filter: blur(8px);
}

.dialog-card {
  max-height: inherit;
  padding: clamp(20px, 4vw, 35px);
  overflow-y: auto;
}

.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.dialog-heading h2 {
  margin: 0;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: clamp(28px, 5vw, 40px);
}

.icon-button {
  display: grid;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 24px;
}

.rule-flow {
  display: flex;
  gap: 9px;
  align-items: center;
  justify-content: center;
  margin: 24px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted-strong);
  font-size: 12px;
}

.rule-flow span {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.rule-flow b {
  display: grid;
  width: 23px;
  height: 23px;
  place-items: center;
  color: #10241b;
  border-radius: 50%;
  background: var(--lime);
}

.rule-flow i {
  color: #537264;
}

.rules-content {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 11px;
  margin-bottom: 22px;
}

.rules-content section {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(0, 0, 0, 0.1);
}

.rules-content h3 {
  margin: 0 0 8px;
  color: var(--lime);
  font-size: 13px;
}

.rules-content p,
.rules-content ul {
  margin: 0;
  color: var(--muted-strong);
  font-size: 12px;
  line-height: 1.75;
}

.rules-content ul {
  padding-left: 18px;
}

.rules-content .assumption-note {
  grid-column: 1 / -1;
  border-color: rgba(255, 201, 107, 0.18);
  background: rgba(255, 201, 107, 0.05);
}

.rules-content .assumption-note h3 {
  color: var(--amber);
}

.toast {
  position: fixed;
  z-index: 90;
  right: 20px;
  bottom: 20px;
  max-width: min(360px, calc(100% - 40px));
  padding: 12px 15px;
  color: #10251b;
  border-radius: 13px;
  background: var(--lime);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.34);
  font-size: 12px;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px);
  transition: 200ms ease;
}

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

.empty-state {
  padding: 28px;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 16px;
  text-align: center;
}

@keyframes drift {
  from { transform: rotate(0deg) translate3d(0, 0, 0); }
  to { transform: rotate(14deg) translate3d(22px, 30px, 0); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes appear {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

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

  .hero-grid {
    gap: 16px;
    min-height: auto;
  }

  .hero-copy {
    padding-bottom: 10px;
  }

  .setup-panel {
    max-width: 620px;
  }

  .score-panel {
    position: static;
  }

  .score-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .score-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .score-value {
    grid-column: 1 / -1;
    padding-left: 44px;
  }
}

@media (max-width: 680px) {
  .site-header,
  .site-footer,
  .app-shell {
    width: min(100% - 24px, 1180px);
  }

  .site-header {
    min-height: 72px;
  }

  .brand small {
    display: none;
  }

  .brand strong {
    font-size: 18px;
  }

  .round-chip {
    display: none !important;
  }

  .app-shell {
    padding-top: 8px;
  }

  .hero-copy h1 {
    font-size: clamp(52px, 20vw, 78px);
  }

  .hero-lede {
    margin-top: 20px;
  }

  .season-row {
    margin-top: 20px;
  }

  .setup-panel {
    padding: 22px;
    border-radius: 23px;
  }

  .habitat-preview,
  .habitat-grid,
  .habitat-result-grid {
    grid-template-columns: 1fr;
  }

  .habitat-mini {
    min-height: 122px;
  }

  .habitat-mini .mini-icon {
    margin-bottom: 13px;
  }

  .progress-card {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 16px;
  }

  .stage-card {
    padding: 19px;
    border-radius: 23px;
  }

  .stage-heading {
    display: block;
  }

  .habitat-card {
    min-height: 194px;
  }

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

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

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

  .selection-dock {
    align-items: stretch;
    flex-direction: column;
  }

  .selection-dock .primary-button {
    width: 100%;
  }

  .result-hero,
  .final-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .round-gain {
    width: 100%;
  }

  .winner-emblem {
    width: 84px;
    height: 84px;
    font-size: 42px;
  }

  .rules-content {
    grid-template-columns: 1fr;
  }

  .rules-content .assumption-note {
    grid-column: auto;
  }

  .rule-flow {
    align-items: stretch;
    flex-direction: column;
  }

  .rule-flow i {
    display: none;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }
}

@media (max-width: 400px) {
  .header-actions .ghost-button span {
    display: none;
  }

  .difficulty-options {
    grid-template-columns: 1fr;
  }

  .difficulty-option span {
    min-height: 46px;
  }

  .card-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .game-card {
    padding: 12px;
  }

  .ranking-row {
    grid-template-columns: 28px 38px minmax(0, 1fr);
  }

  .ranking-score {
    grid-column: 2 / -1;
    text-align: left;
  }
}

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