/* Hamster House — cozy full-bleed companion */

:root {
  --bg: #e8d4b4;
  --ink: #3a2418;
  --ink-dim: #6a4830;
  --accent: #d48830;
  --panel: rgba(255, 248, 236, 0.82);
  --panel-border: rgba(90, 55, 25, 0.18);
  --glow: rgba(255, 180, 80, 0.3);
  --font-ui: "Outfit", system-ui, sans-serif;
  --font-pixel: "Press Start 2P", monospace;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
}

body {
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

#habitat {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  display: block;
  background: #e8d4b4;
}

#vignette {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse 85% 80% at 50% 48%,
    transparent 55%,
    rgba(120, 70, 30, 0.14) 100%
  );
  z-index: 2;
}

#grain {
  pointer-events: none;
  position: absolute;
  inset: 0;
  opacity: 0.025;
  z-index: 3;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

/* —— Chrome —— */
.chrome {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: calc(1rem + var(--safe-top)) 1.25rem 0;
  pointer-events: none;
}

.chrome > * {
  pointer-events: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--panel);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 0.65rem 1rem 0.65rem 0.75rem;
  box-shadow: 0 8px 28px rgba(120, 80, 40, 0.12);
}

.brand-mark {
  font-size: 1.5rem;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

.brand-text h1 {
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  letter-spacing: 0.04em;
  color: var(--ink);
  font-weight: 400;
  line-height: 1.4;
}

.tagline {
  font-size: 0.7rem;
  color: var(--ink-dim);
  font-weight: 300;
  letter-spacing: 0.02em;
  margin-top: 0.15rem;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: flex-end;
}

.ctrl {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--ink);
  background: var(--panel);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  padding: 0.55rem 0.9rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  box-shadow: 0 4px 14px rgba(120, 80, 40, 0.1);
}

.ctrl:hover {
  background: rgba(255, 252, 246, 0.9);
  border-color: rgba(120, 80, 40, 0.2);
}

.ctrl:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ctrl:active {
  transform: scale(0.96);
}

.ctrl .label {
  color: var(--ink-dim);
}

.ctrl[aria-pressed="true"] {
  border-color: rgba(220, 150, 60, 0.55);
  box-shadow: 0 0 0 1px rgba(232, 180, 80, 0.25), 0 4px 14px rgba(120, 80, 40, 0.1);
}

.ctrl[aria-pressed="false"] .icon-on,
.ctrl[aria-pressed="true"] .icon-muted {
  display: none;
}

.ctrl[aria-pressed="true"] .icon-on,
.ctrl[aria-pressed="false"] .icon-muted {
  display: inline;
}

/* —— Status —— */
.status {
  position: absolute;
  bottom: calc(3.5rem + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  max-width: min(90vw, 28rem);
  text-align: center;
  pointer-events: none;
}

#status-text {
  display: inline-block;
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  line-height: 1.6;
  letter-spacing: 0.06em;
  color: var(--ink);
  background: var(--panel);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 0.7rem 1.1rem;
  box-shadow: 0 8px 24px rgba(120, 80, 40, 0.12);
  opacity: 0;
  transition: opacity 0.6s ease;
}

#status-text.visible {
  opacity: 1;
}

.hint {
  position: absolute;
  bottom: calc(1.25rem + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  font-size: 0.72rem;
  color: var(--ink-dim);
  letter-spacing: 0.04em;
  opacity: 0.7;
  white-space: nowrap;
  pointer-events: none;
  transition: opacity 1s ease;
}

.hint.hidden {
  opacity: 0;
}

.footer {
  position: absolute;
  bottom: calc(1.1rem + var(--safe-bottom));
  right: 1.25rem;
  z-index: 10;
  font-size: 0.68rem;
  color: var(--ink-dim);
  opacity: 0.55;
  letter-spacing: 0.04em;
  pointer-events: none;
}

.footer .sep {
  margin: 0 0.35rem;
  opacity: 0.5;
}

/* —— Boot screen —— */
.boot {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse 60% 50% at 50% 40%, rgba(255, 200, 140, 0.45), transparent 70%),
    #f5e8d4;
  transition: opacity 0.7s ease, visibility 0.7s;
}

.boot.gone {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.boot-card {
  text-align: center;
  padding: 2rem 1.5rem;
  max-width: 22rem;
  animation: rise 0.8s ease both;
}

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

.boot-hamster {
  font-size: 3.5rem;
  line-height: 1;
  margin-bottom: 1rem;
  animation: bob 2.4s ease-in-out infinite;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.4));
}

@keyframes bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

.boot-card h2 {
  font-family: var(--font-pixel);
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  margin-bottom: 1rem;
  color: var(--ink);
}

.boot-card p {
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--ink-dim);
  font-weight: 300;
  margin-bottom: 1.75rem;
}

.enter {
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  letter-spacing: 0.08em;
  color: #1a1420;
  background: linear-gradient(180deg, #f0c98a 0%, #d4a05a 100%);
  border: none;
  border-radius: 999px;
  padding: 1rem 1.6rem;
  cursor: pointer;
  box-shadow:
    0 0 0 1px rgba(255, 220, 160, 0.3),
    0 8px 24px rgba(200, 140, 60, 0.35);
  transition: transform 0.15s, box-shadow 0.2s;
}

.enter:hover {
  transform: translateY(-1px);
  box-shadow:
    0 0 0 1px rgba(255, 220, 160, 0.45),
    0 12px 32px rgba(200, 140, 60, 0.45);
}

.enter:active {
  transform: translateY(1px);
}

.boot-note {
  margin-top: 1.25rem !important;
  margin-bottom: 0 !important;
  font-size: 0.72rem !important;
  opacity: 0.65;
}

/* —— Responsive —— */
@media (max-width: 640px) {
  .brand-text h1 {
    font-size: 0.45rem;
  }

  .tagline {
    display: none;
  }

  .ctrl .label {
    display: none;
  }

  .ctrl {
    padding: 0.6rem 0.75rem;
  }

  .hint {
    font-size: 0.65rem;
    white-space: normal;
    text-align: center;
    max-width: 80vw;
    bottom: calc(2.75rem + var(--safe-bottom));
  }

  .footer {
    left: 1rem;
    right: auto;
    font-size: 0.62rem;
  }

  #status-text {
    font-size: 0.42rem;
  }

  .status {
    bottom: calc(4.25rem + var(--safe-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  .boot-hamster {
    animation: none;
  }

  #status-text {
    transition: none;
  }
}
