:root {
  color-scheme: dark;
  --bg: #11100d;
  --panel: #1e1a15;
  --panel-2: #292217;
  --text: #fff4dd;
  --muted: #c9b891;
  --gold: #ffbc42;
  --amber: #e97824;
  --pink: #ff6b8b;
  --shadow: rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 16% 8%, rgba(255, 188, 66, .18), transparent 28rem),
    radial-gradient(circle at 90% 18%, rgba(255, 107, 139, .14), transparent 25rem),
    linear-gradient(135deg, #11100d 0%, #1b1712 52%, #090807 100%);
  color: var(--text);
}

button { font: inherit; }

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 42px 0;
}

.hero, .stage, .memory {
  border: 1px solid rgba(255, 244, 221, .12);
  background: linear-gradient(145deg, rgba(30, 26, 21, .92), rgba(22, 19, 15, .84));
  border-radius: 32px;
  box-shadow: 0 24px 80px var(--shadow);
}

.hero {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 24px;
  align-items: end;
  padding: clamp(28px, 6vw, 68px);
}

.eyebrow, .label {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}

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

h1 {
  max-width: 760px;
  margin-bottom: 18px;
  font-size: clamp(3rem, 9vw, 7.8rem);
  line-height: .82;
  letter-spacing: -.075em;
}

.intro {
  max-width: 650px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(1.04rem, 2vw, 1.28rem);
  line-height: 1.6;
}

.bond-card {
  padding: 24px;
  border-radius: 24px;
  background: rgba(255, 255, 255, .065);
}

.bond-card span, .mood span {
  display: block;
  color: var(--muted);
  font-size: .9rem;
}

.bond-card strong {
  display: block;
  margin: 8px 0 14px;
  font-size: 3rem;
}

.bond-card p { margin-bottom: 0; color: var(--muted); }

.meter {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, .11);
}

.meter i {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--amber), var(--gold), var(--pink));
  transition: width .45s ease;
}

.garage {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 18px 0;
}

.excavator-card {
  min-height: 160px;
  padding: 22px;
  border: 1px solid rgba(255, 244, 221, .12);
  border-radius: 24px;
  background: rgba(255, 255, 255, .055);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: transform .2s ease, border-color .2s ease, background .2s ease;
}

.excavator-card:hover, .excavator-card.active {
  transform: translateY(-4px);
  border-color: rgba(255, 188, 66, .65);
  background: rgba(255, 188, 66, .11);
}

.badge {
  display: inline-block;
  margin-bottom: 28px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 188, 66, .15);
  color: var(--gold);
  font-size: .78rem;
  font-weight: 800;
}

.excavator-card strong { display: block; font-size: 1.5rem; }
.excavator-card small { display: block; margin-top: 8px; color: var(--muted); line-height: 1.45; }

.stage {
  display: grid;
  grid-template-columns: minmax(320px, 1.05fr) minmax(320px, .95fr);
  gap: 34px;
  align-items: center;
  padding: clamp(24px, 5vw, 52px);
}

.machine-wrap {
  position: relative;
  min-height: 420px;
  display: grid;
  place-items: center;
}

