:root {
  color-scheme: light;
  --ink: #101010;
  --muted: #777;
  --line: #d8d8d8;
  --line-dark: #b9b9b9;
  --white: #fff;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  font-family: Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  background: var(--white);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

#fxCanvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.simple-game {
  width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
  background: #fff;
}

.items-sidebar {
  z-index: 3;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: #fff;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-title {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 18px;
}

.sidebar-title span {
  color: var(--muted);
  font-size: 14px;
}

.item-search {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0 10px;
  background: #fff;
  outline: none;
}

.item-search:focus {
  border-color: var(--line-dark);
}

.items-list {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 8px;
  overflow: auto;
  padding-right: 4px;
}

.discovery-card {
  max-width: 100%;
  min-height: 34px;
  border: 1px solid var(--line-dark);
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  padding: 6px 9px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  line-height: 1;
  user-select: none;
  overflow: hidden;
}

.discovery-card:hover {
  background: #f7f7f7;
}

.discovery-icon {
  font-size: 17px;
}

.discovery-name {
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 210px;
}

.discovery-meta {
  display: none;
}

.empty-space {
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  background: #fff;
}

.space-hint {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color: #b8b8b8;
  font-size: 18px;
  text-align: center;
  pointer-events: none;
}

.space-hint.hidden {
  display: none;
}

.growth-status {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 2;
  max-width: min(520px, calc(100vw - 330px));
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  padding: 7px 9px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  line-height: 1.2;
  box-shadow: var(--shadow);
}

.growth-status.hidden {
  display: none;
}

.growth-status span,
.growth-status em {
  color: var(--muted);
  font-style: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.growth-status em {
  max-width: 210px;
}

.alchemy-token {
  position: absolute;
  z-index: 2;
  min-width: 92px;
  max-width: min(280px, calc(100vw - 340px));
  min-height: 44px;
  border: 1px solid #9fb8d5;
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  box-shadow: none;
  padding: 8px 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-weight: 700;
  user-select: none;
  touch-action: none;
  overflow: hidden;
}

.alchemy-token.dragging,
.alchemy-token.combine-target {
  z-index: 5;
  border-color: #5d95d6;
  box-shadow: var(--shadow);
}

.token-icon {
  font-size: 20px;
  line-height: 1;
}

.token-name {
  font-size: 18px;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.corner-actions {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 4;
  display: flex;
  gap: 8px;
}

.tiny-button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
}

.tiny-button:hover {
  background: #f7f7f7;
}

.hidden-ui,
.locked-panel {
  display: none !important;
}

.reveal {
  position: fixed;
  left: 50%;
  top: 80px;
  z-index: 6;
  transform: translateX(-50%);
  min-width: 260px;
  max-width: calc(100vw - 320px);
  border: 1px solid var(--line-dark);
  border-radius: 6px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 14px 18px;
  text-align: center;
  animation: revealIn 1800ms ease forwards;
}

.reveal.hidden {
  display: none;
}

.reveal .big-icon {
  display: block;
  font-size: 30px;
  margin-bottom: 4px;
}

.reveal strong {
  display: block;
  font-size: 20px;
  overflow-wrap: anywhere;
}

.reveal span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 14px;
}

.toast-stack {
  position: fixed;
  left: 294px;
  bottom: 14px;
  z-index: 6;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 330px));
}

.toast {
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 10px 12px;
  animation: toastIn 220ms ease both;
}

.toast strong {
  display: block;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.toast span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.empty-state {
  color: var(--muted);
  padding: 12px 0;
}

@keyframes revealIn {
  0% {
    opacity: 0;
    transform: translate(-50%, -10px);
  }
  12%,
  78% {
    opacity: 1;
    transform: translate(-50%, 0);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -8px);
  }
}

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

@media (max-width: 760px) {
  .simple-game {
    grid-template-columns: 1fr;
    grid-template-rows: 42vh 58vh;
  }

  .items-sidebar {
    height: 42vh;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .empty-space {
    height: 58vh;
  }

  .growth-status {
    left: 10px;
    right: 10px;
    max-width: none;
    flex-wrap: wrap;
  }

  .growth-status em {
    max-width: 100%;
  }

  .toast-stack {
    left: 14px;
    width: calc(100vw - 28px);
  }
}
