:root {
  --shell: #d6d6d6;
  --shell-dark: #8b8b8b;
  --shell-light: #f2f2f2;
  --shell-mid: #b2b2b2;
  --screen: #d5dbc8;
  --screen-dark: #7c8573;
  --screen-edge: #9ca38f;
  --ink: #0c0c0c;
  --ink-soft: rgba(12, 12, 12, 0.1);
  --egg: #1d1d1d;
  --lane: #c92a1b;
  --grass: #4e8c22;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: "Courier New", monospace;
  background: linear-gradient(180deg, #dcdcdc, #bfbfbf);
  color: var(--ink);
  display: grid;
  place-items: center;
  padding: 18px;
}

.lcd-console {
  width: min(100%, 1180px);
}

.device-notice {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(190, 190, 190, 0.95);
}

.rotate-notice__card {
  width: min(92vw, 320px);
  border: 3px solid #000;
  background: var(--screen);
  padding: 18px 20px;
  text-align: center;
  text-transform: uppercase;
}

.rotate-notice__title {
  margin: 0 0 8px;
  font-size: 1.2rem;
}

.console-rim {
  background:
    linear-gradient(145deg, var(--shell-light), var(--shell-mid) 35%, var(--shell-light) 100%);
  border: 6px solid #000;
  border-radius: 30px;
  padding: 14px;
  box-shadow: inset 0 0 0 2px #fafafa;
}

.console-rim__inner {
  border: 5px solid #000;
  border-radius: 24px;
  padding: 10px;
  background: linear-gradient(145deg, #f4f4f4, #c6c6c6);
}

.lcd-screen {
  position: relative;
  background: var(--screen);
  border: 4px solid #4d4d4d;
  border-radius: 4px;
  padding: 14px 14px 12px;
  box-shadow:
    inset 0 0 0 2px #969696,
    inset 0 0 24px rgba(0, 0, 0, 0.16);
}

[hidden] {
  display: none !important;
}

.topbar,
.footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  justify-self: end;
}

.action-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand {
  font-size: 0.74rem;
  letter-spacing: 0.18em;
  justify-self: start;
}

.display-row {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  justify-self: center;
}

.score-panel {
  position: relative;
  min-width: 160px;
  text-align: center;
  border: 2px solid rgba(0, 0, 0, 0.2);
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.1);
  font-family: "Courier New", monospace;
  font-size: 3.3rem;
  font-weight: 700;
  line-height: 1;
}

.score-panel--timer {
  min-width: 160px;
  font-size: 3.3rem;
}

.score-panel__ghost {
  opacity: 0.08;
}

.score-panel strong {
  position: absolute;
  inset: 4px 10px;
  color: #000;
  text-align: center;
}

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  font-size: 0.72rem;
}

.in-game-lives {
  position: absolute;
  top: 14px;
  right: 16px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  background: rgba(235, 239, 215, 0.68);
  border: 1px solid rgba(0, 0, 0, 0.18);
  font-size: 0.72rem;
}

.status__label {
  opacity: 0.65;
}

.status strong {
  font-size: 0.95rem;
}

.life-icons {
  display: inline-flex;
  gap: 6px;
}

.life-icon {
  width: 12px;
  height: 16px;
  border: 1px solid #8c7644;
  border-radius: 48% 48% 44% 44%;
  background:
    radial-gradient(circle at 38% 30%, rgba(255, 255, 255, 0.82) 0 18%, transparent 19%),
    linear-gradient(180deg, #f8ead0 0%, #edd091 70%, #d8b868 100%);
  box-shadow:
    inset -1px -1px 0 rgba(111, 93, 52, 0.14),
    0 1px 0 rgba(255, 255, 255, 0.26);
}

.life-icon.is-off {
  filter: grayscale(1);
  opacity: 0.35;
  background:
    radial-gradient(circle at 38% 30%, rgba(255, 255, 255, 0.45) 0 18%, transparent 19%),
    linear-gradient(180deg, #d9d9d9 0%, #bbbbbb 70%, #979797 100%);
  border-color: #7a7a7a;
}

.playfield {
  position: relative;
  margin: 12px 0;
  width: 100%;
  max-width: 1040px;
  aspect-ratio: 2 / 1;
  min-height: 300px;
  margin-left: auto;
  margin-right: auto;
  border: 3px solid var(--screen-edge);
  background:
    radial-gradient(circle at 50% 22%, rgba(255, 255, 255, 0.18), transparent 25%),
    linear-gradient(180deg, #d8decb, #cfd6c0);
  overflow: hidden;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.12);
}

.playfield::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      0deg,
      transparent 0,
      transparent 14px,
      rgba(47, 52, 41, 0.018) 14px,
      rgba(47, 52, 41, 0.018) 15px
    );
  pointer-events: none;
}