.ground {
  position: absolute;
  left: 4%;
  right: 4%;
  bottom: 64px;
  height: 20px;
  border-radius: 999px;
  background: linear-gradient(90deg, #5a3d20, #d08a33, #5a3d20);
  filter: blur(.3px);
}

.machine {
  position: relative;
  width: min(500px, 86vw);
  height: 300px;
  transform-origin: 50% 80%;
  animation: idle 4s ease-in-out infinite;
  z-index: 1;
}

.body, .cab, .tracks, .boom, .arm, .bucket { position: absolute; }
.body { left: 130px; top: 142px; width: 190px; height: 82px; border-radius: 24px 36px 18px 18px; background: linear-gradient(135deg, var(--gold), var(--amber)); }
.cab { left: 180px; top: 82px; width: 96px; height: 82px; border-radius: 26px 26px 12px 12px; background: linear-gradient(135deg, #ffd985, #f28f2d); }
.cab span { position: absolute; inset: 16px 18px 26px; border-radius: 16px 16px 8px 8px; background: linear-gradient(135deg, #1b4152, #79d8ff); }
.tracks { left: 96px; top: 218px; width: 260px; height: 54px; border-radius: 999px; background: repeating-linear-gradient(90deg, #201b15 0 22px, #3a3023 22px 34px); border: 8px solid #12100d; }
.boom { left: 254px; top: 74px; width: 205px; height: 24px; border-radius: 999px; background: var(--gold); transform: rotate(24deg); transform-origin: 0 50%; }
.arm { left: 420px; top: 145px; width: 112px; height: 22px; border-radius: 999px; background: var(--amber); transform: rotate(72deg); transform-origin: 0 50%; }
.bucket { left: 458px; top: 244px; width: 64px; height: 50px; border-radius: 8px 8px 30px 30px; background: #6d5640; transform: rotate(-12deg); }
.heart { position: absolute; left: 214px; top: 116px; color: #941f35; font-size: 24px; text-shadow: 0 0 14px rgba(255, 107, 139, .9); opacity: .9; }

.machine.happy .heart { animation: pulse .7s ease-in-out 3; }
.machine.digging .boom { animation: boomDig .9s ease-in-out 2; }
.machine.digging .arm { animation: armDig .9s ease-in-out 2; }
.machine.digging .bucket { animation: bucketDig .9s ease-in-out 2; }

.machine.brummbert { --gold: #f36d3d; --amber: #9f4a25; }
.machine.mira { --gold: #b77cff; --amber: #5e75ff; }

.profile h2 { margin-bottom: 14px; font-size: clamp(2.1rem, 4vw, 4.2rem); line-height: .95; }
.profile p, .message { color: var(--muted); font-size: 1.05rem; line-height: 1.65; }
.mood { display: flex; justify-content: space-between; gap: 18px; margin: 24px 0; padding: 16px 18px; border-radius: 18px; background: rgba(255, 255, 255, .07); }
.mood strong { color: var(--gold); text-align: right; }
.message { min-height: 104px; padding: 20px; border-left: 4px solid var(--gold); border-radius: 18px; background: rgba(0, 0, 0, .18); }

.talk-form { display: grid; gap: 10px; margin-top: 18px; }
.talk-form label { color: var(--gold); font-weight: 900; }
.talk-form textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid rgba(255, 244, 221, .14);
  border-radius: 18px;
  padding: 14px 16px;
  background: rgba(0, 0, 0, .22);
  color: var(--text);
  line-height: 1.45;
}
.talk-form textarea:focus { outline: 2px solid rgba(255, 188, 66, .7); }
.traits { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.traits span { padding: 12px; border-radius: 14px; background: rgba(255, 255, 255, .06); color: var(--muted); font-size: .9rem; }
.traits strong { display: block; margin-top: 4px; color: var(--text); font-size: 1.2rem; }
.actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 18px; }
.actions button, .talk-form button {
  min-height: 58px;
  border: 0;
  border-radius: 16px;
  background: var(--gold);
  color: #1a1208;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(0, 0, 0, .22);
}
.actions button:hover, .talk-form button:hover { filter: brightness(1.07); transform: translateY(-1px); }
button:disabled { cursor: wait; filter: grayscale(.4) brightness(.75); transform: none; }

.memory { margin-top: 18px; padding: 28px; }
.memory h2 { margin-bottom: 16px; }
.memory ul { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.memory li { padding: 14px 16px; border-radius: 16px; background: rgba(255, 255, 255, .065); color: var(--muted); }

@keyframes idle { 0%, 100% { transform: translateY(0) rotate(-.4deg); } 50% { transform: translateY(-8px) rotate(.5deg); } }
@keyframes pulse { 50% { transform: scale(1.45); color: #ff6b8b; } }
@keyframes boomDig { 50% { transform: rotate(12deg); } }
@keyframes armDig { 50% { transform: rotate(92deg); } }
@keyframes bucketDig { 50% { transform: rotate(18deg) translateY(12px); } }

@media (max-width: 820px) {
  .shell { width: min(100% - 20px, 680px); padding: 16px 0; }
  .hero, .stage { grid-template-columns: 1fr; border-radius: 24px; }
  .garage { grid-template-columns: 1fr; }
  .machine-wrap { min-height: 330px; overflow: hidden; }
  .machine { transform: scale(.74); }
  .traits { grid-template-columns: 1fr; }
  .actions { grid-template-columns: 1fr; }
}
