:root {
  color-scheme: light dark;
  --background: #151716;
  --surface: rgba(26, 27, 27, 0.92);
  --surface-strong: #202221;
  --text: #f4f5f0;
  --muted: #b8bab3;
  --border: rgba(255, 255, 255, 0.17);
  --accent: #45d483;
  --accent-strong: #31bd6e;
  --ink: #092316;
  --danger: #f87171;
  --focus: rgba(69, 212, 131, 0.3);
  --pet-x: 50vw;
  --pet-y: 50vh;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background: var(--background);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

.desktop {
  position: relative;
  min-height: 100svh;
  overflow: hidden;
  background:
    linear-gradient(rgba(255, 255, 255, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.055) 1px, transparent 1px),
    radial-gradient(circle at 64% 44%, rgba(69, 212, 131, 0.13), transparent 34%),
    linear-gradient(135deg, #121413 0%, #17201d 52%, #161512 100%);
  background-size: 28px 28px, 28px 28px, auto, auto;
}

.pet-widget {
  position: absolute;
  left: 0;
  top: 0;
  width: 288px;
  min-height: 520px;
  transform: translate3d(var(--pet-x), var(--pet-y), 0);
  will-change: transform;
}

.pet {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 0;
  width: 192px;
  height: 208px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  outline: 0;
  transform: translateX(-50%);
  touch-action: manipulation;
}

.pet__frame {
  display: block;
  width: 192px;
  height: 208px;
  background-image: url("./assets/frajder-spritesheet.webp");
  background-repeat: no-repeat;
  background-size: 1536px 1872px;
  image-rendering: auto;
  filter: drop-shadow(0 18px 18px rgba(23, 23, 23, 0.16));
  pointer-events: none;
}

.pet:hover .pet__frame {
  filter: drop-shadow(0 20px 20px rgba(15, 118, 110, 0.2));
}

.pet:focus-visible {
  box-shadow: 0 0 0 5px var(--focus);
}

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

.notification-count,
.panel-toggle {
  position: absolute;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  outline: 0;
}

.notification-count {
  right: 78px;
  top: 7px;
  width: 34px;
  height: 34px;
  border-color: rgba(69, 212, 131, 0.55);
  background: var(--accent);
  color: #092316;
  font-size: 0.78rem;
  font-weight: 700;
  box-shadow: 0 10px 22px rgba(69, 212, 131, 0.2);
}

.notification-count[hidden] {
  display: none;
}

.panel-toggle {
  right: 52px;
  top: 1px;
  width: 28px;
  height: 28px;
  background: rgba(18, 20, 19, 0.74);
}

.panel-toggle::before {
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  content: "";
  transform: rotate(45deg) translate(-1px, -1px);
}

.panel-toggle[aria-expanded="true"]::before {
  transform: rotate(225deg) translate(-1px, -1px);
}

.notification-count:hover,
.panel-toggle:hover,
.notification-card__body:hover,
.notification-dismiss:hover {
  filter: brightness(1.08);
}

.notification-count:focus-visible,
.panel-toggle:focus-visible,
.notification-card__body:focus-visible,
.notification-dismiss:focus-visible {
  box-shadow: 0 0 0 5px var(--focus);
}

.notification-panel {
  position: absolute;
  z-index: 4;
  left: 50%;
  top: 396px;
  width: min(280px, calc(100vw - 24px));
  transform: translateX(-50%);
}

.identity-panel {
  position: absolute;
  left: 50%;
  top: 204px;
  z-index: 4;
  display: grid;
  width: min(280px, calc(100vw - 24px));
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  transform: translateX(-50%);
  backdrop-filter: blur(18px) saturate(1.1);
}

.identity-panel__prompt {
  margin: 0;
  color: var(--text);
  font-size: 0.94rem;
  font-weight: 650;
  line-height: 1.25;
}

.identity-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.identity-action {
  min-height: 38px;
  padding: 0 15px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: var(--ink);
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 750;
}

.identity-action--ghost {
  border-color: var(--border);
  background: transparent;
  color: var(--text);
}

.identity-link {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 750;
  text-decoration: none;
}

.identity-action:hover {
  filter: brightness(1.08);
}

.identity-action:focus-visible,
.field input:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 5px var(--focus);
}

.identity-action:disabled {
  cursor: progress;
  opacity: 0.66;
}

.identity-form {
  display: grid;
  gap: 10px;
}

.field {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 700;
}

.field input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  padding: 0 10px;
  outline: 0;
}

.identity-status {
  min-height: 1rem;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.3;
}

.identity-status[data-tone="error"] {
  color: var(--danger);
}

.identity-profile {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  align-items: center;
}

.mystery-pet {
  display: inline-flex;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(69, 212, 131, 0.45);
  border-radius: 8px;
  background: rgba(69, 212, 131, 0.09);
  color: var(--accent);
  font-size: 1.35rem;
  font-weight: 850;
}

.profile-avatar {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(69, 212, 131, 0.45);
  border-radius: 8px;
  background: rgba(69, 212, 131, 0.09);
  object-fit: cover;
}

.identity-profile__text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.identity-profile__text strong,
.identity-profile__text span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.identity-profile__text strong {
  color: var(--text);
  font-size: 0.92rem;
}

.identity-profile__text span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 650;
}