.playfield__pattern {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 22% 30%, rgba(47, 52, 41, 0.05) 0 22px, transparent 23px),
    radial-gradient(circle at 76% 62%, rgba(47, 52, 41, 0.04) 0 18px, transparent 19px),
    radial-gradient(circle at 34% 70%, rgba(47, 52, 41, 0.04) 0 14px, transparent 15px),
    radial-gradient(circle at 86% 26%, rgba(47, 52, 41, 0.04) 0 12px, transparent 13px);
  opacity: 0.35;
  pointer-events: none;
}

.labels {
  position: absolute;
  inset: 0;
  font-size: 0.68rem;
  opacity: 0.4;
}

.label {
  position: absolute;
}

.label--left-top {
  top: 26px;
  left: 66px;
}

.label--left-bottom {
  bottom: 28px;
  left: 66px;
}

.label--right-top {
  top: 26px;
  right: 66px;
}

.label--right-bottom {
  bottom: 28px;
  right: 66px;
}

.nest {
  display: none;
}

.hen {
  position: absolute;
  width: clamp(68px, 8.2vw, 92px);
  height: clamp(68px, 8.2vw, 92px);
  z-index: 2;
  cursor: pointer;
  touch-action: manipulation;
}

.hen__image {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.hen--top-left {
  top: 42px;
  left: 8px;
}

.hen--bottom-left {
  bottom: 192px;
  left: 8px;
}

.hen--top-right {
  top: 42px;
  right: 8px;
  transform: scaleX(-1);
}

.hen--bottom-right {
  bottom: 192px;
  right: 8px;
  transform: scaleX(-1);
}

.lane {
  position: absolute;
  height: clamp(14px, 1.9vw, 20px);
  background:
    linear-gradient(180deg, #ef3b28 0 58%, #a61e12 58% 100%);
  border-radius: 3px;
  transform-origin: center;
  opacity: 1;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.14);
}

.lane::before {
  content: "";
  position: absolute;
  right: 10px;
  top: 4px;
  width: clamp(12px, 1.5vw, 16px);
  height: clamp(32px, 4.8vw, 50px);
  background: linear-gradient(180deg, #d73020, #93180e);
  border-radius: 2px;
}

.lane::after {
  content: "";
  position: absolute;
  left: -6px;
  top: 2px;
  width: clamp(18px, 2.4vw, 24px);
  height: clamp(12px, 1.9vw, 16px);
  background: linear-gradient(180deg, #ef3b28, #a61e12);
  border-radius: 10px 3px 3px 10px;
}

.lane--top-left {
  top: 156px;
  left: 44px;
  width: 34%;
  transform: rotate(13deg);
}

.lane--bottom-left {
  bottom: 156px;
  left: 44px;
  width: 34%;
  transform: rotate(13deg);
}

.lane--top-right {
  top: 156px;
  right: 44px;
  width: 34%;
  transform: rotate(-13deg);
}

.lane--bottom-right {
  bottom: 156px;
  right: 44px;
  width: 34%;
  transform: rotate(-13deg);
}

.lane--bottom-left::after,
.lane--bottom-right::after {
  top: -4px;
  height: 20px;
}

.lane--top-right::before,
.lane--bottom-right::before {
  right: auto;
  left: 10px;
}

.lane--top-right::after,
.lane--bottom-right::after {
  left: auto;
  right: -6px;
  border-radius: 3px 10px 10px 3px;
}

.grass {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: clamp(42px, 6.2vw, 62px);
  z-index: 1;
  background: url("trawa.png") repeat-x left bottom / auto 100%;
  opacity: 0.98;
}

.grass::before {
  content: none;
}

.egg-layer {
  position: absolute;
  inset: 0;
}

.egg {
  position: absolute;
  width: 20px;
  height: 26px;
  border: 1px solid #8c7644;
  border-radius: 48% 48% 44% 44%;
  background:
    radial-gradient(circle at 38% 30%, rgba(255, 255, 255, 0.82) 0 18%, transparent 19%),
    linear-gradient(180deg, #f8ead0 0%, #edd091 70%, #d8b868 100%);
  box-shadow:
    inset -1px -2px 0 rgba(111, 93, 52, 0.14),
    0 1px 0 rgba(255, 255, 255, 0.26);
  transform: translate(-50%, -50%) rotate(var(--egg-tilt, 0deg));
}

.egg--broken {
  width: 34px;
  height: 20px;
  border: none;
  background: transparent;
  transform: translate(-50%, -50%) rotate(0deg);
}

.egg--broken::before,
.egg--broken::after {
  content: "";
  position: absolute;
  top: 2px;
  width: 14px;
  height: 12px;
  border: 4px solid var(--egg);
  background: rgba(255, 255, 255, 0.08);
}

.egg--broken::before {
  left: 0;
  border-radius: 10px 8px 8px 12px;
  clip-path: polygon(0 100%, 0 32%, 22% 48%, 40% 28%, 58% 50%, 76% 26%, 100% 42%, 100% 100%);
  transform: rotate(-12deg);
}

.egg--broken::after {
  right: 0;
  border-radius: 8px 10px 12px 8px;
  clip-path: polygon(0 42%, 22% 24%, 40% 48%, 58% 26%, 76% 52%, 100% 34%, 100% 100%, 0 100%);
  transform: rotate(12deg);
}

.egg--broken > span {
  position: absolute;
  left: 50%;
  top: 10px;
  width: 12px;
  height: 12px;
  transform: translateX(-50%);
  border: 3px solid var(--egg);
  border-radius: 50%;
  background: #f2cf4a;
}

.mobile-lane-btn,
.action-btn,
.restart-btn {
  appearance: none;
  border: 2px solid #000;
  background: rgba(240, 240, 240, 0.88);
  color: #000;
  font: inherit;
  text-transform: uppercase;
  cursor: pointer;
}

.action-btn {
  padding: 8px 12px;
  font-size: 0.76rem;
  white-space: nowrap;
  border-radius: 4px;
  line-height: 1;
}

.mobile-lane-btn {
  position: absolute;
  z-index: 3;
  width: 36px;
  height: 28px;
  border-radius: 4px;
  font-size: 0.72rem;
  display: none !important;
}

.mobile-lane-btn--top-left {
  top: 84px;
  left: 84px;
}

.mobile-lane-btn--bottom-left {
  bottom: 84px;
  left: 84px;
}

.mobile-lane-btn--top-right {
  top: 84px;
  right: 84px;
}

.mobile-lane-btn--bottom-right {
  bottom: 84px;
  right: 84px;
}

@media (min-width: 681px) {
  .mobile-lane-btn {
    display: none !important;
  }
}

@media (hover: hover) and (pointer: fine) {
  .hen:hover {
    filter: brightness(1.03);
  }
}

.wolf {
  position: absolute;
  left: 50%;
  top: 58%;
  width: clamp(180px, 31vw, 270px);
  height: clamp(186px, 33vw, 280px);
  transform: translate(-50%, -50%);
  z-index: 2;
}

.wolf__image {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: clamp(106px, 18vw, 150px);
  height: auto;
  opacity: 0.92;
  filter: contrast(1.1);
  transform-origin: 50% 70%;
  transition: transform 120ms ease;
  translate: -50% 0;
}

.wolf__basket {
  position: absolute;
  width: clamp(58px, 10vw, 88px);
  height: auto;
  opacity: 0;
  transition: opacity 120ms ease;
}

.wolf__basket--top-left {
  top: 48px;
  left: 18px;
  transform: rotate(-24deg);
}

.wolf__basket--bottom-left {
  top: 222px;
  left: 12px;
  transform: rotate(30deg);
}

.wolf__basket--top-right {
  top: 44px;
  right: 8px;
  transform: rotate(24deg);
}

.wolf__basket--bottom-right {
  top: 222px;
  right: 10px;
  transform: rotate(-30deg);
}

.wolf[data-side="left"] .wolf__image {
  transform: scaleX(1);
}

.wolf[data-side="right"] .wolf__image {
  transform: scaleX(-1);
}

.wolf[data-position="top-left"] .wolf__basket--top-left,
.wolf[data-position="bottom-left"] .wolf__basket--bottom-left,
.wolf[data-position="top-right"] .wolf__basket--top-right,
.wolf[data-position="bottom-right"] .wolf__basket--bottom-right {
  opacity: 1;
}

.controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
  max-width: 230px;
  margin-left: auto;
  margin-right: auto;
}

.control-btn,
.restart-btn {
  appearance: none;
  border: 2px solid #666;
  border-radius: 4px;
  background: linear-gradient(180deg, #dfdfdf, #bfbfbf);
  color: var(--ink);
  font: inherit;
  text-transform: uppercase;
  padding: 8px 6px;
  cursor: pointer;
  touch-action: manipulation;
  font-size: 0.74rem;
}

.footer-bar {
  margin-top: 10px;
  font-size: 0.7rem;
  gap: 12px;
  flex-wrap: wrap;
}

.footer-bar p {
  margin: 0;
}

.speed-readout {
  opacity: 0.7;
}

.visit-readout {
  opacity: 0.7;
}

.visit-readout strong {
  font-size: 0.82rem;
}

.speed-readout strong {
  font-size: 0.82rem;
}

.credits a {
  color: inherit;
}

.start-overlay,
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(213, 219, 200, 0.94);
  display: grid;
  place-items: center;
  z-index: 4;
}

.start-overlay__card,
.overlay__card {
  width: min(88%, 360px);
  border: 3px solid #000;
  padding: 16px 20px;
  text-align: center;
  text-transform: uppercase;
  background: rgba(213, 219, 200, 0.98);
}

.start-overlay__title {
  margin: 0 0 10px;
  font-size: 1.25rem;
  letter-spacing: 0.08em;
}

.start-overlay__card p,
.overlay__card p {
  margin: 6px 0;
}

.overlay__actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.overlay__status {
  margin-top: 10px;
  font-size: 0.72rem;
  opacity: 0.72;
}

.share-panel {
  margin-top: 12px;
  text-align: left;
}

.share-panel__label {
  margin: 0 0 6px;
  font-size: 0.74rem;
}

.share-panel__message {
  width: 100%;
  min-height: 90px;
  resize: none;
  border: 2px solid rgba(0, 0, 0, 0.28);
  background: rgba(255, 255, 255, 0.32);
  color: #000;
  font: inherit;
  padding: 10px;
}

.start-btn {
  appearance: none;
  margin-top: 10px;
  padding: 10px 24px;
  border: 2px solid #000;
  background: linear-gradient(180deg, #efefef, #c8c8c8);
  color: #000;
  font: inherit;
  text-transform: uppercase;
  cursor: pointer;
}

@media (max-width: 680px) {
  body {
    padding: 8px;
  }

  .lcd-console {
    width: 100%;
  }

  .topbar,
  .footer-bar {
    flex-wrap: wrap;
  }

  .brand {
    width: 100%;
    text-align: center;
  }

  .topbar {
    display: flex;
    justify-content: center;
  }

  .display-row {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }

  .topbar__actions {
    width: 100%;
    justify-content: center;
  }

  .action-bar {
    flex-wrap: wrap;
    justify-content: center;
  }

  .score-panel {
    min-width: 130px;
    font-size: 2.6rem;
  }

  .score-panel--timer {
    min-width: 130px;
    font-size: 2.6rem;
  }

  .playfield {
    aspect-ratio: 2 / 1;
    min-height: 0;
  }

  .wolf {
    width: 180px;
    height: 190px;
  }

  .wolf__image {
    width: 112px;
  }

  .lane--top-left,
  .lane--bottom-left,
  .lane--top-right,
  .lane--bottom-right {
    width: 36%;
  }

  .mobile-lane-btn {
    display: block !important;
  }

  .mobile-lane-btn--top-left {
    top: 8px;
    left: 8px;
  }

  .mobile-lane-btn--bottom-left {
    bottom: 8px;
    left: 8px;
  }

  .mobile-lane-btn--top-right {
    top: 8px;
    right: 8px;
  }

  .mobile-lane-btn--bottom-right {
    bottom: 8px;
    right: 8px;
  }

  .in-game-lives {
    top: 8px;
    right: 8px;
    gap: 5px;
    padding: 3px 6px;
    font-size: 0.62rem;
  }

  .labels {
    font-size: 0.55rem;
  }

  .controls {
    display: none;
  }
}

@media (max-width: 900px) {
  .device-notice {
    display: grid;
  }

  .lcd-console {
    display: none;
    pointer-events: none;
  }
}
