[hidden] { display: none !important; }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  overscroll-behavior: none;
  height: 100%;
  overflow: hidden;
  background: #3a2a1e;
  color: #f5ecdd;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

#stage {
  cursor: none;
  -webkit-touch-callout: none;
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

button {
  font: inherit;
  min-height: 48px;
  min-width: 48px;
  touch-action: manipulation;
  -webkit-touch-callout: none;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: #3b2d22;
  color: #f5ecdd;
  cursor: pointer;
}

button:focus-visible {
  outline: 2px solid #ffd27a;
  outline-offset: 2px;
}

#topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 52px;
  padding: calc(env(safe-area-inset-top) + 6px) 12px 6px;
  background: rgba(28, 20, 14, 0.88);
}

.title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.count {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 16px;
  font-weight: 600;
}

.count-icon {
  flex: 0 0 auto;
}

#shelf,
#fly {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

#shelf {
  top: var(--top-h, 52px);
  height: var(--shelf-h, 96px);
}

#topbar button {
  min-width: 44px;
  padding: 0 10px;
  font-size: 15px;
}

.hint {
  position: fixed;
  top: calc(var(--strip-h, 150px) + 10px);
  left: 50%;
  transform: translateX(-50%);
  max-width: 92vw;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(28, 20, 14, 0.8);
  color: #f5ecdd;
  font-size: 16px;
  text-align: center;
  pointer-events: none;
}

.next {
  position: fixed;
  right: 16px;
  bottom: calc(var(--dock-h, 110px) + 16px);
  width: 64px;
  height: 64px;
  min-width: 64px;
  min-height: 64px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #f0c674;
  color: #2b1d10;
  border: none;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

#dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 10px 8px calc(10px + env(safe-area-inset-bottom));
  background: rgba(28, 20, 14, 0.9);
}

#tools {
  flex: 1 1 0;
  display: flex;
  gap: 4px;
  min-width: 0;
}

.tool {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px 2px;
  line-height: 1.15;
}

.tool .name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

@media (max-width: 380px) {
  .tool .name {
    font-size: 13px;
  }
}

.tool .sub {
  font-size: 12px;
  opacity: 0.8;
  min-height: 14px;
  text-align: center;
}

.tool[aria-pressed="true"] {
  background: #f0c674;
  color: #2b1d10;
}

.tool.locked {
  opacity: 0.55;
}

.tool.glint {
  animation: glint 1.6s ease-out 1;
}

@keyframes glint {
  0% { box-shadow: 0 0 0 0 rgba(255, 236, 170, 0.9); }
  60% { box-shadow: 0 0 0 10px rgba(255, 236, 170, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 236, 170, 0); }
}

.retry {
  flex: 0 0 auto;
  min-width: 92px;
  background: #d9573b;
  color: #fff8ef;
  font-weight: 700;
  font-size: 16px;
}