.profile-view,
.mint-panel {
  position: absolute;
  z-index: 8;
  right: clamp(16px, 4vw, 48px);
  top: clamp(16px, 5vh, 48px);
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100svh - 32px);
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  backdrop-filter: blur(18px) saturate(1.1);
}

.profile-view__close {
  position: absolute;
  right: 12px;
  top: 12px;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.profile-view__close::before,
.profile-view__close::after {
  position: absolute;
  left: 9px;
  top: 14px;
  width: 10px;
  height: 1.5px;
  border-radius: 999px;
  background: currentColor;
  content: "";
}

.profile-view__close::before {
  transform: rotate(45deg);
}

.profile-view__close::after {
  transform: rotate(-45deg);
}

.profile-view__body {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 18px;
  align-items: start;
}

.profile-view__avatar {
  width: 120px;
  height: 120px;
  border: 1px solid var(--border);
  border-radius: 8px;
  object-fit: cover;
}

.profile-view__summary {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding-right: 34px;
}

.profile-view__summary h1,
.profile-view__summary p {
  margin: 0;
}

.profile-view__summary h1 {
  color: var(--text);
  font-size: 1.3rem;
  line-height: 1.15;
}

.profile-view__summary p,
.profile-view__chains,
.profile-view__empty {
  color: var(--muted);
  font-size: 0.86rem;
}

.profile-view__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.profile-view__stats span,
.profile-view__stats strong {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.78rem;
}

.profile-view__chains,
.profile-view__pets {
  margin: 0;
  padding: 0;
  list-style: none;
}

.profile-view__chains {
  display: grid;
  gap: 4px;
}

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

.profile-pet,
.mint-card {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.profile-pet img,
.mint-card img {
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid var(--border);
  border-radius: 8px;
  object-fit: cover;
}

.profile-pet span,
.mint-card span {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mint-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 32px;
  margin-bottom: 12px;
  padding-right: 34px;
}

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

.mint-card strong {
  overflow: hidden;
  font-size: 0.82rem;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mint-card__actions {
  display: grid;
  gap: 6px;
}

.mint-card__actions .identity-action {
  min-height: 32px;
  padding: 0 8px;
  font-size: 0.72rem;
}

.notification-list {
  display: grid;
  gap: 8px;
}

.notification-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  overflow: hidden;
  backdrop-filter: blur(18px) saturate(1.1);
}

.notification-card__body {
  display: block;
  width: 100%;
  min-height: 74px;
  padding: 10px 42px 13px 13px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.notification-card__title {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.18;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notification-card__description {
  display: -webkit-box;
  margin-top: 2px;
  overflow: hidden;
  color: var(--text);
  font-size: 0.83rem;
  line-height: 1.22;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.notification-card__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
}

.notification-progress {
  position: relative;
  flex: 1;
  height: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.notification-progress__bar {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.notification-status {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 13px;
  height: 13px;
  border: 1.5px solid var(--border);
  border-radius: 999px;
}

.notification-status[data-status="running"],
.notification-status[data-status="queued"] {
  border-top-color: var(--accent);
  animation: spin 900ms linear infinite;
}

.notification-status[data-status="done"] {
  border-color: var(--accent);
  background: var(--accent);
}

.notification-status[data-status="done"]::before {
  position: absolute;
  left: 3px;
  top: 1px;
  width: 4px;
  height: 7px;
  border-right: 1.5px solid #092316;
  border-bottom: 1.5px solid #092316;
  content: "";
  transform: rotate(45deg);
}

.notification-status[data-status="failed"] {
  border-color: var(--danger);
  background: var(--danger);
}

.notification-status[data-status="review"] {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 3px rgba(69, 212, 131, 0.25);
}

.notification-dismiss {
  position: absolute;
  right: 9px;
  bottom: 8px;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  cursor: pointer;
}

.notification-dismiss::before,
.notification-dismiss::after {
  position: absolute;
  left: 7px;
  top: 11px;
  width: 10px;
  height: 1.5px;
  border-radius: 999px;
  background: currentColor;
  content: "";
}

.notification-dismiss::before {
  transform: rotate(45deg);
}

.notification-dismiss::after {
  transform: rotate(-45deg);
}

.notification-empty {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}

.action-readout {
  position: absolute;
  left: 50%;
  top: 184px;
  z-index: 2;
  max-width: min(280px, calc(100vw - 24px));
  color: var(--muted);
  font-size: 0.75rem;
  opacity: 0;
  text-align: center;
  transform: translateX(-50%);
  transition: opacity 160ms ease-out;
}

.action-readout[data-visible="true"] {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .pet-widget {
    will-change: auto;
  }

  .pet__frame {
    filter: drop-shadow(0 12px 12px rgba(23, 23, 23, 0.13));
  }
  .notification-status[data-status="running"],
  .notification-status[data-status="queued"] {
    animation: none;
  }
}

@media (max-width: 480px) {
  .pet-widget {
    width: 252px;
  }

  .notification-panel,
  .identity-panel,
  .action-readout {
    width: min(280px, calc(100vw - 18px));
  }

  .profile-view__body {
    grid-template-columns: 88px 1fr;
  }

  .profile-view__avatar {
    width: 88px;
    height: 88px;
  }

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

@keyframes spin {
  to {
    transform: rotate(1turn);
  }
}
